@dotobokuri/fleet-console 1.23.0 → 1.24.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 (69) hide show
  1. package/AGENTS.md +41 -257
  2. package/README.md +8 -0
  3. package/dist/cli.d.ts +11 -1
  4. package/dist/cli.mjs +1738 -453
  5. package/dist/client/assets/{_baseUniq-BjOe5yYF.js → _baseUniq-yooYbTgN.js} +1 -1
  6. package/dist/client/assets/{arc-bFUuO3jf.js → arc-D4mme5Ts.js} +1 -1
  7. package/dist/client/assets/{architectureDiagram-Q4EWVU46-Ba7nimQq.js → architectureDiagram-Q4EWVU46-BAJOviEX.js} +1 -1
  8. package/dist/client/assets/{blockDiagram-DXYQGD6D-CQGf47hl.js → blockDiagram-DXYQGD6D-DuObpxQ3.js} +1 -1
  9. package/dist/client/assets/{c4Diagram-AHTNJAMY-DZF_cAK4.js → c4Diagram-AHTNJAMY-BOT-SD34.js} +1 -1
  10. package/dist/client/assets/channel-TZYyAq1v.js +1 -0
  11. package/dist/client/assets/{chunk-4BX2VUAB-DjUUHSQ5.js → chunk-4BX2VUAB-BF_aMTes.js} +1 -1
  12. package/dist/client/assets/{chunk-4TB4RGXK-Dvqti8bd.js → chunk-4TB4RGXK-M4brBcnD.js} +1 -1
  13. package/dist/client/assets/{chunk-55IACEB6-2BxiBvkp.js → chunk-55IACEB6-CrG-4b2Z.js} +1 -1
  14. package/dist/client/assets/{chunk-EDXVE4YY-CqCjol5O.js → chunk-EDXVE4YY-BxDSygH1.js} +1 -1
  15. package/dist/client/assets/{chunk-FMBD7UC4-eoCfIbly.js → chunk-FMBD7UC4-Bh7MEX7E.js} +1 -1
  16. package/dist/client/assets/{chunk-OYMX7WX6-CoC86V_1.js → chunk-OYMX7WX6-DBnBwxer.js} +1 -1
  17. package/dist/client/assets/{chunk-QZHKN3VN-CJQA5mlQ.js → chunk-QZHKN3VN-bjAogQwW.js} +1 -1
  18. package/dist/client/assets/{chunk-YZCP3GAM-C5C4kbLu.js → chunk-YZCP3GAM-l4FGlk_c.js} +1 -1
  19. package/dist/client/assets/classDiagram-6PBFFD2Q-Dh6hZUl4.js +1 -0
  20. package/dist/client/assets/classDiagram-v2-HSJHXN6E-Dh6hZUl4.js +1 -0
  21. package/dist/client/assets/clone-DgWGnVWH.js +1 -0
  22. package/dist/client/assets/{cose-bilkent-S5V4N54A-CahuunpL.js → cose-bilkent-S5V4N54A-Bm5QA4zo.js} +1 -1
  23. package/dist/client/assets/{dagre-KV5264BT-Cbv5kSi5.js → dagre-KV5264BT-PzXQN-5Q.js} +1 -1
  24. package/dist/client/assets/{diagram-5BDNPKRD-CNm40ZGB.js → diagram-5BDNPKRD-KhaAKPtX.js} +1 -1
  25. package/dist/client/assets/{diagram-G4DWMVQ6-DrlGNT3i.js → diagram-G4DWMVQ6-DBbjfiR8.js} +1 -1
  26. package/dist/client/assets/{diagram-MMDJMWI5-r8Y2oqmw.js → diagram-MMDJMWI5-QWro7PRX.js} +1 -1
  27. package/dist/client/assets/{diagram-TYMM5635-CMzEhXup.js → diagram-TYMM5635-B9LqWrbF.js} +1 -1
  28. package/dist/client/assets/{erDiagram-SMLLAGMA-UFjUUMPz.js → erDiagram-SMLLAGMA-b0VkMMN4.js} +1 -1
  29. package/dist/client/assets/{flowDiagram-DWJPFMVM-Dd1STmYc.js → flowDiagram-DWJPFMVM-edxBAbe6.js} +1 -1
  30. package/dist/client/assets/{ganttDiagram-T4ZO3ILL-CHHU0hVd.js → ganttDiagram-T4ZO3ILL-ks2Gg1_V.js} +1 -1
  31. package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-vj2HukAF.js → gitGraphDiagram-UUTBAWPF-DymUyYNl.js} +1 -1
  32. package/dist/client/assets/{graph-DhjfEbEb.js → graph-B-B_mqfh.js} +1 -1
  33. package/dist/client/assets/index-BgLzfg-v.css +1 -0
  34. package/dist/client/assets/index-pDnb-q6f.js +380 -0
  35. package/dist/client/assets/{infoDiagram-42DDH7IO-CC7AEgDm.js → infoDiagram-42DDH7IO-B5iLIYAc.js} +1 -1
  36. package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-DlRw2B9G.js → ishikawaDiagram-UXIWVN3A-DnztLLn7.js} +1 -1
  37. package/dist/client/assets/{journeyDiagram-VCZTEJTY-BbRXANKQ.js → journeyDiagram-VCZTEJTY-BKDRfH1Y.js} +1 -1
  38. package/dist/client/assets/{kanban-definition-6JOO6SKY-DtvdCxGN.js → kanban-definition-6JOO6SKY-DPB3Phvr.js} +1 -1
  39. package/dist/client/assets/{layout-Dg5cvw5v.js → layout-BEeRhYTG.js} +1 -1
  40. package/dist/client/assets/{linear-BvVlQLqF.js → linear-QzmfWKSq.js} +1 -1
  41. package/dist/client/assets/{mermaid.core-DzrV8sC-.js → mermaid.core-BVka5dgm.js} +4 -4
  42. package/dist/client/assets/{min-DNGQ1Ciz.js → min-CfXk9kSN.js} +1 -1
  43. package/dist/client/assets/{mindmap-definition-QFDTVHPH-DxJCNZbg.js → mindmap-definition-QFDTVHPH-tGrGhr6Z.js} +1 -1
  44. package/dist/client/assets/{pieDiagram-DEJITSTG-B75XHG-s.js → pieDiagram-DEJITSTG-ZRBqRiRK.js} +1 -1
  45. package/dist/client/assets/{quadrantDiagram-34T5L4WZ-CL4yoF0m.js → quadrantDiagram-34T5L4WZ-VCINZgct.js} +1 -1
  46. package/dist/client/assets/{requirementDiagram-MS252O5E-kGV4vcr1.js → requirementDiagram-MS252O5E-DFLzADh3.js} +1 -1
  47. package/dist/client/assets/{sankeyDiagram-XADWPNL6-DoA4u7wI.js → sankeyDiagram-XADWPNL6-BbouN8Ji.js} +1 -1
  48. package/dist/client/assets/{sequenceDiagram-FGHM5R23-ZpNDf1bS.js → sequenceDiagram-FGHM5R23-B58_LF0R.js} +1 -1
  49. package/dist/client/assets/{stateDiagram-FHFEXIEX-BzgKcVAG.js → stateDiagram-FHFEXIEX-pk-OHHuL.js} +1 -1
  50. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-xsN122JA.js +1 -0
  51. package/dist/client/assets/{timeline-definition-GMOUNBTQ-B_DkUDsD.js → timeline-definition-GMOUNBTQ-4jQdCvaj.js} +1 -1
  52. package/dist/client/assets/{vennDiagram-DHZGUBPP-MCUnnsKb.js → vennDiagram-DHZGUBPP-CUr1fH6N.js} +1 -1
  53. package/dist/client/assets/{wardley-RL74JXVD-D_JAMSxj.js → wardley-RL74JXVD-D0cfvvNA.js} +1 -1
  54. package/dist/client/assets/{wardleyDiagram-NUSXRM2D-BHCwZGLq.js → wardleyDiagram-NUSXRM2D-D0l_Rp_Z.js} +1 -1
  55. package/dist/client/assets/{xychartDiagram-5P7HB3ND-FbGwbD3V.js → xychartDiagram-5P7HB3ND-BdR8OEuJ.js} +1 -1
  56. package/dist/client/index.html +3 -3
  57. package/dist/desktop-protocol.d.ts +49 -0
  58. package/dist/desktop-protocol.mjs +99 -0
  59. package/dist/fleet-plugins/diff/routes.mjs +124 -225
  60. package/dist/fleet-plugins/skills/routes.mjs +218 -82
  61. package/dist/fleet-plugins/terminal/routes.mjs +190 -176
  62. package/package.json +7 -2
  63. package/dist/client/assets/channel-D2BahVp1.js +0 -1
  64. package/dist/client/assets/classDiagram-6PBFFD2Q-DsDAVLhS.js +0 -1
  65. package/dist/client/assets/classDiagram-v2-HSJHXN6E-DsDAVLhS.js +0 -1
  66. package/dist/client/assets/clone-CdZy2Xzf.js +0 -1
  67. package/dist/client/assets/index-Dq9EKm2G.css +0 -1
  68. package/dist/client/assets/index-DtzbOdd7.js +0 -380
  69. package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-yRK5hzZ4.js +0 -1
@@ -0,0 +1,380 @@
1
+ function kx(e,t){for(var i=0;i<t.length;i++){const s=t[i];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in e)){const d=Object.getOwnPropertyDescriptor(s,o);d&&Object.defineProperty(e,o,d.get?d:{enumerable:!0,get:()=>s[o]})}}}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 o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const d of o)if(d.type==="childList")for(const p of d.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&s(p)}).observe(document,{childList:!0,subtree:!0});function i(o){const d={};return o.integrity&&(d.integrity=o.integrity),o.referrerPolicy&&(d.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?d.credentials="include":o.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function s(o){if(o.ep)return;o.ep=!0;const d=i(o);fetch(o.href,d)}})();function Vg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function e$(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var i=function s(){var o=!1;try{o=this instanceof s}catch{}return o?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};i.prototype=t.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(i,s,o.get?o:{enumerable:!0,get:function(){return e[s]}})}),i}var kp={exports:{}},Rl={};var Ey;function tT(){if(Ey)return Rl;Ey=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(s,o,d){var p=null;if(d!==void 0&&(p=""+d),o.key!==void 0&&(p=""+o.key),"key"in o){d={};for(var l in o)l!=="key"&&(d[l]=o[l])}else d=o;return o=d.ref,{$$typeof:e,type:s,key:p,ref:o!==void 0?o:null,props:d}}return Rl.Fragment=t,Rl.jsx=i,Rl.jsxs=i,Rl}var ky;function nT(){return ky||(ky=1,kp.exports=tT()),kp.exports}var u=nT();const iT=Vg(u),rT=kx({__proto__:null,default:iT},[u]);var Tp={exports:{}},Ke={};var Ty;function sT(){if(Ty)return Ke;Ty=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),p=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),S=Symbol.iterator;function C(D){return D===null||typeof D!="object"?null:(D=S&&D[S]||D["@@iterator"],typeof D=="function"?D:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,_={};function b(D,U,V){this.props=D,this.context=U,this.refs=_,this.updater=V||T}b.prototype.isReactComponent={},b.prototype.setState=function(D,U){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,U,"setState")},b.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function g(){}g.prototype=b.prototype;function y(D,U,V){this.props=D,this.context=U,this.refs=_,this.updater=V||T}var k=y.prototype=new g;k.constructor=y,w(k,b.prototype),k.isPureReactComponent=!0;var M=Array.isArray;function A(){}var N={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function B(D,U,V){var J=V.ref;return{$$typeof:e,type:D,key:U,ref:J!==void 0?J:null,props:V}}function q(D,U){return B(D.type,U,D.props)}function W(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function G(D){var U={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(V){return U[V]})}var I=/\/+/g;function K(D,U){return typeof D=="object"&&D!==null&&D.key!=null?G(""+D.key):U.toString(36)}function H(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(A,A):(D.status="pending",D.then(function(U){D.status==="pending"&&(D.status="fulfilled",D.value=U)},function(U){D.status==="pending"&&(D.status="rejected",D.reason=U)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function P(D,U,V,J,le){var pe=typeof D;(pe==="undefined"||pe==="boolean")&&(D=null);var te=!1;if(D===null)te=!0;else switch(pe){case"bigint":case"string":case"number":te=!0;break;case"object":switch(D.$$typeof){case e:case t:te=!0;break;case v:return te=D._init,P(te(D._payload),U,V,J,le)}}if(te)return le=le(D),te=J===""?"."+K(D,0):J,M(le)?(V="",te!=null&&(V=te.replace(I,"$&/")+"/"),P(le,U,V,"",function(re){return re})):le!=null&&(W(le)&&(le=q(le,V+(le.key==null||D&&D.key===le.key?"":(""+le.key).replace(I,"$&/")+"/")+te)),U.push(le)),1;te=0;var F=J===""?".":J+":";if(M(D))for(var ae=0;ae<D.length;ae++)J=D[ae],pe=F+K(J,ae),te+=P(J,U,V,pe,le);else if(ae=C(D),typeof ae=="function")for(D=ae.call(D),ae=0;!(J=D.next()).done;)J=J.value,pe=F+K(J,ae++),te+=P(J,U,V,pe,le);else if(pe==="object"){if(typeof D.then=="function")return P(H(D),U,V,J,le);throw U=String(D),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return te}function Y(D,U,V){if(D==null)return D;var J=[],le=0;return P(D,J,"","",function(pe){return U.call(V,pe,le++)}),J}function X(D){if(D._status===-1){var U=D._result;U=U(),U.then(function(V){(D._status===0||D._status===-1)&&(D._status=1,D._result=V)},function(V){(D._status===0||D._status===-1)&&(D._status=2,D._result=V)}),D._status===-1&&(D._status=0,D._result=U)}if(D._status===1)return D._result.default;throw D._result}var j=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},z={map:Y,forEach:function(D,U,V){Y(D,function(){U.apply(this,arguments)},V)},count:function(D){var U=0;return Y(D,function(){U++}),U},toArray:function(D){return Y(D,function(U){return U})||[]},only:function(D){if(!W(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ke.Activity=m,Ke.Children=z,Ke.Component=b,Ke.Fragment=i,Ke.Profiler=o,Ke.PureComponent=y,Ke.StrictMode=s,Ke.Suspense=h,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(D){return N.H.useMemoCache(D)}},Ke.cache=function(D){return function(){return D.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(D,U,V){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var J=w({},D.props),le=D.key;if(U!=null)for(pe in U.key!==void 0&&(le=""+U.key),U)!R.call(U,pe)||pe==="key"||pe==="__self"||pe==="__source"||pe==="ref"&&U.ref===void 0||(J[pe]=U[pe]);var pe=arguments.length-2;if(pe===1)J.children=V;else if(1<pe){for(var te=Array(pe),F=0;F<pe;F++)te[F]=arguments[F+2];J.children=te}return B(D.type,le,J)},Ke.createContext=function(D){return D={$$typeof:p,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:d,_context:D},D},Ke.createElement=function(D,U,V){var J,le={},pe=null;if(U!=null)for(J in U.key!==void 0&&(pe=""+U.key),U)R.call(U,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(le[J]=U[J]);var te=arguments.length-2;if(te===1)le.children=V;else if(1<te){for(var F=Array(te),ae=0;ae<te;ae++)F[ae]=arguments[ae+2];le.children=F}if(D&&D.defaultProps)for(J in te=D.defaultProps,te)le[J]===void 0&&(le[J]=te[J]);return B(D,pe,le)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(D){return{$$typeof:l,render:D}},Ke.isValidElement=W,Ke.lazy=function(D){return{$$typeof:v,_payload:{_status:-1,_result:D},_init:X}},Ke.memo=function(D,U){return{$$typeof:f,type:D,compare:U===void 0?null:U}},Ke.startTransition=function(D){var U=N.T,V={};N.T=V;try{var J=D(),le=N.S;le!==null&&le(V,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(A,j)}catch(pe){j(pe)}finally{U!==null&&V.types!==null&&(U.types=V.types),N.T=U}},Ke.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},Ke.use=function(D){return N.H.use(D)},Ke.useActionState=function(D,U,V){return N.H.useActionState(D,U,V)},Ke.useCallback=function(D,U){return N.H.useCallback(D,U)},Ke.useContext=function(D){return N.H.useContext(D)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(D,U){return N.H.useDeferredValue(D,U)},Ke.useEffect=function(D,U){return N.H.useEffect(D,U)},Ke.useEffectEvent=function(D){return N.H.useEffectEvent(D)},Ke.useId=function(){return N.H.useId()},Ke.useImperativeHandle=function(D,U,V){return N.H.useImperativeHandle(D,U,V)},Ke.useInsertionEffect=function(D,U){return N.H.useInsertionEffect(D,U)},Ke.useLayoutEffect=function(D,U){return N.H.useLayoutEffect(D,U)},Ke.useMemo=function(D,U){return N.H.useMemo(D,U)},Ke.useOptimistic=function(D,U){return N.H.useOptimistic(D,U)},Ke.useReducer=function(D,U,V){return N.H.useReducer(D,U,V)},Ke.useRef=function(D){return N.H.useRef(D)},Ke.useState=function(D){return N.H.useState(D)},Ke.useSyncExternalStore=function(D,U,V){return N.H.useSyncExternalStore(D,U,V)},Ke.useTransition=function(){return N.H.useTransition()},Ke.version="19.2.7",Ke}var Ay;function Yg(){return Ay||(Ay=1,Tp.exports=sT()),Tp.exports}var L=Yg();const aT=Vg(L),Lh=kx({__proto__:null,default:aT},[L]),oT="fc-operation-body";let ti=class extends Error{status;constructor(t,i){super(i),this.name="ApiError",this.status=t}};async function Tx(e){const t=await fetch("/api/v1/operations/catalog",{signal:e});if(!t.ok)throw new ti(t.status,`Operation catalog request failed: ${t.status}`);const i=await t.json();return Array.isArray(i.plugins)?i.plugins.map(cT).filter(s=>s!==null):[]}function Mh(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)||Ax(t))throw new ti(500,"Invalid operation response");return t}function Ax(e){return Pm(e,new Set(["canonicalCwd","cwd","persona","prompt","providerSession","ticket","token","toolAllowlist","tools","transcriptPath"]))}function lT({children:e,className:t}){return u.jsx("div",{className:hT(oT,t),children:e})}function cT(e){if(!Rx(e)||typeof e.id!="string"||typeof e.title!="string"||!Array.isArray(e.kinds))return null;const t=e.kinds.map(uT).filter(i=>i!==null);return t.length===0?null:{id:e.id,title:e.title,kinds:t}}function uT(e){return!Rx(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 Rx(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Pm(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(i=>Pm(i,t)):Object.entries(e).some(([i,s])=>t.has(i)||Pm(s,t))}function hT(...e){return e.filter(t=>!!t).join(" ")}const dT=Object.freeze(Object.defineProperty({__proto__:null,ApiError:ti,OperationBody:lT,assertOperationNode:Mh,fetchOperationCatalog:Tx,hasForbiddenBrowserPayloadKey:Ax},Symbol.toStringTag,{value:"Module"}));function fT(e){return e}function pT(e){return e}function Lx(e=()=>{}){const t=new Set;return{api:{fetch:(i,s,o)=>fetch(Ap(i,s),o).then(yT),subscribe:(i,s,o)=>{const d=new EventSource(Ap(i,s));d.onmessage=o;const p=()=>d.close();return t.add(p),()=>{p(),t.delete(p)}},resync:e},lifecycle:{onDispose:i=>(t.add(i),()=>t.delete(i))},terminal:{requestTicket:async(i,s,o,d)=>{const p=await fetch(Ap(i,s),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:o}),signal:d});if(!p.ok)throw new ti(p.status,`Terminal ticket request failed: ${p.status}`);const l=await p.json();if(typeof l.ticket!="string"||typeof l.ttlMs!="number")throw new ti(p.status,"Invalid terminal ticket response");return{ticket:l.ticket,ttlMs:l.ttlMs}}},notifications:{emit:()=>{},dismiss:()=>{}},operations:{create:async i=>{const s=await fetch("/api/v1/operations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok)throw new ti(s.status,`Operation create failed: ${s.status}`);const o=await s.json();return Mh(o.operation)},rename:async(i,s)=>{const o=await fetch(`/api/v1/operations/${encodeURIComponent(i)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:s})});if(!o.ok)throw new ti(o.status,`Operation rename failed: ${o.status}`);const d=await o.json();return Mh(d.operation)},remove:async i=>{const s=await fetch(`/api/v1/operations/${encodeURIComponent(i)}`,{method:"DELETE"});if(!s.ok)throw new ti(s.status,`Operation remove failed: ${s.status}`)}},preferences:{read:(i,s)=>xT(i,s),write:(i,s)=>wT(i,s)},settings:{read:async i=>{const s=await fetch(Ry(i));if(!s.ok)throw new ti(s.status,`Plugin settings read failed: ${s.status}`);const d=(await s.json()).value;return typeof d=="object"&&d!==null&&!Array.isArray(d)?d:null},write:async(i,s)=>{const o=await fetch(Ry(i),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok)throw new ti(o.status,`Plugin settings write failed: ${o.status}`)}},status:{set:()=>{},clear:()=>{}}}}function Mx(e,t){return L.useSyncExternalStore(e,t,t)}function mT(){const[e,t]=L.useState([]),i=L.useCallback(async()=>{const s=await fetch("/api/v1/operations");if(!s.ok)throw new ti(s.status,`Operations request failed: ${s.status}`);const o=await s.json();t(Array.isArray(o.operations)?o.operations.map(Mh):[])},[]);return L.useEffect(()=>{i()},[i]),{operations:e,refresh:i}}function gT(e,t){return L.useMemo(()=>({fetch:(i,s)=>e.fetch(t,i,s),subscribe:(i,s)=>e.subscribe(t,i,s)}),[e,t])}function _T(e,t){return L.useMemo(()=>({read:()=>e.read(t),write:i=>e.write(t,i)}),[e,t])}function vT(e,t,i){const[s,o]=L.useState(()=>e.read(t,i)),d=L.useCallback(p=>{o(p),e.write(t,p)},[e,t]);return[s,d]}function bT(e,t){return L.useMemo(()=>({set:i=>e.set(t,i),clear:()=>e.clear(t)}),[e,t])}async function yT(e){if(!e.ok)throw new ti(e.status,`Plugin request failed: ${e.status}`);return e}function Ap(e,t){if(!/^[a-z0-9][a-z0-9._-]*$/i.test(e))throw new ti(400,"Invalid plugin id");const i=t.startsWith("/")?t:`/${t}`;if(i.includes(".."))throw new ti(400,"Invalid plugin path");return`/plugins/${e}${i}`}const ST=/^[a-z0-9][a-z0-9._-]*$/;function Ry(e){if(!ST.test(e))throw new ti(400,"Invalid plugin id");return`/api/v1/settings/plugins/${encodeURIComponent(e)}`}function xT(e,t){if(typeof window>"u")return t;try{const i=window.localStorage.getItem(`fleet-plugin.${e}`);return i===null?t:JSON.parse(i)}catch{return t}}function wT(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(`fleet-plugin.${e}`,JSON.stringify(t))}catch{}}const CT=Object.freeze(Object.defineProperty({__proto__:null,React:Lh,createClientCapabilities:Lx,defineOperationKind:pT,definePlugin:fT,useOperationStatus:bT,useOperations:mT,usePluginApi:gT,usePluginSettings:_T,usePluginStorage:vT,useStoreSnapshot:Mx},Symbol.toStringTag,{value:"Module"}));function ET(e){return e}function kT({title:e,description:t,children:i}){return u.jsxs("section",{className:"fc-settings-card",children:[e?u.jsx("h3",{className:"fc-settings-card__title",children:e}):null,t?u.jsx("p",{className:"fc-settings-card__desc",children:t}):null,u.jsx("div",{className:"fc-settings-card__body",children:i})]})}function TT({label:e,hint:t,children:i}){const s=L.useId(),o=L.useId();return u.jsxs("div",{className:"fc-settings-row",role:"group","aria-labelledby":s,"aria-describedby":t?o:void 0,children:[u.jsxs("div",{className:"fc-settings-row__copy",children:[u.jsx("div",{className:"fc-settings-row__label",id:s,children:e}),t?u.jsx("div",{className:"fc-settings-row__hint",id:o,children:t}):null]}),u.jsx("div",{className:"fc-settings-row__control",children:i})]})}function AT({checked:e,onChange:t,label:i,disabled:s=!1}){const o=L.useId();return u.jsxs("label",{className:"fc-settings-toggle",htmlFor:o,children:[u.jsx("input",{id:o,className:"fc-settings-toggle__input",type:"checkbox",checked:e,disabled:s,"aria-label":i?void 0:"Toggle setting",onChange:d=>t(d.currentTarget.checked)}),u.jsx("span",{className:"fc-settings-toggle__control","aria-hidden":"true"}),i?u.jsx("span",{className:"fc-settings-toggle__label",children:i}):null]})}function RT({value:e,options:t,onChange:i,label:s,disabled:o=!1}){const d=L.useId(),p=u.jsx("select",{id:d,className:"fc-settings-select__control",value:e,disabled:o,"aria-label":s?void 0:"Select setting",onChange:l=>i(l.currentTarget.value),children:t.map(l=>u.jsx("option",{value:l.value,children:l.label},l.value))});return s?u.jsxs("label",{className:"fc-settings-select",htmlFor:d,children:[u.jsx("span",{className:"fc-settings-select__label",children:s}),p]}):u.jsx("div",{className:"fc-settings-select",children:p})}function LT({label:e,hint:t,children:i}){const s=L.useId(),o=L.useId();return u.jsxs("div",{className:"fc-settings-field",role:"group","aria-labelledby":s,"aria-describedby":t?o:void 0,children:[u.jsx("div",{className:"fc-settings-field__label",id:s,children:e}),t?u.jsx("div",{className:"fc-settings-field__hint",id:o,children:t}):null,u.jsx("div",{className:"fc-settings-field__control",children:i})]})}const MT=Object.freeze(Object.defineProperty({__proto__:null,SettingsCard:kT,SettingsField:LT,SettingsRow:TT,SettingsSelect:RT,SettingsToggle:AT,defineSettingsSection:ET},Symbol.toStringTag,{value:"Module"}));function NT(e){return e}const OT=Object.freeze(Object.defineProperty({__proto__:null,defineNotificationKind:NT},Symbol.toStringTag,{value:"Module"})),DT=u.jsx("div",{className:"fc-plugin-error",children:"Plugin failed to render."});class Xg extends L.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){this.props.onError?.(t)}render(){return this.state.hasError?this.props.fallback??DT:this.props.children}}const jT=Object.freeze(Object.defineProperty({__proto__:null,PluginErrorBoundary:Xg,React:Lh,default:Lh},Symbol.toStringTag,{value:"Module"}));var Rp={exports:{}},Ll={},Lp={exports:{}},Mp={};var Ly;function IT(){return Ly||(Ly=1,(function(e){function t(P,Y){var X=P.length;P.push(Y);e:for(;0<X;){var j=X-1>>>1,z=P[j];if(0<o(z,Y))P[j]=Y,P[X]=z,X=j;else break e}}function i(P){return P.length===0?null:P[0]}function s(P){if(P.length===0)return null;var Y=P[0],X=P.pop();if(X!==Y){P[0]=X;e:for(var j=0,z=P.length,D=z>>>1;j<D;){var U=2*(j+1)-1,V=P[U],J=U+1,le=P[J];if(0>o(V,X))J<z&&0>o(le,V)?(P[j]=le,P[J]=X,j=J):(P[j]=V,P[U]=X,j=U);else if(J<z&&0>o(le,X))P[j]=le,P[J]=X,j=J;else break e}}return Y}function o(P,Y){var X=P.sortIndex-Y.sortIndex;return X!==0?X:P.id-Y.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;e.unstable_now=function(){return d.now()}}else{var p=Date,l=p.now();e.unstable_now=function(){return p.now()-l}}var h=[],f=[],v=1,m=null,S=3,C=!1,T=!1,w=!1,_=!1,b=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;function k(P){for(var Y=i(f);Y!==null;){if(Y.callback===null)s(f);else if(Y.startTime<=P)s(f),Y.sortIndex=Y.expirationTime,t(h,Y);else break;Y=i(f)}}function M(P){if(w=!1,k(P),!T)if(i(h)!==null)T=!0,A||(A=!0,G());else{var Y=i(f);Y!==null&&H(M,Y.startTime-P)}}var A=!1,N=-1,R=5,B=-1;function q(){return _?!0:!(e.unstable_now()-B<R)}function W(){if(_=!1,A){var P=e.unstable_now();B=P;var Y=!0;try{e:{T=!1,w&&(w=!1,g(N),N=-1),C=!0;var X=S;try{t:{for(k(P),m=i(h);m!==null&&!(m.expirationTime>P&&q());){var j=m.callback;if(typeof j=="function"){m.callback=null,S=m.priorityLevel;var z=j(m.expirationTime<=P);if(P=e.unstable_now(),typeof z=="function"){m.callback=z,k(P),Y=!0;break t}m===i(h)&&s(h),k(P)}else s(h);m=i(h)}if(m!==null)Y=!0;else{var D=i(f);D!==null&&H(M,D.startTime-P),Y=!1}}break e}finally{m=null,S=X,C=!1}Y=void 0}}finally{Y?G():A=!1}}}var G;if(typeof y=="function")G=function(){y(W)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,K=I.port2;I.port1.onmessage=W,G=function(){K.postMessage(null)}}else G=function(){b(W,0)};function H(P,Y){N=b(function(){P(e.unstable_now())},Y)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(P){switch(S){case 1:case 2:case 3:var Y=3;break;default:Y=S}var X=S;S=Y;try{return P()}finally{S=X}},e.unstable_requestPaint=function(){_=!0},e.unstable_runWithPriority=function(P,Y){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var X=S;S=P;try{return Y()}finally{S=X}},e.unstable_scheduleCallback=function(P,Y,X){var j=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?j+X:j):X=j,P){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=X+z,P={id:v++,callback:Y,priorityLevel:P,startTime:X,expirationTime:z,sortIndex:-1},X>j?(P.sortIndex=X,t(f,P),i(h)===null&&P===i(f)&&(w?(g(N),N=-1):w=!0,H(M,X-j))):(P.sortIndex=z,t(h,P),T||C||(T=!0,A||(A=!0,G()))),P},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(P){var Y=S;return function(){var X=S;S=Y;try{return P.apply(this,arguments)}finally{S=X}}}})(Mp)),Mp}var My;function BT(){return My||(My=1,Lp.exports=IT()),Lp.exports}var Np={exports:{}},Fn={};var Ny;function PT(){if(Ny)return Fn;Ny=1;var e=Yg();function t(h){var f="https://react.dev/errors/"+h;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)f+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+h+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var s={d:{f:i,r:function(){throw Error(t(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for("react.portal");function d(h,f,v){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:m==null?null:""+m,children:h,containerInfo:f,implementation:v}}var p=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(h,f){if(h==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Fn.createPortal=function(h,f){var v=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 d(h,f,null,v)},Fn.flushSync=function(h){var f=p.T,v=s.p;try{if(p.T=null,s.p=2,h)return h()}finally{p.T=f,s.p=v,s.d.f()}},Fn.preconnect=function(h,f){typeof h=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,s.d.C(h,f))},Fn.prefetchDNS=function(h){typeof h=="string"&&s.d.D(h)},Fn.preinit=function(h,f){if(typeof h=="string"&&f&&typeof f.as=="string"){var v=f.as,m=l(v,f.crossOrigin),S=typeof f.integrity=="string"?f.integrity:void 0,C=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;v==="style"?s.d.S(h,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:S,fetchPriority:C}):v==="script"&&s.d.X(h,{crossOrigin:m,integrity:S,fetchPriority:C,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Fn.preinitModule=function(h,f){if(typeof h=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var v=l(f.as,f.crossOrigin);s.d.M(h,{crossOrigin:v,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&s.d.M(h)},Fn.preload=function(h,f){if(typeof h=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var v=f.as,m=l(v,f.crossOrigin);s.d.L(h,v,{crossOrigin:m,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})}},Fn.preloadModule=function(h,f){if(typeof h=="string")if(f){var v=l(f.as,f.crossOrigin);s.d.m(h,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:v,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else s.d.m(h)},Fn.requestFormReset=function(h){s.d.r(h)},Fn.unstable_batchedUpdates=function(h,f){return h(f)},Fn.useFormState=function(h,f,v){return p.H.useFormState(h,f,v)},Fn.useFormStatus=function(){return p.H.useHostTransitionStatus()},Fn.version="19.2.7",Fn}var Oy;function Nx(){if(Oy)return Np.exports;Oy=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(),Np.exports=PT(),Np.exports}var Dy;function zT(){if(Dy)return Ll;Dy=1;var e=BT(),t=Yg(),i=Nx();function s(n){var r="https://react.dev/errors/"+n;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+n+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function d(n){var r=n,a=n;if(n.alternate)for(;r.return;)r=r.return;else{n=r;do r=n,(r.flags&4098)!==0&&(a=r.return),n=r.return;while(n)}return r.tag===3?a:null}function p(n){if(n.tag===13){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function l(n){if(n.tag===31){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function h(n){if(d(n)!==n)throw Error(s(188))}function f(n){var r=n.alternate;if(!r){if(r=d(n),r===null)throw Error(s(188));return r!==n?null:n}for(var a=n,c=r;;){var x=a.return;if(x===null)break;var E=x.alternate;if(E===null){if(c=x.return,c!==null){a=c;continue}break}if(x.child===E.child){for(E=x.child;E;){if(E===a)return h(x),n;if(E===c)return h(x),r;E=E.sibling}throw Error(s(188))}if(a.return!==c.return)a=x,c=E;else{for(var O=!1,$=x.child;$;){if($===a){O=!0,a=x,c=E;break}if($===c){O=!0,c=x,a=E;break}$=$.sibling}if(!O){for($=E.child;$;){if($===a){O=!0,a=E,c=x;break}if($===c){O=!0,c=E,a=x;break}$=$.sibling}if(!O)throw Error(s(189))}}if(a.alternate!==c)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?n:r}function v(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n;for(n=n.child;n!==null;){if(r=v(n),r!==null)return r;n=n.sibling}return null}var m=Object.assign,S=Symbol.for("react.element"),C=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),y=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),q=Symbol.for("react.memo_cache_sentinel"),W=Symbol.iterator;function G(n){return n===null||typeof n!="object"?null:(n=W&&n[W]||n["@@iterator"],typeof n=="function"?n:null)}var I=Symbol.for("react.client.reference");function K(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===I?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case w:return"Fragment";case b:return"Profiler";case _:return"StrictMode";case M:return"Suspense";case A:return"SuspenseList";case B:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case T:return"Portal";case y:return n.displayName||"Context";case g:return(n._context.displayName||"Context")+".Consumer";case k:var r=n.render;return n=n.displayName,n||(n=r.displayName||r.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case N:return r=n.displayName||null,r!==null?r:K(n.type)||"Memo";case R:r=n._payload,n=n._init;try{return K(n(r))}catch{}}return null}var H=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},j=[],z=-1;function D(n){return{current:n}}function U(n){0>z||(n.current=j[z],j[z]=null,z--)}function V(n,r){z++,j[z]=n.current,n.current=r}var J=D(null),le=D(null),pe=D(null),te=D(null);function F(n,r){switch(V(pe,r),V(le,n),V(J,null),r.nodeType){case 9:case 11:n=(n=r.documentElement)&&(n=n.namespaceURI)?Vb(n):0;break;default:if(n=r.tagName,r=r.namespaceURI)r=Vb(r),n=Yb(r,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}U(J),V(J,n)}function ae(){U(J),U(le),U(pe)}function re(n){n.memoizedState!==null&&V(te,n);var r=J.current,a=Yb(r,n.type);r!==a&&(V(le,n),V(J,a))}function ge(n){le.current===n&&(U(J),U(le)),te.current===n&&(U(te),El._currentValue=X)}var de,we;function Ie(n){if(de===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);de=r&&r[1]||"",we=-1<a.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+de+n+we}var Ne=!1;function Ge(n,r){if(!n||Ne)return"";Ne=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(r){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(fe){var ue=fe}Reflect.construct(n,[],ye)}else{try{ye.call()}catch(fe){ue=fe}n.call(ye.prototype)}}else{try{throw Error()}catch(fe){ue=fe}(ye=n())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(fe){if(fe&&ue&&typeof fe.stack=="string")return[fe.stack,ue.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var E=c.DetermineComponentFrameRoot(),O=E[0],$=E[1];if(O&&$){var Q=O.split(`
4
+ `),ce=$.split(`
5
+ `);for(x=c=0;c<Q.length&&!Q[c].includes("DetermineComponentFrameRoot");)c++;for(;x<ce.length&&!ce[x].includes("DetermineComponentFrameRoot");)x++;if(c===Q.length||x===ce.length)for(c=Q.length-1,x=ce.length-1;1<=c&&0<=x&&Q[c]!==ce[x];)x--;for(;1<=c&&0<=x;c--,x--)if(Q[c]!==ce[x]){if(c!==1||x!==1)do if(c--,x--,0>x||Q[c]!==ce[x]){var me=`
6
+ `+Q[c].replace(" at new "," at ");return n.displayName&&me.includes("<anonymous>")&&(me=me.replace("<anonymous>",n.displayName)),me}while(1<=c&&0<=x);break}}}finally{Ne=!1,Error.prepareStackTrace=a}return(a=n?n.displayName||n.name:"")?Ie(a):""}function Ee(n,r){switch(n.tag){case 26:case 27:case 5:return Ie(n.type);case 16:return Ie("Lazy");case 13:return n.child!==r&&r!==null?Ie("Suspense Fallback"):Ie("Suspense");case 19:return Ie("SuspenseList");case 0:case 15:return Ge(n.type,!1);case 11:return Ge(n.type.render,!1);case 1:return Ge(n.type,!0);case 31:return Ie("Activity");default:return""}}function ct(n){try{var r="",a=null;do r+=Ee(n,a),a=n,n=n.return;while(n);return r}catch(c){return`
7
+ Error generating stack: `+c.message+`
8
+ `+c.stack}}var wt=Object.prototype.hasOwnProperty,Xt=e.unstable_scheduleCallback,Ln=e.unstable_cancelCallback,$n=e.unstable_shouldYield,en=e.unstable_requestPaint,ft=e.unstable_now,qt=e.unstable_getCurrentPriorityLevel,Ht=e.unstable_ImmediatePriority,yt=e.unstable_UserBlockingPriority,Bt=e.unstable_NormalPriority,vi=e.unstable_LowPriority,Zt=e.unstable_IdlePriority,Mn=e.log,dt=e.unstable_setDisableYieldValue,hn=null,Ot=null;function Jt(n){if(typeof Mn=="function"&&dt(n),Ot&&typeof Ot.setStrictMode=="function")try{Ot.setStrictMode(hn,n)}catch{}}var pt=Math.clz32?Math.clz32:Vr,bi=Math.log,Kn=Math.LN2;function Vr(n){return n>>>=0,n===0?32:31-(bi(n)/Kn|0)|0}var yi=256,wn=262144,Vn=4194304;function tn(n){var r=n&42;if(r!==0)return r;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function ee(n,r,a){var c=n.pendingLanes;if(c===0)return 0;var x=0,E=n.suspendedLanes,O=n.pingedLanes;n=n.warmLanes;var $=c&134217727;return $!==0?(c=$&~E,c!==0?x=tn(c):(O&=$,O!==0?x=tn(O):a||(a=$&~n,a!==0&&(x=tn(a))))):($=c&~E,$!==0?x=tn($):O!==0?x=tn(O):a||(a=c&~n,a!==0&&(x=tn(a)))),x===0?0:r!==0&&r!==x&&(r&E)===0&&(E=x&-x,a=r&-r,E>=a||E===32&&(a&4194048)!==0)?r:x}function _e(n,r){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&r)===0}function xe(n,r){switch(n){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Pe(){var n=Vn;return Vn<<=1,(Vn&62914560)===0&&(Vn=4194304),n}function Ct(n){for(var r=[],a=0;31>a;a++)r.push(n);return r}function mt(n,r){n.pendingLanes|=r,r!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Le(n,r,a,c,x,E){var O=n.pendingLanes;n.pendingLanes=a,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=a,n.entangledLanes&=a,n.errorRecoveryDisabledLanes&=a,n.shellSuspendCounter=0;var $=n.entanglements,Q=n.expirationTimes,ce=n.hiddenUpdates;for(a=O&~a;0<a;){var me=31-pt(a),ye=1<<me;$[me]=0,Q[me]=-1;var ue=ce[me];if(ue!==null)for(ce[me]=null,me=0;me<ue.length;me++){var fe=ue[me];fe!==null&&(fe.lane&=-536870913)}a&=~ye}c!==0&&Te(n,c,0),E!==0&&x===0&&n.tag!==0&&(n.suspendedLanes|=E&~(O&~r))}function Te(n,r,a){n.pendingLanes|=r,n.suspendedLanes&=~r;var c=31-pt(r);n.entangledLanes|=r,n.entanglements[c]=n.entanglements[c]|1073741824|a&261930}function ze(n,r){var a=n.entangledLanes|=r;for(n=n.entanglements;a;){var c=31-pt(a),x=1<<c;x&r|n[c]&r&&(n[c]|=r),a&=~x}}function Pt(n,r){var a=r&-r;return a=(a&42)!==0?1:he(a),(a&(n.suspendedLanes|r))!==0?0:a}function he(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function qe(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Dt(){var n=Y.p;return n!==0?n:(n=window.event,n===void 0?32:vy(n.type))}function nt(n,r){var a=Y.p;try{return Y.p=n,r()}finally{Y.p=a}}var Ae=Math.random().toString(36).slice(2),We="__reactFiber$"+Ae,Xe="__reactProps$"+Ae,pn="__reactContainer$"+Ae,Yn="__reactEvents$"+Ae,ji="__reactListeners$"+Ae,Xn="__reactHandles$"+Ae,hr="__reactResources$"+Ae,Zn="__reactMarker$"+Ae;function Re(n){delete n[We],delete n[Xe],delete n[Yn],delete n[ji],delete n[Xn]}function Z(n){var r=n[We];if(r)return r;for(var a=n.parentNode;a;){if(r=a[pn]||a[We]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(n=ny(n);n!==null;){if(a=n[We])return a;n=ny(n)}return r}n=a,a=n.parentNode}return null}function ve(n){if(n=n[We]||n[pn]){var r=n.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return n}return null}function ke(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n.stateNode;throw Error(s(33))}function et(n){var r=n[hr];return r||(r=n[hr]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function tt(n){n[Zn]=!0}var jt=new Set,nn={};function rn(n,r){Se(n,r),Se(n+"Capture",r)}function Se(n,r){for(nn[n]=r,n=0;n<r.length;n++)jt.add(r[n])}var je=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Be={},gt={};function Kt(n){return wt.call(gt,n)?!0:wt.call(Be,n)?!1:je.test(n)?gt[n]=!0:(Be[n]=!0,!1)}function Un(n,r,a){if(Kt(r))if(a===null)n.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":n.removeAttribute(r);return;case"boolean":var c=r.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){n.removeAttribute(r);return}}n.setAttribute(r,""+a)}}function Si(n,r,a){if(a===null)n.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(r);return}n.setAttribute(r,""+a)}}function ai(n,r,a,c){if(c===null)n.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttributeNS(r,a,""+c)}}function zt(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function xi(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function Oc(n,r,a){var c=Object.getOwnPropertyDescriptor(n.constructor.prototype,r);if(!n.hasOwnProperty(r)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var x=c.get,E=c.set;return Object.defineProperty(n,r,{configurable:!0,get:function(){return x.call(this)},set:function(O){a=""+O,E.call(this,O)}}),Object.defineProperty(n,r,{enumerable:c.enumerable}),{getValue:function(){return a},setValue:function(O){a=""+O},stopTracking:function(){n._valueTracker=null,delete n[r]}}}}function ba(n){if(!n._valueTracker){var r=xi(n)?"checked":"value";n._valueTracker=Oc(n,r,""+n[r])}}function Po(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var a=r.getValue(),c="";return n&&(c=xi(n)?n.checked?"true":"false":n.value),n=c,n!==a?(r.setValue(n),!0):!1}function ya(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Cd=/[\n"\\]/g;function oi(n){return n.replace(Cd,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function zo(n,r,a,c,x,E,O,$){n.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?n.type=O:n.removeAttribute("type"),r!=null?O==="number"?(r===0&&n.value===""||n.value!=r)&&(n.value=""+zt(r)):n.value!==""+zt(r)&&(n.value=""+zt(r)):O!=="submit"&&O!=="reset"||n.removeAttribute("value"),r!=null?Sa(n,O,zt(r)):a!=null?Sa(n,O,zt(a)):c!=null&&n.removeAttribute("value"),x==null&&E!=null&&(n.defaultChecked=!!E),x!=null&&(n.checked=x&&typeof x!="function"&&typeof x!="symbol"),$!=null&&typeof $!="function"&&typeof $!="symbol"&&typeof $!="boolean"?n.name=""+zt($):n.removeAttribute("name")}function js(n,r,a,c,x,E,O,$){if(E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(n.type=E),r!=null||a!=null){if(!(E!=="submit"&&E!=="reset"||r!=null)){ba(n);return}a=a!=null?""+zt(a):"",r=r!=null?""+zt(r):a,$||r===n.value||(n.value=r),n.defaultValue=r}c=c??x,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=$?n.checked:!!c,n.defaultChecked=!!c,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(n.name=O),ba(n)}function Sa(n,r,a){r==="number"&&ya(n.ownerDocument)===n||n.defaultValue===""+a||(n.defaultValue=""+a)}function Nn(n,r,a,c){if(n=n.options,r){r={};for(var x=0;x<a.length;x++)r["$"+a[x]]=!0;for(a=0;a<n.length;a++)x=r.hasOwnProperty("$"+n[a].value),n[a].selected!==x&&(n[a].selected=x),x&&c&&(n[a].defaultSelected=!0)}else{for(a=""+zt(a),r=null,x=0;x<n.length;x++){if(n[x].value===a){n[x].selected=!0,c&&(n[x].defaultSelected=!0);return}r!==null||n[x].disabled||(r=n[x])}r!==null&&(r.selected=!0)}}function Dc(n,r,a){if(r!=null&&(r=""+zt(r),r!==n.value&&(n.value=r),a==null)){n.defaultValue!==r&&(n.defaultValue=r);return}n.defaultValue=a!=null?""+zt(a):""}function xa(n,r,a,c){if(r==null){if(c!=null){if(a!=null)throw Error(s(92));if(H(c)){if(1<c.length)throw Error(s(93));c=c[0]}a=c}a==null&&(a=""),r=a}a=zt(r),n.defaultValue=a,c=n.textContent,c===a&&c!==""&&c!==null&&(n.value=c),ba(n)}function Fe(n,r){if(r){var a=n.firstChild;if(a&&a===n.lastChild&&a.nodeType===3){a.nodeValue=r;return}}n.textContent=r}var jc=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function mn(n,r,a){var c=r.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?c?n.setProperty(r,""):r==="float"?n.cssFloat="":n[r]="":c?n.setProperty(r,a):typeof a!="number"||a===0||jc.has(r)?r==="float"?n.cssFloat=a:n[r]=(""+a).trim():n[r]=a+"px"}function Et(n,r,a){if(r!=null&&typeof r!="object")throw Error(s(62));if(n=n.style,a!=null){for(var c in a)!a.hasOwnProperty(c)||r!=null&&r.hasOwnProperty(c)||(c.indexOf("--")===0?n.setProperty(c,""):c==="float"?n.cssFloat="":n[c]="");for(var x in r)c=r[x],r.hasOwnProperty(x)&&a[x]!==c&&mn(n,x,c)}else for(var E in r)r.hasOwnProperty(E)&&mn(n,E,r[E])}function Yr(n){if(n.indexOf("-")===-1)return!1;switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xr=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Ho=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Xr(n){return Ho.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Ce(){}var Oe=null;function Ve(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var at=null,Qt=null;function Ii(n){var r=ve(n);if(r&&(n=r.stateNode)){var a=n[Xe]||null;e:switch(n=r.stateNode,r.type){case"input":if(zo(n,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),r=a.name,a.type==="radio"&&r!=null){for(a=n;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+oi(""+r)+'"][type="radio"]'),r=0;r<a.length;r++){var c=a[r];if(c!==n&&c.form===n.form){var x=c[Xe]||null;if(!x)throw Error(s(90));zo(c,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(r=0;r<a.length;r++)c=a[r],c.form===n.form&&Po(c)}break e;case"textarea":Dc(n,a.value,a.defaultValue);break e;case"select":r=a.value,r!=null&&Nn(n,!!a.multiple,r,!1)}}}var $o=!1;function Ic(n,r,a){if($o)return n(r,a);$o=!0;try{var c=n(r);return c}finally{if($o=!1,(at!==null||Qt!==null)&&(wu(),at&&(r=at,n=Qt,Qt=at=null,Ii(r),n)))for(r=0;r<n.length;r++)Ii(n[r])}}function Uo(n,r){var a=n.stateNode;if(a===null)return null;var c=a[Xe]||null;if(c===null)return null;a=c[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(n=n.type,c=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!c;break e;default:n=!1}if(n)return null;if(a&&typeof a!="function")throw Error(s(231,r,typeof a));return a}var wr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ed=!1;if(wr)try{var Fo={};Object.defineProperty(Fo,"passive",{get:function(){Ed=!0}}),window.addEventListener("test",Fo,Fo),window.removeEventListener("test",Fo,Fo)}catch{Ed=!1}var Zr=null,kd=null,Bc=null;function Y_(){if(Bc)return Bc;var n,r=kd,a=r.length,c,x="value"in Zr?Zr.value:Zr.textContent,E=x.length;for(n=0;n<a&&r[n]===x[n];n++);var O=a-n;for(c=1;c<=O&&r[a-c]===x[E-c];c++);return Bc=x.slice(n,1<c?1-c:void 0)}function Pc(n){var r=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&r===13&&(n=13)):n=r,n===10&&(n=13),32<=n||n===13?n:0}function zc(){return!0}function X_(){return!1}function li(n){function r(a,c,x,E,O){this._reactName=a,this._targetInst=x,this.type=c,this.nativeEvent=E,this.target=O,this.currentTarget=null;for(var $ in n)n.hasOwnProperty($)&&(a=n[$],this[$]=a?a(E):E[$]);return this.isDefaultPrevented=(E.defaultPrevented!=null?E.defaultPrevented:E.returnValue===!1)?zc:X_,this.isPropagationStopped=X_,this}return m(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=zc)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=zc)},persist:function(){},isPersistent:zc}),r}var Is={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hc=li(Is),Wo=m({},Is,{view:0,detail:0}),QE=li(Wo),Td,Ad,Go,$c=m({},Wo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ld,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Go&&(Go&&n.type==="mousemove"?(Td=n.screenX-Go.screenX,Ad=n.screenY-Go.screenY):Ad=Td=0,Go=n),Td)},movementY:function(n){return"movementY"in n?n.movementY:Ad}}),Z_=li($c),e5=m({},$c,{dataTransfer:0}),t5=li(e5),n5=m({},Wo,{relatedTarget:0}),Rd=li(n5),i5=m({},Is,{animationName:0,elapsedTime:0,pseudoElement:0}),r5=li(i5),s5=m({},Is,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),a5=li(s5),o5=m({},Is,{data:0}),J_=li(o5),l5={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},c5={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"},u5={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function h5(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=u5[n])?!!r[n]:!1}function Ld(){return h5}var d5=m({},Wo,{key:function(n){if(n.key){var r=l5[n.key]||n.key;if(r!=="Unidentified")return r}return n.type==="keypress"?(n=Pc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?c5[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ld,charCode:function(n){return n.type==="keypress"?Pc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Pc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),f5=li(d5),p5=m({},$c,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Q_=li(p5),m5=m({},Wo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ld}),g5=li(m5),_5=m({},Is,{propertyName:0,elapsedTime:0,pseudoElement:0}),v5=li(_5),b5=m({},$c,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),y5=li(b5),S5=m({},Is,{newState:0,oldState:0}),x5=li(S5),w5=[9,13,27,32],Md=wr&&"CompositionEvent"in window,qo=null;wr&&"documentMode"in document&&(qo=document.documentMode);var C5=wr&&"TextEvent"in window&&!qo,ev=wr&&(!Md||qo&&8<qo&&11>=qo),tv=" ",nv=!1;function iv(n,r){switch(n){case"keyup":return w5.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function rv(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var wa=!1;function E5(n,r){switch(n){case"compositionend":return rv(r);case"keypress":return r.which!==32?null:(nv=!0,tv);case"textInput":return n=r.data,n===tv&&nv?null:n;default:return null}}function k5(n,r){if(wa)return n==="compositionend"||!Md&&iv(n,r)?(n=Y_(),Bc=kd=Zr=null,wa=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return ev&&r.locale!=="ko"?null:r.data;default:return null}}var T5={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 sv(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!T5[n.type]:r==="textarea"}function av(n,r,a,c){at?Qt?Qt.push(c):Qt=[c]:at=c,r=Lu(r,"onChange"),0<r.length&&(a=new Hc("onChange","change",null,a,c),n.push({event:a,listeners:r}))}var Ko=null,Vo=null;function A5(n){Ub(n,0)}function Uc(n){var r=ke(n);if(Po(r))return n}function ov(n,r){if(n==="change")return r}var lv=!1;if(wr){var Nd;if(wr){var Od="oninput"in document;if(!Od){var cv=document.createElement("div");cv.setAttribute("oninput","return;"),Od=typeof cv.oninput=="function"}Nd=Od}else Nd=!1;lv=Nd&&(!document.documentMode||9<document.documentMode)}function uv(){Ko&&(Ko.detachEvent("onpropertychange",hv),Vo=Ko=null)}function hv(n){if(n.propertyName==="value"&&Uc(Vo)){var r=[];av(r,Vo,n,Ve(n)),Ic(A5,r)}}function R5(n,r,a){n==="focusin"?(uv(),Ko=r,Vo=a,Ko.attachEvent("onpropertychange",hv)):n==="focusout"&&uv()}function L5(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Uc(Vo)}function M5(n,r){if(n==="click")return Uc(r)}function N5(n,r){if(n==="input"||n==="change")return Uc(r)}function O5(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var wi=typeof Object.is=="function"?Object.is:O5;function Yo(n,r){if(wi(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;var a=Object.keys(n),c=Object.keys(r);if(a.length!==c.length)return!1;for(c=0;c<a.length;c++){var x=a[c];if(!wt.call(r,x)||!wi(n[x],r[x]))return!1}return!0}function dv(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function fv(n,r){var a=dv(n);n=0;for(var c;a;){if(a.nodeType===3){if(c=n+a.textContent.length,n<=r&&c>=r)return{node:a,offset:r-n};n=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=dv(a)}}function pv(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?pv(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function mv(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var r=ya(n.document);r instanceof n.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)n=r.contentWindow;else break;r=ya(n.document)}return r}function Dd(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r&&(r==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||r==="textarea"||n.contentEditable==="true")}var D5=wr&&"documentMode"in document&&11>=document.documentMode,Ca=null,jd=null,Xo=null,Id=!1;function gv(n,r,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Id||Ca==null||Ca!==ya(c)||(c=Ca,"selectionStart"in c&&Dd(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Xo&&Yo(Xo,c)||(Xo=c,c=Lu(jd,"onSelect"),0<c.length&&(r=new Hc("onSelect","select",null,r,a),n.push({event:r,listeners:c}),r.target=Ca)))}function Bs(n,r){var a={};return a[n.toLowerCase()]=r.toLowerCase(),a["Webkit"+n]="webkit"+r,a["Moz"+n]="moz"+r,a}var Ea={animationend:Bs("Animation","AnimationEnd"),animationiteration:Bs("Animation","AnimationIteration"),animationstart:Bs("Animation","AnimationStart"),transitionrun:Bs("Transition","TransitionRun"),transitionstart:Bs("Transition","TransitionStart"),transitioncancel:Bs("Transition","TransitionCancel"),transitionend:Bs("Transition","TransitionEnd")},Bd={},_v={};wr&&(_v=document.createElement("div").style,"AnimationEvent"in window||(delete Ea.animationend.animation,delete Ea.animationiteration.animation,delete Ea.animationstart.animation),"TransitionEvent"in window||delete Ea.transitionend.transition);function Ps(n){if(Bd[n])return Bd[n];if(!Ea[n])return n;var r=Ea[n],a;for(a in r)if(r.hasOwnProperty(a)&&a in _v)return Bd[n]=r[a];return n}var vv=Ps("animationend"),bv=Ps("animationiteration"),yv=Ps("animationstart"),j5=Ps("transitionrun"),I5=Ps("transitionstart"),B5=Ps("transitioncancel"),Sv=Ps("transitionend"),xv=new Map,Pd="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(" ");Pd.push("scrollEnd");function Zi(n,r){xv.set(n,r),rn(r,[n])}var Fc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Bi=[],ka=0,zd=0;function Wc(){for(var n=ka,r=zd=ka=0;r<n;){var a=Bi[r];Bi[r++]=null;var c=Bi[r];Bi[r++]=null;var x=Bi[r];Bi[r++]=null;var E=Bi[r];if(Bi[r++]=null,c!==null&&x!==null){var O=c.pending;O===null?x.next=x:(x.next=O.next,O.next=x),c.pending=x}E!==0&&wv(a,x,E)}}function Gc(n,r,a,c){Bi[ka++]=n,Bi[ka++]=r,Bi[ka++]=a,Bi[ka++]=c,zd|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function Hd(n,r,a,c){return Gc(n,r,a,c),qc(n)}function zs(n,r){return Gc(n,null,null,r),qc(n)}function wv(n,r,a){n.lanes|=a;var c=n.alternate;c!==null&&(c.lanes|=a);for(var x=!1,E=n.return;E!==null;)E.childLanes|=a,c=E.alternate,c!==null&&(c.childLanes|=a),E.tag===22&&(n=E.stateNode,n===null||n._visibility&1||(x=!0)),n=E,E=E.return;return n.tag===3?(E=n.stateNode,x&&r!==null&&(x=31-pt(a),n=E.hiddenUpdates,c=n[x],c===null?n[x]=[r]:c.push(r),r.lane=a|536870912),E):null}function qc(n){if(50<vl)throw vl=0,Xf=null,Error(s(185));for(var r=n.return;r!==null;)n=r,r=n.return;return n.tag===3?n.stateNode:null}var Ta={};function P5(n,r,a,c){this.tag=n,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ci(n,r,a,c){return new P5(n,r,a,c)}function $d(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Cr(n,r){var a=n.alternate;return a===null?(a=Ci(n.tag,r,n.key,n.mode),a.elementType=n.elementType,a.type=n.type,a.stateNode=n.stateNode,a.alternate=n,n.alternate=a):(a.pendingProps=r,a.type=n.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=n.flags&65011712,a.childLanes=n.childLanes,a.lanes=n.lanes,a.child=n.child,a.memoizedProps=n.memoizedProps,a.memoizedState=n.memoizedState,a.updateQueue=n.updateQueue,r=n.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=n.sibling,a.index=n.index,a.ref=n.ref,a.refCleanup=n.refCleanup,a}function Cv(n,r){n.flags&=65011714;var a=n.alternate;return a===null?(n.childLanes=0,n.lanes=r,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=a.childLanes,n.lanes=a.lanes,n.child=a.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=a.memoizedProps,n.memoizedState=a.memoizedState,n.updateQueue=a.updateQueue,n.type=a.type,r=a.dependencies,n.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),n}function Kc(n,r,a,c,x,E){var O=0;if(c=n,typeof n=="function")$d(n)&&(O=1);else if(typeof n=="string")O=Fk(n,a,J.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case B:return n=Ci(31,a,r,x),n.elementType=B,n.lanes=E,n;case w:return Hs(a.children,x,E,r);case _:O=8,x|=24;break;case b:return n=Ci(12,a,r,x|2),n.elementType=b,n.lanes=E,n;case M:return n=Ci(13,a,r,x),n.elementType=M,n.lanes=E,n;case A:return n=Ci(19,a,r,x),n.elementType=A,n.lanes=E,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case y:O=10;break e;case g:O=9;break e;case k:O=11;break e;case N:O=14;break e;case R:O=16,c=null;break e}O=29,a=Error(s(130,n===null?"null":typeof n,"")),c=null}return r=Ci(O,a,r,x),r.elementType=n,r.type=c,r.lanes=E,r}function Hs(n,r,a,c){return n=Ci(7,n,c,r),n.lanes=a,n}function Ud(n,r,a){return n=Ci(6,n,null,r),n.lanes=a,n}function Ev(n){var r=Ci(18,null,null,0);return r.stateNode=n,r}function Fd(n,r,a){return r=Ci(4,n.children!==null?n.children:[],n.key,r),r.lanes=a,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}var kv=new WeakMap;function Pi(n,r){if(typeof n=="object"&&n!==null){var a=kv.get(n);return a!==void 0?a:(r={value:n,source:r,stack:ct(r)},kv.set(n,r),r)}return{value:n,source:r,stack:ct(r)}}var Aa=[],Ra=0,Vc=null,Zo=0,zi=[],Hi=0,Jr=null,dr=1,fr="";function Er(n,r){Aa[Ra++]=Zo,Aa[Ra++]=Vc,Vc=n,Zo=r}function Tv(n,r,a){zi[Hi++]=dr,zi[Hi++]=fr,zi[Hi++]=Jr,Jr=n;var c=dr;n=fr;var x=32-pt(c)-1;c&=~(1<<x),a+=1;var E=32-pt(r)+x;if(30<E){var O=x-x%5;E=(c&(1<<O)-1).toString(32),c>>=O,x-=O,dr=1<<32-pt(r)+x|a<<x|c,fr=E+n}else dr=1<<E|a<<x|c,fr=n}function Wd(n){n.return!==null&&(Er(n,1),Tv(n,1,0))}function Gd(n){for(;n===Vc;)Vc=Aa[--Ra],Aa[Ra]=null,Zo=Aa[--Ra],Aa[Ra]=null;for(;n===Jr;)Jr=zi[--Hi],zi[Hi]=null,fr=zi[--Hi],zi[Hi]=null,dr=zi[--Hi],zi[Hi]=null}function Av(n,r){zi[Hi++]=dr,zi[Hi++]=fr,zi[Hi++]=Jr,dr=r.id,fr=r.overflow,Jr=n}var On=null,$t=null,ut=!1,Qr=null,$i=!1,qd=Error(s(519));function es(n){var r=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jo(Pi(r,n)),qd}function Rv(n){var r=n.stateNode,a=n.type,c=n.memoizedProps;switch(r[We]=n,r[Xe]=c,a){case"dialog":st("cancel",r),st("close",r);break;case"iframe":case"object":case"embed":st("load",r);break;case"video":case"audio":for(a=0;a<yl.length;a++)st(yl[a],r);break;case"source":st("error",r);break;case"img":case"image":case"link":st("error",r),st("load",r);break;case"details":st("toggle",r);break;case"input":st("invalid",r),js(r,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":st("invalid",r);break;case"textarea":st("invalid",r),xa(r,c.value,c.defaultValue,c.children)}a=c.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||r.textContent===""+a||c.suppressHydrationWarning===!0||qb(r.textContent,a)?(c.popover!=null&&(st("beforetoggle",r),st("toggle",r)),c.onScroll!=null&&st("scroll",r),c.onScrollEnd!=null&&st("scrollend",r),c.onClick!=null&&(r.onclick=Ce),r=!0):r=!1,r||es(n,!0)}function Lv(n){for(On=n.return;On;)switch(On.tag){case 5:case 31:case 13:$i=!1;return;case 27:case 3:$i=!0;return;default:On=On.return}}function La(n){if(n!==On)return!1;if(!ut)return Lv(n),ut=!0,!1;var r=n.tag,a;if((a=r!==3&&r!==27)&&((a=r===5)&&(a=n.type,a=!(a!=="form"&&a!=="button")||hp(n.type,n.memoizedProps)),a=!a),a&&$t&&es(n),Lv(n),r===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));$t=ty(n)}else if(r===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(317));$t=ty(n)}else r===27?(r=$t,ps(n.type)?(n=gp,gp=null,$t=n):$t=r):$t=On?Fi(n.stateNode.nextSibling):null;return!0}function $s(){$t=On=null,ut=!1}function Kd(){var n=Qr;return n!==null&&(di===null?di=n:di.push.apply(di,n),Qr=null),n}function Jo(n){Qr===null?Qr=[n]:Qr.push(n)}var Vd=D(null),Us=null,kr=null;function ts(n,r,a){V(Vd,r._currentValue),r._currentValue=a}function Tr(n){n._currentValue=Vd.current,U(Vd)}function Yd(n,r,a){for(;n!==null;){var c=n.alternate;if((n.childLanes&r)!==r?(n.childLanes|=r,c!==null&&(c.childLanes|=r)):c!==null&&(c.childLanes&r)!==r&&(c.childLanes|=r),n===a)break;n=n.return}}function Xd(n,r,a,c){var x=n.child;for(x!==null&&(x.return=n);x!==null;){var E=x.dependencies;if(E!==null){var O=x.child;E=E.firstContext;e:for(;E!==null;){var $=E;E=x;for(var Q=0;Q<r.length;Q++)if($.context===r[Q]){E.lanes|=a,$=E.alternate,$!==null&&($.lanes|=a),Yd(E.return,a,n),c||(O=null);break e}E=$.next}}else if(x.tag===18){if(O=x.return,O===null)throw Error(s(341));O.lanes|=a,E=O.alternate,E!==null&&(E.lanes|=a),Yd(O,a,n),O=null}else O=x.child;if(O!==null)O.return=x;else for(O=x;O!==null;){if(O===n){O=null;break}if(x=O.sibling,x!==null){x.return=O.return,O=x;break}O=O.return}x=O}}function Ma(n,r,a,c){n=null;for(var x=r,E=!1;x!==null;){if(!E){if((x.flags&524288)!==0)E=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var O=x.alternate;if(O===null)throw Error(s(387));if(O=O.memoizedProps,O!==null){var $=x.type;wi(x.pendingProps.value,O.value)||(n!==null?n.push($):n=[$])}}else if(x===te.current){if(O=x.alternate,O===null)throw Error(s(387));O.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(n!==null?n.push(El):n=[El])}x=x.return}n!==null&&Xd(r,n,a,c),r.flags|=262144}function Yc(n){for(n=n.firstContext;n!==null;){if(!wi(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Fs(n){Us=n,kr=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Dn(n){return Mv(Us,n)}function Xc(n,r){return Us===null&&Fs(n),Mv(n,r)}function Mv(n,r){var a=r._currentValue;if(r={context:r,memoizedValue:a,next:null},kr===null){if(n===null)throw Error(s(308));kr=r,n.dependencies={lanes:0,firstContext:r},n.flags|=524288}else kr=kr.next=r;return a}var z5=typeof AbortController<"u"?AbortController:function(){var n=[],r=this.signal={aborted:!1,addEventListener:function(a,c){n.push(c)}};this.abort=function(){r.aborted=!0,n.forEach(function(a){return a()})}},H5=e.unstable_scheduleCallback,$5=e.unstable_NormalPriority,gn={$$typeof:y,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Zd(){return{controller:new z5,data:new Map,refCount:0}}function Qo(n){n.refCount--,n.refCount===0&&H5($5,function(){n.controller.abort()})}var el=null,Jd=0,Na=0,Oa=null;function U5(n,r){if(el===null){var a=el=[];Jd=0,Na=np(),Oa={status:"pending",value:void 0,then:function(c){a.push(c)}}}return Jd++,r.then(Nv,Nv),r}function Nv(){if(--Jd===0&&el!==null){Oa!==null&&(Oa.status="fulfilled");var n=el;el=null,Na=0,Oa=null;for(var r=0;r<n.length;r++)(0,n[r])()}}function F5(n,r){var a=[],c={status:"pending",value:null,reason:null,then:function(x){a.push(x)}};return n.then(function(){c.status="fulfilled",c.value=r;for(var x=0;x<a.length;x++)(0,a[x])(r)},function(x){for(c.status="rejected",c.reason=x,x=0;x<a.length;x++)(0,a[x])(void 0)}),c}var Ov=P.S;P.S=function(n,r){gb=ft(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&U5(n,r),Ov!==null&&Ov(n,r)};var Ws=D(null);function Qd(){var n=Ws.current;return n!==null?n:It.pooledCache}function Zc(n,r){r===null?V(Ws,Ws.current):V(Ws,r.pool)}function Dv(){var n=Qd();return n===null?null:{parent:gn._currentValue,pool:n}}var Da=Error(s(460)),ef=Error(s(474)),Jc=Error(s(542)),Qc={then:function(){}};function jv(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Iv(n,r,a){switch(a=n[a],a===void 0?n.push(r):a!==r&&(r.then(Ce,Ce),r=a),r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,Pv(n),n;default:if(typeof r.status=="string")r.then(Ce,Ce);else{if(n=It,n!==null&&100<n.shellSuspendCounter)throw Error(s(482));n=r,n.status="pending",n.then(function(c){if(r.status==="pending"){var x=r;x.status="fulfilled",x.value=c}},function(c){if(r.status==="pending"){var x=r;x.status="rejected",x.reason=c}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,Pv(n),n}throw qs=r,Da}}function Gs(n){try{var r=n._init;return r(n._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(qs=a,Da):a}}var qs=null;function Bv(){if(qs===null)throw Error(s(459));var n=qs;return qs=null,n}function Pv(n){if(n===Da||n===Jc)throw Error(s(483))}var ja=null,tl=0;function eu(n){var r=tl;return tl+=1,ja===null&&(ja=[]),Iv(ja,n,r)}function nl(n,r){r=r.props.ref,n.ref=r!==void 0?r:null}function tu(n,r){throw r.$$typeof===S?Error(s(525)):(n=Object.prototype.toString.call(r),Error(s(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n)))}function zv(n){function r(ie,ne){if(n){var oe=ie.deletions;oe===null?(ie.deletions=[ne],ie.flags|=16):oe.push(ne)}}function a(ie,ne){if(!n)return null;for(;ne!==null;)r(ie,ne),ne=ne.sibling;return null}function c(ie){for(var ne=new Map;ie!==null;)ie.key!==null?ne.set(ie.key,ie):ne.set(ie.index,ie),ie=ie.sibling;return ne}function x(ie,ne){return ie=Cr(ie,ne),ie.index=0,ie.sibling=null,ie}function E(ie,ne,oe){return ie.index=oe,n?(oe=ie.alternate,oe!==null?(oe=oe.index,oe<ne?(ie.flags|=67108866,ne):oe):(ie.flags|=67108866,ne)):(ie.flags|=1048576,ne)}function O(ie){return n&&ie.alternate===null&&(ie.flags|=67108866),ie}function $(ie,ne,oe,be){return ne===null||ne.tag!==6?(ne=Ud(oe,ie.mode,be),ne.return=ie,ne):(ne=x(ne,oe),ne.return=ie,ne)}function Q(ie,ne,oe,be){var He=oe.type;return He===w?me(ie,ne,oe.props.children,be,oe.key):ne!==null&&(ne.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===R&&Gs(He)===ne.type)?(ne=x(ne,oe.props),nl(ne,oe),ne.return=ie,ne):(ne=Kc(oe.type,oe.key,oe.props,null,ie.mode,be),nl(ne,oe),ne.return=ie,ne)}function ce(ie,ne,oe,be){return ne===null||ne.tag!==4||ne.stateNode.containerInfo!==oe.containerInfo||ne.stateNode.implementation!==oe.implementation?(ne=Fd(oe,ie.mode,be),ne.return=ie,ne):(ne=x(ne,oe.children||[]),ne.return=ie,ne)}function me(ie,ne,oe,be,He){return ne===null||ne.tag!==7?(ne=Hs(oe,ie.mode,be,He),ne.return=ie,ne):(ne=x(ne,oe),ne.return=ie,ne)}function ye(ie,ne,oe){if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return ne=Ud(""+ne,ie.mode,oe),ne.return=ie,ne;if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case C:return oe=Kc(ne.type,ne.key,ne.props,null,ie.mode,oe),nl(oe,ne),oe.return=ie,oe;case T:return ne=Fd(ne,ie.mode,oe),ne.return=ie,ne;case R:return ne=Gs(ne),ye(ie,ne,oe)}if(H(ne)||G(ne))return ne=Hs(ne,ie.mode,oe,null),ne.return=ie,ne;if(typeof ne.then=="function")return ye(ie,eu(ne),oe);if(ne.$$typeof===y)return ye(ie,Xc(ie,ne),oe);tu(ie,ne)}return null}function ue(ie,ne,oe,be){var He=ne!==null?ne.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return He!==null?null:$(ie,ne,""+oe,be);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case C:return oe.key===He?Q(ie,ne,oe,be):null;case T:return oe.key===He?ce(ie,ne,oe,be):null;case R:return oe=Gs(oe),ue(ie,ne,oe,be)}if(H(oe)||G(oe))return He!==null?null:me(ie,ne,oe,be,null);if(typeof oe.then=="function")return ue(ie,ne,eu(oe),be);if(oe.$$typeof===y)return ue(ie,ne,Xc(ie,oe),be);tu(ie,oe)}return null}function fe(ie,ne,oe,be,He){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return ie=ie.get(oe)||null,$(ne,ie,""+be,He);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case C:return ie=ie.get(be.key===null?oe:be.key)||null,Q(ne,ie,be,He);case T:return ie=ie.get(be.key===null?oe:be.key)||null,ce(ne,ie,be,He);case R:return be=Gs(be),fe(ie,ne,oe,be,He)}if(H(be)||G(be))return ie=ie.get(oe)||null,me(ne,ie,be,He,null);if(typeof be.then=="function")return fe(ie,ne,oe,eu(be),He);if(be.$$typeof===y)return fe(ie,ne,oe,Xc(ne,be),He);tu(ne,be)}return null}function Me(ie,ne,oe,be){for(var He=null,_t=null,De=ne,Je=ne=0,lt=null;De!==null&&Je<oe.length;Je++){De.index>Je?(lt=De,De=null):lt=De.sibling;var vt=ue(ie,De,oe[Je],be);if(vt===null){De===null&&(De=lt);break}n&&De&&vt.alternate===null&&r(ie,De),ne=E(vt,ne,Je),_t===null?He=vt:_t.sibling=vt,_t=vt,De=lt}if(Je===oe.length)return a(ie,De),ut&&Er(ie,Je),He;if(De===null){for(;Je<oe.length;Je++)De=ye(ie,oe[Je],be),De!==null&&(ne=E(De,ne,Je),_t===null?He=De:_t.sibling=De,_t=De);return ut&&Er(ie,Je),He}for(De=c(De);Je<oe.length;Je++)lt=fe(De,ie,Je,oe[Je],be),lt!==null&&(n&&lt.alternate!==null&&De.delete(lt.key===null?Je:lt.key),ne=E(lt,ne,Je),_t===null?He=lt:_t.sibling=lt,_t=lt);return n&&De.forEach(function(bs){return r(ie,bs)}),ut&&Er(ie,Je),He}function Ue(ie,ne,oe,be){if(oe==null)throw Error(s(151));for(var He=null,_t=null,De=ne,Je=ne=0,lt=null,vt=oe.next();De!==null&&!vt.done;Je++,vt=oe.next()){De.index>Je?(lt=De,De=null):lt=De.sibling;var bs=ue(ie,De,vt.value,be);if(bs===null){De===null&&(De=lt);break}n&&De&&bs.alternate===null&&r(ie,De),ne=E(bs,ne,Je),_t===null?He=bs:_t.sibling=bs,_t=bs,De=lt}if(vt.done)return a(ie,De),ut&&Er(ie,Je),He;if(De===null){for(;!vt.done;Je++,vt=oe.next())vt=ye(ie,vt.value,be),vt!==null&&(ne=E(vt,ne,Je),_t===null?He=vt:_t.sibling=vt,_t=vt);return ut&&Er(ie,Je),He}for(De=c(De);!vt.done;Je++,vt=oe.next())vt=fe(De,ie,Je,vt.value,be),vt!==null&&(n&&vt.alternate!==null&&De.delete(vt.key===null?Je:vt.key),ne=E(vt,ne,Je),_t===null?He=vt:_t.sibling=vt,_t=vt);return n&&De.forEach(function(eT){return r(ie,eT)}),ut&&Er(ie,Je),He}function Lt(ie,ne,oe,be){if(typeof oe=="object"&&oe!==null&&oe.type===w&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case C:e:{for(var He=oe.key;ne!==null;){if(ne.key===He){if(He=oe.type,He===w){if(ne.tag===7){a(ie,ne.sibling),be=x(ne,oe.props.children),be.return=ie,ie=be;break e}}else if(ne.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===R&&Gs(He)===ne.type){a(ie,ne.sibling),be=x(ne,oe.props),nl(be,oe),be.return=ie,ie=be;break e}a(ie,ne);break}else r(ie,ne);ne=ne.sibling}oe.type===w?(be=Hs(oe.props.children,ie.mode,be,oe.key),be.return=ie,ie=be):(be=Kc(oe.type,oe.key,oe.props,null,ie.mode,be),nl(be,oe),be.return=ie,ie=be)}return O(ie);case T:e:{for(He=oe.key;ne!==null;){if(ne.key===He)if(ne.tag===4&&ne.stateNode.containerInfo===oe.containerInfo&&ne.stateNode.implementation===oe.implementation){a(ie,ne.sibling),be=x(ne,oe.children||[]),be.return=ie,ie=be;break e}else{a(ie,ne);break}else r(ie,ne);ne=ne.sibling}be=Fd(oe,ie.mode,be),be.return=ie,ie=be}return O(ie);case R:return oe=Gs(oe),Lt(ie,ne,oe,be)}if(H(oe))return Me(ie,ne,oe,be);if(G(oe)){if(He=G(oe),typeof He!="function")throw Error(s(150));return oe=He.call(oe),Ue(ie,ne,oe,be)}if(typeof oe.then=="function")return Lt(ie,ne,eu(oe),be);if(oe.$$typeof===y)return Lt(ie,ne,Xc(ie,oe),be);tu(ie,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,ne!==null&&ne.tag===6?(a(ie,ne.sibling),be=x(ne,oe),be.return=ie,ie=be):(a(ie,ne),be=Ud(oe,ie.mode,be),be.return=ie,ie=be),O(ie)):a(ie,ne)}return function(ie,ne,oe,be){try{tl=0;var He=Lt(ie,ne,oe,be);return ja=null,He}catch(De){if(De===Da||De===Jc)throw De;var _t=Ci(29,De,null,ie.mode);return _t.lanes=be,_t.return=ie,_t}}}var Ks=zv(!0),Hv=zv(!1),ns=!1;function tf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function nf(n,r){n=n.updateQueue,r.updateQueue===n&&(r.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function is(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function rs(n,r,a){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(St&2)!==0){var x=c.pending;return x===null?r.next=r:(r.next=x.next,x.next=r),c.pending=r,r=qc(n),wv(n,null,a),r}return Gc(n,c,r,a),qc(n)}function il(n,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var c=r.lanes;c&=n.pendingLanes,a|=c,r.lanes=a,ze(n,a)}}function rf(n,r){var a=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var x=null,E=null;if(a=a.firstBaseUpdate,a!==null){do{var O={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};E===null?x=E=O:E=E.next=O,a=a.next}while(a!==null);E===null?x=E=r:E=E.next=r}else x=E=r;a={baseState:c.baseState,firstBaseUpdate:x,lastBaseUpdate:E,shared:c.shared,callbacks:c.callbacks},n.updateQueue=a;return}n=a.lastBaseUpdate,n===null?a.firstBaseUpdate=r:n.next=r,a.lastBaseUpdate=r}var sf=!1;function rl(){if(sf){var n=Oa;if(n!==null)throw n}}function sl(n,r,a,c){sf=!1;var x=n.updateQueue;ns=!1;var E=x.firstBaseUpdate,O=x.lastBaseUpdate,$=x.shared.pending;if($!==null){x.shared.pending=null;var Q=$,ce=Q.next;Q.next=null,O===null?E=ce:O.next=ce,O=Q;var me=n.alternate;me!==null&&(me=me.updateQueue,$=me.lastBaseUpdate,$!==O&&($===null?me.firstBaseUpdate=ce:$.next=ce,me.lastBaseUpdate=Q))}if(E!==null){var ye=x.baseState;O=0,me=ce=Q=null,$=E;do{var ue=$.lane&-536870913,fe=ue!==$.lane;if(fe?(ot&ue)===ue:(c&ue)===ue){ue!==0&&ue===Na&&(sf=!0),me!==null&&(me=me.next={lane:0,tag:$.tag,payload:$.payload,callback:null,next:null});e:{var Me=n,Ue=$;ue=r;var Lt=a;switch(Ue.tag){case 1:if(Me=Ue.payload,typeof Me=="function"){ye=Me.call(Lt,ye,ue);break e}ye=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=Ue.payload,ue=typeof Me=="function"?Me.call(Lt,ye,ue):Me,ue==null)break e;ye=m({},ye,ue);break e;case 2:ns=!0}}ue=$.callback,ue!==null&&(n.flags|=64,fe&&(n.flags|=8192),fe=x.callbacks,fe===null?x.callbacks=[ue]:fe.push(ue))}else fe={lane:ue,tag:$.tag,payload:$.payload,callback:$.callback,next:null},me===null?(ce=me=fe,Q=ye):me=me.next=fe,O|=ue;if($=$.next,$===null){if($=x.shared.pending,$===null)break;fe=$,$=fe.next,fe.next=null,x.lastBaseUpdate=fe,x.shared.pending=null}}while(!0);me===null&&(Q=ye),x.baseState=Q,x.firstBaseUpdate=ce,x.lastBaseUpdate=me,E===null&&(x.shared.lanes=0),cs|=O,n.lanes=O,n.memoizedState=ye}}function $v(n,r){if(typeof n!="function")throw Error(s(191,n));n.call(r)}function Uv(n,r){var a=n.callbacks;if(a!==null)for(n.callbacks=null,n=0;n<a.length;n++)$v(a[n],r)}var Ia=D(null),nu=D(0);function Fv(n,r){n=Ir,V(nu,n),V(Ia,r),Ir=n|r.baseLanes}function af(){V(nu,Ir),V(Ia,Ia.current)}function of(){Ir=nu.current,U(Ia),U(nu)}var Ei=D(null),Ui=null;function ss(n){var r=n.alternate;V(dn,dn.current&1),V(Ei,n),Ui===null&&(r===null||Ia.current!==null||r.memoizedState!==null)&&(Ui=n)}function lf(n){V(dn,dn.current),V(Ei,n),Ui===null&&(Ui=n)}function Wv(n){n.tag===22?(V(dn,dn.current),V(Ei,n),Ui===null&&(Ui=n)):as()}function as(){V(dn,dn.current),V(Ei,Ei.current)}function ki(n){U(Ei),Ui===n&&(Ui=null),U(dn)}var dn=D(0);function iu(n){for(var r=n;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||pp(a)||mp(a)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Ar=0,Ze=null,At=null,_n=null,ru=!1,Ba=!1,Vs=!1,su=0,al=0,Pa=null,W5=0;function sn(){throw Error(s(321))}function cf(n,r){if(r===null)return!1;for(var a=0;a<r.length&&a<n.length;a++)if(!wi(n[a],r[a]))return!1;return!0}function uf(n,r,a,c,x,E){return Ar=E,Ze=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,P.H=n===null||n.memoizedState===null?T0:Ef,Vs=!1,E=a(c,x),Vs=!1,Ba&&(E=qv(r,a,c,x)),Gv(n),E}function Gv(n){P.H=cl;var r=At!==null&&At.next!==null;if(Ar=0,_n=At=Ze=null,ru=!1,al=0,Pa=null,r)throw Error(s(300));n===null||vn||(n=n.dependencies,n!==null&&Yc(n)&&(vn=!0))}function qv(n,r,a,c){Ze=n;var x=0;do{if(Ba&&(Pa=null),al=0,Ba=!1,25<=x)throw Error(s(301));if(x+=1,_n=At=null,n.updateQueue!=null){var E=n.updateQueue;E.lastEffect=null,E.events=null,E.stores=null,E.memoCache!=null&&(E.memoCache.index=0)}P.H=A0,E=r(a,c)}while(Ba);return E}function G5(){var n=P.H,r=n.useState()[0];return r=typeof r.then=="function"?ol(r):r,n=n.useState()[0],(At!==null?At.memoizedState:null)!==n&&(Ze.flags|=1024),r}function hf(){var n=su!==0;return su=0,n}function df(n,r,a){r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~a}function ff(n){if(ru){for(n=n.memoizedState;n!==null;){var r=n.queue;r!==null&&(r.pending=null),n=n.next}ru=!1}Ar=0,_n=At=Ze=null,Ba=!1,al=su=0,Pa=null}function Jn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _n===null?Ze.memoizedState=_n=n:_n=_n.next=n,_n}function fn(){if(At===null){var n=Ze.alternate;n=n!==null?n.memoizedState:null}else n=At.next;var r=_n===null?Ze.memoizedState:_n.next;if(r!==null)_n=r,At=n;else{if(n===null)throw Ze.alternate===null?Error(s(467)):Error(s(310));At=n,n={memoizedState:At.memoizedState,baseState:At.baseState,baseQueue:At.baseQueue,queue:At.queue,next:null},_n===null?Ze.memoizedState=_n=n:_n=_n.next=n}return _n}function au(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ol(n){var r=al;return al+=1,Pa===null&&(Pa=[]),n=Iv(Pa,n,r),r=Ze,(_n===null?r.memoizedState:_n.next)===null&&(r=r.alternate,P.H=r===null||r.memoizedState===null?T0:Ef),n}function ou(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return ol(n);if(n.$$typeof===y)return Dn(n)}throw Error(s(438,String(n)))}function pf(n){var r=null,a=Ze.updateQueue;if(a!==null&&(r=a.memoCache),r==null){var c=Ze.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(r={data:c.data.map(function(x){return x.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),a===null&&(a=au(),Ze.updateQueue=a),a.memoCache=r,a=r.data[r.index],a===void 0)for(a=r.data[r.index]=Array(n),c=0;c<n;c++)a[c]=q;return r.index++,a}function Rr(n,r){return typeof r=="function"?r(n):r}function lu(n){var r=fn();return mf(r,At,n)}function mf(n,r,a){var c=n.queue;if(c===null)throw Error(s(311));c.lastRenderedReducer=a;var x=n.baseQueue,E=c.pending;if(E!==null){if(x!==null){var O=x.next;x.next=E.next,E.next=O}r.baseQueue=x=E,c.pending=null}if(E=n.baseState,x===null)n.memoizedState=E;else{r=x.next;var $=O=null,Q=null,ce=r,me=!1;do{var ye=ce.lane&-536870913;if(ye!==ce.lane?(ot&ye)===ye:(Ar&ye)===ye){var ue=ce.revertLane;if(ue===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null}),ye===Na&&(me=!0);else if((Ar&ue)===ue){ce=ce.next,ue===Na&&(me=!0);continue}else ye={lane:0,revertLane:ce.revertLane,gesture:null,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null},Q===null?($=Q=ye,O=E):Q=Q.next=ye,Ze.lanes|=ue,cs|=ue;ye=ce.action,Vs&&a(E,ye),E=ce.hasEagerState?ce.eagerState:a(E,ye)}else ue={lane:ye,revertLane:ce.revertLane,gesture:ce.gesture,action:ce.action,hasEagerState:ce.hasEagerState,eagerState:ce.eagerState,next:null},Q===null?($=Q=ue,O=E):Q=Q.next=ue,Ze.lanes|=ye,cs|=ye;ce=ce.next}while(ce!==null&&ce!==r);if(Q===null?O=E:Q.next=$,!wi(E,n.memoizedState)&&(vn=!0,me&&(a=Oa,a!==null)))throw a;n.memoizedState=E,n.baseState=O,n.baseQueue=Q,c.lastRenderedState=E}return x===null&&(c.lanes=0),[n.memoizedState,c.dispatch]}function gf(n){var r=fn(),a=r.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=n;var c=a.dispatch,x=a.pending,E=r.memoizedState;if(x!==null){a.pending=null;var O=x=x.next;do E=n(E,O.action),O=O.next;while(O!==x);wi(E,r.memoizedState)||(vn=!0),r.memoizedState=E,r.baseQueue===null&&(r.baseState=E),a.lastRenderedState=E}return[E,c]}function Kv(n,r,a){var c=Ze,x=fn(),E=ut;if(E){if(a===void 0)throw Error(s(407));a=a()}else a=r();var O=!wi((At||x).memoizedState,a);if(O&&(x.memoizedState=a,vn=!0),x=x.queue,bf(Xv.bind(null,c,x,n),[n]),x.getSnapshot!==r||O||_n!==null&&_n.memoizedState.tag&1){if(c.flags|=2048,za(9,{destroy:void 0},Yv.bind(null,c,x,a,r),null),It===null)throw Error(s(349));E||(Ar&127)!==0||Vv(c,r,a)}return a}function Vv(n,r,a){n.flags|=16384,n={getSnapshot:r,value:a},r=Ze.updateQueue,r===null?(r=au(),Ze.updateQueue=r,r.stores=[n]):(a=r.stores,a===null?r.stores=[n]:a.push(n))}function Yv(n,r,a,c){r.value=a,r.getSnapshot=c,Zv(r)&&Jv(n)}function Xv(n,r,a){return a(function(){Zv(r)&&Jv(n)})}function Zv(n){var r=n.getSnapshot;n=n.value;try{var a=r();return!wi(n,a)}catch{return!0}}function Jv(n){var r=zs(n,2);r!==null&&fi(r,n,2)}function _f(n){var r=Jn();if(typeof n=="function"){var a=n;if(n=a(),Vs){Jt(!0);try{a()}finally{Jt(!1)}}}return r.memoizedState=r.baseState=n,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rr,lastRenderedState:n},r}function Qv(n,r,a,c){return n.baseState=a,mf(n,At,typeof c=="function"?c:Rr)}function q5(n,r,a,c,x){if(hu(n))throw Error(s(485));if(n=r.action,n!==null){var E={payload:x,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){E.listeners.push(O)}};P.T!==null?a(!0):E.isTransition=!1,c(E),a=r.pending,a===null?(E.next=r.pending=E,e0(r,E)):(E.next=a.next,r.pending=a.next=E)}}function e0(n,r){var a=r.action,c=r.payload,x=n.state;if(r.isTransition){var E=P.T,O={};P.T=O;try{var $=a(x,c),Q=P.S;Q!==null&&Q(O,$),t0(n,r,$)}catch(ce){vf(n,r,ce)}finally{E!==null&&O.types!==null&&(E.types=O.types),P.T=E}}else try{E=a(x,c),t0(n,r,E)}catch(ce){vf(n,r,ce)}}function t0(n,r,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(c){n0(n,r,c)},function(c){return vf(n,r,c)}):n0(n,r,a)}function n0(n,r,a){r.status="fulfilled",r.value=a,i0(r),n.state=a,r=n.pending,r!==null&&(a=r.next,a===r?n.pending=null:(a=a.next,r.next=a,e0(n,a)))}function vf(n,r,a){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do r.status="rejected",r.reason=a,i0(r),r=r.next;while(r!==c)}n.action=null}function i0(n){n=n.listeners;for(var r=0;r<n.length;r++)(0,n[r])()}function r0(n,r){return r}function s0(n,r){if(ut){var a=It.formState;if(a!==null){e:{var c=Ze;if(ut){if($t){t:{for(var x=$t,E=$i;x.nodeType!==8;){if(!E){x=null;break t}if(x=Fi(x.nextSibling),x===null){x=null;break t}}E=x.data,x=E==="F!"||E==="F"?x:null}if(x){$t=Fi(x.nextSibling),c=x.data==="F!";break e}}es(c)}c=!1}c&&(r=a[0])}}return a=Jn(),a.memoizedState=a.baseState=r,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r0,lastRenderedState:r},a.queue=c,a=C0.bind(null,Ze,c),c.dispatch=a,c=_f(!1),E=Cf.bind(null,Ze,!1,c.queue),c=Jn(),x={state:r,dispatch:null,action:n,pending:null},c.queue=x,a=q5.bind(null,Ze,x,E,a),x.dispatch=a,c.memoizedState=n,[r,a,!1]}function a0(n){var r=fn();return o0(r,At,n)}function o0(n,r,a){if(r=mf(n,r,r0)[0],n=lu(Rr)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var c=ol(r)}catch(O){throw O===Da?Jc:O}else c=r;r=fn();var x=r.queue,E=x.dispatch;return a!==r.memoizedState&&(Ze.flags|=2048,za(9,{destroy:void 0},K5.bind(null,x,a),null)),[c,E,n]}function K5(n,r){n.action=r}function l0(n){var r=fn(),a=At;if(a!==null)return o0(r,a,n);fn(),r=r.memoizedState,a=fn();var c=a.queue.dispatch;return a.memoizedState=n,[r,c,!1]}function za(n,r,a,c){return n={tag:n,create:a,deps:c,inst:r,next:null},r=Ze.updateQueue,r===null&&(r=au(),Ze.updateQueue=r),a=r.lastEffect,a===null?r.lastEffect=n.next=n:(c=a.next,a.next=n,n.next=c,r.lastEffect=n),n}function c0(){return fn().memoizedState}function cu(n,r,a,c){var x=Jn();Ze.flags|=n,x.memoizedState=za(1|r,{destroy:void 0},a,c===void 0?null:c)}function uu(n,r,a,c){var x=fn();c=c===void 0?null:c;var E=x.memoizedState.inst;At!==null&&c!==null&&cf(c,At.memoizedState.deps)?x.memoizedState=za(r,E,a,c):(Ze.flags|=n,x.memoizedState=za(1|r,E,a,c))}function u0(n,r){cu(8390656,8,n,r)}function bf(n,r){uu(2048,8,n,r)}function V5(n){Ze.flags|=4;var r=Ze.updateQueue;if(r===null)r=au(),Ze.updateQueue=r,r.events=[n];else{var a=r.events;a===null?r.events=[n]:a.push(n)}}function h0(n){var r=fn().memoizedState;return V5({ref:r,nextImpl:n}),function(){if((St&2)!==0)throw Error(s(440));return r.impl.apply(void 0,arguments)}}function d0(n,r){return uu(4,2,n,r)}function f0(n,r){return uu(4,4,n,r)}function p0(n,r){if(typeof r=="function"){n=n();var a=r(n);return function(){typeof a=="function"?a():r(null)}}if(r!=null)return n=n(),r.current=n,function(){r.current=null}}function m0(n,r,a){a=a!=null?a.concat([n]):null,uu(4,4,p0.bind(null,r,n),a)}function yf(){}function g0(n,r){var a=fn();r=r===void 0?null:r;var c=a.memoizedState;return r!==null&&cf(r,c[1])?c[0]:(a.memoizedState=[n,r],n)}function _0(n,r){var a=fn();r=r===void 0?null:r;var c=a.memoizedState;if(r!==null&&cf(r,c[1]))return c[0];if(c=n(),Vs){Jt(!0);try{n()}finally{Jt(!1)}}return a.memoizedState=[c,r],c}function Sf(n,r,a){return a===void 0||(Ar&1073741824)!==0&&(ot&261930)===0?n.memoizedState=r:(n.memoizedState=a,n=vb(),Ze.lanes|=n,cs|=n,a)}function v0(n,r,a,c){return wi(a,r)?a:Ia.current!==null?(n=Sf(n,a,c),wi(n,r)||(vn=!0),n):(Ar&42)===0||(Ar&1073741824)!==0&&(ot&261930)===0?(vn=!0,n.memoizedState=a):(n=vb(),Ze.lanes|=n,cs|=n,r)}function b0(n,r,a,c,x){var E=Y.p;Y.p=E!==0&&8>E?E:8;var O=P.T,$={};P.T=$,Cf(n,!1,r,a);try{var Q=x(),ce=P.S;if(ce!==null&&ce($,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var me=F5(Q,c);ll(n,r,me,Ri(n))}else ll(n,r,c,Ri(n))}catch(ye){ll(n,r,{then:function(){},status:"rejected",reason:ye},Ri())}finally{Y.p=E,O!==null&&$.types!==null&&(O.types=$.types),P.T=O}}function Y5(){}function xf(n,r,a,c){if(n.tag!==5)throw Error(s(476));var x=y0(n).queue;b0(n,x,r,X,a===null?Y5:function(){return S0(n),a(c)})}function y0(n){var r=n.memoizedState;if(r!==null)return r;r={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rr,lastRenderedState:X},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rr,lastRenderedState:a},next:null},n.memoizedState=r,n=n.alternate,n!==null&&(n.memoizedState=r),r}function S0(n){var r=y0(n);r.next===null&&(r=n.alternate.memoizedState),ll(n,r.next.queue,{},Ri())}function wf(){return Dn(El)}function x0(){return fn().memoizedState}function w0(){return fn().memoizedState}function X5(n){for(var r=n.return;r!==null;){switch(r.tag){case 24:case 3:var a=Ri();n=is(a);var c=rs(r,n,a);c!==null&&(fi(c,r,a),il(c,r,a)),r={cache:Zd()},n.payload=r;return}r=r.return}}function Z5(n,r,a){var c=Ri();a={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},hu(n)?E0(r,a):(a=Hd(n,r,a,c),a!==null&&(fi(a,n,c),k0(a,r,c)))}function C0(n,r,a){var c=Ri();ll(n,r,a,c)}function ll(n,r,a,c){var x={lane:c,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(hu(n))E0(r,x);else{var E=n.alternate;if(n.lanes===0&&(E===null||E.lanes===0)&&(E=r.lastRenderedReducer,E!==null))try{var O=r.lastRenderedState,$=E(O,a);if(x.hasEagerState=!0,x.eagerState=$,wi($,O))return Gc(n,r,x,0),It===null&&Wc(),!1}catch{}if(a=Hd(n,r,x,c),a!==null)return fi(a,n,c),k0(a,r,c),!0}return!1}function Cf(n,r,a,c){if(c={lane:2,revertLane:np(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},hu(n)){if(r)throw Error(s(479))}else r=Hd(n,a,c,2),r!==null&&fi(r,n,2)}function hu(n){var r=n.alternate;return n===Ze||r!==null&&r===Ze}function E0(n,r){Ba=ru=!0;var a=n.pending;a===null?r.next=r:(r.next=a.next,a.next=r),n.pending=r}function k0(n,r,a){if((a&4194048)!==0){var c=r.lanes;c&=n.pendingLanes,a|=c,r.lanes=a,ze(n,a)}}var cl={readContext:Dn,use:ou,useCallback:sn,useContext:sn,useEffect:sn,useImperativeHandle:sn,useLayoutEffect:sn,useInsertionEffect:sn,useMemo:sn,useReducer:sn,useRef:sn,useState:sn,useDebugValue:sn,useDeferredValue:sn,useTransition:sn,useSyncExternalStore:sn,useId:sn,useHostTransitionStatus:sn,useFormState:sn,useActionState:sn,useOptimistic:sn,useMemoCache:sn,useCacheRefresh:sn};cl.useEffectEvent=sn;var T0={readContext:Dn,use:ou,useCallback:function(n,r){return Jn().memoizedState=[n,r===void 0?null:r],n},useContext:Dn,useEffect:u0,useImperativeHandle:function(n,r,a){a=a!=null?a.concat([n]):null,cu(4194308,4,p0.bind(null,r,n),a)},useLayoutEffect:function(n,r){return cu(4194308,4,n,r)},useInsertionEffect:function(n,r){cu(4,2,n,r)},useMemo:function(n,r){var a=Jn();r=r===void 0?null:r;var c=n();if(Vs){Jt(!0);try{n()}finally{Jt(!1)}}return a.memoizedState=[c,r],c},useReducer:function(n,r,a){var c=Jn();if(a!==void 0){var x=a(r);if(Vs){Jt(!0);try{a(r)}finally{Jt(!1)}}}else x=r;return c.memoizedState=c.baseState=x,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:x},c.queue=n,n=n.dispatch=Z5.bind(null,Ze,n),[c.memoizedState,n]},useRef:function(n){var r=Jn();return n={current:n},r.memoizedState=n},useState:function(n){n=_f(n);var r=n.queue,a=C0.bind(null,Ze,r);return r.dispatch=a,[n.memoizedState,a]},useDebugValue:yf,useDeferredValue:function(n,r){var a=Jn();return Sf(a,n,r)},useTransition:function(){var n=_f(!1);return n=b0.bind(null,Ze,n.queue,!0,!1),Jn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,r,a){var c=Ze,x=Jn();if(ut){if(a===void 0)throw Error(s(407));a=a()}else{if(a=r(),It===null)throw Error(s(349));(ot&127)!==0||Vv(c,r,a)}x.memoizedState=a;var E={value:a,getSnapshot:r};return x.queue=E,u0(Xv.bind(null,c,E,n),[n]),c.flags|=2048,za(9,{destroy:void 0},Yv.bind(null,c,E,a,r),null),a},useId:function(){var n=Jn(),r=It.identifierPrefix;if(ut){var a=fr,c=dr;a=(c&~(1<<32-pt(c)-1)).toString(32)+a,r="_"+r+"R_"+a,a=su++,0<a&&(r+="H"+a.toString(32)),r+="_"}else a=W5++,r="_"+r+"r_"+a.toString(32)+"_";return n.memoizedState=r},useHostTransitionStatus:wf,useFormState:s0,useActionState:s0,useOptimistic:function(n){var r=Jn();r.memoizedState=r.baseState=n;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=a,r=Cf.bind(null,Ze,!0,a),a.dispatch=r,[n,r]},useMemoCache:pf,useCacheRefresh:function(){return Jn().memoizedState=X5.bind(null,Ze)},useEffectEvent:function(n){var r=Jn(),a={impl:n};return r.memoizedState=a,function(){if((St&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}},Ef={readContext:Dn,use:ou,useCallback:g0,useContext:Dn,useEffect:bf,useImperativeHandle:m0,useInsertionEffect:d0,useLayoutEffect:f0,useMemo:_0,useReducer:lu,useRef:c0,useState:function(){return lu(Rr)},useDebugValue:yf,useDeferredValue:function(n,r){var a=fn();return v0(a,At.memoizedState,n,r)},useTransition:function(){var n=lu(Rr)[0],r=fn().memoizedState;return[typeof n=="boolean"?n:ol(n),r]},useSyncExternalStore:Kv,useId:x0,useHostTransitionStatus:wf,useFormState:a0,useActionState:a0,useOptimistic:function(n,r){var a=fn();return Qv(a,At,n,r)},useMemoCache:pf,useCacheRefresh:w0};Ef.useEffectEvent=h0;var A0={readContext:Dn,use:ou,useCallback:g0,useContext:Dn,useEffect:bf,useImperativeHandle:m0,useInsertionEffect:d0,useLayoutEffect:f0,useMemo:_0,useReducer:gf,useRef:c0,useState:function(){return gf(Rr)},useDebugValue:yf,useDeferredValue:function(n,r){var a=fn();return At===null?Sf(a,n,r):v0(a,At.memoizedState,n,r)},useTransition:function(){var n=gf(Rr)[0],r=fn().memoizedState;return[typeof n=="boolean"?n:ol(n),r]},useSyncExternalStore:Kv,useId:x0,useHostTransitionStatus:wf,useFormState:l0,useActionState:l0,useOptimistic:function(n,r){var a=fn();return At!==null?Qv(a,At,n,r):(a.baseState=n,[n,a.queue.dispatch])},useMemoCache:pf,useCacheRefresh:w0};A0.useEffectEvent=h0;function kf(n,r,a,c){r=n.memoizedState,a=a(c,r),a=a==null?r:m({},r,a),n.memoizedState=a,n.lanes===0&&(n.updateQueue.baseState=a)}var Tf={enqueueSetState:function(n,r,a){n=n._reactInternals;var c=Ri(),x=is(c);x.payload=r,a!=null&&(x.callback=a),r=rs(n,x,c),r!==null&&(fi(r,n,c),il(r,n,c))},enqueueReplaceState:function(n,r,a){n=n._reactInternals;var c=Ri(),x=is(c);x.tag=1,x.payload=r,a!=null&&(x.callback=a),r=rs(n,x,c),r!==null&&(fi(r,n,c),il(r,n,c))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var a=Ri(),c=is(a);c.tag=2,r!=null&&(c.callback=r),r=rs(n,c,a),r!==null&&(fi(r,n,a),il(r,n,a))}};function R0(n,r,a,c,x,E,O){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(c,E,O):r.prototype&&r.prototype.isPureReactComponent?!Yo(a,c)||!Yo(x,E):!0}function L0(n,r,a,c){n=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,c),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,c),r.state!==n&&Tf.enqueueReplaceState(r,r.state,null)}function Ys(n,r){var a=r;if("ref"in r){a={};for(var c in r)c!=="ref"&&(a[c]=r[c])}if(n=n.defaultProps){a===r&&(a=m({},a));for(var x in n)a[x]===void 0&&(a[x]=n[x])}return a}function M0(n){Fc(n)}function N0(n){console.error(n)}function O0(n){Fc(n)}function du(n,r){try{var a=n.onUncaughtError;a(r.value,{componentStack:r.stack})}catch(c){setTimeout(function(){throw c})}}function D0(n,r,a){try{var c=n.onCaughtError;c(a.value,{componentStack:a.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function Af(n,r,a){return a=is(a),a.tag=3,a.payload={element:null},a.callback=function(){du(n,r)},a}function j0(n){return n=is(n),n.tag=3,n}function I0(n,r,a,c){var x=a.type.getDerivedStateFromError;if(typeof x=="function"){var E=c.value;n.payload=function(){return x(E)},n.callback=function(){D0(r,a,c)}}var O=a.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(n.callback=function(){D0(r,a,c),typeof x!="function"&&(us===null?us=new Set([this]):us.add(this));var $=c.stack;this.componentDidCatch(c.value,{componentStack:$!==null?$:""})})}function J5(n,r,a,c,x){if(a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(r=a.alternate,r!==null&&Ma(r,a,x,!0),a=Ei.current,a!==null){switch(a.tag){case 31:case 13:return Ui===null?Cu():a.alternate===null&&an===0&&(an=3),a.flags&=-257,a.flags|=65536,a.lanes=x,c===Qc?a.flags|=16384:(r=a.updateQueue,r===null?a.updateQueue=new Set([c]):r.add(c),Qf(n,c,x)),!1;case 22:return a.flags|=65536,c===Qc?a.flags|=16384:(r=a.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([c])},a.updateQueue=r):(a=r.retryQueue,a===null?r.retryQueue=new Set([c]):a.add(c)),Qf(n,c,x)),!1}throw Error(s(435,a.tag))}return Qf(n,c,x),Cu(),!1}if(ut)return r=Ei.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=x,c!==qd&&(n=Error(s(422),{cause:c}),Jo(Pi(n,a)))):(c!==qd&&(r=Error(s(423),{cause:c}),Jo(Pi(r,a))),n=n.current.alternate,n.flags|=65536,x&=-x,n.lanes|=x,c=Pi(c,a),x=Af(n.stateNode,c,x),rf(n,x),an!==4&&(an=2)),!1;var E=Error(s(520),{cause:c});if(E=Pi(E,a),_l===null?_l=[E]:_l.push(E),an!==4&&(an=2),r===null)return!0;c=Pi(c,a),a=r;do{switch(a.tag){case 3:return a.flags|=65536,n=x&-x,a.lanes|=n,n=Af(a.stateNode,c,n),rf(a,n),!1;case 1:if(r=a.type,E=a.stateNode,(a.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(us===null||!us.has(E))))return a.flags|=65536,x&=-x,a.lanes|=x,x=j0(x),I0(x,n,a,c),rf(a,x),!1}a=a.return}while(a!==null);return!1}var Rf=Error(s(461)),vn=!1;function jn(n,r,a,c){r.child=n===null?Hv(r,null,a,c):Ks(r,n.child,a,c)}function B0(n,r,a,c,x){a=a.render;var E=r.ref;if("ref"in c){var O={};for(var $ in c)$!=="ref"&&(O[$]=c[$])}else O=c;return Fs(r),c=uf(n,r,a,O,E,x),$=hf(),n!==null&&!vn?(df(n,r,x),Lr(n,r,x)):(ut&&$&&Wd(r),r.flags|=1,jn(n,r,c,x),r.child)}function P0(n,r,a,c,x){if(n===null){var E=a.type;return typeof E=="function"&&!$d(E)&&E.defaultProps===void 0&&a.compare===null?(r.tag=15,r.type=E,z0(n,r,E,c,x)):(n=Kc(a.type,null,c,r,r.mode,x),n.ref=r.ref,n.return=r,r.child=n)}if(E=n.child,!Bf(n,x)){var O=E.memoizedProps;if(a=a.compare,a=a!==null?a:Yo,a(O,c)&&n.ref===r.ref)return Lr(n,r,x)}return r.flags|=1,n=Cr(E,c),n.ref=r.ref,n.return=r,r.child=n}function z0(n,r,a,c,x){if(n!==null){var E=n.memoizedProps;if(Yo(E,c)&&n.ref===r.ref)if(vn=!1,r.pendingProps=c=E,Bf(n,x))(n.flags&131072)!==0&&(vn=!0);else return r.lanes=n.lanes,Lr(n,r,x)}return Lf(n,r,a,c,x)}function H0(n,r,a,c){var x=c.children,E=n!==null?n.memoizedState:null;if(n===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((r.flags&128)!==0){if(E=E!==null?E.baseLanes|a:a,n!==null){for(c=r.child=n.child,x=0;c!==null;)x=x|c.lanes|c.childLanes,c=c.sibling;c=x&~E}else c=0,r.child=null;return $0(n,r,E,a,c)}if((a&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},n!==null&&Zc(r,E!==null?E.cachePool:null),E!==null?Fv(r,E):af(),Wv(r);else return c=r.lanes=536870912,$0(n,r,E!==null?E.baseLanes|a:a,a,c)}else E!==null?(Zc(r,E.cachePool),Fv(r,E),as(),r.memoizedState=null):(n!==null&&Zc(r,null),af(),as());return jn(n,r,x,a),r.child}function ul(n,r){return n!==null&&n.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function $0(n,r,a,c,x){var E=Qd();return E=E===null?null:{parent:gn._currentValue,pool:E},r.memoizedState={baseLanes:a,cachePool:E},n!==null&&Zc(r,null),af(),Wv(r),n!==null&&Ma(n,r,c,!0),r.childLanes=x,null}function fu(n,r){return r=mu({mode:r.mode,children:r.children},n.mode),r.ref=n.ref,n.child=r,r.return=n,r}function U0(n,r,a){return Ks(r,n.child,null,a),n=fu(r,r.pendingProps),n.flags|=2,ki(r),r.memoizedState=null,n}function Q5(n,r,a){var c=r.pendingProps,x=(r.flags&128)!==0;if(r.flags&=-129,n===null){if(ut){if(c.mode==="hidden")return n=fu(r,c),r.lanes=536870912,ul(null,n);if(lf(r),(n=$t)?(n=ey(n,$i),n=n!==null&&n.data==="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:Jr!==null?{id:dr,overflow:fr}:null,retryLane:536870912,hydrationErrors:null},a=Ev(n),a.return=r,r.child=a,On=r,$t=null)):n=null,n===null)throw es(r);return r.lanes=536870912,null}return fu(r,c)}var E=n.memoizedState;if(E!==null){var O=E.dehydrated;if(lf(r),x)if(r.flags&256)r.flags&=-257,r=U0(n,r,a);else if(r.memoizedState!==null)r.child=n.child,r.flags|=128,r=null;else throw Error(s(558));else if(vn||Ma(n,r,a,!1),x=(a&n.childLanes)!==0,vn||x){if(c=It,c!==null&&(O=Pt(c,a),O!==0&&O!==E.retryLane))throw E.retryLane=O,zs(n,O),fi(c,n,O),Rf;Cu(),r=U0(n,r,a)}else n=E.treeContext,$t=Fi(O.nextSibling),On=r,ut=!0,Qr=null,$i=!1,n!==null&&Av(r,n),r=fu(r,c),r.flags|=4096;return r}return n=Cr(n.child,{mode:c.mode,children:c.children}),n.ref=r.ref,r.child=n,n.return=r,n}function pu(n,r){var a=r.ref;if(a===null)n!==null&&n.ref!==null&&(r.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(n===null||n.ref!==a)&&(r.flags|=4194816)}}function Lf(n,r,a,c,x){return Fs(r),a=uf(n,r,a,c,void 0,x),c=hf(),n!==null&&!vn?(df(n,r,x),Lr(n,r,x)):(ut&&c&&Wd(r),r.flags|=1,jn(n,r,a,x),r.child)}function F0(n,r,a,c,x,E){return Fs(r),r.updateQueue=null,a=qv(r,c,a,x),Gv(n),c=hf(),n!==null&&!vn?(df(n,r,E),Lr(n,r,E)):(ut&&c&&Wd(r),r.flags|=1,jn(n,r,a,E),r.child)}function W0(n,r,a,c,x){if(Fs(r),r.stateNode===null){var E=Ta,O=a.contextType;typeof O=="object"&&O!==null&&(E=Dn(O)),E=new a(c,E),r.memoizedState=E.state!==null&&E.state!==void 0?E.state:null,E.updater=Tf,r.stateNode=E,E._reactInternals=r,E=r.stateNode,E.props=c,E.state=r.memoizedState,E.refs={},tf(r),O=a.contextType,E.context=typeof O=="object"&&O!==null?Dn(O):Ta,E.state=r.memoizedState,O=a.getDerivedStateFromProps,typeof O=="function"&&(kf(r,a,O,c),E.state=r.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof E.getSnapshotBeforeUpdate=="function"||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(O=E.state,typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount(),O!==E.state&&Tf.enqueueReplaceState(E,E.state,null),sl(r,c,E,x),rl(),E.state=r.memoizedState),typeof E.componentDidMount=="function"&&(r.flags|=4194308),c=!0}else if(n===null){E=r.stateNode;var $=r.memoizedProps,Q=Ys(a,$);E.props=Q;var ce=E.context,me=a.contextType;O=Ta,typeof me=="object"&&me!==null&&(O=Dn(me));var ye=a.getDerivedStateFromProps;me=typeof ye=="function"||typeof E.getSnapshotBeforeUpdate=="function",$=r.pendingProps!==$,me||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||($||ce!==O)&&L0(r,E,c,O),ns=!1;var ue=r.memoizedState;E.state=ue,sl(r,c,E,x),rl(),ce=r.memoizedState,$||ue!==ce||ns?(typeof ye=="function"&&(kf(r,a,ye,c),ce=r.memoizedState),(Q=ns||R0(r,a,Q,c,ue,ce,O))?(me||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(r.flags|=4194308)):(typeof E.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=c,r.memoizedState=ce),E.props=c,E.state=ce,E.context=O,c=Q):(typeof E.componentDidMount=="function"&&(r.flags|=4194308),c=!1)}else{E=r.stateNode,nf(n,r),O=r.memoizedProps,me=Ys(a,O),E.props=me,ye=r.pendingProps,ue=E.context,ce=a.contextType,Q=Ta,typeof ce=="object"&&ce!==null&&(Q=Dn(ce)),$=a.getDerivedStateFromProps,(ce=typeof $=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(O!==ye||ue!==Q)&&L0(r,E,c,Q),ns=!1,ue=r.memoizedState,E.state=ue,sl(r,c,E,x),rl();var fe=r.memoizedState;O!==ye||ue!==fe||ns||n!==null&&n.dependencies!==null&&Yc(n.dependencies)?(typeof $=="function"&&(kf(r,a,$,c),fe=r.memoizedState),(me=ns||R0(r,a,me,c,ue,fe,Q)||n!==null&&n.dependencies!==null&&Yc(n.dependencies))?(ce||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(c,fe,Q),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(c,fe,Q)),typeof E.componentDidUpdate=="function"&&(r.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof E.componentDidUpdate!="function"||O===n.memoizedProps&&ue===n.memoizedState||(r.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&ue===n.memoizedState||(r.flags|=1024),r.memoizedProps=c,r.memoizedState=fe),E.props=c,E.state=fe,E.context=Q,c=me):(typeof E.componentDidUpdate!="function"||O===n.memoizedProps&&ue===n.memoizedState||(r.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||O===n.memoizedProps&&ue===n.memoizedState||(r.flags|=1024),c=!1)}return E=c,pu(n,r),c=(r.flags&128)!==0,E||c?(E=r.stateNode,a=c&&typeof a.getDerivedStateFromError!="function"?null:E.render(),r.flags|=1,n!==null&&c?(r.child=Ks(r,n.child,null,x),r.child=Ks(r,null,a,x)):jn(n,r,a,x),r.memoizedState=E.state,n=r.child):n=Lr(n,r,x),n}function G0(n,r,a,c){return $s(),r.flags|=256,jn(n,r,a,c),r.child}var Mf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Nf(n){return{baseLanes:n,cachePool:Dv()}}function Of(n,r,a){return n=n!==null?n.childLanes&~a:0,r&&(n|=Ai),n}function q0(n,r,a){var c=r.pendingProps,x=!1,E=(r.flags&128)!==0,O;if((O=E)||(O=n!==null&&n.memoizedState===null?!1:(dn.current&2)!==0),O&&(x=!0,r.flags&=-129),O=(r.flags&32)!==0,r.flags&=-33,n===null){if(ut){if(x?ss(r):as(),(n=$t)?(n=ey(n,$i),n=n!==null&&n.data!=="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:Jr!==null?{id:dr,overflow:fr}:null,retryLane:536870912,hydrationErrors:null},a=Ev(n),a.return=r,r.child=a,On=r,$t=null)):n=null,n===null)throw es(r);return mp(n)?r.lanes=32:r.lanes=536870912,null}var $=c.children;return c=c.fallback,x?(as(),x=r.mode,$=mu({mode:"hidden",children:$},x),c=Hs(c,x,a,null),$.return=r,c.return=r,$.sibling=c,r.child=$,c=r.child,c.memoizedState=Nf(a),c.childLanes=Of(n,O,a),r.memoizedState=Mf,ul(null,c)):(ss(r),Df(r,$))}var Q=n.memoizedState;if(Q!==null&&($=Q.dehydrated,$!==null)){if(E)r.flags&256?(ss(r),r.flags&=-257,r=jf(n,r,a)):r.memoizedState!==null?(as(),r.child=n.child,r.flags|=128,r=null):(as(),$=c.fallback,x=r.mode,c=mu({mode:"visible",children:c.children},x),$=Hs($,x,a,null),$.flags|=2,c.return=r,$.return=r,c.sibling=$,r.child=c,Ks(r,n.child,null,a),c=r.child,c.memoizedState=Nf(a),c.childLanes=Of(n,O,a),r.memoizedState=Mf,r=ul(null,c));else if(ss(r),mp($)){if(O=$.nextSibling&&$.nextSibling.dataset,O)var ce=O.dgst;O=ce,c=Error(s(419)),c.stack="",c.digest=O,Jo({value:c,source:null,stack:null}),r=jf(n,r,a)}else if(vn||Ma(n,r,a,!1),O=(a&n.childLanes)!==0,vn||O){if(O=It,O!==null&&(c=Pt(O,a),c!==0&&c!==Q.retryLane))throw Q.retryLane=c,zs(n,c),fi(O,n,c),Rf;pp($)||Cu(),r=jf(n,r,a)}else pp($)?(r.flags|=192,r.child=n.child,r=null):(n=Q.treeContext,$t=Fi($.nextSibling),On=r,ut=!0,Qr=null,$i=!1,n!==null&&Av(r,n),r=Df(r,c.children),r.flags|=4096);return r}return x?(as(),$=c.fallback,x=r.mode,Q=n.child,ce=Q.sibling,c=Cr(Q,{mode:"hidden",children:c.children}),c.subtreeFlags=Q.subtreeFlags&65011712,ce!==null?$=Cr(ce,$):($=Hs($,x,a,null),$.flags|=2),$.return=r,c.return=r,c.sibling=$,r.child=c,ul(null,c),c=r.child,$=n.child.memoizedState,$===null?$=Nf(a):(x=$.cachePool,x!==null?(Q=gn._currentValue,x=x.parent!==Q?{parent:Q,pool:Q}:x):x=Dv(),$={baseLanes:$.baseLanes|a,cachePool:x}),c.memoizedState=$,c.childLanes=Of(n,O,a),r.memoizedState=Mf,ul(n.child,c)):(ss(r),a=n.child,n=a.sibling,a=Cr(a,{mode:"visible",children:c.children}),a.return=r,a.sibling=null,n!==null&&(O=r.deletions,O===null?(r.deletions=[n],r.flags|=16):O.push(n)),r.child=a,r.memoizedState=null,a)}function Df(n,r){return r=mu({mode:"visible",children:r},n.mode),r.return=n,n.child=r}function mu(n,r){return n=Ci(22,n,null,r),n.lanes=0,n}function jf(n,r,a){return Ks(r,n.child,null,a),n=Df(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function K0(n,r,a){n.lanes|=r;var c=n.alternate;c!==null&&(c.lanes|=r),Yd(n.return,r,a)}function If(n,r,a,c,x,E){var O=n.memoizedState;O===null?n.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:x,treeForkCount:E}:(O.isBackwards=r,O.rendering=null,O.renderingStartTime=0,O.last=c,O.tail=a,O.tailMode=x,O.treeForkCount=E)}function V0(n,r,a){var c=r.pendingProps,x=c.revealOrder,E=c.tail;c=c.children;var O=dn.current,$=(O&2)!==0;if($?(O=O&1|2,r.flags|=128):O&=1,V(dn,O),jn(n,r,c,a),c=ut?Zo:0,!$&&n!==null&&(n.flags&128)!==0)e:for(n=r.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&K0(n,a,r);else if(n.tag===19)K0(n,a,r);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===r)break e;for(;n.sibling===null;){if(n.return===null||n.return===r)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(x){case"forwards":for(a=r.child,x=null;a!==null;)n=a.alternate,n!==null&&iu(n)===null&&(x=a),a=a.sibling;a=x,a===null?(x=r.child,r.child=null):(x=a.sibling,a.sibling=null),If(r,!1,x,a,E,c);break;case"backwards":case"unstable_legacy-backwards":for(a=null,x=r.child,r.child=null;x!==null;){if(n=x.alternate,n!==null&&iu(n)===null){r.child=x;break}n=x.sibling,x.sibling=a,a=x,x=n}If(r,!0,a,null,E,c);break;case"together":If(r,!1,null,null,void 0,c);break;default:r.memoizedState=null}return r.child}function Lr(n,r,a){if(n!==null&&(r.dependencies=n.dependencies),cs|=r.lanes,(a&r.childLanes)===0)if(n!==null){if(Ma(n,r,a,!1),(a&r.childLanes)===0)return null}else return null;if(n!==null&&r.child!==n.child)throw Error(s(153));if(r.child!==null){for(n=r.child,a=Cr(n,n.pendingProps),r.child=a,a.return=r;n.sibling!==null;)n=n.sibling,a=a.sibling=Cr(n,n.pendingProps),a.return=r;a.sibling=null}return r.child}function Bf(n,r){return(n.lanes&r)!==0?!0:(n=n.dependencies,!!(n!==null&&Yc(n)))}function ek(n,r,a){switch(r.tag){case 3:F(r,r.stateNode.containerInfo),ts(r,gn,n.memoizedState.cache),$s();break;case 27:case 5:re(r);break;case 4:F(r,r.stateNode.containerInfo);break;case 10:ts(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,lf(r),null;break;case 13:var c=r.memoizedState;if(c!==null)return c.dehydrated!==null?(ss(r),r.flags|=128,null):(a&r.child.childLanes)!==0?q0(n,r,a):(ss(r),n=Lr(n,r,a),n!==null?n.sibling:null);ss(r);break;case 19:var x=(n.flags&128)!==0;if(c=(a&r.childLanes)!==0,c||(Ma(n,r,a,!1),c=(a&r.childLanes)!==0),x){if(c)return V0(n,r,a);r.flags|=128}if(x=r.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),V(dn,dn.current),c)break;return null;case 22:return r.lanes=0,H0(n,r,a,r.pendingProps);case 24:ts(r,gn,n.memoizedState.cache)}return Lr(n,r,a)}function Y0(n,r,a){if(n!==null)if(n.memoizedProps!==r.pendingProps)vn=!0;else{if(!Bf(n,a)&&(r.flags&128)===0)return vn=!1,ek(n,r,a);vn=(n.flags&131072)!==0}else vn=!1,ut&&(r.flags&1048576)!==0&&Tv(r,Zo,r.index);switch(r.lanes=0,r.tag){case 16:e:{var c=r.pendingProps;if(n=Gs(r.elementType),r.type=n,typeof n=="function")$d(n)?(c=Ys(n,c),r.tag=1,r=W0(null,r,n,c,a)):(r.tag=0,r=Lf(null,r,n,c,a));else{if(n!=null){var x=n.$$typeof;if(x===k){r.tag=11,r=B0(null,r,n,c,a);break e}else if(x===N){r.tag=14,r=P0(null,r,n,c,a);break e}}throw r=K(n)||n,Error(s(306,r,""))}}return r;case 0:return Lf(n,r,r.type,r.pendingProps,a);case 1:return c=r.type,x=Ys(c,r.pendingProps),W0(n,r,c,x,a);case 3:e:{if(F(r,r.stateNode.containerInfo),n===null)throw Error(s(387));c=r.pendingProps;var E=r.memoizedState;x=E.element,nf(n,r),sl(r,c,null,a);var O=r.memoizedState;if(c=O.cache,ts(r,gn,c),c!==E.cache&&Xd(r,[gn],a,!0),rl(),c=O.element,E.isDehydrated)if(E={element:c,isDehydrated:!1,cache:O.cache},r.updateQueue.baseState=E,r.memoizedState=E,r.flags&256){r=G0(n,r,c,a);break e}else if(c!==x){x=Pi(Error(s(424)),r),Jo(x),r=G0(n,r,c,a);break e}else for(n=r.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,$t=Fi(n.firstChild),On=r,ut=!0,Qr=null,$i=!0,a=Hv(r,null,c,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if($s(),c===x){r=Lr(n,r,a);break e}jn(n,r,c,a)}r=r.child}return r;case 26:return pu(n,r),n===null?(a=ay(r.type,null,r.pendingProps,null))?r.memoizedState=a:ut||(a=r.type,n=r.pendingProps,c=Mu(pe.current).createElement(a),c[We]=r,c[Xe]=n,In(c,a,n),tt(c),r.stateNode=c):r.memoizedState=ay(r.type,n.memoizedProps,r.pendingProps,n.memoizedState),null;case 27:return re(r),n===null&&ut&&(c=r.stateNode=iy(r.type,r.pendingProps,pe.current),On=r,$i=!0,x=$t,ps(r.type)?(gp=x,$t=Fi(c.firstChild)):$t=x),jn(n,r,r.pendingProps.children,a),pu(n,r),n===null&&(r.flags|=4194304),r.child;case 5:return n===null&&ut&&((x=c=$t)&&(c=Lk(c,r.type,r.pendingProps,$i),c!==null?(r.stateNode=c,On=r,$t=Fi(c.firstChild),$i=!1,x=!0):x=!1),x||es(r)),re(r),x=r.type,E=r.pendingProps,O=n!==null?n.memoizedProps:null,c=E.children,hp(x,E)?c=null:O!==null&&hp(x,O)&&(r.flags|=32),r.memoizedState!==null&&(x=uf(n,r,G5,null,null,a),El._currentValue=x),pu(n,r),jn(n,r,c,a),r.child;case 6:return n===null&&ut&&((n=a=$t)&&(a=Mk(a,r.pendingProps,$i),a!==null?(r.stateNode=a,On=r,$t=null,n=!0):n=!1),n||es(r)),null;case 13:return q0(n,r,a);case 4:return F(r,r.stateNode.containerInfo),c=r.pendingProps,n===null?r.child=Ks(r,null,c,a):jn(n,r,c,a),r.child;case 11:return B0(n,r,r.type,r.pendingProps,a);case 7:return jn(n,r,r.pendingProps,a),r.child;case 8:return jn(n,r,r.pendingProps.children,a),r.child;case 12:return jn(n,r,r.pendingProps.children,a),r.child;case 10:return c=r.pendingProps,ts(r,r.type,c.value),jn(n,r,c.children,a),r.child;case 9:return x=r.type._context,c=r.pendingProps.children,Fs(r),x=Dn(x),c=c(x),r.flags|=1,jn(n,r,c,a),r.child;case 14:return P0(n,r,r.type,r.pendingProps,a);case 15:return z0(n,r,r.type,r.pendingProps,a);case 19:return V0(n,r,a);case 31:return Q5(n,r,a);case 22:return H0(n,r,a,r.pendingProps);case 24:return Fs(r),c=Dn(gn),n===null?(x=Qd(),x===null&&(x=It,E=Zd(),x.pooledCache=E,E.refCount++,E!==null&&(x.pooledCacheLanes|=a),x=E),r.memoizedState={parent:c,cache:x},tf(r),ts(r,gn,x)):((n.lanes&a)!==0&&(nf(n,r),sl(r,null,null,a),rl()),x=n.memoizedState,E=r.memoizedState,x.parent!==c?(x={parent:c,cache:c},r.memoizedState=x,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=x),ts(r,gn,c)):(c=E.cache,ts(r,gn,c),c!==x.cache&&Xd(r,[gn],a,!0))),jn(n,r,r.pendingProps.children,a),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function Mr(n){n.flags|=4}function Pf(n,r,a,c,x){if((r=(n.mode&32)!==0)&&(r=!1),r){if(n.flags|=16777216,(x&335544128)===x)if(n.stateNode.complete)n.flags|=8192;else if(xb())n.flags|=8192;else throw qs=Qc,ef}else n.flags&=-16777217}function X0(n,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!hy(r))if(xb())n.flags|=8192;else throw qs=Qc,ef}function gu(n,r){r!==null&&(n.flags|=4),n.flags&16384&&(r=n.tag!==22?Pe():536870912,n.lanes|=r,Fa|=r)}function hl(n,r){if(!ut)switch(n.tailMode){case"hidden":r=n.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?n.tail=null:a.sibling=null;break;case"collapsed":a=n.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?r||n.tail===null?n.tail=null:n.tail.sibling=null:c.sibling=null}}function Ut(n){var r=n.alternate!==null&&n.alternate.child===n.child,a=0,c=0;if(r)for(var x=n.child;x!==null;)a|=x.lanes|x.childLanes,c|=x.subtreeFlags&65011712,c|=x.flags&65011712,x.return=n,x=x.sibling;else for(x=n.child;x!==null;)a|=x.lanes|x.childLanes,c|=x.subtreeFlags,c|=x.flags,x.return=n,x=x.sibling;return n.subtreeFlags|=c,n.childLanes=a,r}function tk(n,r,a){var c=r.pendingProps;switch(Gd(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ut(r),null;case 1:return Ut(r),null;case 3:return a=r.stateNode,c=null,n!==null&&(c=n.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),Tr(gn),ae(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(n===null||n.child===null)&&(La(r)?Mr(r):n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Kd())),Ut(r),null;case 26:var x=r.type,E=r.memoizedState;return n===null?(Mr(r),E!==null?(Ut(r),X0(r,E)):(Ut(r),Pf(r,x,null,c,a))):E?E!==n.memoizedState?(Mr(r),Ut(r),X0(r,E)):(Ut(r),r.flags&=-16777217):(n=n.memoizedProps,n!==c&&Mr(r),Ut(r),Pf(r,x,n,c,a)),null;case 27:if(ge(r),a=pe.current,x=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==c&&Mr(r);else{if(!c){if(r.stateNode===null)throw Error(s(166));return Ut(r),null}n=J.current,La(r)?Rv(r):(n=iy(x,c,a),r.stateNode=n,Mr(r))}return Ut(r),null;case 5:if(ge(r),x=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==c&&Mr(r);else{if(!c){if(r.stateNode===null)throw Error(s(166));return Ut(r),null}if(E=J.current,La(r))Rv(r);else{var O=Mu(pe.current);switch(E){case 1:E=O.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:E=O.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":E=O.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":E=O.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":E=O.createElement("div"),E.innerHTML="<script><\/script>",E=E.removeChild(E.firstChild);break;case"select":E=typeof c.is=="string"?O.createElement("select",{is:c.is}):O.createElement("select"),c.multiple?E.multiple=!0:c.size&&(E.size=c.size);break;default:E=typeof c.is=="string"?O.createElement(x,{is:c.is}):O.createElement(x)}}E[We]=r,E[Xe]=c;e:for(O=r.child;O!==null;){if(O.tag===5||O.tag===6)E.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===r)break e;for(;O.sibling===null;){if(O.return===null||O.return===r)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}r.stateNode=E;e:switch(In(E,x,c),x){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Mr(r)}}return Ut(r),Pf(r,r.type,n===null?null:n.memoizedProps,r.pendingProps,a),null;case 6:if(n&&r.stateNode!=null)n.memoizedProps!==c&&Mr(r);else{if(typeof c!="string"&&r.stateNode===null)throw Error(s(166));if(n=pe.current,La(r)){if(n=r.stateNode,a=r.memoizedProps,c=null,x=On,x!==null)switch(x.tag){case 27:case 5:c=x.memoizedProps}n[We]=r,n=!!(n.nodeValue===a||c!==null&&c.suppressHydrationWarning===!0||qb(n.nodeValue,a)),n||es(r,!0)}else n=Mu(n).createTextNode(c),n[We]=r,r.stateNode=n}return Ut(r),null;case 31:if(a=r.memoizedState,n===null||n.memoizedState!==null){if(c=La(r),a!==null){if(n===null){if(!c)throw Error(s(318));if(n=r.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(s(557));n[We]=r}else $s(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Ut(r),n=!1}else a=Kd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=a),n=!0;if(!n)return r.flags&256?(ki(r),r):(ki(r),null);if((r.flags&128)!==0)throw Error(s(558))}return Ut(r),null;case 13:if(c=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(x=La(r),c!==null&&c.dehydrated!==null){if(n===null){if(!x)throw Error(s(318));if(x=r.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(s(317));x[We]=r}else $s(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Ut(r),x=!1}else x=Kd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=x),x=!0;if(!x)return r.flags&256?(ki(r),r):(ki(r),null)}return ki(r),(r.flags&128)!==0?(r.lanes=a,r):(a=c!==null,n=n!==null&&n.memoizedState!==null,a&&(c=r.child,x=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(x=c.alternate.memoizedState.cachePool.pool),E=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(E=c.memoizedState.cachePool.pool),E!==x&&(c.flags|=2048)),a!==n&&a&&(r.child.flags|=8192),gu(r,r.updateQueue),Ut(r),null);case 4:return ae(),n===null&&ap(r.stateNode.containerInfo),Ut(r),null;case 10:return Tr(r.type),Ut(r),null;case 19:if(U(dn),c=r.memoizedState,c===null)return Ut(r),null;if(x=(r.flags&128)!==0,E=c.rendering,E===null)if(x)hl(c,!1);else{if(an!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(E=iu(n),E!==null){for(r.flags|=128,hl(c,!1),n=E.updateQueue,r.updateQueue=n,gu(r,n),r.subtreeFlags=0,n=a,a=r.child;a!==null;)Cv(a,n),a=a.sibling;return V(dn,dn.current&1|2),ut&&Er(r,c.treeForkCount),r.child}n=n.sibling}c.tail!==null&&ft()>Su&&(r.flags|=128,x=!0,hl(c,!1),r.lanes=4194304)}else{if(!x)if(n=iu(E),n!==null){if(r.flags|=128,x=!0,n=n.updateQueue,r.updateQueue=n,gu(r,n),hl(c,!0),c.tail===null&&c.tailMode==="hidden"&&!E.alternate&&!ut)return Ut(r),null}else 2*ft()-c.renderingStartTime>Su&&a!==536870912&&(r.flags|=128,x=!0,hl(c,!1),r.lanes=4194304);c.isBackwards?(E.sibling=r.child,r.child=E):(n=c.last,n!==null?n.sibling=E:r.child=E,c.last=E)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=ft(),n.sibling=null,a=dn.current,V(dn,x?a&1|2:a&1),ut&&Er(r,c.treeForkCount),n):(Ut(r),null);case 22:case 23:return ki(r),of(),c=r.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(r.flags|=8192):c&&(r.flags|=8192),c?(a&536870912)!==0&&(r.flags&128)===0&&(Ut(r),r.subtreeFlags&6&&(r.flags|=8192)):Ut(r),a=r.updateQueue,a!==null&&gu(r,a.retryQueue),a=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(a=n.memoizedState.cachePool.pool),c=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),c!==a&&(r.flags|=2048),n!==null&&U(Ws),null;case 24:return a=null,n!==null&&(a=n.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),Tr(gn),Ut(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function nk(n,r){switch(Gd(r),r.tag){case 1:return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return Tr(gn),ae(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 26:case 27:case 5:return ge(r),null;case 31:if(r.memoizedState!==null){if(ki(r),r.alternate===null)throw Error(s(340));$s()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 13:if(ki(r),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(s(340));$s()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return U(dn),null;case 4:return ae(),null;case 10:return Tr(r.type),null;case 22:case 23:return ki(r),of(),n!==null&&U(Ws),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 24:return Tr(gn),null;case 25:return null;default:return null}}function Z0(n,r){switch(Gd(r),r.tag){case 3:Tr(gn),ae();break;case 26:case 27:case 5:ge(r);break;case 4:ae();break;case 31:r.memoizedState!==null&&ki(r);break;case 13:ki(r);break;case 19:U(dn);break;case 10:Tr(r.type);break;case 22:case 23:ki(r),of(),n!==null&&U(Ws);break;case 24:Tr(gn)}}function dl(n,r){try{var a=r.updateQueue,c=a!==null?a.lastEffect:null;if(c!==null){var x=c.next;a=x;do{if((a.tag&n)===n){c=void 0;var E=a.create,O=a.inst;c=E(),O.destroy=c}a=a.next}while(a!==x)}}catch($){Tt(r,r.return,$)}}function os(n,r,a){try{var c=r.updateQueue,x=c!==null?c.lastEffect:null;if(x!==null){var E=x.next;c=E;do{if((c.tag&n)===n){var O=c.inst,$=O.destroy;if($!==void 0){O.destroy=void 0,x=r;var Q=a,ce=$;try{ce()}catch(me){Tt(x,Q,me)}}}c=c.next}while(c!==E)}}catch(me){Tt(r,r.return,me)}}function J0(n){var r=n.updateQueue;if(r!==null){var a=n.stateNode;try{Uv(r,a)}catch(c){Tt(n,n.return,c)}}}function Q0(n,r,a){a.props=Ys(n.type,n.memoizedProps),a.state=n.memoizedState;try{a.componentWillUnmount()}catch(c){Tt(n,r,c)}}function fl(n,r){try{var a=n.ref;if(a!==null){switch(n.tag){case 26:case 27:case 5:var c=n.stateNode;break;case 30:c=n.stateNode;break;default:c=n.stateNode}typeof a=="function"?n.refCleanup=a(c):a.current=c}}catch(x){Tt(n,r,x)}}function pr(n,r){var a=n.ref,c=n.refCleanup;if(a!==null)if(typeof c=="function")try{c()}catch(x){Tt(n,r,x)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(x){Tt(n,r,x)}else a.current=null}function eb(n){var r=n.type,a=n.memoizedProps,c=n.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":a.autoFocus&&c.focus();break e;case"img":a.src?c.src=a.src:a.srcSet&&(c.srcset=a.srcSet)}}catch(x){Tt(n,n.return,x)}}function zf(n,r,a){try{var c=n.stateNode;Ck(c,n.type,a,r),c[Xe]=r}catch(x){Tt(n,n.return,x)}}function tb(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&ps(n.type)||n.tag===4}function Hf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||tb(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&ps(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function $f(n,r,a){var c=n.tag;if(c===5||c===6)n=n.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(n,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(n),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=Ce));else if(c!==4&&(c===27&&ps(n.type)&&(a=n.stateNode,r=null),n=n.child,n!==null))for($f(n,r,a),n=n.sibling;n!==null;)$f(n,r,a),n=n.sibling}function _u(n,r,a){var c=n.tag;if(c===5||c===6)n=n.stateNode,r?a.insertBefore(n,r):a.appendChild(n);else if(c!==4&&(c===27&&ps(n.type)&&(a=n.stateNode),n=n.child,n!==null))for(_u(n,r,a),n=n.sibling;n!==null;)_u(n,r,a),n=n.sibling}function nb(n){var r=n.stateNode,a=n.memoizedProps;try{for(var c=n.type,x=r.attributes;x.length;)r.removeAttributeNode(x[0]);In(r,c,a),r[We]=n,r[Xe]=a}catch(E){Tt(n,n.return,E)}}var Nr=!1,bn=!1,Uf=!1,ib=typeof WeakSet=="function"?WeakSet:Set,Cn=null;function ik(n,r){if(n=n.containerInfo,cp=Pu,n=mv(n),Dd(n)){if("selectionStart"in n)var a={start:n.selectionStart,end:n.selectionEnd};else e:{a=(a=n.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var x=c.anchorOffset,E=c.focusNode;c=c.focusOffset;try{a.nodeType,E.nodeType}catch{a=null;break e}var O=0,$=-1,Q=-1,ce=0,me=0,ye=n,ue=null;t:for(;;){for(var fe;ye!==a||x!==0&&ye.nodeType!==3||($=O+x),ye!==E||c!==0&&ye.nodeType!==3||(Q=O+c),ye.nodeType===3&&(O+=ye.nodeValue.length),(fe=ye.firstChild)!==null;)ue=ye,ye=fe;for(;;){if(ye===n)break t;if(ue===a&&++ce===x&&($=O),ue===E&&++me===c&&(Q=O),(fe=ye.nextSibling)!==null)break;ye=ue,ue=ye.parentNode}ye=fe}a=$===-1||Q===-1?null:{start:$,end:Q}}else a=null}a=a||{start:0,end:0}}else a=null;for(up={focusedElem:n,selectionRange:a},Pu=!1,Cn=r;Cn!==null;)if(r=Cn,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,Cn=n;else for(;Cn!==null;){switch(r=Cn,E=r.alternate,n=r.flags,r.tag){case 0:if((n&4)!==0&&(n=r.updateQueue,n=n!==null?n.events:null,n!==null))for(a=0;a<n.length;a++)x=n[a],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&E!==null){n=void 0,a=r,x=E.memoizedProps,E=E.memoizedState,c=a.stateNode;try{var Me=Ys(a.type,x);n=c.getSnapshotBeforeUpdate(Me,E),c.__reactInternalSnapshotBeforeUpdate=n}catch(Ue){Tt(a,a.return,Ue)}}break;case 3:if((n&1024)!==0){if(n=r.stateNode.containerInfo,a=n.nodeType,a===9)fp(n);else if(a===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":fp(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(s(163))}if(n=r.sibling,n!==null){n.return=r.return,Cn=n;break}Cn=r.return}}function rb(n,r,a){var c=a.flags;switch(a.tag){case 0:case 11:case 15:Dr(n,a),c&4&&dl(5,a);break;case 1:if(Dr(n,a),c&4)if(n=a.stateNode,r===null)try{n.componentDidMount()}catch(O){Tt(a,a.return,O)}else{var x=Ys(a.type,r.memoizedProps);r=r.memoizedState;try{n.componentDidUpdate(x,r,n.__reactInternalSnapshotBeforeUpdate)}catch(O){Tt(a,a.return,O)}}c&64&&J0(a),c&512&&fl(a,a.return);break;case 3:if(Dr(n,a),c&64&&(n=a.updateQueue,n!==null)){if(r=null,a.child!==null)switch(a.child.tag){case 27:case 5:r=a.child.stateNode;break;case 1:r=a.child.stateNode}try{Uv(n,r)}catch(O){Tt(a,a.return,O)}}break;case 27:r===null&&c&4&&nb(a);case 26:case 5:Dr(n,a),r===null&&c&4&&eb(a),c&512&&fl(a,a.return);break;case 12:Dr(n,a);break;case 31:Dr(n,a),c&4&&ob(n,a);break;case 13:Dr(n,a),c&4&&lb(n,a),c&64&&(n=a.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(a=dk.bind(null,a),Nk(n,a))));break;case 22:if(c=a.memoizedState!==null||Nr,!c){r=r!==null&&r.memoizedState!==null||bn,x=Nr;var E=bn;Nr=c,(bn=r)&&!E?jr(n,a,(a.subtreeFlags&8772)!==0):Dr(n,a),Nr=x,bn=E}break;case 30:break;default:Dr(n,a)}}function sb(n){var r=n.alternate;r!==null&&(n.alternate=null,sb(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&Re(r)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Vt=null,ci=!1;function Or(n,r,a){for(a=a.child;a!==null;)ab(n,r,a),a=a.sibling}function ab(n,r,a){if(Ot&&typeof Ot.onCommitFiberUnmount=="function")try{Ot.onCommitFiberUnmount(hn,a)}catch{}switch(a.tag){case 26:bn||pr(a,r),Or(n,r,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:bn||pr(a,r);var c=Vt,x=ci;ps(a.type)&&(Vt=a.stateNode,ci=!1),Or(n,r,a),xl(a.stateNode),Vt=c,ci=x;break;case 5:bn||pr(a,r);case 6:if(c=Vt,x=ci,Vt=null,Or(n,r,a),Vt=c,ci=x,Vt!==null)if(ci)try{(Vt.nodeType===9?Vt.body:Vt.nodeName==="HTML"?Vt.ownerDocument.body:Vt).removeChild(a.stateNode)}catch(E){Tt(a,r,E)}else try{Vt.removeChild(a.stateNode)}catch(E){Tt(a,r,E)}break;case 18:Vt!==null&&(ci?(n=Vt,Jb(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,a.stateNode),Za(n)):Jb(Vt,a.stateNode));break;case 4:c=Vt,x=ci,Vt=a.stateNode.containerInfo,ci=!0,Or(n,r,a),Vt=c,ci=x;break;case 0:case 11:case 14:case 15:os(2,a,r),bn||os(4,a,r),Or(n,r,a);break;case 1:bn||(pr(a,r),c=a.stateNode,typeof c.componentWillUnmount=="function"&&Q0(a,r,c)),Or(n,r,a);break;case 21:Or(n,r,a);break;case 22:bn=(c=bn)||a.memoizedState!==null,Or(n,r,a),bn=c;break;default:Or(n,r,a)}}function ob(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Za(n)}catch(a){Tt(r,r.return,a)}}}function lb(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Za(n)}catch(a){Tt(r,r.return,a)}}function rk(n){switch(n.tag){case 31:case 13:case 19:var r=n.stateNode;return r===null&&(r=n.stateNode=new ib),r;case 22:return n=n.stateNode,r=n._retryCache,r===null&&(r=n._retryCache=new ib),r;default:throw Error(s(435,n.tag))}}function vu(n,r){var a=rk(n);r.forEach(function(c){if(!a.has(c)){a.add(c);var x=fk.bind(null,n,c);c.then(x,x)}})}function ui(n,r){var a=r.deletions;if(a!==null)for(var c=0;c<a.length;c++){var x=a[c],E=n,O=r,$=O;e:for(;$!==null;){switch($.tag){case 27:if(ps($.type)){Vt=$.stateNode,ci=!1;break e}break;case 5:Vt=$.stateNode,ci=!1;break e;case 3:case 4:Vt=$.stateNode.containerInfo,ci=!0;break e}$=$.return}if(Vt===null)throw Error(s(160));ab(E,O,x),Vt=null,ci=!1,E=x.alternate,E!==null&&(E.return=null),x.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)cb(r,n),r=r.sibling}var Ji=null;function cb(n,r){var a=n.alternate,c=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ui(r,n),hi(n),c&4&&(os(3,n,n.return),dl(3,n),os(5,n,n.return));break;case 1:ui(r,n),hi(n),c&512&&(bn||a===null||pr(a,a.return)),c&64&&Nr&&(n=n.updateQueue,n!==null&&(c=n.callbacks,c!==null&&(a=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=a===null?c:a.concat(c))));break;case 26:var x=Ji;if(ui(r,n),hi(n),c&512&&(bn||a===null||pr(a,a.return)),c&4){var E=a!==null?a.memoizedState:null;if(c=n.memoizedState,a===null)if(c===null)if(n.stateNode===null){e:{c=n.type,a=n.memoizedProps,x=x.ownerDocument||x;t:switch(c){case"title":E=x.getElementsByTagName("title")[0],(!E||E[Zn]||E[We]||E.namespaceURI==="http://www.w3.org/2000/svg"||E.hasAttribute("itemprop"))&&(E=x.createElement(c),x.head.insertBefore(E,x.querySelector("head > title"))),In(E,c,a),E[We]=n,tt(E),c=E;break e;case"link":var O=cy("link","href",x).get(c+(a.href||""));if(O){for(var $=0;$<O.length;$++)if(E=O[$],E.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&E.getAttribute("rel")===(a.rel==null?null:a.rel)&&E.getAttribute("title")===(a.title==null?null:a.title)&&E.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){O.splice($,1);break t}}E=x.createElement(c),In(E,c,a),x.head.appendChild(E);break;case"meta":if(O=cy("meta","content",x).get(c+(a.content||""))){for($=0;$<O.length;$++)if(E=O[$],E.getAttribute("content")===(a.content==null?null:""+a.content)&&E.getAttribute("name")===(a.name==null?null:a.name)&&E.getAttribute("property")===(a.property==null?null:a.property)&&E.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&E.getAttribute("charset")===(a.charSet==null?null:a.charSet)){O.splice($,1);break t}}E=x.createElement(c),In(E,c,a),x.head.appendChild(E);break;default:throw Error(s(468,c))}E[We]=n,tt(E),c=E}n.stateNode=c}else uy(x,n.type,n.stateNode);else n.stateNode=ly(x,c,n.memoizedProps);else E!==c?(E===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):E.count--,c===null?uy(x,n.type,n.stateNode):ly(x,c,n.memoizedProps)):c===null&&n.stateNode!==null&&zf(n,n.memoizedProps,a.memoizedProps)}break;case 27:ui(r,n),hi(n),c&512&&(bn||a===null||pr(a,a.return)),a!==null&&c&4&&zf(n,n.memoizedProps,a.memoizedProps);break;case 5:if(ui(r,n),hi(n),c&512&&(bn||a===null||pr(a,a.return)),n.flags&32){x=n.stateNode;try{Fe(x,"")}catch(Me){Tt(n,n.return,Me)}}c&4&&n.stateNode!=null&&(x=n.memoizedProps,zf(n,x,a!==null?a.memoizedProps:x)),c&1024&&(Uf=!0);break;case 6:if(ui(r,n),hi(n),c&4){if(n.stateNode===null)throw Error(s(162));c=n.memoizedProps,a=n.stateNode;try{a.nodeValue=c}catch(Me){Tt(n,n.return,Me)}}break;case 3:if(Du=null,x=Ji,Ji=Nu(r.containerInfo),ui(r,n),Ji=x,hi(n),c&4&&a!==null&&a.memoizedState.isDehydrated)try{Za(r.containerInfo)}catch(Me){Tt(n,n.return,Me)}Uf&&(Uf=!1,ub(n));break;case 4:c=Ji,Ji=Nu(n.stateNode.containerInfo),ui(r,n),hi(n),Ji=c;break;case 12:ui(r,n),hi(n);break;case 31:ui(r,n),hi(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,vu(n,c)));break;case 13:ui(r,n),hi(n),n.child.flags&8192&&n.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(yu=ft()),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,vu(n,c)));break;case 22:x=n.memoizedState!==null;var Q=a!==null&&a.memoizedState!==null,ce=Nr,me=bn;if(Nr=ce||x,bn=me||Q,ui(r,n),bn=me,Nr=ce,hi(n),c&8192)e:for(r=n.stateNode,r._visibility=x?r._visibility&-2:r._visibility|1,x&&(a===null||Q||Nr||bn||Xs(n)),a=null,r=n;;){if(r.tag===5||r.tag===26){if(a===null){Q=a=r;try{if(E=Q.stateNode,x)O=E.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{$=Q.stateNode;var ye=Q.memoizedProps.style,ue=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;$.style.display=ue==null||typeof ue=="boolean"?"":(""+ue).trim()}}catch(Me){Tt(Q,Q.return,Me)}}}else if(r.tag===6){if(a===null){Q=r;try{Q.stateNode.nodeValue=x?"":Q.memoizedProps}catch(Me){Tt(Q,Q.return,Me)}}}else if(r.tag===18){if(a===null){Q=r;try{var fe=Q.stateNode;x?Qb(fe,!0):Qb(Q.stateNode,!1)}catch(Me){Tt(Q,Q.return,Me)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===n)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break e;for(;r.sibling===null;){if(r.return===null||r.return===n)break e;a===r&&(a=null),r=r.return}a===r&&(a=null),r.sibling.return=r.return,r=r.sibling}c&4&&(c=n.updateQueue,c!==null&&(a=c.retryQueue,a!==null&&(c.retryQueue=null,vu(n,a))));break;case 19:ui(r,n),hi(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,vu(n,c)));break;case 30:break;case 21:break;default:ui(r,n),hi(n)}}function hi(n){var r=n.flags;if(r&2){try{for(var a,c=n.return;c!==null;){if(tb(c)){a=c;break}c=c.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var x=a.stateNode,E=Hf(n);_u(n,E,x);break;case 5:var O=a.stateNode;a.flags&32&&(Fe(O,""),a.flags&=-33);var $=Hf(n);_u(n,$,O);break;case 3:case 4:var Q=a.stateNode.containerInfo,ce=Hf(n);$f(n,ce,Q);break;default:throw Error(s(161))}}catch(me){Tt(n,n.return,me)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function ub(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var r=n;ub(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),n=n.sibling}}function Dr(n,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)rb(n,r.alternate,r),r=r.sibling}function Xs(n){for(n=n.child;n!==null;){var r=n;switch(r.tag){case 0:case 11:case 14:case 15:os(4,r,r.return),Xs(r);break;case 1:pr(r,r.return);var a=r.stateNode;typeof a.componentWillUnmount=="function"&&Q0(r,r.return,a),Xs(r);break;case 27:xl(r.stateNode);case 26:case 5:pr(r,r.return),Xs(r);break;case 22:r.memoizedState===null&&Xs(r);break;case 30:Xs(r);break;default:Xs(r)}n=n.sibling}}function jr(n,r,a){for(a=a&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var c=r.alternate,x=n,E=r,O=E.flags;switch(E.tag){case 0:case 11:case 15:jr(x,E,a),dl(4,E);break;case 1:if(jr(x,E,a),c=E,x=c.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(ce){Tt(c,c.return,ce)}if(c=E,x=c.updateQueue,x!==null){var $=c.stateNode;try{var Q=x.shared.hiddenCallbacks;if(Q!==null)for(x.shared.hiddenCallbacks=null,x=0;x<Q.length;x++)$v(Q[x],$)}catch(ce){Tt(c,c.return,ce)}}a&&O&64&&J0(E),fl(E,E.return);break;case 27:nb(E);case 26:case 5:jr(x,E,a),a&&c===null&&O&4&&eb(E),fl(E,E.return);break;case 12:jr(x,E,a);break;case 31:jr(x,E,a),a&&O&4&&ob(x,E);break;case 13:jr(x,E,a),a&&O&4&&lb(x,E);break;case 22:E.memoizedState===null&&jr(x,E,a),fl(E,E.return);break;case 30:break;default:jr(x,E,a)}r=r.sibling}}function Ff(n,r){var a=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(a=n.memoizedState.cachePool.pool),n=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(n=r.memoizedState.cachePool.pool),n!==a&&(n!=null&&n.refCount++,a!=null&&Qo(a))}function Wf(n,r){n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&Qo(n))}function Qi(n,r,a,c){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)hb(n,r,a,c),r=r.sibling}function hb(n,r,a,c){var x=r.flags;switch(r.tag){case 0:case 11:case 15:Qi(n,r,a,c),x&2048&&dl(9,r);break;case 1:Qi(n,r,a,c);break;case 3:Qi(n,r,a,c),x&2048&&(n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&Qo(n)));break;case 12:if(x&2048){Qi(n,r,a,c),n=r.stateNode;try{var E=r.memoizedProps,O=E.id,$=E.onPostCommit;typeof $=="function"&&$(O,r.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(Q){Tt(r,r.return,Q)}}else Qi(n,r,a,c);break;case 31:Qi(n,r,a,c);break;case 13:Qi(n,r,a,c);break;case 23:break;case 22:E=r.stateNode,O=r.alternate,r.memoizedState!==null?E._visibility&2?Qi(n,r,a,c):pl(n,r):E._visibility&2?Qi(n,r,a,c):(E._visibility|=2,Ha(n,r,a,c,(r.subtreeFlags&10256)!==0||!1)),x&2048&&Ff(O,r);break;case 24:Qi(n,r,a,c),x&2048&&Wf(r.alternate,r);break;default:Qi(n,r,a,c)}}function Ha(n,r,a,c,x){for(x=x&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var E=n,O=r,$=a,Q=c,ce=O.flags;switch(O.tag){case 0:case 11:case 15:Ha(E,O,$,Q,x),dl(8,O);break;case 23:break;case 22:var me=O.stateNode;O.memoizedState!==null?me._visibility&2?Ha(E,O,$,Q,x):pl(E,O):(me._visibility|=2,Ha(E,O,$,Q,x)),x&&ce&2048&&Ff(O.alternate,O);break;case 24:Ha(E,O,$,Q,x),x&&ce&2048&&Wf(O.alternate,O);break;default:Ha(E,O,$,Q,x)}r=r.sibling}}function pl(n,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var a=n,c=r,x=c.flags;switch(c.tag){case 22:pl(a,c),x&2048&&Ff(c.alternate,c);break;case 24:pl(a,c),x&2048&&Wf(c.alternate,c);break;default:pl(a,c)}r=r.sibling}}var ml=8192;function $a(n,r,a){if(n.subtreeFlags&ml)for(n=n.child;n!==null;)db(n,r,a),n=n.sibling}function db(n,r,a){switch(n.tag){case 26:$a(n,r,a),n.flags&ml&&n.memoizedState!==null&&Wk(a,Ji,n.memoizedState,n.memoizedProps);break;case 5:$a(n,r,a);break;case 3:case 4:var c=Ji;Ji=Nu(n.stateNode.containerInfo),$a(n,r,a),Ji=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=ml,ml=16777216,$a(n,r,a),ml=c):$a(n,r,a));break;default:$a(n,r,a)}}function fb(n){var r=n.alternate;if(r!==null&&(n=r.child,n!==null)){r.child=null;do r=n.sibling,n.sibling=null,n=r;while(n!==null)}}function gl(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var c=r[a];Cn=c,mb(c,n)}fb(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)pb(n),n=n.sibling}function pb(n){switch(n.tag){case 0:case 11:case 15:gl(n),n.flags&2048&&os(9,n,n.return);break;case 3:gl(n);break;case 12:gl(n);break;case 22:var r=n.stateNode;n.memoizedState!==null&&r._visibility&2&&(n.return===null||n.return.tag!==13)?(r._visibility&=-3,bu(n)):gl(n);break;default:gl(n)}}function bu(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var c=r[a];Cn=c,mb(c,n)}fb(n)}for(n=n.child;n!==null;){switch(r=n,r.tag){case 0:case 11:case 15:os(8,r,r.return),bu(r);break;case 22:a=r.stateNode,a._visibility&2&&(a._visibility&=-3,bu(r));break;default:bu(r)}n=n.sibling}}function mb(n,r){for(;Cn!==null;){var a=Cn;switch(a.tag){case 0:case 11:case 15:os(8,a,r);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var c=a.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:Qo(a.memoizedState.cache)}if(c=a.child,c!==null)c.return=a,Cn=c;else e:for(a=n;Cn!==null;){c=Cn;var x=c.sibling,E=c.return;if(sb(c),c===a){Cn=null;break e}if(x!==null){x.return=E,Cn=x;break e}Cn=E}}}var sk={getCacheForType:function(n){var r=Dn(gn),a=r.data.get(n);return a===void 0&&(a=n(),r.data.set(n,a)),a},cacheSignal:function(){return Dn(gn).controller.signal}},ak=typeof WeakMap=="function"?WeakMap:Map,St=0,It=null,rt=null,ot=0,kt=0,Ti=null,ls=!1,Ua=!1,Gf=!1,Ir=0,an=0,cs=0,Zs=0,qf=0,Ai=0,Fa=0,_l=null,di=null,Kf=!1,yu=0,gb=0,Su=1/0,xu=null,us=null,xn=0,hs=null,Wa=null,Br=0,Vf=0,Yf=null,_b=null,vl=0,Xf=null;function Ri(){return(St&2)!==0&&ot!==0?ot&-ot:P.T!==null?np():Dt()}function vb(){if(Ai===0)if((ot&536870912)===0||ut){var n=wn;wn<<=1,(wn&3932160)===0&&(wn=262144),Ai=n}else Ai=536870912;return n=Ei.current,n!==null&&(n.flags|=32),Ai}function fi(n,r,a){(n===It&&(kt===2||kt===9)||n.cancelPendingCommit!==null)&&(Ga(n,0),ds(n,ot,Ai,!1)),mt(n,a),((St&2)===0||n!==It)&&(n===It&&((St&2)===0&&(Zs|=a),an===4&&ds(n,ot,Ai,!1)),mr(n))}function bb(n,r,a){if((St&6)!==0)throw Error(s(327));var c=!a&&(r&127)===0&&(r&n.expiredLanes)===0||_e(n,r),x=c?ck(n,r):Jf(n,r,!0),E=c;do{if(x===0){Ua&&!c&&ds(n,r,0,!1);break}else{if(a=n.current.alternate,E&&!ok(a)){x=Jf(n,r,!1),E=!1;continue}if(x===2){if(E=r,n.errorRecoveryDisabledLanes&E)var O=0;else O=n.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){r=O;e:{var $=n;x=_l;var Q=$.current.memoizedState.isDehydrated;if(Q&&(Ga($,O).flags|=256),O=Jf($,O,!1),O!==2){if(Gf&&!Q){$.errorRecoveryDisabledLanes|=E,Zs|=E,x=4;break e}E=di,di=x,E!==null&&(di===null?di=E:di.push.apply(di,E))}x=O}if(E=!1,x!==2)continue}}if(x===1){Ga(n,0),ds(n,r,0,!0);break}e:{switch(c=n,E=x,E){case 0:case 1:throw Error(s(345));case 4:if((r&4194048)!==r)break;case 6:ds(c,r,Ai,!ls);break e;case 2:di=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(x=yu+300-ft(),10<x)){if(ds(c,r,Ai,!ls),ee(c,0,!0)!==0)break e;Br=r,c.timeoutHandle=Xb(yb.bind(null,c,a,di,xu,Kf,r,Ai,Zs,Fa,ls,E,"Throttled",-0,0),x);break e}yb(c,a,di,xu,Kf,r,Ai,Zs,Fa,ls,E,null,-0,0)}}break}while(!0);mr(n)}function yb(n,r,a,c,x,E,O,$,Q,ce,me,ye,ue,fe){if(n.timeoutHandle=-1,ye=r.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ce},db(r,E,ye);var Me=(E&62914560)===E?yu-ft():(E&4194048)===E?gb-ft():0;if(Me=Gk(ye,Me),Me!==null){Br=E,n.cancelPendingCommit=Me(Ab.bind(null,n,r,E,a,c,x,O,$,Q,me,ye,null,ue,fe)),ds(n,E,O,!ce);return}}Ab(n,r,E,a,c,x,O,$,Q)}function ok(n){for(var r=n;;){var a=r.tag;if((a===0||a===11||a===15)&&r.flags&16384&&(a=r.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var c=0;c<a.length;c++){var x=a[c],E=x.getSnapshot;x=x.value;try{if(!wi(E(),x))return!1}catch{return!1}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function ds(n,r,a,c){r&=~qf,r&=~Zs,n.suspendedLanes|=r,n.pingedLanes&=~r,c&&(n.warmLanes|=r),c=n.expirationTimes;for(var x=r;0<x;){var E=31-pt(x),O=1<<E;c[E]=-1,x&=~O}a!==0&&Te(n,a,r)}function wu(){return(St&6)===0?(bl(0),!1):!0}function Zf(){if(rt!==null){if(kt===0)var n=rt.return;else n=rt,kr=Us=null,ff(n),ja=null,tl=0,n=rt;for(;n!==null;)Z0(n.alternate,n),n=n.return;rt=null}}function Ga(n,r){var a=n.timeoutHandle;a!==-1&&(n.timeoutHandle=-1,Tk(a)),a=n.cancelPendingCommit,a!==null&&(n.cancelPendingCommit=null,a()),Br=0,Zf(),It=n,rt=a=Cr(n.current,null),ot=r,kt=0,Ti=null,ls=!1,Ua=_e(n,r),Gf=!1,Fa=Ai=qf=Zs=cs=an=0,di=_l=null,Kf=!1,(r&8)!==0&&(r|=r&32);var c=n.entangledLanes;if(c!==0)for(n=n.entanglements,c&=r;0<c;){var x=31-pt(c),E=1<<x;r|=n[x],c&=~E}return Ir=r,Wc(),a}function Sb(n,r){Ze=null,P.H=cl,r===Da||r===Jc?(r=Bv(),kt=3):r===ef?(r=Bv(),kt=4):kt=r===Rf?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Ti=r,rt===null&&(an=1,du(n,Pi(r,n.current)))}function xb(){var n=Ei.current;return n===null?!0:(ot&4194048)===ot?Ui===null:(ot&62914560)===ot||(ot&536870912)!==0?n===Ui:!1}function wb(){var n=P.H;return P.H=cl,n===null?cl:n}function Cb(){var n=P.A;return P.A=sk,n}function Cu(){an=4,ls||(ot&4194048)!==ot&&Ei.current!==null||(Ua=!0),(cs&134217727)===0&&(Zs&134217727)===0||It===null||ds(It,ot,Ai,!1)}function Jf(n,r,a){var c=St;St|=2;var x=wb(),E=Cb();(It!==n||ot!==r)&&(xu=null,Ga(n,r)),r=!1;var O=an;e:do try{if(kt!==0&&rt!==null){var $=rt,Q=Ti;switch(kt){case 8:Zf(),O=6;break e;case 3:case 2:case 9:case 6:Ei.current===null&&(r=!0);var ce=kt;if(kt=0,Ti=null,qa(n,$,Q,ce),a&&Ua){O=0;break e}break;default:ce=kt,kt=0,Ti=null,qa(n,$,Q,ce)}}lk(),O=an;break}catch(me){Sb(n,me)}while(!0);return r&&n.shellSuspendCounter++,kr=Us=null,St=c,P.H=x,P.A=E,rt===null&&(It=null,ot=0,Wc()),O}function lk(){for(;rt!==null;)Eb(rt)}function ck(n,r){var a=St;St|=2;var c=wb(),x=Cb();It!==n||ot!==r?(xu=null,Su=ft()+500,Ga(n,r)):Ua=_e(n,r);e:do try{if(kt!==0&&rt!==null){r=rt;var E=Ti;t:switch(kt){case 1:kt=0,Ti=null,qa(n,r,E,1);break;case 2:case 9:if(jv(E)){kt=0,Ti=null,kb(r);break}r=function(){kt!==2&&kt!==9||It!==n||(kt=7),mr(n)},E.then(r,r);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:jv(E)?(kt=0,Ti=null,kb(r)):(kt=0,Ti=null,qa(n,r,E,7));break;case 5:var O=null;switch(rt.tag){case 26:O=rt.memoizedState;case 5:case 27:var $=rt;if(O?hy(O):$.stateNode.complete){kt=0,Ti=null;var Q=$.sibling;if(Q!==null)rt=Q;else{var ce=$.return;ce!==null?(rt=ce,Eu(ce)):rt=null}break t}}kt=0,Ti=null,qa(n,r,E,5);break;case 6:kt=0,Ti=null,qa(n,r,E,6);break;case 8:Zf(),an=6;break e;default:throw Error(s(462))}}uk();break}catch(me){Sb(n,me)}while(!0);return kr=Us=null,P.H=c,P.A=x,St=a,rt!==null?0:(It=null,ot=0,Wc(),an)}function uk(){for(;rt!==null&&!$n();)Eb(rt)}function Eb(n){var r=Y0(n.alternate,n,Ir);n.memoizedProps=n.pendingProps,r===null?Eu(n):rt=r}function kb(n){var r=n,a=r.alternate;switch(r.tag){case 15:case 0:r=F0(a,r,r.pendingProps,r.type,void 0,ot);break;case 11:r=F0(a,r,r.pendingProps,r.type.render,r.ref,ot);break;case 5:ff(r);default:Z0(a,r),r=rt=Cv(r,Ir),r=Y0(a,r,Ir)}n.memoizedProps=n.pendingProps,r===null?Eu(n):rt=r}function qa(n,r,a,c){kr=Us=null,ff(r),ja=null,tl=0;var x=r.return;try{if(J5(n,x,r,a,ot)){an=1,du(n,Pi(a,n.current)),rt=null;return}}catch(E){if(x!==null)throw rt=x,E;an=1,du(n,Pi(a,n.current)),rt=null;return}r.flags&32768?(ut||c===1?n=!0:Ua||(ot&536870912)!==0?n=!1:(ls=n=!0,(c===2||c===9||c===3||c===6)&&(c=Ei.current,c!==null&&c.tag===13&&(c.flags|=16384))),Tb(r,n)):Eu(r)}function Eu(n){var r=n;do{if((r.flags&32768)!==0){Tb(r,ls);return}n=r.return;var a=tk(r.alternate,r,Ir);if(a!==null){rt=a;return}if(r=r.sibling,r!==null){rt=r;return}rt=r=n}while(r!==null);an===0&&(an=5)}function Tb(n,r){do{var a=nk(n.alternate,n);if(a!==null){a.flags&=32767,rt=a;return}if(a=n.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!r&&(n=n.sibling,n!==null)){rt=n;return}rt=n=a}while(n!==null);an=6,rt=null}function Ab(n,r,a,c,x,E,O,$,Q){n.cancelPendingCommit=null;do ku();while(xn!==0);if((St&6)!==0)throw Error(s(327));if(r!==null){if(r===n.current)throw Error(s(177));if(E=r.lanes|r.childLanes,E|=zd,Le(n,a,E,O,$,Q),n===It&&(rt=It=null,ot=0),Wa=r,hs=n,Br=a,Vf=E,Yf=x,_b=c,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,pk(Bt,function(){return Ob(),null})):(n.callbackNode=null,n.callbackPriority=0),c=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||c){c=P.T,P.T=null,x=Y.p,Y.p=2,O=St,St|=4;try{ik(n,r,a)}finally{St=O,Y.p=x,P.T=c}}xn=1,Rb(),Lb(),Mb()}}function Rb(){if(xn===1){xn=0;var n=hs,r=Wa,a=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||a){a=P.T,P.T=null;var c=Y.p;Y.p=2;var x=St;St|=4;try{cb(r,n);var E=up,O=mv(n.containerInfo),$=E.focusedElem,Q=E.selectionRange;if(O!==$&&$&&$.ownerDocument&&pv($.ownerDocument.documentElement,$)){if(Q!==null&&Dd($)){var ce=Q.start,me=Q.end;if(me===void 0&&(me=ce),"selectionStart"in $)$.selectionStart=ce,$.selectionEnd=Math.min(me,$.value.length);else{var ye=$.ownerDocument||document,ue=ye&&ye.defaultView||window;if(ue.getSelection){var fe=ue.getSelection(),Me=$.textContent.length,Ue=Math.min(Q.start,Me),Lt=Q.end===void 0?Ue:Math.min(Q.end,Me);!fe.extend&&Ue>Lt&&(O=Lt,Lt=Ue,Ue=O);var ie=fv($,Ue),ne=fv($,Lt);if(ie&&ne&&(fe.rangeCount!==1||fe.anchorNode!==ie.node||fe.anchorOffset!==ie.offset||fe.focusNode!==ne.node||fe.focusOffset!==ne.offset)){var oe=ye.createRange();oe.setStart(ie.node,ie.offset),fe.removeAllRanges(),Ue>Lt?(fe.addRange(oe),fe.extend(ne.node,ne.offset)):(oe.setEnd(ne.node,ne.offset),fe.addRange(oe))}}}}for(ye=[],fe=$;fe=fe.parentNode;)fe.nodeType===1&&ye.push({element:fe,left:fe.scrollLeft,top:fe.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$<ye.length;$++){var be=ye[$];be.element.scrollLeft=be.left,be.element.scrollTop=be.top}}Pu=!!cp,up=cp=null}finally{St=x,Y.p=c,P.T=a}}n.current=r,xn=2}}function Lb(){if(xn===2){xn=0;var n=hs,r=Wa,a=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||a){a=P.T,P.T=null;var c=Y.p;Y.p=2;var x=St;St|=4;try{rb(n,r.alternate,r)}finally{St=x,Y.p=c,P.T=a}}xn=3}}function Mb(){if(xn===4||xn===3){xn=0,en();var n=hs,r=Wa,a=Br,c=_b;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?xn=5:(xn=0,Wa=hs=null,Nb(n,n.pendingLanes));var x=n.pendingLanes;if(x===0&&(us=null),qe(a),r=r.stateNode,Ot&&typeof Ot.onCommitFiberRoot=="function")try{Ot.onCommitFiberRoot(hn,r,void 0,(r.current.flags&128)===128)}catch{}if(c!==null){r=P.T,x=Y.p,Y.p=2,P.T=null;try{for(var E=n.onRecoverableError,O=0;O<c.length;O++){var $=c[O];E($.value,{componentStack:$.stack})}}finally{P.T=r,Y.p=x}}(Br&3)!==0&&ku(),mr(n),x=n.pendingLanes,(a&261930)!==0&&(x&42)!==0?n===Xf?vl++:(vl=0,Xf=n):vl=0,bl(0)}}function Nb(n,r){(n.pooledCacheLanes&=r)===0&&(r=n.pooledCache,r!=null&&(n.pooledCache=null,Qo(r)))}function ku(){return Rb(),Lb(),Mb(),Ob()}function Ob(){if(xn!==5)return!1;var n=hs,r=Vf;Vf=0;var a=qe(Br),c=P.T,x=Y.p;try{Y.p=32>a?32:a,P.T=null,a=Yf,Yf=null;var E=hs,O=Br;if(xn=0,Wa=hs=null,Br=0,(St&6)!==0)throw Error(s(331));var $=St;if(St|=4,pb(E.current),hb(E,E.current,O,a),St=$,bl(0,!1),Ot&&typeof Ot.onPostCommitFiberRoot=="function")try{Ot.onPostCommitFiberRoot(hn,E)}catch{}return!0}finally{Y.p=x,P.T=c,Nb(n,r)}}function Db(n,r,a){r=Pi(a,r),r=Af(n.stateNode,r,2),n=rs(n,r,2),n!==null&&(mt(n,2),mr(n))}function Tt(n,r,a){if(n.tag===3)Db(n,n,a);else for(;r!==null;){if(r.tag===3){Db(r,n,a);break}else if(r.tag===1){var c=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(us===null||!us.has(c))){n=Pi(a,n),a=j0(2),c=rs(r,a,2),c!==null&&(I0(a,c,r,n),mt(c,2),mr(c));break}}r=r.return}}function Qf(n,r,a){var c=n.pingCache;if(c===null){c=n.pingCache=new ak;var x=new Set;c.set(r,x)}else x=c.get(r),x===void 0&&(x=new Set,c.set(r,x));x.has(a)||(Gf=!0,x.add(a),n=hk.bind(null,n,r,a),r.then(n,n))}function hk(n,r,a){var c=n.pingCache;c!==null&&c.delete(r),n.pingedLanes|=n.suspendedLanes&a,n.warmLanes&=~a,It===n&&(ot&a)===a&&(an===4||an===3&&(ot&62914560)===ot&&300>ft()-yu?(St&2)===0&&Ga(n,0):qf|=a,Fa===ot&&(Fa=0)),mr(n)}function jb(n,r){r===0&&(r=Pe()),n=zs(n,r),n!==null&&(mt(n,r),mr(n))}function dk(n){var r=n.memoizedState,a=0;r!==null&&(a=r.retryLane),jb(n,a)}function fk(n,r){var a=0;switch(n.tag){case 31:case 13:var c=n.stateNode,x=n.memoizedState;x!==null&&(a=x.retryLane);break;case 19:c=n.stateNode;break;case 22:c=n.stateNode._retryCache;break;default:throw Error(s(314))}c!==null&&c.delete(r),jb(n,a)}function pk(n,r){return Xt(n,r)}var Tu=null,Ka=null,ep=!1,Au=!1,tp=!1,fs=0;function mr(n){n!==Ka&&n.next===null&&(Ka===null?Tu=Ka=n:Ka=Ka.next=n),Au=!0,ep||(ep=!0,gk())}function bl(n,r){if(!tp&&Au){tp=!0;do for(var a=!1,c=Tu;c!==null;){if(n!==0){var x=c.pendingLanes;if(x===0)var E=0;else{var O=c.suspendedLanes,$=c.pingedLanes;E=(1<<31-pt(42|n)+1)-1,E&=x&~(O&~$),E=E&201326741?E&201326741|1:E?E|2:0}E!==0&&(a=!0,zb(c,E))}else E=ot,E=ee(c,c===It?E:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(E&3)===0||_e(c,E)||(a=!0,zb(c,E));c=c.next}while(a);tp=!1}}function mk(){Ib()}function Ib(){Au=ep=!1;var n=0;fs!==0&&kk()&&(n=fs);for(var r=ft(),a=null,c=Tu;c!==null;){var x=c.next,E=Bb(c,r);E===0?(c.next=null,a===null?Tu=x:a.next=x,x===null&&(Ka=a)):(a=c,(n!==0||(E&3)!==0)&&(Au=!0)),c=x}xn!==0&&xn!==5||bl(n),fs!==0&&(fs=0)}function Bb(n,r){for(var a=n.suspendedLanes,c=n.pingedLanes,x=n.expirationTimes,E=n.pendingLanes&-62914561;0<E;){var O=31-pt(E),$=1<<O,Q=x[O];Q===-1?(($&a)===0||($&c)!==0)&&(x[O]=xe($,r)):Q<=r&&(n.expiredLanes|=$),E&=~$}if(r=It,a=ot,a=ee(n,n===r?a:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c=n.callbackNode,a===0||n===r&&(kt===2||kt===9)||n.cancelPendingCommit!==null)return c!==null&&c!==null&&Ln(c),n.callbackNode=null,n.callbackPriority=0;if((a&3)===0||_e(n,a)){if(r=a&-a,r===n.callbackPriority)return r;switch(c!==null&&Ln(c),qe(a)){case 2:case 8:a=yt;break;case 32:a=Bt;break;case 268435456:a=Zt;break;default:a=Bt}return c=Pb.bind(null,n),a=Xt(a,c),n.callbackPriority=r,n.callbackNode=a,r}return c!==null&&c!==null&&Ln(c),n.callbackPriority=2,n.callbackNode=null,2}function Pb(n,r){if(xn!==0&&xn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var a=n.callbackNode;if(ku()&&n.callbackNode!==a)return null;var c=ot;return c=ee(n,n===It?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(bb(n,c,r),Bb(n,ft()),n.callbackNode!=null&&n.callbackNode===a?Pb.bind(null,n):null)}function zb(n,r){if(ku())return null;bb(n,r,!0)}function gk(){Ak(function(){(St&6)!==0?Xt(Ht,mk):Ib()})}function np(){if(fs===0){var n=Na;n===0&&(n=yi,yi<<=1,(yi&261888)===0&&(yi=256)),fs=n}return fs}function Hb(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Xr(""+n)}function $b(n,r){var a=r.ownerDocument.createElement("input");return a.name=r.name,a.value=r.value,n.id&&a.setAttribute("form",n.id),r.parentNode.insertBefore(a,r),n=new FormData(n),a.parentNode.removeChild(a),n}function _k(n,r,a,c,x){if(r==="submit"&&a&&a.stateNode===x){var E=Hb((x[Xe]||null).action),O=c.submitter;O&&(r=(r=O[Xe]||null)?Hb(r.formAction):O.getAttribute("formAction"),r!==null&&(E=r,O=null));var $=new Hc("action","action",null,c,x);n.push({event:$,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(fs!==0){var Q=O?$b(x,O):new FormData(x);xf(a,{pending:!0,data:Q,method:x.method,action:E},null,Q)}}else typeof E=="function"&&($.preventDefault(),Q=O?$b(x,O):new FormData(x),xf(a,{pending:!0,data:Q,method:x.method,action:E},E,Q))},currentTarget:x}]})}}for(var ip=0;ip<Pd.length;ip++){var rp=Pd[ip],vk=rp.toLowerCase(),bk=rp[0].toUpperCase()+rp.slice(1);Zi(vk,"on"+bk)}Zi(vv,"onAnimationEnd"),Zi(bv,"onAnimationIteration"),Zi(yv,"onAnimationStart"),Zi("dblclick","onDoubleClick"),Zi("focusin","onFocus"),Zi("focusout","onBlur"),Zi(j5,"onTransitionRun"),Zi(I5,"onTransitionStart"),Zi(B5,"onTransitionCancel"),Zi(Sv,"onTransitionEnd"),Se("onMouseEnter",["mouseout","mouseover"]),Se("onMouseLeave",["mouseout","mouseover"]),Se("onPointerEnter",["pointerout","pointerover"]),Se("onPointerLeave",["pointerout","pointerover"]),rn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),rn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),rn("onBeforeInput",["compositionend","keypress","textInput","paste"]),rn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),rn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),rn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var yl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),yk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(yl));function Ub(n,r){r=(r&4)!==0;for(var a=0;a<n.length;a++){var c=n[a],x=c.event;c=c.listeners;e:{var E=void 0;if(r)for(var O=c.length-1;0<=O;O--){var $=c[O],Q=$.instance,ce=$.currentTarget;if($=$.listener,Q!==E&&x.isPropagationStopped())break e;E=$,x.currentTarget=ce;try{E(x)}catch(me){Fc(me)}x.currentTarget=null,E=Q}else for(O=0;O<c.length;O++){if($=c[O],Q=$.instance,ce=$.currentTarget,$=$.listener,Q!==E&&x.isPropagationStopped())break e;E=$,x.currentTarget=ce;try{E(x)}catch(me){Fc(me)}x.currentTarget=null,E=Q}}}}function st(n,r){var a=r[Yn];a===void 0&&(a=r[Yn]=new Set);var c=n+"__bubble";a.has(c)||(Fb(r,n,2,!1),a.add(c))}function sp(n,r,a){var c=0;r&&(c|=4),Fb(a,n,c,r)}var Ru="_reactListening"+Math.random().toString(36).slice(2);function ap(n){if(!n[Ru]){n[Ru]=!0,jt.forEach(function(a){a!=="selectionchange"&&(yk.has(a)||sp(a,!1,n),sp(a,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[Ru]||(r[Ru]=!0,sp("selectionchange",!1,r))}}function Fb(n,r,a,c){switch(vy(r)){case 2:var x=Vk;break;case 8:x=Yk;break;default:x=Sp}a=x.bind(null,r,a,n),x=void 0,!Ed||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(x=!0),c?x!==void 0?n.addEventListener(r,a,{capture:!0,passive:x}):n.addEventListener(r,a,!0):x!==void 0?n.addEventListener(r,a,{passive:x}):n.addEventListener(r,a,!1)}function op(n,r,a,c,x){var E=c;if((r&1)===0&&(r&2)===0&&c!==null)e:for(;;){if(c===null)return;var O=c.tag;if(O===3||O===4){var $=c.stateNode.containerInfo;if($===x)break;if(O===4)for(O=c.return;O!==null;){var Q=O.tag;if((Q===3||Q===4)&&O.stateNode.containerInfo===x)return;O=O.return}for(;$!==null;){if(O=Z($),O===null)return;if(Q=O.tag,Q===5||Q===6||Q===26||Q===27){c=E=O;continue e}$=$.parentNode}}c=c.return}Ic(function(){var ce=E,me=Ve(a),ye=[];e:{var ue=xv.get(n);if(ue!==void 0){var fe=Hc,Me=n;switch(n){case"keypress":if(Pc(a)===0)break e;case"keydown":case"keyup":fe=f5;break;case"focusin":Me="focus",fe=Rd;break;case"focusout":Me="blur",fe=Rd;break;case"beforeblur":case"afterblur":fe=Rd;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fe=Z_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=t5;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=g5;break;case vv:case bv:case yv:fe=r5;break;case Sv:fe=v5;break;case"scroll":case"scrollend":fe=QE;break;case"wheel":fe=y5;break;case"copy":case"cut":case"paste":fe=a5;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=Q_;break;case"toggle":case"beforetoggle":fe=x5}var Ue=(r&4)!==0,Lt=!Ue&&(n==="scroll"||n==="scrollend"),ie=Ue?ue!==null?ue+"Capture":null:ue;Ue=[];for(var ne=ce,oe;ne!==null;){var be=ne;if(oe=be.stateNode,be=be.tag,be!==5&&be!==26&&be!==27||oe===null||ie===null||(be=Uo(ne,ie),be!=null&&Ue.push(Sl(ne,be,oe))),Lt)break;ne=ne.return}0<Ue.length&&(ue=new fe(ue,Me,null,a,me),ye.push({event:ue,listeners:Ue}))}}if((r&7)===0){e:{if(ue=n==="mouseover"||n==="pointerover",fe=n==="mouseout"||n==="pointerout",ue&&a!==Oe&&(Me=a.relatedTarget||a.fromElement)&&(Z(Me)||Me[pn]))break e;if((fe||ue)&&(ue=me.window===me?me:(ue=me.ownerDocument)?ue.defaultView||ue.parentWindow:window,fe?(Me=a.relatedTarget||a.toElement,fe=ce,Me=Me?Z(Me):null,Me!==null&&(Lt=d(Me),Ue=Me.tag,Me!==Lt||Ue!==5&&Ue!==27&&Ue!==6)&&(Me=null)):(fe=null,Me=ce),fe!==Me)){if(Ue=Z_,be="onMouseLeave",ie="onMouseEnter",ne="mouse",(n==="pointerout"||n==="pointerover")&&(Ue=Q_,be="onPointerLeave",ie="onPointerEnter",ne="pointer"),Lt=fe==null?ue:ke(fe),oe=Me==null?ue:ke(Me),ue=new Ue(be,ne+"leave",fe,a,me),ue.target=Lt,ue.relatedTarget=oe,be=null,Z(me)===ce&&(Ue=new Ue(ie,ne+"enter",Me,a,me),Ue.target=oe,Ue.relatedTarget=Lt,be=Ue),Lt=be,fe&&Me)t:{for(Ue=Sk,ie=fe,ne=Me,oe=0,be=ie;be;be=Ue(be))oe++;be=0;for(var He=ne;He;He=Ue(He))be++;for(;0<oe-be;)ie=Ue(ie),oe--;for(;0<be-oe;)ne=Ue(ne),be--;for(;oe--;){if(ie===ne||ne!==null&&ie===ne.alternate){Ue=ie;break t}ie=Ue(ie),ne=Ue(ne)}Ue=null}else Ue=null;fe!==null&&Wb(ye,ue,fe,Ue,!1),Me!==null&&Lt!==null&&Wb(ye,Lt,Me,Ue,!0)}}e:{if(ue=ce?ke(ce):window,fe=ue.nodeName&&ue.nodeName.toLowerCase(),fe==="select"||fe==="input"&&ue.type==="file")var _t=ov;else if(sv(ue))if(lv)_t=N5;else{_t=L5;var De=R5}else fe=ue.nodeName,!fe||fe.toLowerCase()!=="input"||ue.type!=="checkbox"&&ue.type!=="radio"?ce&&Yr(ce.elementType)&&(_t=ov):_t=M5;if(_t&&(_t=_t(n,ce))){av(ye,_t,a,me);break e}De&&De(n,ue,ce),n==="focusout"&&ce&&ue.type==="number"&&ce.memoizedProps.value!=null&&Sa(ue,"number",ue.value)}switch(De=ce?ke(ce):window,n){case"focusin":(sv(De)||De.contentEditable==="true")&&(Ca=De,jd=ce,Xo=null);break;case"focusout":Xo=jd=Ca=null;break;case"mousedown":Id=!0;break;case"contextmenu":case"mouseup":case"dragend":Id=!1,gv(ye,a,me);break;case"selectionchange":if(D5)break;case"keydown":case"keyup":gv(ye,a,me)}var Je;if(Md)e:{switch(n){case"compositionstart":var lt="onCompositionStart";break e;case"compositionend":lt="onCompositionEnd";break e;case"compositionupdate":lt="onCompositionUpdate";break e}lt=void 0}else wa?iv(n,a)&&(lt="onCompositionEnd"):n==="keydown"&&a.keyCode===229&&(lt="onCompositionStart");lt&&(ev&&a.locale!=="ko"&&(wa||lt!=="onCompositionStart"?lt==="onCompositionEnd"&&wa&&(Je=Y_()):(Zr=me,kd="value"in Zr?Zr.value:Zr.textContent,wa=!0)),De=Lu(ce,lt),0<De.length&&(lt=new J_(lt,n,null,a,me),ye.push({event:lt,listeners:De}),Je?lt.data=Je:(Je=rv(a),Je!==null&&(lt.data=Je)))),(Je=C5?E5(n,a):k5(n,a))&&(lt=Lu(ce,"onBeforeInput"),0<lt.length&&(De=new J_("onBeforeInput","beforeinput",null,a,me),ye.push({event:De,listeners:lt}),De.data=Je)),_k(ye,n,ce,a,me)}Ub(ye,r)})}function Sl(n,r,a){return{instance:n,listener:r,currentTarget:a}}function Lu(n,r){for(var a=r+"Capture",c=[];n!==null;){var x=n,E=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||E===null||(x=Uo(n,a),x!=null&&c.unshift(Sl(n,x,E)),x=Uo(n,r),x!=null&&c.push(Sl(n,x,E))),n.tag===3)return c;n=n.return}return[]}function Sk(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Wb(n,r,a,c,x){for(var E=r._reactName,O=[];a!==null&&a!==c;){var $=a,Q=$.alternate,ce=$.stateNode;if($=$.tag,Q!==null&&Q===c)break;$!==5&&$!==26&&$!==27||ce===null||(Q=ce,x?(ce=Uo(a,E),ce!=null&&O.unshift(Sl(a,ce,Q))):x||(ce=Uo(a,E),ce!=null&&O.push(Sl(a,ce,Q)))),a=a.return}O.length!==0&&n.push({event:r,listeners:O})}var xk=/\r\n?/g,wk=/\u0000|\uFFFD/g;function Gb(n){return(typeof n=="string"?n:""+n).replace(xk,`
9
+ `).replace(wk,"")}function qb(n,r){return r=Gb(r),Gb(n)===r}function Rt(n,r,a,c,x,E){switch(a){case"children":typeof c=="string"?r==="body"||r==="textarea"&&c===""||Fe(n,c):(typeof c=="number"||typeof c=="bigint")&&r!=="body"&&Fe(n,""+c);break;case"className":Si(n,"class",c);break;case"tabIndex":Si(n,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Si(n,a,c);break;case"style":Et(n,c,E);break;case"data":if(r!=="object"){Si(n,"data",c);break}case"src":case"href":if(c===""&&(r!=="a"||a!=="href")){n.removeAttribute(a);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(a);break}c=Xr(""+c),n.setAttribute(a,c);break;case"action":case"formAction":if(typeof c=="function"){n.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof E=="function"&&(a==="formAction"?(r!=="input"&&Rt(n,r,"name",x.name,x,null),Rt(n,r,"formEncType",x.formEncType,x,null),Rt(n,r,"formMethod",x.formMethod,x,null),Rt(n,r,"formTarget",x.formTarget,x,null)):(Rt(n,r,"encType",x.encType,x,null),Rt(n,r,"method",x.method,x,null),Rt(n,r,"target",x.target,x,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(a);break}c=Xr(""+c),n.setAttribute(a,c);break;case"onClick":c!=null&&(n.onclick=Ce);break;case"onScroll":c!=null&&st("scroll",n);break;case"onScrollEnd":c!=null&&st("scrollend",n);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(s(61));if(a=c.__html,a!=null){if(x.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"multiple":n.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":n.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){n.removeAttribute("xlink:href");break}a=Xr(""+c),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(a,""+c):n.removeAttribute(a);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":c&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(a,""):n.removeAttribute(a);break;case"capture":case"download":c===!0?n.setAttribute(a,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(a,c):n.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?n.setAttribute(a,c):n.removeAttribute(a);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?n.removeAttribute(a):n.setAttribute(a,c);break;case"popover":st("beforetoggle",n),st("toggle",n),Un(n,"popover",c);break;case"xlinkActuate":ai(n,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":ai(n,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":ai(n,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":ai(n,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":ai(n,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":ai(n,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":ai(n,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":ai(n,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":ai(n,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Un(n,"is",c);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=xr.get(a)||a,Un(n,a,c))}}function lp(n,r,a,c,x,E){switch(a){case"style":Et(n,c,E);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(s(61));if(a=c.__html,a!=null){if(x.children!=null)throw Error(s(60));n.innerHTML=a}}break;case"children":typeof c=="string"?Fe(n,c):(typeof c=="number"||typeof c=="bigint")&&Fe(n,""+c);break;case"onScroll":c!=null&&st("scroll",n);break;case"onScrollEnd":c!=null&&st("scrollend",n);break;case"onClick":c!=null&&(n.onclick=Ce);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!nn.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(x=a.endsWith("Capture"),r=a.slice(2,x?a.length-7:void 0),E=n[Xe]||null,E=E!=null?E[a]:null,typeof E=="function"&&n.removeEventListener(r,E,x),typeof c=="function")){typeof E!="function"&&E!==null&&(a in n?n[a]=null:n.hasAttribute(a)&&n.removeAttribute(a)),n.addEventListener(r,c,x);break e}a in n?n[a]=c:c===!0?n.setAttribute(a,""):Un(n,a,c)}}}function In(n,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":st("error",n),st("load",n);var c=!1,x=!1,E;for(E in a)if(a.hasOwnProperty(E)){var O=a[E];if(O!=null)switch(E){case"src":c=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Rt(n,r,E,O,a,null)}}x&&Rt(n,r,"srcSet",a.srcSet,a,null),c&&Rt(n,r,"src",a.src,a,null);return;case"input":st("invalid",n);var $=E=O=x=null,Q=null,ce=null;for(c in a)if(a.hasOwnProperty(c)){var me=a[c];if(me!=null)switch(c){case"name":x=me;break;case"type":O=me;break;case"checked":Q=me;break;case"defaultChecked":ce=me;break;case"value":E=me;break;case"defaultValue":$=me;break;case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(s(137,r));break;default:Rt(n,r,c,me,a,null)}}js(n,E,$,Q,ce,O,x,!1);return;case"select":st("invalid",n),c=O=E=null;for(x in a)if(a.hasOwnProperty(x)&&($=a[x],$!=null))switch(x){case"value":E=$;break;case"defaultValue":O=$;break;case"multiple":c=$;default:Rt(n,r,x,$,a,null)}r=E,a=O,n.multiple=!!c,r!=null?Nn(n,!!c,r,!1):a!=null&&Nn(n,!!c,a,!0);return;case"textarea":st("invalid",n),E=x=c=null;for(O in a)if(a.hasOwnProperty(O)&&($=a[O],$!=null))switch(O){case"value":c=$;break;case"defaultValue":x=$;break;case"children":E=$;break;case"dangerouslySetInnerHTML":if($!=null)throw Error(s(91));break;default:Rt(n,r,O,$,a,null)}xa(n,c,x,E);return;case"option":for(Q in a)a.hasOwnProperty(Q)&&(c=a[Q],c!=null)&&(Q==="selected"?n.selected=c&&typeof c!="function"&&typeof c!="symbol":Rt(n,r,Q,c,a,null));return;case"dialog":st("beforetoggle",n),st("toggle",n),st("cancel",n),st("close",n);break;case"iframe":case"object":st("load",n);break;case"video":case"audio":for(c=0;c<yl.length;c++)st(yl[c],n);break;case"image":st("error",n),st("load",n);break;case"details":st("toggle",n);break;case"embed":case"source":case"link":st("error",n),st("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ce in a)if(a.hasOwnProperty(ce)&&(c=a[ce],c!=null))switch(ce){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:Rt(n,r,ce,c,a,null)}return;default:if(Yr(r)){for(me in a)a.hasOwnProperty(me)&&(c=a[me],c!==void 0&&lp(n,r,me,c,a,void 0));return}}for($ in a)a.hasOwnProperty($)&&(c=a[$],c!=null&&Rt(n,r,$,c,a,null))}function Ck(n,r,a,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,E=null,O=null,$=null,Q=null,ce=null,me=null;for(fe in a){var ye=a[fe];if(a.hasOwnProperty(fe)&&ye!=null)switch(fe){case"checked":break;case"value":break;case"defaultValue":Q=ye;default:c.hasOwnProperty(fe)||Rt(n,r,fe,null,c,ye)}}for(var ue in c){var fe=c[ue];if(ye=a[ue],c.hasOwnProperty(ue)&&(fe!=null||ye!=null))switch(ue){case"type":E=fe;break;case"name":x=fe;break;case"checked":ce=fe;break;case"defaultChecked":me=fe;break;case"value":O=fe;break;case"defaultValue":$=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(s(137,r));break;default:fe!==ye&&Rt(n,r,ue,fe,c,ye)}}zo(n,O,$,Q,ce,me,E,x);return;case"select":fe=O=$=ue=null;for(E in a)if(Q=a[E],a.hasOwnProperty(E)&&Q!=null)switch(E){case"value":break;case"multiple":fe=Q;default:c.hasOwnProperty(E)||Rt(n,r,E,null,c,Q)}for(x in c)if(E=c[x],Q=a[x],c.hasOwnProperty(x)&&(E!=null||Q!=null))switch(x){case"value":ue=E;break;case"defaultValue":$=E;break;case"multiple":O=E;default:E!==Q&&Rt(n,r,x,E,c,Q)}r=$,a=O,c=fe,ue!=null?Nn(n,!!a,ue,!1):!!c!=!!a&&(r!=null?Nn(n,!!a,r,!0):Nn(n,!!a,a?[]:"",!1));return;case"textarea":fe=ue=null;for($ in a)if(x=a[$],a.hasOwnProperty($)&&x!=null&&!c.hasOwnProperty($))switch($){case"value":break;case"children":break;default:Rt(n,r,$,null,c,x)}for(O in c)if(x=c[O],E=a[O],c.hasOwnProperty(O)&&(x!=null||E!=null))switch(O){case"value":ue=x;break;case"defaultValue":fe=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(s(91));break;default:x!==E&&Rt(n,r,O,x,c,E)}Dc(n,ue,fe);return;case"option":for(var Me in a)ue=a[Me],a.hasOwnProperty(Me)&&ue!=null&&!c.hasOwnProperty(Me)&&(Me==="selected"?n.selected=!1:Rt(n,r,Me,null,c,ue));for(Q in c)ue=c[Q],fe=a[Q],c.hasOwnProperty(Q)&&ue!==fe&&(ue!=null||fe!=null)&&(Q==="selected"?n.selected=ue&&typeof ue!="function"&&typeof ue!="symbol":Rt(n,r,Q,ue,c,fe));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 Ue in a)ue=a[Ue],a.hasOwnProperty(Ue)&&ue!=null&&!c.hasOwnProperty(Ue)&&Rt(n,r,Ue,null,c,ue);for(ce in c)if(ue=c[ce],fe=a[ce],c.hasOwnProperty(ce)&&ue!==fe&&(ue!=null||fe!=null))switch(ce){case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,r));break;default:Rt(n,r,ce,ue,c,fe)}return;default:if(Yr(r)){for(var Lt in a)ue=a[Lt],a.hasOwnProperty(Lt)&&ue!==void 0&&!c.hasOwnProperty(Lt)&&lp(n,r,Lt,void 0,c,ue);for(me in c)ue=c[me],fe=a[me],!c.hasOwnProperty(me)||ue===fe||ue===void 0&&fe===void 0||lp(n,r,me,ue,c,fe);return}}for(var ie in a)ue=a[ie],a.hasOwnProperty(ie)&&ue!=null&&!c.hasOwnProperty(ie)&&Rt(n,r,ie,null,c,ue);for(ye in c)ue=c[ye],fe=a[ye],!c.hasOwnProperty(ye)||ue===fe||ue==null&&fe==null||Rt(n,r,ye,ue,c,fe)}function Kb(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ek(){if(typeof performance.getEntriesByType=="function"){for(var n=0,r=0,a=performance.getEntriesByType("resource"),c=0;c<a.length;c++){var x=a[c],E=x.transferSize,O=x.initiatorType,$=x.duration;if(E&&$&&Kb(O)){for(O=0,$=x.responseEnd,c+=1;c<a.length;c++){var Q=a[c],ce=Q.startTime;if(ce>$)break;var me=Q.transferSize,ye=Q.initiatorType;me&&Kb(ye)&&(Q=Q.responseEnd,O+=me*(Q<$?1:($-ce)/(Q-ce)))}if(--c,r+=8*(E+O)/(x.duration/1e3),n++,10<n)break}}if(0<n)return r/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var cp=null,up=null;function Mu(n){return n.nodeType===9?n:n.ownerDocument}function Vb(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Yb(n,r){if(n===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&r==="foreignObject"?0:n}function hp(n,r){return n==="textarea"||n==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var dp=null;function kk(){var n=window.event;return n&&n.type==="popstate"?n===dp?!1:(dp=n,!0):(dp=null,!1)}var Xb=typeof setTimeout=="function"?setTimeout:void 0,Tk=typeof clearTimeout=="function"?clearTimeout:void 0,Zb=typeof Promise=="function"?Promise:void 0,Ak=typeof queueMicrotask=="function"?queueMicrotask:typeof Zb<"u"?function(n){return Zb.resolve(null).then(n).catch(Rk)}:Xb;function Rk(n){setTimeout(function(){throw n})}function ps(n){return n==="head"}function Jb(n,r){var a=r,c=0;do{var x=a.nextSibling;if(n.removeChild(a),x&&x.nodeType===8)if(a=x.data,a==="/$"||a==="/&"){if(c===0){n.removeChild(x),Za(r);return}c--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")c++;else if(a==="html")xl(n.ownerDocument.documentElement);else if(a==="head"){a=n.ownerDocument.head,xl(a);for(var E=a.firstChild;E;){var O=E.nextSibling,$=E.nodeName;E[Zn]||$==="SCRIPT"||$==="STYLE"||$==="LINK"&&E.rel.toLowerCase()==="stylesheet"||a.removeChild(E),E=O}}else a==="body"&&xl(n.ownerDocument.body);a=x}while(a);Za(r)}function Qb(n,r){var a=n;n=0;do{var c=a.nextSibling;if(a.nodeType===1?r?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(r?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),c&&c.nodeType===8)if(a=c.data,a==="/$"){if(n===0)break;n--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||n++;a=c}while(a)}function fp(n){var r=n.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var a=r;switch(r=r.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":fp(a),Re(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}n.removeChild(a)}}function Lk(n,r,a,c){for(;n.nodeType===1;){var x=a;if(n.nodeName.toLowerCase()!==r.toLowerCase()){if(!c&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(c){if(!n[Zn])switch(r){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(E=n.getAttribute("rel"),E==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(E!==x.rel||n.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||n.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||n.getAttribute("title")!==(x.title==null?null:x.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(E=n.getAttribute("src"),(E!==(x.src==null?null:x.src)||n.getAttribute("type")!==(x.type==null?null:x.type)||n.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&E&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(r==="input"&&n.type==="hidden"){var E=x.name==null?null:""+x.name;if(x.type==="hidden"&&n.getAttribute("name")===E)return n}else return n;if(n=Fi(n.nextSibling),n===null)break}return null}function Mk(n,r,a){if(r==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=Fi(n.nextSibling),n===null))return null;return n}function ey(n,r){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!r||(n=Fi(n.nextSibling),n===null))return null;return n}function pp(n){return n.data==="$?"||n.data==="$~"}function mp(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function Nk(n,r){var a=n.ownerDocument;if(n.data==="$~")n._reactRetry=r;else if(n.data!=="$?"||a.readyState!=="loading")r();else{var c=function(){r(),a.removeEventListener("DOMContentLoaded",c)};a.addEventListener("DOMContentLoaded",c),n._reactRetry=c}}function Fi(n){for(;n!=null;n=n.nextSibling){var r=n.nodeType;if(r===1||r===3)break;if(r===8){if(r=n.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return n}var gp=null;function ty(n){n=n.nextSibling;for(var r=0;n;){if(n.nodeType===8){var a=n.data;if(a==="/$"||a==="/&"){if(r===0)return Fi(n.nextSibling);r--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||r++}n=n.nextSibling}return null}function ny(n){n=n.previousSibling;for(var r=0;n;){if(n.nodeType===8){var a=n.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(r===0)return n;r--}else a!=="/$"&&a!=="/&"||r++}n=n.previousSibling}return null}function iy(n,r,a){switch(r=Mu(a),n){case"html":if(n=r.documentElement,!n)throw Error(s(452));return n;case"head":if(n=r.head,!n)throw Error(s(453));return n;case"body":if(n=r.body,!n)throw Error(s(454));return n;default:throw Error(s(451))}}function xl(n){for(var r=n.attributes;r.length;)n.removeAttributeNode(r[0]);Re(n)}var Wi=new Map,ry=new Set;function Nu(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Pr=Y.d;Y.d={f:Ok,r:Dk,D:jk,C:Ik,L:Bk,m:Pk,X:Hk,S:zk,M:$k};function Ok(){var n=Pr.f(),r=wu();return n||r}function Dk(n){var r=ve(n);r!==null&&r.tag===5&&r.type==="form"?S0(r):Pr.r(n)}var Va=typeof document>"u"?null:document;function sy(n,r,a){var c=Va;if(c&&typeof r=="string"&&r){var x=oi(r);x='link[rel="'+n+'"][href="'+x+'"]',typeof a=="string"&&(x+='[crossorigin="'+a+'"]'),ry.has(x)||(ry.add(x),n={rel:n,crossOrigin:a,href:r},c.querySelector(x)===null&&(r=c.createElement("link"),In(r,"link",n),tt(r),c.head.appendChild(r)))}}function jk(n){Pr.D(n),sy("dns-prefetch",n,null)}function Ik(n,r){Pr.C(n,r),sy("preconnect",n,r)}function Bk(n,r,a){Pr.L(n,r,a);var c=Va;if(c&&n&&r){var x='link[rel="preload"][as="'+oi(r)+'"]';r==="image"&&a&&a.imageSrcSet?(x+='[imagesrcset="'+oi(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(x+='[imagesizes="'+oi(a.imageSizes)+'"]')):x+='[href="'+oi(n)+'"]';var E=x;switch(r){case"style":E=Ya(n);break;case"script":E=Xa(n)}Wi.has(E)||(n=m({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:n,as:r},a),Wi.set(E,n),c.querySelector(x)!==null||r==="style"&&c.querySelector(wl(E))||r==="script"&&c.querySelector(Cl(E))||(r=c.createElement("link"),In(r,"link",n),tt(r),c.head.appendChild(r)))}}function Pk(n,r){Pr.m(n,r);var a=Va;if(a&&n){var c=r&&typeof r.as=="string"?r.as:"script",x='link[rel="modulepreload"][as="'+oi(c)+'"][href="'+oi(n)+'"]',E=x;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":E=Xa(n)}if(!Wi.has(E)&&(n=m({rel:"modulepreload",href:n},r),Wi.set(E,n),a.querySelector(x)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Cl(E)))return}c=a.createElement("link"),In(c,"link",n),tt(c),a.head.appendChild(c)}}}function zk(n,r,a){Pr.S(n,r,a);var c=Va;if(c&&n){var x=et(c).hoistableStyles,E=Ya(n);r=r||"default";var O=x.get(E);if(!O){var $={loading:0,preload:null};if(O=c.querySelector(wl(E)))$.loading=5;else{n=m({rel:"stylesheet",href:n,"data-precedence":r},a),(a=Wi.get(E))&&_p(n,a);var Q=O=c.createElement("link");tt(Q),In(Q,"link",n),Q._p=new Promise(function(ce,me){Q.onload=ce,Q.onerror=me}),Q.addEventListener("load",function(){$.loading|=1}),Q.addEventListener("error",function(){$.loading|=2}),$.loading|=4,Ou(O,r,c)}O={type:"stylesheet",instance:O,count:1,state:$},x.set(E,O)}}}function Hk(n,r){Pr.X(n,r);var a=Va;if(a&&n){var c=et(a).hoistableScripts,x=Xa(n),E=c.get(x);E||(E=a.querySelector(Cl(x)),E||(n=m({src:n,async:!0},r),(r=Wi.get(x))&&vp(n,r),E=a.createElement("script"),tt(E),In(E,"link",n),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},c.set(x,E))}}function $k(n,r){Pr.M(n,r);var a=Va;if(a&&n){var c=et(a).hoistableScripts,x=Xa(n),E=c.get(x);E||(E=a.querySelector(Cl(x)),E||(n=m({src:n,async:!0,type:"module"},r),(r=Wi.get(x))&&vp(n,r),E=a.createElement("script"),tt(E),In(E,"link",n),a.head.appendChild(E)),E={type:"script",instance:E,count:1,state:null},c.set(x,E))}}function ay(n,r,a,c){var x=(x=pe.current)?Nu(x):null;if(!x)throw Error(s(446));switch(n){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=Ya(a.href),a=et(x).hoistableStyles,c=a.get(r),c||(c={type:"style",instance:null,count:0,state:null},a.set(r,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){n=Ya(a.href);var E=et(x).hoistableStyles,O=E.get(n);if(O||(x=x.ownerDocument||x,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},E.set(n,O),(E=x.querySelector(wl(n)))&&!E._p&&(O.instance=E,O.state.loading=5),Wi.has(n)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Wi.set(n,a),E||Uk(x,n,a,O.state))),r&&c===null)throw Error(s(528,""));return O}if(r&&c!==null)throw Error(s(529,""));return null;case"script":return r=a.async,a=a.src,typeof a=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Xa(a),a=et(x).hoistableScripts,c=a.get(r),c||(c={type:"script",instance:null,count:0,state:null},a.set(r,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,n))}}function Ya(n){return'href="'+oi(n)+'"'}function wl(n){return'link[rel="stylesheet"]['+n+"]"}function oy(n){return m({},n,{"data-precedence":n.precedence,precedence:null})}function Uk(n,r,a,c){n.querySelector('link[rel="preload"][as="style"]['+r+"]")?c.loading=1:(r=n.createElement("link"),c.preload=r,r.addEventListener("load",function(){return c.loading|=1}),r.addEventListener("error",function(){return c.loading|=2}),In(r,"link",a),tt(r),n.head.appendChild(r))}function Xa(n){return'[src="'+oi(n)+'"]'}function Cl(n){return"script[async]"+n}function ly(n,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var c=n.querySelector('style[data-href~="'+oi(a.href)+'"]');if(c)return r.instance=c,tt(c),c;var x=m({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),tt(c),In(c,"style",x),Ou(c,a.precedence,n),r.instance=c;case"stylesheet":x=Ya(a.href);var E=n.querySelector(wl(x));if(E)return r.state.loading|=4,r.instance=E,tt(E),E;c=oy(a),(x=Wi.get(x))&&_p(c,x),E=(n.ownerDocument||n).createElement("link"),tt(E);var O=E;return O._p=new Promise(function($,Q){O.onload=$,O.onerror=Q}),In(E,"link",c),r.state.loading|=4,Ou(E,a.precedence,n),r.instance=E;case"script":return E=Xa(a.src),(x=n.querySelector(Cl(E)))?(r.instance=x,tt(x),x):(c=a,(x=Wi.get(E))&&(c=m({},a),vp(c,x)),n=n.ownerDocument||n,x=n.createElement("script"),tt(x),In(x,"link",c),n.head.appendChild(x),r.instance=x);case"void":return null;default:throw Error(s(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(c=r.instance,r.state.loading|=4,Ou(c,a.precedence,n));return r.instance}function Ou(n,r,a){for(var c=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=c.length?c[c.length-1]:null,E=x,O=0;O<c.length;O++){var $=c[O];if($.dataset.precedence===r)E=$;else if(E!==x)break}E?E.parentNode.insertBefore(n,E.nextSibling):(r=a.nodeType===9?a.head:a,r.insertBefore(n,r.firstChild))}function _p(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.title==null&&(n.title=r.title)}function vp(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.integrity==null&&(n.integrity=r.integrity)}var Du=null;function cy(n,r,a){if(Du===null){var c=new Map,x=Du=new Map;x.set(a,c)}else x=Du,c=x.get(a),c||(c=new Map,x.set(a,c));if(c.has(n))return c;for(c.set(n,null),a=a.getElementsByTagName(n),x=0;x<a.length;x++){var E=a[x];if(!(E[Zn]||E[We]||n==="link"&&E.getAttribute("rel")==="stylesheet")&&E.namespaceURI!=="http://www.w3.org/2000/svg"){var O=E.getAttribute(r)||"";O=n+O;var $=c.get(O);$?$.push(E):c.set(O,[E])}}return c}function uy(n,r,a){n=n.ownerDocument||n,n.head.insertBefore(a,r==="title"?n.querySelector("head > title"):null)}function Fk(n,r,a){if(a===1||r.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(n=r.disabled,typeof r.precedence=="string"&&n==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function hy(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function Wk(n,r,a,c){if(a.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var x=Ya(c.href),E=r.querySelector(wl(x));if(E){r=E._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(n.count++,n=ju.bind(n),r.then(n,n)),a.state.loading|=4,a.instance=E,tt(E);return}E=r.ownerDocument||r,c=oy(c),(x=Wi.get(x))&&_p(c,x),E=E.createElement("link"),tt(E);var O=E;O._p=new Promise(function($,Q){O.onload=$,O.onerror=Q}),In(E,"link",c),a.instance=E}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(n.count++,a=ju.bind(n),r.addEventListener("load",a),r.addEventListener("error",a))}}var bp=0;function Gk(n,r){return n.stylesheets&&n.count===0&&Bu(n,n.stylesheets),0<n.count||0<n.imgCount?function(a){var c=setTimeout(function(){if(n.stylesheets&&Bu(n,n.stylesheets),n.unsuspend){var E=n.unsuspend;n.unsuspend=null,E()}},6e4+r);0<n.imgBytes&&bp===0&&(bp=62500*Ek());var x=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Bu(n,n.stylesheets),n.unsuspend)){var E=n.unsuspend;n.unsuspend=null,E()}},(n.imgBytes>bp?50:800)+r);return n.unsuspend=a,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(x)}}:null}function ju(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Iu=null;function Bu(n,r){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Iu=new Map,r.forEach(qk,n),Iu=null,ju.call(n))}function qk(n,r){if(!(r.state.loading&4)){var a=Iu.get(n);if(a)var c=a.get(null);else{a=new Map,Iu.set(n,a);for(var x=n.querySelectorAll("link[data-precedence],style[data-precedence]"),E=0;E<x.length;E++){var O=x[E];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(a.set(O.dataset.precedence,O),c=O)}c&&a.set(null,c)}x=r.instance,O=x.getAttribute("data-precedence"),E=a.get(O)||c,E===c&&a.set(null,x),a.set(O,x),this.count++,c=ju.bind(this),x.addEventListener("load",c),x.addEventListener("error",c),E?E.parentNode.insertBefore(x,E.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(x,n.firstChild)),r.state.loading|=4}}var El={$$typeof:y,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function Kk(n,r,a,c,x,E,O,$,Q){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ct(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ct(0),this.hiddenUpdates=Ct(null),this.identifierPrefix=c,this.onUncaughtError=x,this.onCaughtError=E,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function dy(n,r,a,c,x,E,O,$,Q,ce,me,ye){return n=new Kk(n,r,a,O,Q,ce,me,ye,$),r=1,E===!0&&(r|=24),E=Ci(3,null,null,r),n.current=E,E.stateNode=n,r=Zd(),r.refCount++,n.pooledCache=r,r.refCount++,E.memoizedState={element:c,isDehydrated:a,cache:r},tf(E),n}function fy(n){return n?(n=Ta,n):Ta}function py(n,r,a,c,x,E){x=fy(x),c.context===null?c.context=x:c.pendingContext=x,c=is(r),c.payload={element:a},E=E===void 0?null:E,E!==null&&(c.callback=E),a=rs(n,c,r),a!==null&&(fi(a,n,r),il(a,n,r))}function my(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var a=n.retryLane;n.retryLane=a!==0&&a<r?a:r}}function yp(n,r){my(n,r),(n=n.alternate)&&my(n,r)}function gy(n){if(n.tag===13||n.tag===31){var r=zs(n,67108864);r!==null&&fi(r,n,67108864),yp(n,67108864)}}function _y(n){if(n.tag===13||n.tag===31){var r=Ri();r=he(r);var a=zs(n,r);a!==null&&fi(a,n,r),yp(n,r)}}var Pu=!0;function Vk(n,r,a,c){var x=P.T;P.T=null;var E=Y.p;try{Y.p=2,Sp(n,r,a,c)}finally{Y.p=E,P.T=x}}function Yk(n,r,a,c){var x=P.T;P.T=null;var E=Y.p;try{Y.p=8,Sp(n,r,a,c)}finally{Y.p=E,P.T=x}}function Sp(n,r,a,c){if(Pu){var x=xp(c);if(x===null)op(n,r,c,zu,a),by(n,c);else if(Zk(x,n,r,a,c))c.stopPropagation();else if(by(n,c),r&4&&-1<Xk.indexOf(n)){for(;x!==null;){var E=ve(x);if(E!==null)switch(E.tag){case 3:if(E=E.stateNode,E.current.memoizedState.isDehydrated){var O=tn(E.pendingLanes);if(O!==0){var $=E;for($.pendingLanes|=2,$.entangledLanes|=2;O;){var Q=1<<31-pt(O);$.entanglements[1]|=Q,O&=~Q}mr(E),(St&6)===0&&(Su=ft()+500,bl(0))}}break;case 31:case 13:$=zs(E,2),$!==null&&fi($,E,2),wu(),yp(E,2)}if(E=xp(c),E===null&&op(n,r,c,zu,a),E===x)break;x=E}x!==null&&c.stopPropagation()}else op(n,r,c,null,a)}}function xp(n){return n=Ve(n),wp(n)}var zu=null;function wp(n){if(zu=null,n=Z(n),n!==null){var r=d(n);if(r===null)n=null;else{var a=r.tag;if(a===13){if(n=p(r),n!==null)return n;n=null}else if(a===31){if(n=l(r),n!==null)return n;n=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;n=null}else r!==n&&(n=null)}}return zu=n,null}function vy(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(qt()){case Ht:return 2;case yt:return 8;case Bt:case vi:return 32;case Zt:return 268435456;default:return 32}default:return 32}}var Cp=!1,ms=null,gs=null,_s=null,kl=new Map,Tl=new Map,vs=[],Xk="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 by(n,r){switch(n){case"focusin":case"focusout":ms=null;break;case"dragenter":case"dragleave":gs=null;break;case"mouseover":case"mouseout":_s=null;break;case"pointerover":case"pointerout":kl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Tl.delete(r.pointerId)}}function Al(n,r,a,c,x,E){return n===null||n.nativeEvent!==E?(n={blockedOn:r,domEventName:a,eventSystemFlags:c,nativeEvent:E,targetContainers:[x]},r!==null&&(r=ve(r),r!==null&&gy(r)),n):(n.eventSystemFlags|=c,r=n.targetContainers,x!==null&&r.indexOf(x)===-1&&r.push(x),n)}function Zk(n,r,a,c,x){switch(r){case"focusin":return ms=Al(ms,n,r,a,c,x),!0;case"dragenter":return gs=Al(gs,n,r,a,c,x),!0;case"mouseover":return _s=Al(_s,n,r,a,c,x),!0;case"pointerover":var E=x.pointerId;return kl.set(E,Al(kl.get(E)||null,n,r,a,c,x)),!0;case"gotpointercapture":return E=x.pointerId,Tl.set(E,Al(Tl.get(E)||null,n,r,a,c,x)),!0}return!1}function yy(n){var r=Z(n.target);if(r!==null){var a=d(r);if(a!==null){if(r=a.tag,r===13){if(r=p(a),r!==null){n.blockedOn=r,nt(n.priority,function(){_y(a)});return}}else if(r===31){if(r=l(a),r!==null){n.blockedOn=r,nt(n.priority,function(){_y(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){n.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}n.blockedOn=null}function Hu(n){if(n.blockedOn!==null)return!1;for(var r=n.targetContainers;0<r.length;){var a=xp(n.nativeEvent);if(a===null){a=n.nativeEvent;var c=new a.constructor(a.type,a);Oe=c,a.target.dispatchEvent(c),Oe=null}else return r=ve(a),r!==null&&gy(r),n.blockedOn=a,!1;r.shift()}return!0}function Sy(n,r,a){Hu(n)&&a.delete(r)}function Jk(){Cp=!1,ms!==null&&Hu(ms)&&(ms=null),gs!==null&&Hu(gs)&&(gs=null),_s!==null&&Hu(_s)&&(_s=null),kl.forEach(Sy),Tl.forEach(Sy)}function $u(n,r){n.blockedOn===r&&(n.blockedOn=null,Cp||(Cp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Jk)))}var Uu=null;function xy(n){Uu!==n&&(Uu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Uu===n&&(Uu=null);for(var r=0;r<n.length;r+=3){var a=n[r],c=n[r+1],x=n[r+2];if(typeof c!="function"){if(wp(c||a)===null)continue;break}var E=ve(a);E!==null&&(n.splice(r,3),r-=3,xf(E,{pending:!0,data:x,method:a.method,action:c},c,x))}}))}function Za(n){function r(Q){return $u(Q,n)}ms!==null&&$u(ms,n),gs!==null&&$u(gs,n),_s!==null&&$u(_s,n),kl.forEach(r),Tl.forEach(r);for(var a=0;a<vs.length;a++){var c=vs[a];c.blockedOn===n&&(c.blockedOn=null)}for(;0<vs.length&&(a=vs[0],a.blockedOn===null);)yy(a),a.blockedOn===null&&vs.shift();if(a=(n.ownerDocument||n).$$reactFormReplay,a!=null)for(c=0;c<a.length;c+=3){var x=a[c],E=a[c+1],O=x[Xe]||null;if(typeof E=="function")O||xy(a);else if(O){var $=null;if(E&&E.hasAttribute("formAction")){if(x=E,O=E[Xe]||null)$=O.formAction;else if(wp(x)!==null)continue}else $=O.action;typeof $=="function"?a[c+1]=$:(a.splice(c,3),c-=3),xy(a)}}}function wy(){function n(E){E.canIntercept&&E.info==="react-transition"&&E.intercept({handler:function(){return new Promise(function(O){return x=O})},focusReset:"manual",scroll:"manual"})}function r(){x!==null&&(x(),x=null),c||setTimeout(a,20)}function a(){if(!c&&!navigation.transition){var E=navigation.currentEntry;E&&E.url!=null&&navigation.navigate(E.url,{state:E.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,x=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(a,100),function(){c=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),x!==null&&(x(),x=null)}}}function Ep(n){this._internalRoot=n}Fu.prototype.render=Ep.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(s(409));var a=r.current,c=Ri();py(a,c,n,r,null,null)},Fu.prototype.unmount=Ep.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;py(n.current,2,null,n,null,null),wu(),r[pn]=null}};function Fu(n){this._internalRoot=n}Fu.prototype.unstable_scheduleHydration=function(n){if(n){var r=Dt();n={blockedOn:null,target:n,priority:r};for(var a=0;a<vs.length&&r!==0&&r<vs[a].priority;a++);vs.splice(a,0,n),a===0&&yy(n)}};var Cy=t.version;if(Cy!=="19.2.7")throw Error(s(527,Cy,"19.2.7"));Y.findDOMNode=function(n){var r=n._reactInternals;if(r===void 0)throw typeof n.render=="function"?Error(s(188)):(n=Object.keys(n).join(","),Error(s(268,n)));return n=f(r),n=n!==null?v(n):null,n=n===null?null:n.stateNode,n};var Qk={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wu.isDisabled&&Wu.supportsFiber)try{hn=Wu.inject(Qk),Ot=Wu}catch{}}return Ll.createRoot=function(n,r){if(!o(n))throw Error(s(299));var a=!1,c="",x=M0,E=N0,O=O0;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onUncaughtError!==void 0&&(x=r.onUncaughtError),r.onCaughtError!==void 0&&(E=r.onCaughtError),r.onRecoverableError!==void 0&&(O=r.onRecoverableError)),r=dy(n,1,!1,null,null,a,c,null,x,E,O,wy),n[pn]=r.current,ap(n),new Ep(r)},Ll.hydrateRoot=function(n,r,a){if(!o(n))throw Error(s(299));var c=!1,x="",E=M0,O=N0,$=O0,Q=null;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(x=a.identifierPrefix),a.onUncaughtError!==void 0&&(E=a.onUncaughtError),a.onCaughtError!==void 0&&(O=a.onCaughtError),a.onRecoverableError!==void 0&&($=a.onRecoverableError),a.formState!==void 0&&(Q=a.formState)),r=dy(n,1,!0,r,a??null,c,x,Q,E,O,$,wy),r.context=fy(null),a=r.current,c=Ri(),c=he(c),x=is(c),x.callback=null,rs(a,x,c),a=c,r.current.lanes=a,mt(r,a),mr(r),n[pn]=r.current,ap(n),new Fu(r)},Ll.version="19.2.7",Ll}var jy;function HT(){if(jy)return Rp.exports;jy=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(),Rp.exports=zT(),Rp.exports}var $T=HT();var Iy="popstate";function By(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function UT(e={}){function t(s,o){let d=o.state?.masked,{pathname:p,search:l,hash:h}=d||s.location;return zm("",{pathname:p,search:l,hash:h},o.state&&o.state.usr||null,o.state&&o.state.key||"default",d?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function i(s,o){return typeof o=="string"?o:hc(o)}return WT(t,i,null,e)}function Yt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ar(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function FT(){return Math.random().toString(36).substring(2,10)}function Py(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 zm(e,t,i=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?No(t):t,state:i,key:t&&t.key||s||FT(),mask:o}}function hc({pathname:e="/",search:t="",hash:i=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function No(e){let t={};if(e){let i=e.indexOf("#");i>=0&&(t.hash=e.substring(i),e=e.substring(0,i));let s=e.indexOf("?");s>=0&&(t.search=e.substring(s),e=e.substring(0,s)),e&&(t.pathname=e)}return t}function WT(e,t,i,s={}){let{window:o=document.defaultView,v5Compat:d=!1}=s,p=o.history,l="POP",h=null,f=v();f==null&&(f=0,p.replaceState({...p.state,idx:f},""));function v(){return(p.state||{idx:null}).idx}function m(){l="POP";let _=v(),b=_==null?null:_-f;f=_,h&&h({action:l,location:w.location,delta:b})}function S(_,b){l="PUSH";let g=By(_)?_:zm(w.location,_,b);f=v()+1;let y=Py(g,f),k=w.createHref(g.mask||g);try{p.pushState(y,"",k)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;o.location.assign(k)}d&&h&&h({action:l,location:w.location,delta:1})}function C(_,b){l="REPLACE";let g=By(_)?_:zm(w.location,_,b);f=v();let y=Py(g,f),k=w.createHref(g.mask||g);p.replaceState(y,"",k),d&&h&&h({action:l,location:w.location,delta:0})}function T(_){return GT(o,_)}let w={get action(){return l},get location(){return e(o,p)},listen(_){if(h)throw new Error("A history only accepts one active listener");return o.addEventListener(Iy,m),h=_,()=>{o.removeEventListener(Iy,m),h=null}},createHref(_){return t(o,_)},createURL:T,encodeLocation(_){let b=T(_);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:S,replace:C,go(_){return p.go(_)}};return w}function GT(e,t,i=!1){let s="http://localhost";e&&(s=e.location.origin!=="null"?e.location.origin:e.location.href),Yt(s,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:hc(t);return o=o.replace(/ $/,"%20"),!i&&o.startsWith("//")&&(o=s+o),new URL(o,s)}function Ox(e,t,i="/"){return qT(e,t,i,!1)}function qT(e,t,i,s,o){let d=typeof t=="string"?No(t):t,p=qr(d.pathname||"/",i);if(p==null)return null;let l=KT(e),h=null,f=sA(p);for(let v=0;h==null&&v<l.length;++v)h=iA(l[v],f,s);return h}function KT(e){let t=Dx(e);return VT(t),t}function Dx(e,t=[],i=[],s="",o=!1){let d=(p,l,h=o,f)=>{let v={relativePath:f===void 0?p.path||"":f,caseSensitive:p.caseSensitive===!0,childrenIndex:l,route:p};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(s)&&h)return;Yt(v.relativePath.startsWith(s),`Absolute route path "${v.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(s.length)}let m=rr([s,v.relativePath]),S=i.concat(v);p.children&&p.children.length>0&&(Yt(p.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),Dx(p.children,t,S,m,h)),!(p.path==null&&!p.index)&&t.push({path:m,score:tA(m,p.index),routesMeta:S})};return e.forEach((p,l)=>{if(p.path===""||!p.path?.includes("?"))d(p,l);else for(let h of jx(p.path))d(p,l,!0,h)}),t}function jx(e){let t=e.split("/");if(t.length===0)return[];let[i,...s]=t,o=i.endsWith("?"),d=i.replace(/\?$/,"");if(s.length===0)return o?[d,""]:[d];let p=jx(s.join("/")),l=[];return l.push(...p.map(h=>h===""?d:[d,h].join("/"))),o&&l.push(...p),l.map(h=>e.startsWith("/")&&h===""?"/":h)}function VT(e){e.sort((t,i)=>t.score!==i.score?i.score-t.score:nA(t.routesMeta.map(s=>s.childrenIndex),i.routesMeta.map(s=>s.childrenIndex)))}var YT=/^:[\w-]+$/,XT=3,ZT=2,JT=1,QT=10,eA=-2,zy=e=>e==="*";function tA(e,t){let i=e.split("/"),s=i.length;return i.some(zy)&&(s+=eA),t&&(s+=ZT),i.filter(o=>!zy(o)).reduce((o,d)=>o+(YT.test(d)?XT:d===""?JT:QT),s)}function nA(e,t){return e.length===t.length&&e.slice(0,-1).every((s,o)=>s===t[o])?e[e.length-1]-t[t.length-1]:0}function iA(e,t,i=!1){let{routesMeta:s}=e,o={},d="/",p=[];for(let l=0;l<s.length;++l){let h=s[l],f=l===s.length-1,v=d==="/"?t:t.slice(d.length)||"/",m=Nh({path:h.relativePath,caseSensitive:h.caseSensitive,end:f},v),S=h.route;if(!m&&f&&i&&!s[s.length-1].route.index&&(m=Nh({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},v)),!m)return null;Object.assign(o,m.params),p.push({params:o,pathname:rr([d,m.pathname]),pathnameBase:cA(rr([d,m.pathnameBase])),route:S}),m.pathnameBase!=="/"&&(d=rr([d,m.pathnameBase]))}return p}function Nh(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[i,s]=rA(e.path,e.caseSensitive,e.end),o=t.match(i);if(!o)return null;let d=o[0],p=d.replace(/(.)\/+$/,"$1"),l=o.slice(1);return{params:s.reduce((f,{paramName:v,isOptional:m},S)=>{if(v==="*"){let T=l[S]||"";p=d.slice(0,d.length-T.length).replace(/(.)\/+$/,"$1")}const C=l[S];return m&&!C?f[v]=void 0:f[v]=(C||"").replace(/%2F/g,"/"),f},{}),pathname:d,pathnameBase:p,pattern:e}}function rA(e,t=!1,i=!0){ar(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(p,l,h,f,v)=>{if(s.push({paramName:l,isOptional:h!=null}),h){let m=v.charAt(f+p.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),s]}function sA(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ar(!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 qr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let i=t.endsWith("/")?t.length-1:t.length,s=e.charAt(i);return s&&s!=="/"?null:e.slice(i)||"/"}var aA=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function oA(e,t="/"){let{pathname:i,search:s="",hash:o=""}=typeof e=="string"?No(e):e,d;return i?(i=Ix(i),i.startsWith("/")?d=Hy(i.substring(1),"/"):d=Hy(i,t)):d=t,{pathname:d,search:uA(s),hash:hA(o)}}function Hy(e,t){let i=Oh(t).split("/");return e.split("/").forEach(o=>{o===".."?i.length>1&&i.pop():o!=="."&&i.push(o)}),i.length>1?i.join("/"):"/"}function Op(e,t,i,s){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function lA(e){return e.filter((t,i)=>i===0||t.route.path&&t.route.path.length>0)}function Zg(e){let t=lA(e);return t.map((i,s)=>s===t.length-1?i.pathname:i.pathnameBase)}function rd(e,t,i,s=!1){let o;typeof e=="string"?o=No(e):(o={...e},Yt(!o.pathname||!o.pathname.includes("?"),Op("?","pathname","search",o)),Yt(!o.pathname||!o.pathname.includes("#"),Op("#","pathname","hash",o)),Yt(!o.search||!o.search.includes("#"),Op("#","search","hash",o)));let d=e===""||o.pathname==="",p=d?"/":o.pathname,l;if(p==null)l=i;else{let m=t.length-1;if(!s&&p.startsWith("..")){let S=p.split("/");for(;S[0]==="..";)S.shift(),m-=1;o.pathname=S.join("/")}l=m>=0?t[m]:"/"}let h=oA(o,l),f=p&&p!=="/"&&p.endsWith("/"),v=(d||p===".")&&i.endsWith("/");return!h.pathname.endsWith("/")&&(f||v)&&(h.pathname+="/"),h}var Ix=e=>e.replace(/\/\/+/g,"/"),rr=e=>Ix(e.join("/")),Oh=e=>e.replace(/\/+$/,""),cA=e=>Oh(e).replace(/^\/*/,"/"),uA=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,hA=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,dA=class{constructor(e,t,i,s=!1){this.status=e,this.statusText=t||"",this.internal=s,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function fA(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function pA(e){let t=e.map(i=>i.route.path).filter(Boolean);return rr(t)||"/"}var Bx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Px(e,t){let i=e;if(typeof i!="string"||!aA.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let s=i,o=!1;if(Bx)try{let d=new URL(window.location.href),p=i.startsWith("//")?new URL(d.protocol+i):new URL(i),l=qr(p.pathname,t);p.origin===d.origin&&l!=null?i=l+p.search+p.hash:o=!0}catch{ar(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:o,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var zx=["POST","PUT","PATCH","DELETE"];new Set(zx);var mA=["GET",...zx];new Set(mA);var Oo=L.createContext(null);Oo.displayName="DataRouter";var sd=L.createContext(null);sd.displayName="DataRouterState";var Hx=L.createContext(!1);function gA(){return L.useContext(Hx)}var $x=L.createContext({isTransitioning:!1});$x.displayName="ViewTransition";var _A=L.createContext(new Map);_A.displayName="Fetchers";var vA=L.createContext(null);vA.displayName="Await";var Di=L.createContext(null);Di.displayName="Navigation";var Rc=L.createContext(null);Rc.displayName="Location";var yr=L.createContext({outlet:null,matches:[],isDataRoute:!1});yr.displayName="Route";var Jg=L.createContext(null);Jg.displayName="RouteError";var Ux="REACT_ROUTER_ERROR",bA="REDIRECT",yA="ROUTE_ERROR_RESPONSE";function SA(e){if(e.startsWith(`${Ux}:${bA}:{`))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 xA(e){if(e.startsWith(`${Ux}:${yA}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new dA(t.status,t.statusText,t.data)}catch{}}function wA(e,{relative:t}={}){Yt(Do(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:s}=L.useContext(Di),{hash:o,pathname:d,search:p}=Mc(e,{relative:t}),l=d;return i!=="/"&&(l=d==="/"?i:rr([i,d])),s.createHref({pathname:l,search:p,hash:o})}function Do(){return L.useContext(Rc)!=null}function lr(){return Yt(Do(),"useLocation() may be used only in the context of a <Router> component."),L.useContext(Rc).location}var Fx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Wx(e){L.useContext(Di).static||L.useLayoutEffect(e)}function Lc(){let{isDataRoute:e}=L.useContext(yr);return e?IA():CA()}function CA(){Yt(Do(),"useNavigate() may be used only in the context of a <Router> component.");let e=L.useContext(Oo),{basename:t,navigator:i}=L.useContext(Di),{matches:s}=L.useContext(yr),{pathname:o}=lr(),d=JSON.stringify(Zg(s)),p=L.useRef(!1);return Wx(()=>{p.current=!0}),L.useCallback((h,f={})=>{if(ar(p.current,Fx),!p.current)return;if(typeof h=="number"){i.go(h);return}let v=rd(h,JSON.parse(d),o,f.relative==="path");e==null&&t!=="/"&&(v.pathname=v.pathname==="/"?t:rr([t,v.pathname])),(f.replace?i.replace:i.push)(v,f.state,f)},[t,i,d,o,e])}L.createContext(null);function Mc(e,{relative:t}={}){let{matches:i}=L.useContext(yr),{pathname:s}=lr(),o=JSON.stringify(Zg(i));return L.useMemo(()=>rd(e,JSON.parse(o),s,t==="path"),[e,o,s,t])}function EA(e,t){return Gx(e,t)}function Gx(e,t,i){Yt(Do(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=L.useContext(Di),{matches:o}=L.useContext(yr),d=o[o.length-1],p=d?d.params:{},l=d?d.pathname:"/",h=d?d.pathnameBase:"/",f=d&&d.route;{let _=f&&f.path||"";Kx(l,!f||_.endsWith("*")||_.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${_}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
10
+
11
+ Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let v=lr(),m;if(t){let _=typeof t=="string"?No(t):t;Yt(h==="/"||_.pathname?.startsWith(h),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${_.pathname}" was given in the \`location\` prop.`),m=_}else m=v;let S=m.pathname||"/",C=S;if(h!=="/"){let _=h.replace(/^\//,"").split("/");C="/"+S.replace(/^\//,"").split("/").slice(_.length).join("/")}let T=i&&i.state.matches.length?i.state.matches.map(_=>Object.assign(_,{route:i.manifest[_.route.id]||_.route})):Ox(e,{pathname:C});ar(f||T!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),ar(T==null||T[T.length-1].route.element!==void 0||T[T.length-1].route.Component!==void 0||T[T.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let w=LA(T&&T.map(_=>Object.assign({},_,{params:Object.assign({},p,_.params),pathname:rr([h,s.encodeLocation?s.encodeLocation(_.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?h:rr([h,s.encodeLocation?s.encodeLocation(_.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),o,i);return t&&w?L.createElement(Rc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},w):w}function kA(){let e=jA(),t=fA(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),i=e instanceof Error?e.stack:null,s="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:s},d={padding:"2px 4px",backgroundColor:s},p=null;return console.error("Error handled by React Router default ErrorBoundary:",e),p=L.createElement(L.Fragment,null,L.createElement("p",null,"💿 Hey developer 👋"),L.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",L.createElement("code",{style:d},"ErrorBoundary")," or"," ",L.createElement("code",{style:d},"errorElement")," prop on your route.")),L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},t),i?L.createElement("pre",{style:o},i):null,p)}var TA=L.createElement(kA,null),qx=class extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const i=xA(e.digest);i&&(e=i)}let t=e!==void 0?L.createElement(yr.Provider,{value:this.props.routeContext},L.createElement(Jg.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?L.createElement(AA,{error:e},t):t}};qx.contextType=Hx;var Dp=new WeakMap;function AA({children:e,error:t}){let{basename:i}=L.useContext(Di);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=SA(t.digest);if(s){let o=Dp.get(t);if(o)throw o;let d=Px(s.location,i);if(Bx&&!Dp.get(t))if(d.isExternal||s.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const p=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:s.replace}));throw Dp.set(t,p),p}return L.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return e}function RA({routeContext:e,match:t,children:i}){let s=L.useContext(Oo);return s&&s.static&&s.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=t.route.id),L.createElement(yr.Provider,{value:e},i)}function LA(e,t=[],i){let s=i?.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(t.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let o=e,d=s?.errors;if(d!=null){let v=o.findIndex(m=>m.route.id&&d?.[m.route.id]!==void 0);Yt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),o=o.slice(0,Math.min(o.length,v+1))}let p=!1,l=-1;if(i&&s){p=s.renderFallback;for(let v=0;v<o.length;v++){let m=o[v];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(l=v),m.route.id){let{loaderData:S,errors:C}=s,T=m.route.loader&&!S.hasOwnProperty(m.route.id)&&(!C||C[m.route.id]===void 0);if(m.route.lazy||T){i.isStatic&&(p=!0),l>=0?o=o.slice(0,l+1):o=[o[0]];break}}}}let h=i?.onError,f=s&&h?(v,m)=>{h(v,{location:s.location,params:s.matches?.[0]?.params??{},pattern:pA(s.matches),errorInfo:m})}:void 0;return o.reduceRight((v,m,S)=>{let C,T=!1,w=null,_=null;s&&(C=d&&m.route.id?d[m.route.id]:void 0,w=m.route.errorElement||TA,p&&(l<0&&S===0?(Kx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,_=null):l===S&&(T=!0,_=m.route.hydrateFallbackElement||null)));let b=t.concat(o.slice(0,S+1)),g=()=>{let y;return C?y=w:T?y=_:m.route.Component?y=L.createElement(m.route.Component,null):m.route.element?y=m.route.element:y=v,L.createElement(RA,{match:m,routeContext:{outlet:v,matches:b,isDataRoute:s!=null},children:y})};return s&&(m.route.ErrorBoundary||m.route.errorElement||S===0)?L.createElement(qx,{location:s.location,revalidation:s.revalidation,component:w,error:C,children:g(),routeContext:{outlet:null,matches:b,isDataRoute:!0},onError:f}):g()},null)}function Qg(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function MA(e){let t=L.useContext(Oo);return Yt(t,Qg(e)),t}function NA(e){let t=L.useContext(sd);return Yt(t,Qg(e)),t}function OA(e){let t=L.useContext(yr);return Yt(t,Qg(e)),t}function e_(e){let t=OA(e),i=t.matches[t.matches.length-1];return Yt(i.route.id,`${e} can only be used on routes that contain a unique "id"`),i.route.id}function DA(){return e_("useRouteId")}function jA(){let e=L.useContext(Jg),t=NA("useRouteError"),i=e_("useRouteError");return e!==void 0?e:t.errors?.[i]}function IA(){let{router:e}=MA("useNavigate"),t=e_("useNavigate"),i=L.useRef(!1);return Wx(()=>{i.current=!0}),L.useCallback(async(o,d={})=>{ar(i.current,Fx),i.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:t,...d}))},[e,t])}var $y={};function Kx(e,t,i){!t&&!$y[e]&&($y[e]=!0,ar(!1,i))}L.memo(BA);function BA({routes:e,manifest:t,future:i,state:s,isStatic:o,onError:d}){return Gx(e,void 0,{manifest:t,state:s,isStatic:o,onError:d})}function Uy({to:e,replace:t,state:i,relative:s}){Yt(Do(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=L.useContext(Di);ar(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:d}=L.useContext(yr),{pathname:p}=lr(),l=Lc(),h=rd(e,Zg(d),p,s==="path"),f=JSON.stringify(h);return L.useEffect(()=>{l(JSON.parse(f),{replace:t,state:i,relative:s})},[l,f,s,t,i]),null}function ro(e){Yt(!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 PA({basename:e="/",children:t=null,location:i,navigationType:s="POP",navigator:o,static:d=!1,useTransitions:p}){Yt(!Do(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=e.replace(/^\/*/,"/"),h=L.useMemo(()=>({basename:l,navigator:o,static:d,useTransitions:p,future:{}}),[l,o,d,p]);typeof i=="string"&&(i=No(i));let{pathname:f="/",search:v="",hash:m="",state:S=null,key:C="default",mask:T}=i,w=L.useMemo(()=>{let _=qr(f,l);return _==null?null:{location:{pathname:_,search:v,hash:m,state:S,key:C,mask:T},navigationType:s}},[l,f,v,m,S,C,s,T]);return ar(w!=null,`<Router basename="${l}"> is not able to match the URL "${f}${v}${m}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:L.createElement(Di.Provider,{value:h},L.createElement(Rc.Provider,{children:t,value:w}))}function zA({children:e,location:t}){return EA(Hm(e),t)}function Hm(e,t=[]){let i=[];return L.Children.forEach(e,(s,o)=>{if(!L.isValidElement(s))return;let d=[...t,o];if(s.type===L.Fragment){i.push.apply(i,Hm(s.props.children,d));return}Yt(s.type===ro,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Yt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let p={id:s.props.id||d.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(p.children=Hm(s.props.children,d)),i.push(p)}),i}var ph="get",mh="application/x-www-form-urlencoded";function ad(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function HA(e){return ad(e)&&e.tagName.toLowerCase()==="button"}function $A(e){return ad(e)&&e.tagName.toLowerCase()==="form"}function UA(e){return ad(e)&&e.tagName.toLowerCase()==="input"}function FA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function WA(e,t){return e.button===0&&(!t||t==="_self")&&!FA(e)}var Gu=null;function GA(){if(Gu===null)try{new FormData(document.createElement("form"),0),Gu=!1}catch{Gu=!0}return Gu}var qA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function jp(e){return e!=null&&!qA.has(e)?(ar(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${mh}"`),null):e}function KA(e,t){let i,s,o,d,p;if($A(e)){let l=e.getAttribute("action");s=l?qr(l,t):null,i=e.getAttribute("method")||ph,o=jp(e.getAttribute("enctype"))||mh,d=new FormData(e)}else if(HA(e)||UA(e)&&(e.type==="submit"||e.type==="image")){let l=e.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=e.getAttribute("formaction")||l.getAttribute("action");if(s=h?qr(h,t):null,i=e.getAttribute("formmethod")||l.getAttribute("method")||ph,o=jp(e.getAttribute("formenctype"))||jp(l.getAttribute("enctype"))||mh,d=new FormData(l,e),!GA()){let{name:f,type:v,value:m}=e;if(v==="image"){let S=f?`${f}.`:"";d.append(`${S}x`,"0"),d.append(`${S}y`,"0")}else f&&d.append(f,m)}}else{if(ad(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=ph,s=null,o=mh,p=e}return d&&o==="text/plain"&&(p=d,d=void 0),{action:s,method:i.toLowerCase(),encType:o,formData:d,body:p}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function t_(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Vx(e,t,i,s){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return i?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${s}`:o.pathname=`${o.pathname}.${s}`:o.pathname==="/"?o.pathname=`_root.${s}`:t&&qr(o.pathname,t)==="/"?o.pathname=`${Oh(t)}/_root.${s}`:o.pathname=`${Oh(o.pathname)}.${s}`,o}async function VA(e,t){if(e.id in t)return t[e.id];try{let i=await import(e.module);return t[e.id]=i,i}catch(i){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function YA(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 XA(e,t,i){let s=await Promise.all(e.map(async o=>{let d=t.routes[o.route.id];if(d){let p=await VA(d,i);return p.links?p.links():[]}return[]}));return eR(s.flat(1).filter(YA).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function Fy(e,t,i,s,o,d){let p=(h,f)=>i[f]?h.route.id!==i[f].route.id:!0,l=(h,f)=>i[f].pathname!==h.pathname||i[f].route.path?.endsWith("*")&&i[f].params["*"]!==h.params["*"];return d==="assets"?t.filter((h,f)=>p(h,f)||l(h,f)):d==="data"?t.filter((h,f)=>{let v=s.routes[h.route.id];if(!v||!v.hasLoader)return!1;if(p(h,f)||l(h,f))return!0;if(h.route.shouldRevalidate){let m=h.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function ZA(e,t,{includeHydrateFallback:i}={}){return JA(e.map(s=>{let o=t.routes[s.route.id];if(!o)return[];let d=[o.module];return o.clientActionModule&&(d=d.concat(o.clientActionModule)),o.clientLoaderModule&&(d=d.concat(o.clientLoaderModule)),i&&o.hydrateFallbackModule&&(d=d.concat(o.hydrateFallbackModule)),o.imports&&(d=d.concat(o.imports)),d}).flat(1))}function JA(e){return[...new Set(e)]}function QA(e){let t={},i=Object.keys(e).sort();for(let s of i)t[s]=e[s];return t}function eR(e,t){let i=new Set;return new Set(t),e.reduce((s,o)=>{let d=JSON.stringify(QA(o));return i.has(d)||(i.add(d),s.push({key:d,link:o})),s},[])}function n_(){let e=L.useContext(Oo);return t_(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function tR(){let e=L.useContext(sd);return t_(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var i_=L.createContext(void 0);i_.displayName="FrameworkContext";function r_(){let e=L.useContext(i_);return t_(e,"You must render this element inside a <HydratedRouter> element"),e}function nR(e,t){let i=L.useContext(i_),[s,o]=L.useState(!1),[d,p]=L.useState(!1),{onFocus:l,onBlur:h,onMouseEnter:f,onMouseLeave:v,onTouchStart:m}=t,S=L.useRef(null);L.useEffect(()=>{if(e==="render"&&p(!0),e==="viewport"){let w=b=>{b.forEach(g=>{p(g.isIntersecting)})},_=new IntersectionObserver(w,{threshold:.5});return S.current&&_.observe(S.current),()=>{_.disconnect()}}},[e]),L.useEffect(()=>{if(s){let w=setTimeout(()=>{p(!0)},100);return()=>{clearTimeout(w)}}},[s]);let C=()=>{o(!0)},T=()=>{o(!1),p(!1)};return i?e!=="intent"?[d,S,{}]:[d,S,{onFocus:Ml(l,C),onBlur:Ml(h,T),onMouseEnter:Ml(f,C),onMouseLeave:Ml(v,T),onTouchStart:Ml(m,C)}]:[!1,S,{}]}function Ml(e,t){return i=>{e&&e(i),i.defaultPrevented||t(i)}}function iR({page:e,...t}){let i=gA(),{router:s}=n_(),o=L.useMemo(()=>Ox(s.routes,e,s.basename),[s.routes,e,s.basename]);return o?i?L.createElement(sR,{page:e,matches:o,...t}):L.createElement(aR,{page:e,matches:o,...t}):null}function rR(e){let{manifest:t,routeModules:i}=r_(),[s,o]=L.useState([]);return L.useEffect(()=>{let d=!1;return XA(e,t,i).then(p=>{d||o(p)}),()=>{d=!0}},[e,t,i]),s}function sR({page:e,matches:t,...i}){let s=lr(),{future:o}=r_(),{basename:d}=n_(),p=L.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let l=Vx(e,d,o.v8_trailingSlashAwareDataRequests,"rsc"),h=!1,f=[];for(let v of t)typeof v.route.shouldRevalidate=="function"?h=!0:f.push(v.route.id);return h&&f.length>0&&l.searchParams.set("_routes",f.join(",")),[l.pathname+l.search]},[d,o.v8_trailingSlashAwareDataRequests,e,s,t]);return L.createElement(L.Fragment,null,p.map(l=>L.createElement("link",{key:l,rel:"prefetch",as:"fetch",href:l,...i})))}function aR({page:e,matches:t,...i}){let s=lr(),{future:o,manifest:d,routeModules:p}=r_(),{basename:l}=n_(),{loaderData:h,matches:f}=tR(),v=L.useMemo(()=>Fy(e,t,f,d,s,"data"),[e,t,f,d,s]),m=L.useMemo(()=>Fy(e,t,f,d,s,"assets"),[e,t,f,d,s]),S=L.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let w=new Set,_=!1;if(t.forEach(g=>{let y=d.routes[g.route.id];!y||!y.hasLoader||(!v.some(k=>k.route.id===g.route.id)&&g.route.id in h&&p[g.route.id]?.shouldRevalidate||y.hasClientLoader?_=!0:w.add(g.route.id))}),w.size===0)return[];let b=Vx(e,l,o.v8_trailingSlashAwareDataRequests,"data");return _&&w.size>0&&b.searchParams.set("_routes",t.filter(g=>w.has(g.route.id)).map(g=>g.route.id).join(",")),[b.pathname+b.search]},[l,o.v8_trailingSlashAwareDataRequests,h,s,d,v,t,e,p]),C=L.useMemo(()=>ZA(m,d),[m,d]),T=rR(m);return L.createElement(L.Fragment,null,S.map(w=>L.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...i})),C.map(w=>L.createElement("link",{key:w,rel:"modulepreload",href:w,...i})),T.map(({key:w,link:_})=>L.createElement("link",{key:w,nonce:i.nonce,..._,crossOrigin:_.crossOrigin??i.crossOrigin})))}function oR(...e){return t=>{e.forEach(i=>{typeof i=="function"?i(t):i!=null&&(i.current=t)})}}var lR=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{lR&&(window.__reactRouterVersion="7.17.0")}catch{}function cR({basename:e,children:t,useTransitions:i,window:s}){let o=L.useRef();o.current==null&&(o.current=UT({window:s,v5Compat:!0}));let d=o.current,[p,l]=L.useState({action:d.action,location:d.location}),h=L.useCallback(f=>{i===!1?l(f):L.startTransition(()=>l(f))},[i]);return L.useLayoutEffect(()=>d.listen(h),[d,h]),L.createElement(PA,{basename:e,children:t,location:p.location,navigationType:p.action,navigator:d,useTransitions:i})}var Yx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dc=L.forwardRef(function({onClick:t,discover:i="render",prefetch:s="none",relative:o,reloadDocument:d,replace:p,mask:l,state:h,target:f,to:v,preventScrollReset:m,viewTransition:S,defaultShouldRevalidate:C,...T},w){let{basename:_,navigator:b,useTransitions:g}=L.useContext(Di),y=typeof v=="string"&&Yx.test(v),k=Px(v,_);v=k.to;let M=wA(v,{relative:o}),A=lr(),N=null;if(l){let H=rd(l,[],A.mask?A.mask.pathname:"/",!0);_!=="/"&&(H.pathname=H.pathname==="/"?_:rr([_,H.pathname])),N=b.createHref(H)}let[R,B,q]=nR(s,T),W=fR(v,{replace:p,mask:l,state:h,target:f,preventScrollReset:m,relative:o,viewTransition:S,defaultShouldRevalidate:C,useTransitions:g});function G(H){t&&t(H),H.defaultPrevented||W(H)}let I=!(k.isExternal||d),K=L.createElement("a",{...T,...q,href:(I?N:void 0)||k.absoluteURL||M,onClick:I?G:t,ref:oR(w,B),target:f,"data-discover":!y&&i==="render"?"true":void 0});return R&&!y?L.createElement(L.Fragment,null,K,L.createElement(iR,{page:M})):K});dc.displayName="Link";var uR=L.forwardRef(function({"aria-current":t="page",caseSensitive:i=!1,className:s="",end:o=!1,style:d,to:p,viewTransition:l,children:h,...f},v){let m=Mc(p,{relative:f.relative}),S=lr(),C=L.useContext(sd),{navigator:T,basename:w}=L.useContext(Di),_=C!=null&&vR(m)&&l===!0,b=T.encodeLocation?T.encodeLocation(m).pathname:m.pathname,g=S.pathname,y=C&&C.navigation&&C.navigation.location?C.navigation.location.pathname:null;i||(g=g.toLowerCase(),y=y?y.toLowerCase():null,b=b.toLowerCase()),y&&w&&(y=qr(y,w)||y);const k=b!=="/"&&b.endsWith("/")?b.length-1:b.length;let M=g===b||!o&&g.startsWith(b)&&g.charAt(k)==="/",A=y!=null&&(y===b||!o&&y.startsWith(b)&&y.charAt(b.length)==="/"),N={isActive:M,isPending:A,isTransitioning:_},R=M?t:void 0,B;typeof s=="function"?B=s(N):B=[s,M?"active":null,A?"pending":null,_?"transitioning":null].filter(Boolean).join(" ");let q=typeof d=="function"?d(N):d;return L.createElement(dc,{...f,"aria-current":R,className:B,ref:v,style:q,to:p,viewTransition:l},typeof h=="function"?h(N):h)});uR.displayName="NavLink";var hR=L.forwardRef(({discover:e="render",fetcherKey:t,navigate:i,reloadDocument:s,replace:o,state:d,method:p=ph,action:l,onSubmit:h,relative:f,preventScrollReset:v,viewTransition:m,defaultShouldRevalidate:S,...C},T)=>{let{useTransitions:w}=L.useContext(Di),_=gR(),b=_R(l,{relative:f}),g=p.toLowerCase()==="get"?"get":"post",y=typeof l=="string"&&Yx.test(l),k=M=>{if(h&&h(M),M.defaultPrevented)return;M.preventDefault();let A=M.nativeEvent.submitter,N=A?.getAttribute("formmethod")||p,R=()=>_(A||M.currentTarget,{fetcherKey:t,method:N,navigate:i,replace:o,state:d,relative:f,preventScrollReset:v,viewTransition:m,defaultShouldRevalidate:S});w&&i!==!1?L.startTransition(()=>R()):R()};return L.createElement("form",{ref:T,method:g,action:b,onSubmit:s?h:k,...C,"data-discover":!y&&e==="render"?"true":void 0})});hR.displayName="Form";function dR(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Xx(e){let t=L.useContext(Oo);return Yt(t,dR(e)),t}function fR(e,{target:t,replace:i,mask:s,state:o,preventScrollReset:d,relative:p,viewTransition:l,defaultShouldRevalidate:h,useTransitions:f}={}){let v=Lc(),m=lr(),S=Mc(e,{relative:p});return L.useCallback(C=>{if(WA(C,t)){C.preventDefault();let T=i!==void 0?i:hc(m)===hc(S),w=()=>v(e,{replace:T,mask:s,state:o,preventScrollReset:d,relative:p,viewTransition:l,defaultShouldRevalidate:h});f?L.startTransition(()=>w()):w()}},[m,v,S,i,s,o,t,e,d,p,l,h,f])}var pR=0,mR=()=>`__${String(++pR)}__`;function gR(){let{router:e}=Xx("useSubmit"),{basename:t}=L.useContext(Di),i=DA(),s=e.fetch,o=e.navigate;return L.useCallback(async(d,p={})=>{let{action:l,method:h,encType:f,formData:v,body:m}=KA(d,t);if(p.navigate===!1){let S=p.fetcherKey||mR();await s(S,i,p.action||l,{defaultShouldRevalidate:p.defaultShouldRevalidate,preventScrollReset:p.preventScrollReset,formData:v,body:m,formMethod:p.method||h,formEncType:p.encType||f,flushSync:p.flushSync})}else await o(p.action||l,{defaultShouldRevalidate:p.defaultShouldRevalidate,preventScrollReset:p.preventScrollReset,formData:v,body:m,formMethod:p.method||h,formEncType:p.encType||f,replace:p.replace,state:p.state,fromRouteId:i,flushSync:p.flushSync,viewTransition:p.viewTransition})},[s,o,t,i])}function _R(e,{relative:t}={}){let{basename:i}=L.useContext(Di),s=L.useContext(yr);Yt(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),d={...Mc(e||".",{relative:t})},p=lr();if(e==null){d.search=p.search;let l=new URLSearchParams(d.search),h=l.getAll("index");if(h.some(v=>v==="")){l.delete("index"),h.filter(m=>m).forEach(m=>l.append("index",m));let v=l.toString();d.search=v?`?${v}`:""}}return(!e||e===".")&&o.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(d.pathname=d.pathname==="/"?i:rr([i,d.pathname])),hc(d)}function vR(e,{relative:t}={}){let i=L.useContext($x);Yt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Xx("useViewTransitionState"),o=Mc(e,{relative:t});if(!i.isTransitioning)return!1;let d=qr(i.currentLocation.pathname,s)||i.currentLocation.pathname,p=qr(i.nextLocation.pathname,s)||i.nextLocation.pathname;return Nh(o.pathname,p)!=null||Nh(o.pathname,d)!=null}var Os=Nx();const bR=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath"];class ht extends Error{status;constructor(t,i){super(i),this.name="ApiError",this.status=t}}async function yR(e){const t=await fetch("/api/v1/theaters",{signal:e});await qn(t);const i=await t.json();if(!Array.isArray(i.theaters))throw new ht(t.status,"Invalid Theater response");return{theaters:i.theaters.map(s=>tw(s,t.status))}}async function SR(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}`:"",s=await fetch(`/api/v1/status${i}`,{signal:t});return await qn(s),LR(await s.json(),s.status)}async function xR(e={}){const t=new URLSearchParams;e.locale&&t.set("locale",e.locale),e.force&&t.set("force","true");const i=t.size>0?`?${t}`:"",s=await fetch(`/api/v1/updates/release-notes${i}`,{signal:e.signal});return await qn(s),NR(await s.json(),s.status)}async function wR(e){const t=await fetch("/api/v1/updates/apply",{method:"POST",signal:e});return await qn(t),MR(await t.json(),t.status)}async function Zx(e,t){const i=await fetch("/api/v1/theaters",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folderGrantId:e}),signal:t});await qn(i);const s=await i.json();return tw(s,i.status)}async function CR(e,t){const i=await fetch("/api/v1/theaters/folder-listings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});return await qn(i),IR(await i.json(),i.status)}async function Jx(e,t){const i=await fetch("/api/v1/theaters/folder-grants",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e}),signal:t});await qn(i);const s=await i.json();if(typeof s.folderGrantId!="string")throw new ht(i.status,"Invalid folder grant response");return s.folderGrantId}async function ER(e,t,i){const s=await fetch("/api/v1/plans/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relPath:t}),signal:i});return await qn(s),await s.json()}async function kR(e,t,i,s){const o=await fetch("/api/v1/plans/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relPath:t,name:i}),signal:s});return await qn(o),await o.json()}async function TR(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await qn(i)}async function gi(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}`:"",s=await fetch(`/api/v1/operations${i}`,{signal:t});await qn(s);const o=await s.json();if(!Array.isArray(o.operations))throw new ht(s.status,"Invalid operations response");return o.operations.map(d=>ew(d,s.status))}async function ta(e,t){const s=await fetch("/api/v1/operations/groups",{signal:t});await qn(s);const o=await s.json();if(!Array.isArray(o.groups))throw new ht(s.status,"Invalid groups response");return o.groups.map(d=>s_(d,s.status))}async function AR(e,t){const i=await fetch("/api/v1/operations/groups",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await qn(i);const s=await i.json();return s_(s.group,i.status)}async function Ip(e,t,i){const s=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:i});await qn(s);const o=await s.json();return s_(o.group,s.status)}async function RR(e,t){const i=await fetch(`/api/v1/operations/groups/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await qn(i)}async function Qx(e,t,i){return gh(e,{title:t},i)}async function gh(e,t,i){const s=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:i});await qn(s);const o=await s.json();return ew(o.operation,s.status)}function ew(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.theaterId!="string"||typeof i.type!="string"||typeof i.pluginId!="string"||typeof i.title!="string"||!i.payload||typeof i.payload!="object"||Array.isArray(i.payload)||!i.ts||typeof i.ts.createdAt!="number"||typeof i.ts.updatedAt!="number"||fc(i)||fc(i.payload))throw new ht(t,"Invalid operation response");return{id:i.id,theaterId:i.theaterId,type:i.type,pluginId:i.pluginId,title:i.title,payload:i.payload,geometry:i.geometry??null,accent:typeof i.accent=="string"?i.accent:null,groupId:i.groupId===null?null:typeof i.groupId=="string"?i.groupId:void 0,ts:i.ts}}function s_(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.theaterId!="string"||typeof i.name!="string"||typeof i.color!="string"||typeof i.order!="number"||typeof i.createdAt!="number")throw new ht(t,"Invalid group response");return{id:i.id,theaterId:i.theaterId,name:i.name,color:i.color,order:i.order,createdAt:i.createdAt}}function tw(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.label!="string"||typeof i.createdAt!="string"||typeof i.lastOpenedAt!="string"||typeof i.hasWiki!="boolean"||typeof i.activeAdmiralCount!="number"||fc(i))throw new ht(t,"Invalid Theater response");return i}function LR(e,t){const i=e;if(!i||typeof i.workspaces!="number"||typeof i.version!="string"||i.channel!=="stable"&&i.channel!=="local"&&i.channel!=="desktop"&&i.channel!=="unknown"||typeof i.updateAvailable!="boolean"||typeof i.port!="number"||i.portMode!=="dynamic"&&i.portMode!=="static"||i.requestedPort!==null&&typeof i.requestedPort!="number"||typeof i.effectivePort!="number"||typeof i.portHonored!="boolean"||i.wikiServerStatus!=="available"&&i.wikiServerStatus!=="unavailable"&&i.wikiServerStatus!=="unknown")throw new ht(t,"Invalid status response");return{workspaces:i.workspaces,version:i.version,channel:i.channel,updateAvailable:i.updateAvailable,latestVersion:typeof i.latestVersion=="string"?i.latestVersion:void 0,port:i.port,portMode:i.portMode,requestedPort:i.requestedPort,effectivePort:i.effectivePort,portHonored:i.portHonored,wikiServerStatus:i.wikiServerStatus}}function MR(e,t){const i=e;if(!i||i.status!=="accepted")throw new ht(t,"Invalid update response");return{status:"accepted"}}function NR(e,t){const i=e;if(!i||!Array.isArray(i.notes)||i.sourceRef!=="main"||typeof i.fetchedAt!="number"||typeof i.stale!="boolean"||"url"in i||"token"in i||"path"in i)throw new ht(t,"Invalid release notes response");return{notes:i.notes.map(s=>OR(s,t)),sourceRef:"main",fetchedAt:i.fetchedAt,stale:i.stale}}function OR(e,t){const i=e;if(!i||typeof i.version!="string"||i.date!==null&&typeof i.date!="string"||!Array.isArray(i.sections)||typeof i.localizationFallback!="boolean")throw new ht(t,"Invalid release notes response");return{version:i.version,date:i.date,sections:i.sections.map(s=>DR(s,t)),localizationFallback:i.localizationFallback}}function DR(e,t){const i=e;if(!i||i.heading!=="Added"&&i.heading!=="Changed"&&i.heading!=="Fixed"&&i.heading!=="Removed"&&i.heading!=="Breaking Changes"||!Array.isArray(i.items))throw new ht(t,"Invalid release notes response");return{heading:i.heading,items:i.items.map(s=>jR(s,t))}}function jR(e,t){const i=e;if(!i||!Array.isArray(i.packageTags)||!i.packageTags.every(s=>typeof s=="string")||typeof i.text!="string")throw new ht(t,"Invalid release notes response");return{packageTags:i.packageTags,text:i.text}}function IR(e,t){const i=e;if(!i||typeof i.path!="string"||i.parentPath!==null&&typeof i.parentPath!="string"||!Array.isArray(i.roots)||!Array.isArray(i.entries)||fc(i))throw new ht(t,"Invalid folder list response");return{path:i.path,parentPath:i.parentPath??null,roots:i.roots.filter(s=>typeof s=="string"),entries:i.entries.map(s=>BR(s,t)),truncated:i.truncated===!0?!0:void 0}}function BR(e,t){const i=e;if(!i||typeof i.name!="string"||typeof i.path!="string"||i.kind!=="dir"||typeof i.accessible!="boolean"||fc(i))throw new ht(t,"Invalid folder entry response");return{name:i.name,path:i.path,kind:"dir",accessible:i.accessible}}function fc(e){if(!e||typeof e!="object")return!1;const t=e;return bR.some(i=>i in t)}async function qn(e){if(e.ok)return;let t=`${e.status} ${e.statusText}`;try{const i=await e.json();typeof i.error=="string"?t=i.error:typeof i.message=="string"&&(t=i.message)}catch{}throw new ht(e.status,t)}function Wy(e,t){return e!==null&&e===t?e:null}function PR(e,t){return e&&t}function zR(e,t){return e?!1:t}const HR="__unassigned__";function $R(e){const t=new Map(e.theaters.map(s=>[s.id,s])),i=[];for(const s of e.operations)s.theaterId&&i.push(WR(s,t.get(s.theaterId)));return i}function UR(e,t){const i=nw(t);return i.length===0?e:e.filter(s=>{const o=GR(s);return i.every(d=>o.includes(d))})}function FR(e){const t=[],i=new Map;for(const s of e){const o=s.theaterId??HR,d=i.get(o);if(d!==void 0){const p=t[d];p&&(t[d]={...p,entries:[...p.entries,s]});continue}i.set(o,t.length),t.push({theaterId:s.theaterId,theaterLabel:s.theaterLabel,entries:[s]})}return t}function nw(e){return e.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)}function WR(e,t){return{operationId:e.id,theaterId:e.theaterId,theaterLabel:t?.label??e.theaterId,operationName:e.title,pluginId:e.pluginId,status:"operation"}}function GR(e){return[e.operationName,e.theaterLabel,e.pluginId].join(" ").toLocaleLowerCase()}const qR=200,KR=.5,VR="mmmmmmmmmmwwwwiIl1 0O-_|┌ABCxyz",YR=["monospace","serif","sans-serif"],Kl=new Map;function XR(e,t={}){const i=od(e);if(!i)return!1;const s=i.toLocaleLowerCase(),o=Kl.get(s);if(o!==void 0)return o;const d=t.document??globalThis.document;if(!d)return!1;const p=d.createElement("canvas").getContext("2d");if(!p)return!1;const l=YR.some(h=>{const f=Gy(p,`${iw(i)}, ${h}`),v=Gy(p,h);return Math.abs(f-v)>KR});return ZR(s,l,t.maxEntries??qR),l}function iw(e){return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Dh(e,t){const i=od(e);return i?`${iw(i)}, ${t}`:t}function od(e){return e.replace(/[\x00-\x1F\x7F]/g,"").trim().slice(0,128)}function Gy(e,t){return e.font=`28px ${t}`,e.measureText(VR).width}function ZR(e,t,i){if(Kl.size>=Math.max(1,i)){const s=Kl.keys().next().value;s&&Kl.delete(s)}Kl.set(e,t)}const go={min:12,max:18,step:1,defaultValue:14},ic={source:"builtin",id:"manrope",size:go.defaultValue},jh=[{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 JR(e){if(!e||typeof e!="object")return ic;const t=e,i=QR(t.size);if(t.source==="builtin"&&t3(t.id))return{source:"builtin",id:t.id,size:i};if(t.source==="system"&&typeof t.familyName=="string"){const s=od(t.familyName);if(s)return{source:"system",familyName:s,size:i}}return ic}function QR(e){return typeof e!="number"||!Number.isInteger(e)||e<go.min||e>go.max?go.defaultValue:e}function rw(e){return e.source==="system"?Dh(e.familyName,jh[0].family):e3(e.id).family}function e3(e){return jh.find(t=>t.id===e)??jh[0]}function t3(e){return e==="manrope"||e==="jetbrains-mono"||e==="source-code-pro"}const $m="fleet-console.activeTheaterId",sw="fleet-console.commissioningSeen",aw="fleet-console.whatsNewSeenVersion",ow="fleet-console.notificationPreferences",lw=1,n3="instrument",qu={globalMute:!1,dnd:!1,mutedTheaterIds:{}},Um=new Set;let qy=0,Fm=null,$e={connection:"connecting",connectionError:null,activeTheme:n3,version:"",updateAvailable:!1,latestVersion:null,portMode:"dynamic",requestedPort:null,effectivePort:0,portHonored:!0,theaters:[],operations:[],operationsHydrated:!1,groups:[],activeTheaterId:null,activeOperationId:null,operationStatus:{},addingTheater:!1,theaterError:null,operationsViewActive:!1,operationSearchOpen:!1,whatsNewOpen:!1,releaseNotes:[],releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:null,releaseNotesFetchedAt:null,releaseNotesStale:!1,automaticWhatsNewVersion:null,selectedReleaseNoteKey:null,onboardingOpen:!1,bootstrapped:!1,pendingOperationFocus:null,operationNotifications:{},notificationPreferences:L3(),codexReader:null,codexReaderExpanded:!1};function pc(){return $e}function cw(e){return Um.add(e),()=>{Um.delete(e)}}function it(e){$e={...$e,...e},k3()}function i3(e){$e.operationsViewActive!==e&&it({operationsViewActive:e})}function Ih(e){l3(e),it({activeTheme:e})}function Wm(e){u3(e)}function r3(e){it({version:e.version,updateAvailable:e.updateAvailable,latestVersion:e.latestVersion??null,portMode:e.portMode,requestedPort:e.requestedPort,effectivePort:e.effectivePort,portHonored:e.portHonored,..._w({...$e,version:e.version})})}function s3(){it({releaseNotesLoading:!0,releaseNotesError:null})}function a3(e){const t={...$e,releaseNotes:e.notes,releaseNotesLoading:!1,releaseNotesError:null,releaseNotesSourceRef:e.sourceRef,releaseNotesFetchedAt:e.fetchedAt,releaseNotesStale:e.stale,selectedReleaseNoteKey:$e.selectedReleaseNoteKey&&bw(e.notes,$e.selectedReleaseNoteKey)?$e.selectedReleaseNoteKey:vw(e.notes)};it({releaseNotes:t.releaseNotes,releaseNotesLoading:t.releaseNotesLoading,releaseNotesError:t.releaseNotesError,releaseNotesSourceRef:t.releaseNotesSourceRef,releaseNotesFetchedAt:t.releaseNotesFetchedAt,releaseNotesStale:t.releaseNotesStale,..._w(t)})}function o3(e){it({releaseNotesLoading:!1,releaseNotesError:e})}function l3(e){typeof document>"u"||document.documentElement.setAttribute("data-theme",e)}function c3(){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 u3(e){typeof document>"u"||(document.documentElement.setAttribute("data-ui-font",e.source),document.documentElement.style.setProperty("--font-body",rw(e)),document.documentElement.style.setProperty("--font-body-size",`${e.size}px`))}function h3(e){const t=gw(e,$e.activeTheaterId);it({theaters:e,activeTheaterId:t})}function d3(e){h3(e.theaters)}function _i(e){it({operations:e,operationsHydrated:!0})}function f3(e){const t=$e.operations.findIndex(s=>s.id===e.id);if(t===-1)return;const i=[...$e.operations];i[t]=e,it({operations:i})}function na(e){it({groups:e})}function p3(e){ld(e),it({activeTheaterId:e})}function Mi(e){$e.activeOperationId!==e&&it({activeOperationId:e})}function m3(e,t){if(t==="idle"){uw(e);return}$e.operationStatus[e]!==t&&it({operationStatus:{...$e.operationStatus,[e]:t}})}function uw(e){if(!(e in $e.operationStatus))return;const t={...$e.operationStatus};delete t[e],it({operationStatus:t})}function g3(e){if(!e.operationId)return;const t=$e.operations.find(p=>p.id===e.operationId);if(!t)return;const i=t.theaterId??null,s=$e.theaters.find(p=>p.id===i)?.label??i??"Unknown",o=t.title,d=A3(e.kind);qy+=1,it({operationNotifications:{...$e.operationNotifications,[e.operationId]:{kind:d,operationId:e.operationId,theaterId:i,theaterLabel:s,operationLabel:o,lastRaisedSeq:qy}}})}function hw(){it({addingTheater:!0,theaterError:null})}function dw(e){const t=[e,...$e.theaters.filter(i=>i.id!==e.id)];ld(e.id),it({theaters:t,activeTheaterId:e.id,addingTheater:!1,theaterError:null})}function _3(){it({addingTheater:!1,theaterError:null})}function Gm(e){it({addingTheater:!1,theaterError:e})}function mc(e){const t=$e.operations.find(i=>i.id===e);t&&(ld(t.theaterId),it({activeTheaterId:t.theaterId,activeOperationId:e,pendingOperationFocus:e,operationNotifications:mw($e.operationNotifications,e)}),window.dispatchEvent(new CustomEvent("fleet-console:focus-operation",{detail:{operationId:e}})))}function Bp(){$e.pendingOperationFocus!==null&&it({pendingOperationFocus:null})}function v3(e,t,i){if(e.length===0)return null;const s=t?e.indexOf(t):-1,o=s===-1?i>0?0:e.length-1:(s+i+e.length)%e.length;return e[o]??null}function a_(e,t){if(t.length===0)return[...e].sort(qm);const i=new Map(t.map((s,o)=>[s,o]));return[...e].sort((s,o)=>{const d=i.get(s.id),p=i.get(o.id);return d!==void 0&&p!==void 0?d-p:d!==void 0?-1:p!==void 0?1:qm(s,o)})}function fw(e,t,i,s=[]){const o=a_(e,i),d=new Set(s),p=[...t].sort((h,f)=>h.order-f.order||h.createdAt-f.createdAt),l=new Map;for(const h of p)l.set(h.id,[]);l.set(null,[]);for(const h of o){const f=h.groupId??null;f!==null&&l.has(f)?l.get(f).push(h):l.get(null).push(h)}return[...p.filter(h=>!d.has(h.id)).flatMap(h=>l.get(h.id)??[]),...l.get(null)??[]]}function qm(e,t){return e.ts.createdAt-t.ts.createdAt||e.id.localeCompare(t.id)}function Pp(){it({operationSearchOpen:!1})}function pw(){it({operationSearchOpen:!$e.operationSearchOpen})}function b3(){$e.releaseNotes.length===0||$e.whatsNewOpen||it({whatsNewOpen:!0,selectedReleaseNoteKey:$e.selectedReleaseNoteKey??vw($e.releaseNotes)})}function Ku(){$e.whatsNewOpen&&($e.automaticWhatsNewVersion&&D3($e.automaticWhatsNewVersion),it({whatsNewOpen:!1,automaticWhatsNewVersion:null}))}function Ky(e){bw($e.releaseNotes,e)&&it({selectedReleaseNoteKey:e})}function Nl(){N3(!0),$e.onboardingOpen&&it({onboardingOpen:!1})}function Wr(e){it({codexReader:e,codexReaderExpanded:!1})}function _h(){$e.codexReader!==null&&it({codexReaderExpanded:!0})}function y3(){it({codexReaderExpanded:!1})}function zp(){it({codexReader:null,codexReaderExpanded:!1})}function Vy(){if($e.bootstrapped)return;const e=$e.theaters.length===0&&!M3();it({bootstrapped:!0,onboardingOpen:e?!0:$e.onboardingOpen})}function Yy(e){const t=$e.theaters.filter(p=>p.id!==e),i=gw(t,$e.activeTheaterId===e?null:$e.activeTheaterId),s=T3($e.operationNotifications,e),o=new Set($e.operations.filter(p=>p.theaterId===e).map(p=>p.id)),d=$e.activeOperationId&&o.has($e.activeOperationId)?null:$e.activeOperationId;ld(i),it({theaters:t,activeTheaterId:i,activeOperationId:d,operationNotifications:s})}function S3(e){const t=mw($e.operationNotifications,e);t!==$e.operationNotifications&&it({operationNotifications:t})}function x3(e){const t={...$e.notificationPreferences,globalMute:e};l_(t),it({notificationPreferences:t})}function w3(e){const t={...$e.notificationPreferences,dnd:e};l_(t),it({notificationPreferences:t})}function C3(e){const t={...$e.notificationPreferences.mutedTheaterIds};t[e]?delete t[e]:t[e]=!0;const i={...$e.notificationPreferences,mutedTheaterIds:t};l_(i),it({notificationPreferences:i})}function E3(e){return $R(e)}function k3(){for(const e of Um)e()}function mw(e,t){if(!e[t])return e;const i={...e};return delete i[t],i}function T3(e,t){let i=!1;const s={};for(const[o,d]of Object.entries(e)){if(d.theaterId===t){i=!0;continue}s[o]=d}return i?s:e}function gw(e,t){const i=new Set(e.map(o=>o.id)),s=R3();return s&&i.has(s)?s:t&&i.has(t)?t:e[0]?.id??null}function A3(e){const t=e.toLowerCase();return t==="ended"||t.includes(".end")||t.includes("done")?"ended":"input-waiting"}function _w(e){const t=e.releaseNotes.findIndex(s=>s.version!=="Unreleased"),i=t>=0?e.releaseNotes[t]:void 0;return!i||!e.version||i.version!==e.version||O3()===i.version?{whatsNewOpen:e.whatsNewOpen,automaticWhatsNewVersion:e.automaticWhatsNewVersion,selectedReleaseNoteKey:e.selectedReleaseNoteKey}:{whatsNewOpen:!0,automaticWhatsNewVersion:i.version,selectedReleaseNoteKey:o_(i.version,t)}}function vw(e){return e[0]?o_(e[0].version,0):null}function bw(e,t){return e.some((i,s)=>o_(i.version,s)===t)}function o_(e,t){return`${e}:${t}`}function R3(){if(typeof window>"u")return null;try{return window.localStorage.getItem($m)}catch{return null}}function ld(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem($m,e):window.localStorage.removeItem($m)}catch{}}function L3(){if(typeof window>"u")return qu;try{const e=window.localStorage.getItem(ow);if(!e)return qu;const t=JSON.parse(e);return j3(t)?{globalMute:t.preferences.globalMute,dnd:t.preferences.dnd,mutedTheaterIds:t.preferences.mutedTheaterIds}:qu}catch{return qu}}function M3(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(sw)==="1"}catch{return!1}}function N3(e){if(!(typeof window>"u"))try{e&&window.localStorage.setItem(sw,"1")}catch{}}function O3(){if(Fm!==null)return Fm;if(typeof window>"u")return null;try{return window.localStorage.getItem(aw)}catch{return null}}function D3(e){if(Fm=e,!(typeof window>"u"))try{window.localStorage.setItem(aw,e)}catch{}}function l_(e){if(!(typeof window>"u"))try{window.localStorage.setItem(ow,JSON.stringify({version:lw,preferences:e}))}catch{}}function j3(e){if(!e||typeof e!="object")return!1;const t=e;if(t.version!==lw||!t.preferences||typeof t.preferences!="object")return!1;const i=t.preferences;return typeof i.globalMute=="boolean"&&typeof i.dnd=="boolean"&&!!i.mutedTheaterIds&&typeof i.mutedTheaterIds=="object"}function cr(){return L.useSyncExternalStore(cw,pc,pc)}const I3=[{title:"Console",entries:[{combos:[["Mod","K"]],description:"Search Operations across Theaters"},{combos:[["Esc"]],description:"Close the open overlay or menu"}]},{title:"Operations",entries:[{combos:[["Esc"]],description:"Close the carrier job stream"},{combos:[["Shift","Enter"]],description:"Insert a newline in the terminal instead of submitting"},{combos:[["Enter"],["Esc"]],description:"Confirm or cancel a session rename"},{combos:[["↑"],["↓"]],description:"Move between Theater, Theme, and launch menu items"}]},{title:"Map",entries:[{combos:[["Alt","←"],["Alt","→"]],description:"Focus the previous / next Operation"},{combos:[["Alt","F"]],description:"Toggle Formation view (open panels only)"},{combos:[["Alt","Shift","F"]],description:"Formation view including minimized panels"},{combos:[["Drag"]],description:"Pan the operations map"},{combos:[["Shift","Drag"]],description:"Draw a new Operation terminal"},{combos:[["Space","Drag"]],description:"Pan even while a terminal has focus"},{combos:[["Scroll"]],description:"Zoom the map in or out"},{combos:[["Right-click"]],description:"Open the canvas actions menu"},{combos:[["Double-click"]],description:"Focus an Operation from its title bar; rename from its name"},{combos:[["Click"]],description:"Clear terminal focus on the empty canvas"}]},{title:"Codex",entries:[{combos:[["Mod","K"]],description:"Toggle the command palette"},{combos:[["↑"],["↓"]],description:"Move through command palette results"},{combos:[["Enter"]],description:"Open the selected result"},{combos:[["Tab"]],description:"Move focus within the command palette"},{combos:[["Esc"]],description:"Close the command palette or diagram lightbox"},{combos:[["+"],["−"],["0"]],description:"Zoom the diagram lightbox in / out / reset"},{combos:[["F"]],description:"Fit the diagram lightbox to the viewport"}]}],Vl="data-keyboard-shortcuts-open",B3='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function yw(){return document.body.getAttribute(Vl)==="true"}function P3(){return!yw()}function z3({onClose:e}){const t=L.useRef(null);L.useEffect(()=>{const s=t.current,o=document.querySelector(".console-shell"),d=document.body.getAttribute(Vl);return document.body.setAttribute(Vl,"true"),o&&(o.inert=!0),s?.focus(),()=>{d===null?document.body.removeAttribute(Vl):document.body.setAttribute(Vl,d),o&&(o.inert=!1)}},[e]);const i=s=>{if(s.key==="Escape"){s.preventDefault(),e();return}if(s.key!=="Tab")return;const o=[...t.current?.querySelectorAll(B3)??[]];if(o.length===0){s.preventDefault(),t.current?.focus();return}const d=o[0],p=o[o.length-1],l=document.activeElement;(l===t.current||!t.current?.contains(l)||(s.shiftKey?l===d:l===p))&&(s.preventDefault(),(s.shiftKey?p:d)?.focus())};return Os.createPortal(u.jsx("div",{className:"keyboard-shortcuts-scrim",onMouseDown:e,children:u.jsxs("div",{ref:t,className:"keyboard-shortcuts-dialog",role:"dialog","aria-modal":"true","aria-label":"Keyboard Shortcuts",tabIndex:-1,onKeyDown:i,onMouseDown:s=>s.stopPropagation(),children:[u.jsxs("div",{className:"keyboard-shortcuts-dialog-head",children:[u.jsx("strong",{children:"Keyboard Shortcuts"}),u.jsx("button",{type:"button",onClick:e,"aria-label":"Close keyboard shortcuts",children:"✕"})]}),I3.map(s=>u.jsxs("section",{className:"keyboard-shortcuts-group",children:[u.jsx("h3",{children:s.title}),u.jsx("dl",{children:s.entries.map(o=>u.jsxs("div",{children:[u.jsx("dt",{children:o.combos.map((d,p)=>u.jsxs("span",{children:[p>0?" or ":null,d.map(l=>u.jsx("kbd",{children:l==="Mod"?"⌘/Ctrl":l},l))]},d.join("+")))}),u.jsx("dd",{children:o.description})]},`${s.title}:${o.description}`))})]},s.title))]})}),document.body)}const H3=1400,$3="https://github.com/sbluemin/fleet-harness",U3="https://github.com/sbluemin/fleet-harness/stargazers",F3="https://api.github.com/repos/sbluemin/fleet-harness",c_="fleet-console.github-stars",W3=360*60*1e3,Xy='[role="menuitem"]:not([disabled])';function G3(){const e=cr();return u.jsxs("div",{className:"side-bar-brand-foot",children:[u.jsx(K3,{latestVersion:e.latestVersion,updateAvailable:e.updateAvailable}),u.jsx(V3,{version:e.version,releaseDisabled:e.releaseNotesLoading||e.releaseNotes.length===0||!!(e.releaseNotesError&&!e.releaseNotesStale)})]})}function q3({className:e="brand-foot-home"}){return u.jsxs(dc,{className:e,to:"/operations","aria-label":"Operations",children:[u.jsx(sL,{}),u.jsx("span",{className:"brand-foot-wordmark",children:"Fleet"})]})}function K3({latestVersion:e,updateAvailable:t}){const i=L.useRef(null),s=L.useRef(null),o=L.useRef(null),[d,p]=L.useState(!1),l=Lc();Sw(i,s,o,d,p);const h=f=>{p(!1),l(f),window.requestAnimationFrame(()=>{const v=document.querySelector("main h2, h2");v?.focus?.(),v&&document.activeElement!==v&&(v.setAttribute("tabindex","-1"),v.focus())})};return u.jsxs("div",{ref:i,className:"brand-foot-dropup brand-foot-system-menu",children:[u.jsxs("button",{ref:s,type:"button",className:"brand-foot-system-trigger",onClick:()=>p(f=>!f),"aria-haspopup":"menu","aria-expanded":d,"aria-label":"System Menu",title:"System Menu",children:[u.jsx(Zy,{}),u.jsx("span",{children:"System Menu"})]}),d?u.jsxs("div",{ref:o,className:"brand-foot-dropup-menu",role:"menu","aria-label":"System Menu",children:[u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>h("/settings"),children:[u.jsx(Zy,{}),u.jsx("span",{children:"Settings"})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>h("/carrier-settings"),children:[u.jsx(aL,{}),u.jsx("span",{children:"Carriers"})]}),t?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(Y3,{latestVersion:e})]}):null]}):null]})}function V3({releaseDisabled:e,version:t}){const i=L.useRef(null),s=L.useRef(null),o=L.useRef(null),[d,p]=L.useState(!1),[l,h]=L.useState(!1);return Sw(i,s,o,d,p),u.jsxs("div",{ref:i,className:"brand-foot-dropup brand-foot-help-menu",children:[u.jsx("button",{ref:s,type:"button",className:"brand-foot-help-trigger",onClick:()=>p(f=>!f),"aria-haspopup":"menu","aria-expanded":d,"aria-label":"Help",title:"Help",children:u.jsx(oL,{})}),d?u.jsxs("div",{ref:o,className:"brand-foot-dropup-menu brand-foot-help-dropup-menu",role:"menu","aria-label":"Help",children:[u.jsxs("button",{type:"button",role:"menuitem",disabled:e,onClick:()=>{p(!1),b3()},children:[u.jsx(lL,{}),u.jsx("span",{children:"What's New"})]}),u.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{p(!1),h(!0)},children:[u.jsx(cL,{}),u.jsx("span",{children:"Keyboard Shortcuts"})]}),u.jsx("div",{className:"brand-foot-menu-divider",role:"separator"}),u.jsx(X3,{menuItem:!0,version:t})]}):null,l?u.jsx(z3,{onClose:()=>{h(!1),s.current?.focus()}}):null]})}function Sw(e,t,i,s,o){L.useEffect(()=>{if(!s)return;const d=window.requestAnimationFrame(()=>{i.current?.querySelector(Xy)?.focus()}),p=h=>{h.target instanceof Node&&e.current?.contains(h.target)||o(!1)},l=h=>{if(h.key==="Escape"){o(!1),t.current?.focus();return}if(!["ArrowDown","ArrowUp","Home","End"].includes(h.key))return;const f=[...i.current?.querySelectorAll(Xy)??[]];if(f.length===0)return;h.preventDefault();const v=f.findIndex(S=>S===document.activeElement),m=h.key==="Home"||h.key==="ArrowDown"&&v===f.length-1?0:h.key==="End"||h.key==="ArrowUp"&&v<=0?f.length-1:h.key==="ArrowDown"?v+1:v-1;f[m]?.focus()};return window.addEventListener("pointerdown",p,!0),window.addEventListener("keydown",l,!0),()=>{window.cancelAnimationFrame(d),window.removeEventListener("pointerdown",p,!0),window.removeEventListener("keydown",l,!0)}},[i,s,e,o,t])}function Y3({latestVersion:e}){const[t,i]=L.useState("idle"),[s,o]=L.useState(null),d=L.useRef(null),p=Z3(t,s,e);L.useEffect(()=>()=>{d.current!==null&&window.clearTimeout(d.current)},[]);const l=async()=>{if(!p.disabled){d.current!==null&&(window.clearTimeout(d.current),d.current=null),i("applying"),o(null);try{if((await wR()).status!=="accepted"){i("error"),o("invalid_response");return}i("accepted"),d.current=window.setTimeout(()=>{d.current=null,i("completed")},H3)}catch(h){const f=h instanceof ht?h.message:"network_error";o(f),i(Q3(f)?"blocked":"error")}}};return u.jsx("button",{type:"button",className:`brand-foot-update brand-foot-update--${p.tone}`,onClick:l,disabled:p.disabled,title:p.title,"aria-live":"polite",children:p.label})}function X3({menuItem:e=!1,version:t}){const i=eL(),s=i.count!==null;return u.jsxs("div",{className:"brand-foot-github",role:"group","aria-label":"GitHub",children:[u.jsx("a",{className:"brand-foot-github-link",href:$3,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":"Open GitHub repository",title:"GitHub repository",children:u.jsx(uL,{})}),u.jsxs("a",{className:"brand-foot-github-stars",href:U3,target:"_blank",rel:"noopener noreferrer",role:e?"menuitem":void 0,"aria-label":s?`GitHub stars ${i.count.toLocaleString()}`:"Star on GitHub",title:"Star on GitHub",children:[u.jsx(hL,{}),s?u.jsx("span",{className:"brand-foot-github-stars-count",children:rL(i.count)}):null]}),u.jsxs("span",{className:"brand-foot-github-version",children:["v",t]})]})}function Z3(e,t,i){const s=i?`Latest version ${i}`:"Update available";return e==="applying"?{label:"Requesting",title:"Requesting the console update.",tone:"live",disabled:!0}:e==="accepted"?{label:"Updating",title:"The console will restart and open in a new window.",tone:"live",disabled:!0}:e==="completed"?{label:"Done",title:"Continue in the newly opened console window.",tone:"live",disabled:!0}:e==="blocked"?J3(t):e==="error"?{label:"Retry",title:"The update request failed. Try again.",tone:"error",disabled:!1}:{label:"Update",title:s,tone:"warn",disabled:!1}}function J3(e){return e==="local_channel"?{label:"Local",title:"Local development builds are not updated from the console.",tone:"blocked",disabled:!0}:e==="update_already_in_progress"?{label:"Busy",title:"Another update is already in progress.",tone:"blocked",disabled:!0}:e==="update_not_available"?{label:"Current",title:"The server re-check found no update to apply.",tone:"blocked",disabled:!0}:{label:"Blocked",title:"The console is not ready to start an update. Try again shortly.",tone:"error",disabled:!1}}function Q3(e){return e==="local_channel"||e==="update_already_in_progress"||e==="update_not_available"}function eL(){const[e,t]=L.useState(()=>{const i=tL();return i===null?{count:null,status:"idle"}:{count:i,status:"ready"}});return L.useEffect(()=>{if(nL())return;let i=!1;return t(s=>s.status==="ready"?s:{...s,status:"loading"}),fetch(F3,{headers:{Accept:"application/vnd.github+json"}}).then(s=>s.ok?s.json():Promise.reject(new Error(`status ${s.status}`))).then(s=>{if(i)return;const o=typeof s.stargazers_count=="number"?s.stargazers_count:null;if(o===null){t(d=>({count:d.count,status:d.count===null?"error":"ready"}));return}iL(o),t({count:o,status:"ready"})}).catch(()=>{i||t(s=>({count:s.count,status:s.count===null?"error":"ready"}))}),()=>{i=!0}},[]),e}function tL(){try{const e=window.localStorage.getItem(c_);if(!e)return null;const t=JSON.parse(e);return typeof t.count=="number"?t.count:null}catch{return null}}function nL(){try{const e=window.localStorage.getItem(c_);if(!e)return!1;const t=JSON.parse(e);return typeof t.at=="number"&&Date.now()-t.at<W3}catch{return!1}}function iL(e){try{window.localStorage.setItem(c_,JSON.stringify({count:e,at:Date.now()}))}catch{}}function rL(e){if(e<1e3)return String(e);const t=e/1e3;return t<10?`${t.toFixed(1)}k`:`${Math.round(t)}k`}function sL(){return u.jsxs("svg",{className:"brand-foot-glyph",viewBox:"0 0 64 64","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"2",width:"60",height:"60",rx:"14",fill:"var(--ink-deep)",stroke:"var(--surface-rim-strong)",strokeWidth:"2"}),u.jsx("circle",{cx:"32",cy:"32",r:"18.5",fill:"none",stroke:"var(--brass)",strokeWidth:"3.5"}),u.jsx("circle",{cx:"32",cy:"32",r:"10.5",fill:"none",stroke:"var(--brass)",strokeWidth:"1.8",opacity:"0.55"}),u.jsx("path",{d:"M32 9v8M32 47v8M9 32h8M47 32h8",stroke:"var(--brass)",strokeWidth:"3",strokeLinecap:"round"}),u.jsx("circle",{cx:"32",cy:"32",r:"3",fill:"var(--brass)"}),u.jsx("circle",{cx:"44.7",cy:"19.3",r:"5",fill:"var(--aurora)"})]})}function aL(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"4",cy:"4.2",r:"1.15",fill:"currentColor"}),u.jsx("circle",{cx:"4",cy:"8",r:"1.15",fill:"currentColor"}),u.jsx("circle",{cx:"4",cy:"11.8",r:"1.15",fill:"currentColor"}),u.jsx("path",{d:"M7.2 4.2h6M7.2 8h6M7.2 11.8h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function Zy(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M3 4.4h10M3 8h10M3 11.6h10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("circle",{cx:"6.2",cy:"4.4",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"10",cy:"8",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"7.4",cy:"11.6",r:"1.3",fill:"var(--surface-glass-strong)",stroke:"currentColor",strokeWidth:"1.2"})]})}function oL(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M6.2 6.2a1.8 1.8 0 1 1 2.6 1.7c-.5.3-.8.6-.8 1.1v.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"8",cy:"11.6",r:".7",fill:"currentColor"})]})}function lL(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M2 5h12v8H2zM2 5l2-2.5h8L14 5M8 5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function cL(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"1.5",y:"4",width:"13",height:"8",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M4 7h1m2 0h1m2 0h1M5 9.5h6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function uL(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{fill:"currentColor",d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.65 7.65 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8Z"})})}function hL(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 2.2 9.41 6.26 13.71 6.35 10.28 8.94 11.53 13.05 8 10.6 4.47 13.05 5.72 8.94 2.29 6.35 6.59 6.26Z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}const dL=new Set(["path","cwd","realpath","token","ticket","gitdir","folderGrantId"]);class sr extends Error{status;constructor(t,i){super(i),this.status=t}}async function fL(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context`,{signal:t});return await ud(i),ww(await i.json(),i.status)}async function xw(e,t,i){t!==null&&Cw(t);const s=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({relPath:t}),signal:i});return await ud(s),ww(await s.json(),s.status)}async function pL(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context/worktrees`,{signal:t});return await ud(i),gL(await i.json(),i.status)}async function mL(e,t,i){t!==null&&Cw(t);const s=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/path-context/directories`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relativePath:t}),signal:i});return await ud(s),_L(await s.json(),s.status)}function ww(e,t=200){gc(e,t);const i=e;if(i.kind!=="root"&&i.kind!=="worktree"&&i.kind!=="directory"||!Ew(i.label))throw new sr(t,"Invalid path context response");if(i.relPath!==null&&(typeof i.relPath!="string"||!cd(i.relPath)))throw new sr(t,"Invalid path context response");if(i.kind==="root"!=(i.relPath===null))throw new sr(t,"Invalid path context response");return{kind:i.kind,relPath:i.relPath,label:i.label}}function gL(e,t=200){gc(e,t);const i=e;if(typeof i.isGitRepo!="boolean"||!Array.isArray(i.worktrees))throw new sr(t,"Invalid worktrees response");return{isGitRepo:i.isGitRepo,worktrees:i.worktrees.map(s=>{gc(s,t);const o=s;if(typeof o.relPath!="string"||!cd(o.relPath)||o.branch!==null&&typeof o.branch!="string"||typeof o.isCurrent!="boolean")throw new sr(t,"Invalid worktrees response");return{relPath:o.relPath,branch:o.branch,isCurrent:o.isCurrent}})}}function _L(e,t=200){gc(e,t);const i=e;if(!Array.isArray(i.directories))throw new sr(t,"Invalid directories response");return i.directories.map(s=>{gc(s,t);const o=s;if(typeof o.relPath!="string"||!cd(o.relPath)||!Ew(o.label))throw new sr(t,"Invalid directories response");return{relPath:o.relPath,label:o.label}})}function Cw(e){if(!cd(e))throw new sr(400,"Invalid relative path")}function cd(e){return e.length>0&&e.length<=4096&&!e.includes("\0")&&!e.includes("\\")&&!e.startsWith("/")&&!/^[A-Za-z]:/.test(e)&&!e.split("/").some(t=>t===""||t==="."||t==="..")}function Ew(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/.test(e)}function gc(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new sr(t,"Invalid path context response");for(const i of Object.keys(e))if(dL.has(i.toLowerCase()))throw new sr(t,"Unsafe path context response")}async function ud(e){if(e.ok)return;let t=e.statusText||"Request failed";try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new sr(e.status,t)}function vL({theaterId:e,parentPath:t,selectedRelPath:i,isDisabled:s,loadDirectories:o,onSelect:d}){const[p,l]=L.useState(null),[h,f]=L.useState(null);return L.useEffect(()=>{const v=new AbortController;return l(null),f(null),o(t,v.signal).then(l).catch(m=>{v.signal.aborted||f(m instanceof Error?m.message:"Unable to load directories")}),()=>v.abort()},[e,t,o]),h?L.createElement("div",{className:"rail-context-tree-status"},h):p?L.createElement("div",{className:"rail-context-tree",role:"tree","aria-label":"Directories"},p.map(v=>L.createElement(kw,{key:v.relPath,directory:v,theaterId:e,depth:0,selectedRelPath:i,isDisabled:s,loadDirectories:o,onSelect:d}))):L.createElement("div",{className:"rail-context-tree-status"},"Loading directories…")}function kw({directory:e,theaterId:t,depth:i,selectedRelPath:s,isDisabled:o,loadDirectories:d,onSelect:p}){const[l,h]=L.useState(!1),[f,v]=L.useState(null),[m,S]=L.useState(!1),C=L.useCallback(()=>{if(l){h(!1);return}if(h(!0),f)return;const _=new AbortController;S(!0),d(e.relPath,_.signal).then(v).catch(()=>v([])).finally(()=>S(!1))},[f,e.relPath,l,d]),T=L.createElement("div",{className:`rail-context-tree-row${i>0?" is-nested":""}`,style:{paddingLeft:`${i*16}px`}},L.createElement("button",{className:`rail-context-expand${l?" is-expanded":""}`,type:"button",disabled:o,"aria-label":`${l?"Collapse":"Expand"} ${e.label}`,onClick:C},"▸"),L.createElement("button",{className:`rail-context-select${s===e.relPath?" is-selected":""}`,type:"button",disabled:o,onClick:()=>p(e.relPath)},L.createElement("span",{className:"rail-context-folder","aria-hidden":"true"}),L.createElement("span",{className:"rail-context-badge rail-context-badge--directory"},"DIR"),L.createElement("span",{className:"rail-context-row-label"},e.label))),w=l&&f?.map(_=>L.createElement(kw,{key:_.relPath,directory:_,theaterId:t,depth:i+1,selectedRelPath:s,isDisabled:o,loadDirectories:d,onSelect:p}));return L.createElement("div",{className:"rail-context-tree-node",role:"treeitem","aria-expanded":l},T,l&&m?L.createElement("div",{className:"rail-context-tree-status"},"Loading…"):null,w)}const Tw=L.forwardRef(function({className:t,theaterId:i,theaterLabel:s,context:o,isMutating:d,onSelect:p,onClose:l},h){const[f,v]=L.useState(null);L.useEffect(()=>{const C=new AbortController;return pL(i,C.signal).then(v).catch(()=>v({isGitRepo:!1,worktrees:[]})),()=>C.abort()},[i]),L.useEffect(()=>{const C=T=>{T.key==="Escape"&&l()};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[l]);const m=L.useCallback((C,T)=>mL(i,C,T),[i]),S=L.useCallback(C=>{d||p(C)},[d,p]);return u.jsxs("div",{ref:h,className:`rail-context-deck${t?` ${t}`:""}`,role:"dialog","aria-label":"Path context",children:[u.jsx("div",{className:"rail-context-deck-caption",children:"Path context · applies to all path-aware panels"}),u.jsxs("button",{className:`rail-context-row${o.relPath===null?" is-selected":""}`,type:"button",disabled:d,onClick:()=>S(null),children:[u.jsx("span",{className:"rail-context-badge rail-context-badge--root",children:"ROOT"}),u.jsx("span",{className:"rail-context-row-label",children:s}),u.jsx("span",{className:"rail-context-row-secondary",children:"THEATER"})]}),u.jsxs("section",{className:"rail-context-section","aria-label":"Directories",children:[u.jsx("h3",{children:"DIRECTORIES"}),u.jsx(vL,{theaterId:i,parentPath:null,selectedRelPath:o.relPath,isDisabled:d,loadDirectories:m,onSelect:S},`${i}:${o.relPath??"root"}`)]}),f?.isGitRepo?u.jsxs("section",{className:"rail-context-section","aria-label":"Worktrees",children:[u.jsx("h3",{children:"WORKTREES"}),f.worktrees.map(C=>u.jsxs("button",{className:`rail-context-row${o.relPath===C.relPath?" is-selected":""}`,type:"button",title:C.relPath,disabled:d,onClick:()=>S(C.relPath),children:[u.jsx("span",{className:"rail-context-badge rail-context-badge--worktree",children:"WORKTREE"}),u.jsx("span",{className:"rail-context-row-label",children:C.relPath.split("/").at(-1)}),C.branch?u.jsx("span",{className:"rail-context-row-secondary",children:C.branch}):null]},C.relPath))]}):null,u.jsx("div",{className:"rail-context-deck-hint",children:"Selected once · delivered to plugins via SDK"})]})}),Km="fleet-console.rail.activePanelId",Aw="fleet-console.rail.chromeExpanded",Vm=new Set,aa=new Map,Ym=new Map,_o=new Map,rc=new Map;let Bh=null,Yl=0,xt={activeRailPanelId:TL(),railChromeExpanded:AL(),panelExtraWidth:0,pathContextTheaterId:null,pathContext:null,pathContextHydrated:!1,pathContextLoading:!1,pathContextMutationInProgress:!1,pathContextError:null,isPathContextDeckOpen:!1};function bL(e,t,i){return!e||t===null||i}function hd(e){return Vm.add(e),()=>{Vm.delete(e)}}function dd(){return xt}function yL(e){const t=xt.activeRailPanelId===e?null:e;Oi({...xt,activeRailPanelId:t,panelExtraWidth:0,isPathContextDeckOpen:!1}),Dw(t)}function SL(){xt.activeRailPanelId!==null&&(Oi({...xt,activeRailPanelId:null,panelExtraWidth:0,isPathContextDeckOpen:!1}),Dw(null))}function xL(e){xt.railChromeExpanded!==e&&(Oi({...xt,railChromeExpanded:e,isPathContextDeckOpen:!1}),RL(e))}function wL(){xL(!xt.railChromeExpanded)}function CL(e,t){if(e!==xt.activeRailPanelId)return;const i=t===null||!Number.isFinite(t)?0:t,s=Math.max(0,Math.round(i)),o=typeof window<"u"?Math.min(s,Math.max(0,window.innerWidth-548)):s;o!==xt.panelExtraWidth&&Oi({...xt,panelExtraWidth:o})}function Rw(e){Bh?.abort(),Bh=null,Yl+=1;const t=e?aa.get(e):void 0;Oi({...xt,pathContextTheaterId:e,pathContext:t?.context??null,pathContextHydrated:t?.isHydrated??!1,pathContextLoading:t?.isLoading??!1,pathContextMutationInProgress:e!==null&&jw(e),pathContextError:t?.error??null,isPathContextDeckOpen:!1})}async function EL(e,t){xt.pathContextTheaterId!==e&&Rw(e),Bh?.abort();const i=new AbortController;Bh=i;const s=++Yl,o=rc.get(e)??0;aa.set(e,{context:null,isHydrated:!1,isLoading:!0,error:null}),xt.pathContextTheaterId===e&&Oi({...xt,pathContext:null,pathContextHydrated:!1,pathContextLoading:!0,pathContextError:null});try{if(await(Ym.get(e)??Promise.resolve()),i.signal.aborted||s!==Yl)return;const d=await t(i.signal);if(i.signal.aborted||s!==Yl||o!==(rc.get(e)??0))return;const p={context:d,isHydrated:!0,isLoading:!1,error:null};aa.set(e,p),xt.pathContextTheaterId===e&&Oi({...xt,pathContext:d,pathContextHydrated:!0,pathContextLoading:!1,pathContextError:null})}catch(d){if(i.signal.aborted||s!==Yl||o!==(rc.get(e)??0))return;const p=d instanceof Error?d.message:"Unable to load path context";aa.set(e,{context:null,isHydrated:!1,isLoading:!1,error:p}),xt.pathContextTheaterId===e&&Oi({...xt,pathContext:null,pathContextHydrated:!1,pathContextLoading:!1,pathContextError:p})}}async function Lw(e,t){if(xt.pathContextTheaterId!==e)return null;rc.set(e,(rc.get(e)??0)+1),ML(e);const s=(Ym.get(e)??Promise.resolve()).then(()=>LL(e,t));return Ym.set(e,s.then(()=>{})),s}function vh(e){e!==xt.isPathContextDeckOpen&&Oi({...xt,isPathContextDeckOpen:e})}function Mw(){return L.useSyncExternalStore(hd,dd).activeRailPanelId}function Nw(){return L.useSyncExternalStore(hd,dd).railChromeExpanded}function kL(){return L.useSyncExternalStore(hd,dd).panelExtraWidth}function Ow(){return L.useSyncExternalStore(hd,dd)}function TL(){try{return localStorage.getItem(Km)}catch{return null}}function AL(){try{return localStorage.getItem(Aw)!=="0"}catch{return!0}}function Dw(e){try{e===null?localStorage.removeItem(Km):localStorage.setItem(Km,e)}catch{}}function RL(e){try{localStorage.setItem(Aw,e?"1":"0")}catch{}}async function LL(e,t){try{const i=await t(new AbortController().signal),s={context:i,isHydrated:!0,isLoading:!1,error:null};return aa.set(e,s),xt.pathContextTheaterId===e&&Oi({...xt,pathContext:i,pathContextHydrated:!0,pathContextLoading:!1,pathContextError:null,isPathContextDeckOpen:!1}),i}catch(i){const s=i instanceof Error?i.message:"Unable to save path context",o=aa.get(e);return aa.set(e,{context:o?.context??null,isHydrated:o?.isHydrated??!1,isLoading:!1,error:s}),xt.pathContextTheaterId===e&&Oi({...xt,pathContextError:s}),null}finally{NL(e)}}function jw(e){return(_o.get(e)??0)>0}function ML(e){_o.set(e,(_o.get(e)??0)+1),xt.pathContextTheaterId===e&&Oi({...xt,pathContextMutationInProgress:!0,pathContextError:null})}function NL(e){const t=(_o.get(e)??1)-1;t>0?_o.set(e,t):_o.delete(e),xt.pathContextTheaterId===e&&Oi({...xt,pathContextMutationInProgress:jw(e)})}function Oi(e){xt=e;for(const t of Vm)t()}function Iw(e){const{sizeRange:t}=e,[i,s]=L.useState(""),[o,d]=L.useState(e.size),p=L.useRef(Promise.resolve()),l=L.useId(),h=L.useMemo(()=>OL(e),[e]),f=L.useMemo(()=>DL(h,i),[h,i]),v=L.useMemo(()=>f.map((A,N)=>({row:A,index:N})),[f]),[m,S]=L.useState(()=>jL(h,e.selected)),C=h.find(A=>Ph(A.selection,e.selected))??null,T=v[Math.min(m,Math.max(0,v.length-1))]?.row??null,w=`${l}-built-ins`,_=`${l}-installed`;L.useEffect(()=>{d(e.size)},[e.size]),L.useEffect(()=>{m>=v.length&&S(Math.max(0,v.length-1))},[m,v.length]);const b=L.useCallback(A=>{const N=Qy(A,t);d(N),p.current=p.current.catch(()=>{}).then(()=>e.onSizeCommit(N))},[e.onSizeCommit,t]),g=L.useCallback(A=>{f.length&&S(N=>(N+A+f.length)%f.length)},[f.length]),y=L.useCallback(()=>{T&&!T.unavailable&&e.onSelectionChange(T.selection)},[T,e]),k=L.useCallback((A,N)=>{S(A),e.onSelectionChange(N)},[e]),M=A=>{A.key==="ArrowDown"?(A.preventDefault(),g(1)):A.key==="ArrowUp"?(A.preventDefault(),g(-1)):A.key==="Home"?(A.preventDefault(),S(0)):A.key==="End"?(A.preventDefault(),S(Math.max(0,f.length-1))):(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),y())};return u.jsx("section",{className:"fc-font-browser","aria-label":"Font browser","data-disabled":e.disabled?"true":void 0,children:u.jsxs("div",{className:"fc-font-browser__panes",children:[u.jsxs("div",{className:"fc-font-browser__chooser",children:[u.jsx("label",{className:"fc-font-browser__search-label",htmlFor:`${l}-search`,children:"Search fonts"}),u.jsx("input",{id:`${l}-search`,className:"fc-font-browser__search",type:"search",value:i,disabled:e.disabled,placeholder:"Search installed fonts",onChange:A=>{s(A.currentTarget.value),S(0)}}),e.loading?u.jsx("p",{className:"fc-font-browser__state",role:"status",children:"Loading installed fonts…"}):null,e.error?u.jsx("p",{className:"fc-font-browser__state fc-font-browser__state--error",role:"alert",children:e.error}):null,u.jsxs("div",{id:l,className:"fc-font-browser__listbox",role:"listbox",tabIndex:e.disabled?-1:0,"aria-label":"Font choices","aria-activedescendant":T?Bw(l,m):void 0,"aria-busy":e.loading||void 0,onKeyDown:M,children:[u.jsx(Jy,{groupId:w,label:"Built-in",rows:v.filter(({row:A})=>A.source==="builtin"),activeRow:T,selected:e.selected,listboxId:l,disabled:e.disabled,onSelect:k}),u.jsx("div",{className:"fc-font-browser__separator",role:"separator","aria-hidden":"true"}),u.jsx(Jy,{groupId:_,label:"Installed on this machine",rows:v.filter(({row:A})=>A.source==="system"),activeRow:T,selected:e.selected,listboxId:l,disabled:e.disabled,onSelect:k}),!e.loading&&!v.length?u.jsx("p",{className:"fc-font-browser__state",children:"No fonts match this search."}):null]})]}),u.jsxs("aside",{className:"fc-font-browser__preview","aria-live":"polite",children:[u.jsxs("div",{className:"fc-font-browser__preview-head",children:[u.jsx("span",{className:"fc-font-browser__preview-label",children:"Preview"}),u.jsx("span",{className:`fc-font-browser__availability${C?.unavailable?" fc-font-browser__availability--unavailable":""}`,children:C?.unavailable?"Unavailable":"Available"})]}),u.jsx("p",{className:"fc-font-browser__preview-copy",style:{fontFamily:C?.previewFamily??e.fallbackStack,fontSize:`${o}px`},children:e.previewText}),u.jsxs("div",{className:"fc-font-browser__size-control",role:"group","aria-label":"Font size",children:[u.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||o<=t.min,onClick:()=>b(o-t.step),"aria-label":"Decrease font size",children:"−"}),u.jsxs("output",{className:"fc-font-browser__size-value","aria-label":"Font size value",children:[o,"px"]}),u.jsx("button",{type:"button",className:"fc-font-browser__stepper",disabled:e.disabled||o>=t.max,onClick:()=>b(o+t.step),"aria-label":"Increase font size",children:"+"})]}),u.jsx("input",{className:"fc-font-browser__range",type:"range",min:t.min,max:t.max,step:t.step,value:o,disabled:e.disabled,"aria-label":"Font size slider",onChange:A=>d(Qy(Number(A.currentTarget.value),t)),onPointerUp:A=>b(Number(A.currentTarget.value)),onKeyUp:A=>{["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"].includes(A.key)&&b(Number(A.currentTarget.value))}})]})]})})}function Jy({groupId:e,label:t,rows:i,activeRow:s,selected:o,listboxId:d,disabled:p,onSelect:l}){return u.jsxs("div",{className:"fc-font-browser__group",role:"group","aria-labelledby":e,children:[u.jsx("h3",{id:e,className:"fc-font-browser__group-label",children:t}),i.map(({row:h,index:f})=>u.jsxs("button",{id:Bw(d,f),type:"button",className:`fc-font-browser__row${Ph(h.selection,s?.selection??null)?" is-active":""}${h.unavailable?" is-unavailable":""}`,role:"option",tabIndex:-1,"aria-selected":Ph(h.selection,o),disabled:p||h.unavailable,onClick:()=>l(f,h.selection),children:[u.jsx("span",{className:"fc-font-browser__row-name",style:{fontFamily:h.previewFamily},children:h.label}),h.description?u.jsx("span",{className:"fc-font-browser__row-meta",children:h.description}):null,h.unavailable?u.jsx("span",{className:"fc-font-browser__row-status",children:"Unavailable"}):null]},h.id))]})}function OL(e){const t=new Set,i=e.builtIns.flatMap(d=>{const p=[d.id,d.label,...d.aliases??[]].map(sc);return p.some(l=>t.has(l))?[]:(p.forEach(l=>t.add(l)),[{id:`builtin-${d.id}`,label:d.label,family:d.family,previewFamily:d.family,source:"builtin",selection:{source:"builtin",id:d.id},description:d.description,unavailable:!1}])}),s=e.installedFonts.map(d=>({id:`system-${sc(d.family)}`,label:d.family,family:d.family,previewFamily:Dh(d.family,e.fallbackStack),source:"system",selection:{source:"system",familyName:d.family},description:d.monospace?"Monospace":"System font",unavailable:!XR(d.family)})),o=e.selected.source==="system"?e.selected.familyName:null;return o!==null&&!s.some(d=>d.family===o)&&s.unshift({id:`system-${sc(o)}`,label:e.selectedSystemFont??o,family:o,previewFamily:Dh(o,e.fallbackStack),source:"system",selection:{source:"system",familyName:o},description:"Saved system font",unavailable:!0}),[...i,...s]}function DL(e,t){const i=sc(t);return i?e.filter(s=>sc(`${s.label} ${s.description??""}`).includes(i)):e}function sc(e){return e.trim().toLocaleLowerCase()}function Bw(e,t){return`${e}-option-${t}`}function jL(e,t){const i=e.findIndex(s=>Ph(s.selection,t));return i>=0?i:0}function Ph(e,t){return t?e.source==="builtin"?t.source==="builtin"&&e.id===t.id:t.source==="system"&&e.familyName===t.familyName:!1}function Qy(e,t){if(!Number.isFinite(e))return t.defaultValue;const i=Math.round((e-t.min)/t.step)*t.step+t.min;return Math.min(t.max,Math.max(t.min,i))}const IL="/api/v1/settings/fonts/system";class co extends Error{status;constructor(t,i=null){super(t),this.name="SystemFontsFetchError",this.status=i}}function BL(e){if(!zw(e,["version","fonts"])||e.version!==1||!Array.isArray(e.fonts))throw new co("System font response has an unsupported shape.");return{version:1,fonts:e.fonts.map(PL)}}async function Pw(e={}){const t=e.fetchImpl??globalThis.fetch;if(typeof t!="function")throw new co("System font fetching is unavailable in this environment.");let i;try{i=await t(IL,{method:"GET",signal:e.signal})}catch(o){throw o instanceof DOMException&&o.name==="AbortError"?o:new co("System fonts could not be loaded.")}if(!i.ok)throw new co("System fonts could not be loaded.",i.status);let s;try{s=await i.json()}catch{throw new co("System font response is not valid JSON.",i.status)}return BL(s)}function PL(e){if(!zw(e,["family","monospace","uiSuitable"])||typeof e.family!="string"||!e.family.trim()||typeof e.monospace!="boolean"||typeof e.uiSuitable!="boolean")throw new co("System font response contains an invalid record.");return{family:e.family,monospace:e.monospace,uiSuitable:e.uiSuitable}}function zL(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function zw(e,t){return zL(e)&&Object.keys(e).length===t.length&&t.every(i=>Object.hasOwn(e,i))}const e1=250,HL=5e3,t1=1,$L=1013,UL=4e3,FL=4001;function WL(e){const t=new AbortController,i=new TextEncoder;let s=e1,o=null,d=null,p=null,l=!1;const h=()=>{d?.dispose(),d=null},f=(S,C)=>{p={cols:S,rows:C},o?.readyState===t1&&o.send(JSON.stringify({type:"resize",cols:S,rows:C}))},v=async()=>{for(;!t.signal.aborted;){e.onStatus?.("connecting");try{const{ticket:S}=await qL(e.ticketPath,e.operationId,t.signal);if(t.signal.aborted)return;await m(GL(S,e.location,e.wsPath),e),s=e1}catch(S){if(t.signal.aborted)return;e.onStatus?.("connecting",S instanceof Error?S.message:String(S))}await VL(s,t.signal),s=Math.min(s*2,HL)}},m=async(S,C)=>{await new Promise((T,w)=>{const _=(C.webSocketFactory??KL)(S);o=_,_.binaryType="arraybuffer",_.onopen=()=>{C.onStatus?.("live"),h(),d=C.terminal.onData(b=>{_.readyState===t1&&_.send(i.encode(b))}),p&&f(p.cols,p.rows)},_.onmessage=b=>{b.data instanceof ArrayBuffer&&C.terminal.write(new Uint8Array(b.data))},_.onerror=()=>{w(new Error("Terminal WebSocket error"))},_.onclose=b=>{h(),o===_&&(o=null);const g=b?.code;g===UL?(t.abort(),C.onStatus?.("closed","terminal_replaced")):g===FL?(t.abort(),C.onStatus?.("closed","terminal_closed"),C.onExit?.()):g===$L&&(t.abort(),C.onStatus?.("closed","terminal_unavailable")),T()}})};return{start:()=>{l||(l=!0,v())},resize:f,dispose:()=>{t.abort(),h(),e.onStatus?.("closed"),o?.close(),o=null}}}function GL(e,t=window.location,i){return`${t.protocol==="https:"?"wss":"ws"}://${t.host}${i}?ticket=${encodeURIComponent(e)}`}async function qL(e,t,i){const s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({operationId:t}),signal:i});if(!s.ok)throw new Error(`Terminal ticket request failed: ${s.status}`);const o=await s.json();if(typeof o.ticket!="string"||typeof o.ttlMs!="number")throw new Error("Invalid terminal ticket response");return{ticket:o.ticket,ttlMs:o.ttlMs}}function KL(e){return new WebSocket(e)}async function VL(e,t){await new Promise(i=>{const s=()=>{clearTimeout(o),t.removeEventListener("abort",s),i()},o=setTimeout(s,e);t.addEventListener("abort",s)})}var Hp={exports:{}},n1;function YL(){return n1||(n1=1,(function(e,t){(function(i,s){e.exports=s()})(self,(()=>(()=>{var i={};return(()=>{var s=i;Object.defineProperty(s,"__esModule",{value:!0}),s.FitAddon=void 0,s.FitAddon=class{activate(o){this._terminal=o}dispose(){}fit(){const o=this.proposeDimensions();if(!o||!this._terminal||isNaN(o.cols)||isNaN(o.rows))return;const d=this._terminal._core;this._terminal.rows===o.rows&&this._terminal.cols===o.cols||(d._renderService.clear(),this._terminal.resize(o.cols,o.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const o=this._terminal._core,d=o._renderService.dimensions;if(d.css.cell.width===0||d.css.cell.height===0)return;const p=this._terminal.options.scrollback===0?0:o.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),h=parseInt(l.getPropertyValue("height")),f=Math.max(0,parseInt(l.getPropertyValue("width"))),v=window.getComputedStyle(this._terminal.element),m=h-(parseInt(v.getPropertyValue("padding-top"))+parseInt(v.getPropertyValue("padding-bottom"))),S=f-(parseInt(v.getPropertyValue("padding-right"))+parseInt(v.getPropertyValue("padding-left")))-p;return{cols:Math.max(2,Math.floor(S/d.css.cell.width)),rows:Math.max(1,Math.floor(m/d.css.cell.height))}}}})(),i})()))})(Hp)),Hp.exports}var XL=YL(),bh={exports:{}},ZL=bh.exports,i1;function JL(){return i1||(i1=1,(function(e,t){(function(i,s){e.exports=s()})(ZL,(()=>(()=>{var i={433:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV11=void 0;const f=h(938),v=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],m=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],S=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],C=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]];let T;function w(_,b){let g,y=0,k=b.length-1;if(_<b[0][0]||_>b[k][1])return!1;for(;k>=y;)if(g=y+k>>1,_>b[g][1])y=g+1;else{if(!(_<b[g][0]))return!0;k=g-1}return!1}l.UnicodeV11=class{constructor(){if(this.version="11",!T){T=new Uint8Array(65536),T.fill(1),T[0]=0,T.fill(0,1,32),T.fill(0,127,160);for(let _=0;_<v.length;++_)T.fill(0,v[_][0],v[_][1]+1);for(let _=0;_<S.length;++_)T.fill(2,S[_][0],S[_][1]+1)}}wcwidth(_){return _<32?0:_<127?1:_<65536?T[_]:w(_,m)?0:w(_,C)?2:1}charProperties(_,b){let g=this.wcwidth(_),y=g===0&&b!==0;if(y){const k=f.UnicodeService.extractWidth(b);k===0?y=!1:k>g&&(g=k)}return f.UnicodeService.createPropertyValue(0,g,y)}}},345:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===h)return void this._listeners.splice(f,1)}}})),this._event}fire(h,f){const v=[];for(let m=0;m<this._listeners.length;m++)v.push(this._listeners[m]);for(let m=0;m<v.length;m++)v[m].call(void 0,h,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(h,f){return h((v=>f.fire(v)))},l.runAndSubscribe=function(h,f){return f(void 0),h((v=>f(v)))}},490:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const f=h(938),v=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],m=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let S;l.UnicodeV6=class{constructor(){if(this.version="6",!S){S=new Uint8Array(65536),S.fill(1),S[0]=0,S.fill(0,1,32),S.fill(0,127,160),S.fill(2,4352,4448),S[9001]=2,S[9002]=2,S.fill(2,11904,42192),S[12351]=1,S.fill(2,44032,55204),S.fill(2,63744,64256),S.fill(2,65040,65050),S.fill(2,65072,65136),S.fill(2,65280,65377),S.fill(2,65504,65511);for(let C=0;C<v.length;++C)S.fill(0,v[C][0],v[C][1]+1)}}wcwidth(C){return C<32?0:C<127?1:C<65536?S[C]:(function(T,w){let _,b=0,g=w.length-1;if(T<w[0][0]||T>w[g][1])return!1;for(;g>=b;)if(_=b+g>>1,T>w[_][1])b=_+1;else{if(!(T<w[_][0]))return!0;g=_-1}return!1})(C,m)?0:C>=131072&&C<=196605||C>=196608&&C<=262141?2:1}charProperties(C,T){let w=this.wcwidth(C),_=w===0&&T!==0;if(_){const b=f.UnicodeService.extractWidth(T);b===0?_=!1:b>w&&(w=b)}return f.UnicodeService.createPropertyValue(0,w,_)}}},938:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const f=h(345),v=h(490);class m{static extractShouldJoin(C){return(1&C)!=0}static extractWidth(C){return C>>1&3}static extractCharKind(C){return C>>3}static createPropertyValue(C,T,w=!1){return(16777215&C)<<3|(3&T)<<1|(w?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const C=new v.UnicodeV6;this.register(C),this._active=C.version,this._activeProvider=C}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(C){if(!this._providers[C])throw new Error(`unknown Unicode version "${C}"`);this._active=C,this._activeProvider=this._providers[C],this._onChange.fire(C)}register(C){this._providers[C.version]=C}wcwidth(C){return this._activeProvider.wcwidth(C)}getStringCellWidth(C){let T=0,w=0;const _=C.length;for(let b=0;b<_;++b){let g=C.charCodeAt(b);if(55296<=g&&g<=56319){if(++b>=_)return T+this.wcwidth(g);const M=C.charCodeAt(b);56320<=M&&M<=57343?g=1024*(g-55296)+M-56320+65536:T+=this.wcwidth(M)}const y=this.charProperties(g,w);let k=m.extractWidth(y);m.extractShouldJoin(y)&&(k-=m.extractWidth(w)),T+=k,w=y}return T}charProperties(C,T){return this._activeProvider.charProperties(C,T)}}l.UnicodeService=m}},s={};function o(p){var l=s[p];if(l!==void 0)return l.exports;var h=s[p]={exports:{}};return i[p](h,h.exports,o),h.exports}var d={};return(()=>{var p=d;Object.defineProperty(p,"__esModule",{value:!0}),p.Unicode11Addon=void 0;const l=o(433);p.Unicode11Addon=class{activate(h){h.unicode.register(new l.UnicodeV11)}dispose(){}}})(),d})()))})(bh)),bh.exports}var QL=JL();var eM=(e,t,i,s)=>{for(var o=t,d=e.length-1,p;d>=0;d--)(p=e[d])&&(o=p(o)||o);return o},tM=(e,t)=>(i,s)=>t(i,s,e),nM=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?r1.isErrorNoTelemetry(e)?new r1(e.message+`
12
+
13
+ `+e.stack):new Error(e.message+`
14
+
15
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},iM=new nM;function $p(e){rM(e)||iM.onUnexpectedError(e)}var Xm="Canceled";function rM(e){return e instanceof sM?!0:e instanceof Error&&e.name===Xm&&e.message===Xm}var sM=class extends Error{constructor(){super(Xm),this.name=this.message}},r1=class Zm extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Zm)return t;let i=new Zm;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},aM;(e=>{function t(d){return d<0}e.isLessThan=t;function i(d){return d<=0}e.isLessThanOrEqual=i;function s(d){return d>0}e.isGreaterThan=s;function o(d){return d===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(aM||={});function oM(e,t){let i=this,s=!1,o;return function(){return s||(s=!0,t||(o=e.apply(i,arguments))),o}}var Hw;(e=>{function t(k){return k&&typeof k=="object"&&typeof k[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function s(){return i}e.empty=s;function*o(k){yield k}e.single=o;function d(k){return t(k)?k:o(k)}e.wrap=d;function p(k){return k||i}e.from=p;function*l(k){for(let M=k.length-1;M>=0;M--)yield k[M]}e.reverse=l;function h(k){return!k||k[Symbol.iterator]().next().done===!0}e.isEmpty=h;function f(k){return k[Symbol.iterator]().next().value}e.first=f;function v(k,M){let A=0;for(let N of k)if(M(N,A++))return!0;return!1}e.some=v;function m(k,M){for(let A of k)if(M(A))return A}e.find=m;function*S(k,M){for(let A of k)M(A)&&(yield A)}e.filter=S;function*C(k,M){let A=0;for(let N of k)yield M(N,A++)}e.map=C;function*T(k,M){let A=0;for(let N of k)yield*M(N,A++)}e.flatMap=T;function*w(...k){for(let M of k)yield*M}e.concat=w;function _(k,M,A){let N=A;for(let R of k)N=M(N,R);return N}e.reduce=_;function*b(k,M,A=k.length){for(M<0&&(M+=k.length),A<0?A+=k.length:A>k.length&&(A=k.length);M<A;M++)yield k[M]}e.slice=b;function g(k,M=Number.POSITIVE_INFINITY){let A=[];if(M===0)return[A,k];let N=k[Symbol.iterator]();for(let R=0;R<M;R++){let B=N.next();if(B.done)return[A,e.empty()];A.push(B.value)}return[A,{[Symbol.iterator](){return N}}]}e.consume=g;async function y(k){let M=[];for await(let A of k)M.push(A);return Promise.resolve(M)}e.asyncToArray=y})(Hw||={});function $w(e){if(Hw.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Uw(...e){return Wn(()=>$w(e))}function Wn(e){return{dispose:oM(()=>{e()})}}var Fw=class Ww{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{$w(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?Ww.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)}};Fw.DISABLE_DISPOSED_WARNING=!1;var vo=Fw,or=class{constructor(){this._store=new vo,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)}};or.None=Object.freeze({dispose(){}});var Ol=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},u_=typeof process<"u"&&"title"in process,fd=u_?"node":navigator.userAgent,lM=u_?"node":navigator.platform,cM=fd.includes("Firefox"),uM=fd.includes("Edge"),Gw=/^((?!chrome|android).)*safari/i.test(fd);function hM(){if(!Gw)return 0;let e=fd.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}lM.indexOf("Linux")>=0;var dM="",kn=0,Tn=0,An=0,un=0,qi={css:"#00000000",rgba:0},ni;(e=>{function t(o,d,p,l){return l!==void 0?`#${Js(o)}${Js(d)}${Js(p)}${Js(l)}`:`#${Js(o)}${Js(d)}${Js(p)}`}e.toCss=t;function i(o,d,p,l=255){return(o<<24|d<<16|p<<8|l)>>>0}e.toRgba=i;function s(o,d,p,l){return{css:e.toCss(o,d,p,l),rgba:e.toRgba(o,d,p,l)}}e.toColor=s})(ni||={});var Xl;(e=>{function t(h,f){if(un=(f.rgba&255)/255,un===1)return{css:f.css,rgba:f.rgba};let v=f.rgba>>24&255,m=f.rgba>>16&255,S=f.rgba>>8&255,C=h.rgba>>24&255,T=h.rgba>>16&255,w=h.rgba>>8&255;kn=C+Math.round((v-C)*un),Tn=T+Math.round((m-T)*un),An=w+Math.round((S-w)*un);let _=ni.toCss(kn,Tn,An),b=ni.toRgba(kn,Tn,An);return{css:_,rgba:b}}e.blend=t;function i(h){return(h.rgba&255)===255}e.isOpaque=i;function s(h,f,v){let m=oa.ensureContrastRatio(h.rgba,f.rgba,v);if(m)return ni.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=s;function o(h){let f=(h.rgba|255)>>>0;return[kn,Tn,An]=oa.toChannels(f),{css:ni.toCss(kn,Tn,An),rgba:f}}e.opaque=o;function d(h,f){return un=Math.round(f*255),[kn,Tn,An]=oa.toChannels(h.rgba),{css:ni.toCss(kn,Tn,An,un),rgba:ni.toRgba(kn,Tn,An,un)}}e.opacity=d;function p(h,f){return un=h.rgba&255,d(h,un*f/255)}e.multiplyOpacity=p;function l(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=l})(Xl||={});var fM;(e=>{let t,i;try{let o=document.createElement("canvas");o.width=1,o.height=1;let d=o.getContext("2d",{willReadFrequently:!0});d&&(t=d,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function s(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return kn=parseInt(o.slice(1,2).repeat(2),16),Tn=parseInt(o.slice(2,3).repeat(2),16),An=parseInt(o.slice(3,4).repeat(2),16),ni.toColor(kn,Tn,An);case 5:return kn=parseInt(o.slice(1,2).repeat(2),16),Tn=parseInt(o.slice(2,3).repeat(2),16),An=parseInt(o.slice(3,4).repeat(2),16),un=parseInt(o.slice(4,5).repeat(2),16),ni.toColor(kn,Tn,An,un);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let d=o.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(d)return kn=parseInt(d[1]),Tn=parseInt(d[2]),An=parseInt(d[3]),un=Math.round((d[5]===void 0?1:parseFloat(d[5]))*255),ni.toColor(kn,Tn,An,un);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=o,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[kn,Tn,An,un]=t.getImageData(0,0,1,1).data,un!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ni.toRgba(kn,Tn,An,un),css:o}}e.toColor=s})(fM||={});var Qn;(e=>{function t(s){return i(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function i(s,o,d){let p=s/255,l=o/255,h=d/255,f=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4),v=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),m=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4);return f*.2126+v*.7152+m*.0722}e.relativeLuminance2=i})(Qn||={});var oa;(e=>{function t(p,l){if(un=(l&255)/255,un===1)return l;let h=l>>24&255,f=l>>16&255,v=l>>8&255,m=p>>24&255,S=p>>16&255,C=p>>8&255;return kn=m+Math.round((h-m)*un),Tn=S+Math.round((f-S)*un),An=C+Math.round((v-C)*un),ni.toRgba(kn,Tn,An)}e.blend=t;function i(p,l,h){let f=Qn.relativeLuminance(p>>8),v=Qn.relativeLuminance(l>>8);if(zr(f,v)<h){if(v<f){let C=s(p,l,h),T=zr(f,Qn.relativeLuminance(C>>8));if(T<h){let w=o(p,l,h),_=zr(f,Qn.relativeLuminance(w>>8));return T>_?C:w}return C}let m=o(p,l,h),S=zr(f,Qn.relativeLuminance(m>>8));if(S<h){let C=s(p,l,h),T=zr(f,Qn.relativeLuminance(C>>8));return S>T?m:C}return m}}e.ensureContrastRatio=i;function s(p,l,h){let f=p>>24&255,v=p>>16&255,m=p>>8&255,S=l>>24&255,C=l>>16&255,T=l>>8&255,w=zr(Qn.relativeLuminance2(S,C,T),Qn.relativeLuminance2(f,v,m));for(;w<h&&(S>0||C>0||T>0);)S-=Math.max(0,Math.ceil(S*.1)),C-=Math.max(0,Math.ceil(C*.1)),T-=Math.max(0,Math.ceil(T*.1)),w=zr(Qn.relativeLuminance2(S,C,T),Qn.relativeLuminance2(f,v,m));return(S<<24|C<<16|T<<8|255)>>>0}e.reduceLuminance=s;function o(p,l,h){let f=p>>24&255,v=p>>16&255,m=p>>8&255,S=l>>24&255,C=l>>16&255,T=l>>8&255,w=zr(Qn.relativeLuminance2(S,C,T),Qn.relativeLuminance2(f,v,m));for(;w<h&&(S<255||C<255||T<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),T=Math.min(255,T+Math.ceil((255-T)*.1)),w=zr(Qn.relativeLuminance2(S,C,T),Qn.relativeLuminance2(f,v,m));return(S<<24|C<<16|T<<8|255)>>>0}e.increaseLuminance=o;function d(p){return[p>>24&255,p>>16&255,p>>8&255,p&255]}e.toChannels=d})(oa||={});function Js(e){let t=e.toString(16);return t.length<2?"0"+t:t}function zr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function yn(e){if(!e)throw new Error("value must not be falsy");return e}function h_(e){return 57508<=e&&e<=57558}function pM(e){return 57520<=e&&e<=57527}function mM(e){return 57344<=e&&e<=63743}function gM(e){return 9472<=e&&e<=9631}function _M(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 vM(e,t,i,s){return t===1&&i>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!_M(e)&&!h_(e)&&!mM(e)}function qw(e){return h_(e)||gM(e)}function bM(){return{css:{canvas:Vu(),cell:Vu()},device:{canvas:Vu(),cell:Vu(),char:{width:0,height:0,left:0,top:0}}}}function Vu(){return{width:0,height:0}}function yM(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var Bn=0,En=0,gr=!1,Hr=!1,Yu=!1,pi,Up=0,SM=class{constructor(e,t,i,s,o,d){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=s,this._coreBrowserService=o,this._themeService=d,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,s){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,En=0,Bn=0,Hr=!1,gr=!1,Yu=!1,pi=this._themeService.colors,Up=0,e.getCode()!==0&&e.extended.underlineStyle===4){let o=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Up=t*s%(Math.round(o)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",o=>{o.backgroundColorRGB&&(En=o.backgroundColorRGB.rgba>>8&16777215,Hr=!0),o.foregroundColorRGB&&(Bn=o.foregroundColorRGB.rgba>>8&16777215,gr=!0)}),Yu=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Yu){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:En=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:En=(this.result.fg&16777215)<<8|255;break;default:En=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:En=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:En=(this.result.bg&16777215)<<8|255;break}En=oa.blend(En,(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else En=(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Hr=!0,pi.selectionForeground&&(Bn=pi.selectionForeground.rgba>>8&16777215,gr=!0),qw(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Bn=(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Bn=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Bn=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Bn=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Bn=(this.result.fg&16777215)<<8|255;break;default:Bn=this._themeService.colors.foreground.rgba}Bn=oa.blend(Bn,(this._coreBrowserService.isFocused?pi.selectionBackgroundOpaque:pi.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}gr=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",o=>{o.backgroundColorRGB&&(En=o.backgroundColorRGB.rgba>>8&16777215,Hr=!0),o.foregroundColorRGB&&(Bn=o.foregroundColorRGB.rgba>>8&16777215,gr=!0)}),Hr&&(Yu?En=e.bg&-16777216&-134217729|En|50331648:En=e.bg&-16777216|En|50331648),gr&&(Bn=e.fg&-16777216&-67108865|Bn|50331648),this.result.fg&67108864&&(Hr&&!gr&&((this.result.bg&50331648)===0?Bn=this.result.fg&-134217728|pi.background.rgba>>8&16777215&16777215|50331648:Bn=this.result.fg&-134217728|this.result.bg&67108863,gr=!0),!Hr&&gr&&((this.result.fg&50331648)===0?En=this.result.bg&-67108864|pi.foreground.rgba>>8&16777215&16777215|50331648:En=this.result.bg&-67108864|this.result.fg&67108863,Hr=!0)),pi=void 0,this.result.bg=Hr?En:this.result.bg,this.result.fg=gr?Bn:this.result.fg,this.result.ext&=536870911,this.result.ext|=Up<<29&3758096384}},xM=.5,Kw=cM||uM?"bottom":"ideographic",wM={"▀":[{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}]},CM={"░":[[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]]},EM={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},_c={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};_c[""]=_c[""];_c[""]=_c[""];function kM(e,t,i,s,o,d,p,l){let h=wM[t];if(h)return TM(e,h,i,s,o,d),!0;let f=CM[t];if(f)return AM(e,f,i,s,o,d),!0;let v=EM[t];if(v)return RM(e,v,i,s,o,d,l),!0;let m=_c[t];return m?(LM(e,m,i,s,o,d,p,l),!0):!1}function TM(e,t,i,s,o,d){for(let p=0;p<t.length;p++){let l=t[p],h=o/8,f=d/8;e.fillRect(i+l.x*h,s+l.y*f,l.w*h,l.h*f)}}var s1=new Map;function AM(e,t,i,s,o,d){let p=s1.get(t);p||(p=new Map,s1.set(t,p));let l=e.fillStyle;if(typeof l!="string")throw new Error(`Unexpected fillStyle type "${l}"`);let h=p.get(l);if(!h){let f=t[0].length,v=t.length,m=e.canvas.ownerDocument.createElement("canvas");m.width=f,m.height=v;let S=yn(m.getContext("2d")),C=new ImageData(f,v),T,w,_,b;if(l.startsWith("#"))T=parseInt(l.slice(1,3),16),w=parseInt(l.slice(3,5),16),_=parseInt(l.slice(5,7),16),b=l.length>7&&parseInt(l.slice(7,9),16)||1;else if(l.startsWith("rgba"))[T,w,_,b]=l.substring(5,l.length-1).split(",").map(g=>parseFloat(g));else throw new Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);for(let g=0;g<v;g++)for(let y=0;y<f;y++)C.data[(g*f+y)*4]=T,C.data[(g*f+y)*4+1]=w,C.data[(g*f+y)*4+2]=_,C.data[(g*f+y)*4+3]=t[g][y]*(b*255);S.putImageData(C,0,0),h=yn(e.createPattern(m,null)),p.set(l,h)}e.fillStyle=h,e.fillRect(i,s,o,d)}function RM(e,t,i,s,o,d,p){e.strokeStyle=e.fillStyle;for(let[l,h]of Object.entries(t)){e.beginPath(),e.lineWidth=p*Number.parseInt(l);let f;if(typeof h=="function"){let v=.15/d*o;f=h(.15,v)}else f=h;for(let v of f.split(" ")){let m=v[0],S=Vw[m];if(!S){console.error(`Could not find drawing instructions for "${m}"`);continue}let C=v.substring(1).split(",");!C[0]||!C[1]||S(e,Yw(C,o,d,i,s,!0,p))}e.stroke(),e.closePath()}}function LM(e,t,i,s,o,d,p,l){let h=new Path2D;h.rect(i,s,o,d),e.clip(h),e.beginPath();let f=p/12;e.lineWidth=l*f;for(let v of t.d.split(" ")){let m=v[0],S=Vw[m];if(!S){console.error(`Could not find drawing instructions for "${m}"`);continue}let C=v.substring(1).split(",");!C[0]||!C[1]||S(e,Yw(C,o,d,i,s,!1,l,(t.leftPadding??0)*(f/2),(t.rightPadding??0)*(f/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function a1(e,t,i=0){return Math.max(Math.min(e,t),i)}var Vw={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 Yw(e,t,i,s,o,d,p,l=0,h=0){let f=e.map(v=>parseFloat(v)||parseInt(v));if(f.length<2)throw new Error("Too few arguments for instruction");for(let v=0;v<f.length;v+=2)f[v]*=t-l*p-h*p,d&&f[v]!==0&&(f[v]=a1(Math.round(f[v]+.5)-.5,t,0)),f[v]+=s+l*p;for(let v=1;v<f.length;v+=2)f[v]*=i,d&&f[v]!==0&&(f[v]=a1(Math.round(f[v]+.5)-.5,i,0)),f[v]+=o;return f}var o1=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},l1=class{constructor(){this._data=new o1}set(e,t,i,s,o){this._data.get(e,t)||this._data.set(e,t,new o1),this._data.get(e,t).set(i,s,o)}get(e,t,i,s){return this._data.get(e,t)?.get(i,s)}clear(){this._data.clear()}},Xw=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,s=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),o=e.timeRemaining(),i*1.5>o){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=o}this.clear()}},MM=class extends Xw{_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())}}},NM=class extends Xw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},OM=!u_&&"requestIdleCallback"in window?NM:MM,uo=class Zw{constructor(){this.fg=0,this.bg=0,this.extended=new Jw}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 Zw;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}},Jw=class Qw{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Qw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},DM=globalThis.performance&&typeof globalThis.performance.now=="function",jM=class eC{static create(t){return new eC(t)}constructor(t){this._now=DM&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Gr;(e=>{e.None=()=>or.None;function t(G,I){return m(G,()=>{},0,void 0,!0,void 0,I)}e.defer=t;function i(G){return(I,K=null,H)=>{let P=!1,Y;return Y=G(X=>{if(!P)return Y?Y.dispose():P=!0,I.call(K,X)},null,H),P&&Y.dispose(),Y}}e.once=i;function s(G,I,K){return f((H,P=null,Y)=>G(X=>H.call(P,I(X)),null,Y),K)}e.map=s;function o(G,I,K){return f((H,P=null,Y)=>G(X=>{I(X),H.call(P,X)},null,Y),K)}e.forEach=o;function d(G,I,K){return f((H,P=null,Y)=>G(X=>I(X)&&H.call(P,X),null,Y),K)}e.filter=d;function p(G){return G}e.signal=p;function l(...G){return(I,K=null,H)=>{let P=Uw(...G.map(Y=>Y(X=>I.call(K,X))));return v(P,H)}}e.any=l;function h(G,I,K,H){let P=K;return s(G,Y=>(P=I(P,Y),P),H)}e.reduce=h;function f(G,I){let K,H={onWillAddFirstListener(){K=G(P.fire,P)},onDidRemoveLastListener(){K?.dispose()}},P=new Wt(H);return I?.add(P),P.event}function v(G,I){return I instanceof Array?I.push(G):I&&I.add(G),G}function m(G,I,K=100,H=!1,P=!1,Y,X){let j,z,D,U=0,V,J={leakWarningThreshold:Y,onWillAddFirstListener(){j=G(pe=>{U++,z=I(z,pe),H&&!D&&(le.fire(z),z=void 0),V=()=>{let te=z;z=void 0,D=void 0,(!H||U>1)&&le.fire(te),U=0},typeof K=="number"?(clearTimeout(D),D=setTimeout(V,K)):D===void 0&&(D=0,queueMicrotask(V))})},onWillRemoveListener(){P&&U>0&&V?.()},onDidRemoveLastListener(){V=void 0,j.dispose()}},le=new Wt(J);return X?.add(le),le.event}e.debounce=m;function S(G,I=0,K){return e.debounce(G,(H,P)=>H?(H.push(P),H):[P],I,void 0,!0,void 0,K)}e.accumulate=S;function C(G,I=(H,P)=>H===P,K){let H=!0,P;return d(G,Y=>{let X=H||!I(Y,P);return H=!1,P=Y,X},K)}e.latch=C;function T(G,I,K){return[e.filter(G,I,K),e.filter(G,H=>!I(H),K)]}e.split=T;function w(G,I=!1,K=[],H){let P=K.slice(),Y=G(z=>{P?P.push(z):j.fire(z)});H&&H.add(Y);let X=()=>{P?.forEach(z=>j.fire(z)),P=null},j=new Wt({onWillAddFirstListener(){Y||(Y=G(z=>j.fire(z)),H&&H.add(Y))},onDidAddFirstListener(){P&&(I?setTimeout(X):X())},onDidRemoveLastListener(){Y&&Y.dispose(),Y=null}});return H&&H.add(j),j.event}e.buffer=w;function _(G,I){return(K,H,P)=>{let Y=I(new g);return G(function(X){let j=Y.evaluate(X);j!==b&&K.call(H,j)},void 0,P)}}e.chain=_;let b=Symbol("HaltChainable");class g{constructor(){this.steps=[]}map(I){return this.steps.push(I),this}forEach(I){return this.steps.push(K=>(I(K),K)),this}filter(I){return this.steps.push(K=>I(K)?K:b),this}reduce(I,K){let H=K;return this.steps.push(P=>(H=I(H,P),H)),this}latch(I=(K,H)=>K===H){let K=!0,H;return this.steps.push(P=>{let Y=K||!I(P,H);return K=!1,H=P,Y?P:b}),this}evaluate(I){for(let K of this.steps)if(I=K(I),I===b)break;return I}}function y(G,I,K=H=>H){let H=(...j)=>X.fire(K(...j)),P=()=>G.on(I,H),Y=()=>G.removeListener(I,H),X=new Wt({onWillAddFirstListener:P,onDidRemoveLastListener:Y});return X.event}e.fromNodeEventEmitter=y;function k(G,I,K=H=>H){let H=(...j)=>X.fire(K(...j)),P=()=>G.addEventListener(I,H),Y=()=>G.removeEventListener(I,H),X=new Wt({onWillAddFirstListener:P,onDidRemoveLastListener:Y});return X.event}e.fromDOMEventEmitter=k;function M(G){return new Promise(I=>i(G)(I))}e.toPromise=M;function A(G){let I=new Wt;return G.then(K=>{I.fire(K)},()=>{I.fire(void 0)}).finally(()=>{I.dispose()}),I.event}e.fromPromise=A;function N(G,I){return G(K=>I.fire(K))}e.forward=N;function R(G,I,K){return I(K),G(H=>I(H))}e.runAndSubscribe=R;class B{constructor(I,K){this._observable=I,this._counter=0,this._hasChanged=!1;let H={onWillAddFirstListener:()=>{I.addObserver(this)},onDidRemoveLastListener:()=>{I.removeObserver(this)}};this.emitter=new Wt(H),K&&K.add(this.emitter)}beginUpdate(I){this._counter++}handlePossibleChange(I){}handleChange(I,K){this._hasChanged=!0}endUpdate(I){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function q(G,I){return new B(G,I).emitter.event}e.fromObservable=q;function W(G){return(I,K,H)=>{let P=0,Y=!1,X={beginUpdate(){P++},endUpdate(){P--,P===0&&(G.reportChanges(),Y&&(Y=!1,I.call(K)))},handlePossibleChange(){},handleChange(){Y=!0}};G.addObserver(X),G.reportChanges();let j={dispose(){G.removeObserver(X)}};return H instanceof vo?H.add(j):Array.isArray(H)&&H.push(j),j}}e.fromObservableLight=W})(Gr||={});var Jm=class Qm{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Qm._idPool++}`,Qm.all.add(this)}start(t){this._stopWatch=new jM,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Jm.all=new Set,Jm._idPool=0;var IM=Jm,BM=-1,tC=class nC{constructor(t,i,s=(nC._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[d,p]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${p}):`;console.warn(l),console.warn(d);let h=new HM(l,d);this._errorHandler(h)}return()=>{let d=this._stacks.get(t.value)||0;this._stacks.set(t.value,d-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,o]of this._stacks)(!t||i<o)&&(t=[s,o],i=o);return t}};tC._idPool=1;var PM=tC,zM=class iC{constructor(t){this.value=t}static create(){let t=new Error;return new iC(t.stack??"")}print(){console.warn(this.value.split(`
16
+ `).slice(2).join(`
17
+ `))}},HM=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},$M=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},UM=0,Fp=class{constructor(t){this.value=t,this.id=UM++}},FM=2,WM,Wt=class{constructor(t){this._size=0,this._options=t,this._leakageMon=this._options?.leakWarningThreshold?new PM(t?.onListenerError??$p,this._options?.leakWarningThreshold??BM):void 0,this._perfMon=this._options?._profName?new IM(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(t,i,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new $M(`${l}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||$p)(f),or.None}if(this._disposed)return or.None;i&&(t=t.bind(i));let o=new Fp(t),d;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=zM.create(),d=this._leakageMon.check(o.stack,this._size+1)),this._listeners?this._listeners instanceof Fp?(this._deliveryQueue??=new GM,this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._size++;let p=Wn(()=>{d?.(),this._removeListener(o)});return s instanceof vo?s.add(p):Array.isArray(s)&&s.push(p),p},this._event}_removeListener(t){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let i=this._listeners,s=i.indexOf(t);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,i[s]=void 0;let o=this._deliveryQueue.current===this;if(this._size*FM<=i.length){let d=0;for(let p=0;p<i.length;p++)i[p]?i[d++]=i[p]:o&&(this._deliveryQueue.end--,d<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=d}}_deliver(t,i){if(!t)return;let s=this._options?.onListenerError||$p;if(!s){t.value(i);return}try{t.value(i)}catch(o){s(o)}}_deliverQueue(t){let i=t.current._listeners;for(;t.i<t.end;)this._deliver(i[t.i++],t.value);t.reset()}fire(t){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Fp)this._deliver(this._listeners,t);else{let i=this._deliveryQueue;i.enqueue(this,t,this._listeners.length),this._deliverQueue(i)}this._perfMon?.stop()}hasListeners(){return this._size>0}},GM=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},c1={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},Dl=2,jl,ws=class so{constructor(t,i,s){this._document=t,this._config=i,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new l1,this._cacheMapCombined=new l1,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new uo,this._textureSize=512,this._onAddTextureAtlasCanvas=new Wt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Wt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=rC(t,this._config.deviceCellWidth*4+Dl*2,this._config.deviceCellHeight+Dl*2),this._tmpCtx=yn(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 OM;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let s=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,s)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(so.maxAtlasPages&&this._pages.length>=Math.max(4,so.maxAtlasPages)){let i=this._pages.filter(f=>f.canvas.width*2<=(so.maxTextureSize||4096)).sort((f,v)=>v.canvas.width!==f.canvas.width?v.canvas.width-f.canvas.width:v.percentageUsed-f.percentageUsed),s=-1,o=0;for(let f=0;f<i.length;f++)if(i[f].canvas.width!==o)s=f,o=i[f].canvas.width;else if(f-s===3)break;let d=i.slice(s,s+4),p=d.map(f=>f.glyphs[0].texturePage).sort((f,v)=>f>v?1:-1),l=this.pages.length-d.length,h=this._mergePages(d,l);h.version++;for(let f=p.length-1;f>=0;f--)this._deletePage(p[f]);this.pages.push(h),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(h.canvas)}let t=new Wp(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let s=t[0].canvas.width*2,o=new Wp(this._document,s,t);for(let[d,p]of t.entries()){let l=d*p.canvas.width%s,h=Math.floor(d/2)*p.canvas.height;o.ctx.drawImage(p.canvas,l,h);for(let v of p.glyphs)v.texturePage=i,v.sizeClipSpace.x=v.size.x/s,v.sizeClipSpace.y=v.size.y/s,v.texturePosition.x+=l,v.texturePosition.y+=h,v.texturePositionClipSpace.x=v.texturePosition.x/s,v.texturePositionClipSpace.y=v.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(p.canvas);let f=this._activePages.indexOf(p);f!==-1&&this._activePages.splice(f,1)}return o}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let s=this._pages[i];for(let o of s.glyphs)o.texturePage--;s.version++}}getRasterizedGlyphCombinedChar(t,i,s,o,d,p){return this._getFromCacheMap(this._cacheMapCombined,t,i,s,o,d,p)}getRasterizedGlyph(t,i,s,o,d,p){return this._getFromCacheMap(this._cacheMap,t,i,s,o,d,p)}_getFromCacheMap(t,i,s,o,d,p,l){return jl=t.get(i,s,o,d),jl||(jl=this._drawToCache(i,s,o,d,p,l),t.set(i,s,o,d,jl)),jl}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw new Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,i,s,o){if(this._config.allowTransparency)return qi;let d;switch(t){case 16777216:case 33554432:d=this._getColorFromAnsiIndex(i);break;case 50331648:let p=uo.toColorRGB(i);d=ni.toColor(p[0],p[1],p[2]);break;default:s?d=Xl.opaque(this._config.colors.foreground):d=this._config.colors.background;break}return this._config.allowTransparency||(d=Xl.opaque(d)),d}_getForegroundColor(t,i,s,o,d,p,l,h,f,v){let m=this._getMinimumContrastColor(t,i,s,o,d,p,l,f,h,v);if(m)return m;let S;switch(d){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&f&&p<8&&(p+=8),S=this._getColorFromAnsiIndex(p);break;case 50331648:let C=uo.toColorRGB(p);S=ni.toColor(C[0],C[1],C[2]);break;default:l?S=this._config.colors.background:S=this._config.colors.foreground}return this._config.allowTransparency&&(S=Xl.opaque(S)),h&&(S=Xl.multiplyOpacity(S,xM)),S}_resolveBackgroundRgba(t,i,s){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,s,o){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&o&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,s,o,d,p,l,h,f,v){if(this._config.minimumContrastRatio===1||v)return;let m=this._getContrastCache(f),S=m.getColor(t,o);if(S!==void 0)return S||void 0;let C=this._resolveBackgroundRgba(i,s,l),T=this._resolveForegroundRgba(d,p,l,h),w=oa.ensureContrastRatio(C,T,this._config.minimumContrastRatio/(f?2:1));if(!w){m.setColor(t,o,null);return}let _=ni.toColor(w>>24&255,w>>16&255,w>>8&255);return m.setColor(t,o,_),_}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,s,o,d,p){let l=typeof t=="number"?String.fromCharCode(t):t;p&&this._tmpCanvas.parentElement!==p&&(this._tmpCanvas.style.display="none",p.append(this._tmpCanvas));let h=Math.min(this._config.deviceCellWidth*Math.max(l.length,2)+Dl*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<h&&(this._tmpCanvas.width=h);let f=Math.min(this._config.deviceCellHeight+Dl*4,this._textureSize);if(this._tmpCanvas.height<f&&(this._tmpCanvas.height=f),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=o,!!this._workAttributeData.isInvisible())return c1;let v=!!this._workAttributeData.isBold(),m=!!this._workAttributeData.isInverse(),S=!!this._workAttributeData.isDim(),C=!!this._workAttributeData.isItalic(),T=!!this._workAttributeData.isUnderline(),w=!!this._workAttributeData.isStrikethrough(),_=!!this._workAttributeData.isOverline(),b=this._workAttributeData.getFgColor(),g=this._workAttributeData.getFgColorMode(),y=this._workAttributeData.getBgColor(),k=this._workAttributeData.getBgColorMode();if(m){let z=b;b=y,y=z;let D=g;g=k,k=D}let M=this._getBackgroundColor(k,y,m,S);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let A=v?this._config.fontWeightBold:this._config.fontWeight,N=C?"italic":"";this._tmpCtx.font=`${N} ${A} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Kw;let R=l.length===1&&h_(l.charCodeAt(0)),B=l.length===1&&pM(l.charCodeAt(0)),q=this._getForegroundColor(i,k,y,s,g,b,m,S,v,qw(l.charCodeAt(0)));this._tmpCtx.fillStyle=q.css;let W=B?0:Dl*2,G=!1;this._config.customGlyphs!==!1&&(G=kM(this._tmpCtx,l,W,W,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let I=!R,K;if(typeof t=="number"?K=this._unicodeService.wcwidth(t):K=this._unicodeService.getStringCellWidth(t),T){this._tmpCtx.save();let z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=z%2===1?.5:0;if(this._tmpCtx.lineWidth=z,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())I=!1,this._tmpCtx.strokeStyle=`rgb(${uo.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{I=!1;let te=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&te<8&&(te+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(te).css}this._tmpCtx.beginPath();let U=W,V=Math.ceil(W+this._config.deviceCharHeight)-D-(d?z*2:0),J=V+z,le=V+z*2,pe=this._workAttributeData.getUnderlineVariantOffset();for(let te=0;te<K;te++){this._tmpCtx.save();let F=U+te*this._config.deviceCellWidth,ae=U+(te+1)*this._config.deviceCellWidth,re=F+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(F,V),this._tmpCtx.lineTo(ae,V),this._tmpCtx.moveTo(F,le),this._tmpCtx.lineTo(ae,le);break;case 3:let ge=z<=1?le:Math.ceil(W+this._config.deviceCharHeight-z/2)-D,de=z<=1?V:Math.ceil(W+this._config.deviceCharHeight+z/2)-D,we=new Path2D;we.rect(F,V,this._config.deviceCellWidth,le-V),this._tmpCtx.clip(we),this._tmpCtx.moveTo(F-this._config.deviceCellWidth/2,J),this._tmpCtx.bezierCurveTo(F-this._config.deviceCellWidth/2,de,F,de,F,J),this._tmpCtx.bezierCurveTo(F,ge,re,ge,re,J),this._tmpCtx.bezierCurveTo(re,de,ae,de,ae,J),this._tmpCtx.bezierCurveTo(ae,ge,ae+this._config.deviceCellWidth/2,ge,ae+this._config.deviceCellWidth/2,J);break;case 4:let Ie=pe===0?0:pe>=z?z*2-pe:z-pe;pe>=z||Ie===0?(this._tmpCtx.setLineDash([Math.round(z),Math.round(z)]),this._tmpCtx.moveTo(F+Ie,V),this._tmpCtx.lineTo(ae,V)):(this._tmpCtx.setLineDash([Math.round(z),Math.round(z)]),this._tmpCtx.moveTo(F,V),this._tmpCtx.lineTo(F+Ie,V),this._tmpCtx.moveTo(F+Ie+z,V),this._tmpCtx.lineTo(ae,V)),pe=yM(ae-F,z,pe);break;case 5:let Ne=.6,Ge=.3,Ee=ae-F,ct=Math.floor(Ne*Ee),wt=Math.floor(Ge*Ee),Xt=Ee-ct-wt;this._tmpCtx.setLineDash([ct,wt,Xt]),this._tmpCtx.moveTo(F,V),this._tmpCtx.lineTo(ae,V);break;default:this._tmpCtx.moveTo(F,V),this._tmpCtx.lineTo(ae,V);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!G&&this._config.fontSize>=12&&!this._config.allowTransparency&&l!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let te=this._tmpCtx.measureText(l);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in te&&te.actualBoundingBoxDescent>0){this._tmpCtx.save();let F=new Path2D;F.rect(U,V-Math.ceil(z/2),this._config.deviceCellWidth*K,le-V+Math.ceil(z/2)),this._tmpCtx.clip(F),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=M.css,this._tmpCtx.strokeText(l,W,W+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(_){let z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=z%2===1?.5:0;this._tmpCtx.lineWidth=z,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(W,W+D),this._tmpCtx.lineTo(W+this._config.deviceCharWidth*K,W+D),this._tmpCtx.stroke()}if(G||this._tmpCtx.fillText(l,W,W+this._config.deviceCharHeight),l==="_"&&!this._config.allowTransparency){let z=Gp(this._tmpCtx.getImageData(W,W,this._config.deviceCellWidth,this._config.deviceCellHeight),M,q,I);if(z)for(let D=1;D<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=M.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(l,W,W+this._config.deviceCharHeight-D),z=Gp(this._tmpCtx.getImageData(W,W,this._config.deviceCellWidth,this._config.deviceCellHeight),M,q,I),!!z);D++);}if(w){let z=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),D=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=z,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(W,W+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.lineTo(W+this._config.deviceCharWidth*K,W+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.stroke()}this._tmpCtx.restore();let H=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),P;if(this._config.allowTransparency?P=qM(H):P=Gp(H,M,q,I),P)return c1;let Y=this._findGlyphBoundingBox(H,this._workBoundingBox,h,B,G,W),X,j;for(;;){if(this._activePages.length===0){let z=this._createNewPage();X=z,j=z.currentRow,j.height=Y.size.y;break}X=this._activePages[this._activePages.length-1],j=X.currentRow;for(let z of this._activePages)Y.size.y<=z.currentRow.height&&(X=z,j=z.currentRow);for(let z=this._activePages.length-1;z>=0;z--)for(let D of this._activePages[z].fixedRows)D.height<=j.height&&Y.size.y<=D.height&&(X=this._activePages[z],j=D);if(Y.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Wp(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),X=this._overflowSizePage,j=this._overflowSizePage.currentRow,j.x+Y.size.x>=X.canvas.width&&(j.x=0,j.y+=j.height,j.height=0);break}if(j.y+Y.size.y>=X.canvas.height||j.height>Y.size.y+2){let z=!1;if(X.currentRow.y+X.currentRow.height+Y.size.y>=X.canvas.height){let D;for(let U of this._activePages)if(U.currentRow.y+U.currentRow.height+Y.size.y<U.canvas.height){D=U;break}if(D)X=D;else if(so.maxAtlasPages&&this._pages.length>=so.maxAtlasPages&&j.y+Y.size.y<=X.canvas.height&&j.height>=Y.size.y&&j.x+Y.size.x<=X.canvas.width)z=!0;else{let U=this._createNewPage();X=U,j=U.currentRow,j.height=Y.size.y,z=!0}}z||(X.currentRow.height>0&&X.fixedRows.push(X.currentRow),j={x:0,y:X.currentRow.y+X.currentRow.height,height:Y.size.y},X.fixedRows.push(j),X.currentRow={x:0,y:j.y+j.height,height:0})}if(j.x+Y.size.x<=X.canvas.width)break;j===X.currentRow?(j.x=0,j.y+=j.height,j.height=0):X.fixedRows.splice(X.fixedRows.indexOf(j),1)}return Y.texturePage=this._pages.indexOf(X),Y.texturePosition.x=j.x,Y.texturePosition.y=j.y,Y.texturePositionClipSpace.x=j.x/X.canvas.width,Y.texturePositionClipSpace.y=j.y/X.canvas.height,Y.sizeClipSpace.x/=X.canvas.width,Y.sizeClipSpace.y/=X.canvas.height,j.height=Math.max(j.height,Y.size.y),j.x+=Y.size.x,X.ctx.putImageData(H,Y.texturePosition.x-this._workBoundingBox.left,Y.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,Y.size.x,Y.size.y),X.addGlyph(Y),X.version++,Y}_findGlyphBoundingBox(t,i,s,o,d,p){i.top=0;let l=o?this._config.deviceCellHeight:this._tmpCanvas.height,h=o?this._config.deviceCellWidth:s,f=!1;for(let v=0;v<l;v++){for(let m=0;m<h;m++){let S=v*this._tmpCanvas.width*4+m*4+3;if(t.data[S]!==0){i.top=v,f=!0;break}}if(f)break}i.left=0,f=!1;for(let v=0;v<p+h;v++){for(let m=0;m<l;m++){let S=m*this._tmpCanvas.width*4+v*4+3;if(t.data[S]!==0){i.left=v,f=!0;break}}if(f)break}i.right=h,f=!1;for(let v=p+h-1;v>=p;v--){for(let m=0;m<l;m++){let S=m*this._tmpCanvas.width*4+v*4+3;if(t.data[S]!==0){i.right=v,f=!0;break}}if(f)break}i.bottom=l,f=!1;for(let v=l-1;v>=0;v--){for(let m=0;m<h;m++){let S=v*this._tmpCanvas.width*4+m*4+3;if(t.data[S]!==0){i.bottom=v,f=!0;break}}if(f)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+p+(o||d?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+p+(o||d?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Wp=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let s of i)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=rC(e,t,t),this.ctx=yn(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function Gp(e,t,i,s){let o=t.rgba>>>24,d=t.rgba>>>16&255,p=t.rgba>>>8&255,l=i.rgba>>>24,h=i.rgba>>>16&255,f=i.rgba>>>8&255,v=Math.floor((Math.abs(o-l)+Math.abs(d-h)+Math.abs(p-f))/12),m=!0;for(let S=0;S<e.data.length;S+=4)e.data[S]===o&&e.data[S+1]===d&&e.data[S+2]===p||s&&Math.abs(e.data[S]-o)+Math.abs(e.data[S+1]-d)+Math.abs(e.data[S+2]-p)<v?e.data[S+3]=0:m=!1;return m}function qM(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function rC(e,t,i){let s=e.createElement("canvas");return s.width=t,s.height=i,s}function KM(e,t,i,s,o,d,p,l){let h={foreground:d.foreground,background:d.background,cursor:qi,cursorAccent:qi,selectionForeground:qi,selectionBackgroundTransparent:qi,selectionBackgroundOpaque:qi,selectionInactiveBackgroundTransparent:qi,selectionInactiveBackgroundOpaque:qi,overviewRulerBorder:qi,scrollbarSliderBackground:qi,scrollbarSliderHoverBackground:qi,scrollbarSliderActiveBackground:qi,ansi:d.ansi.slice(),contrastCache:d.contrastCache,halfContrastCache:d.halfContrastCache};return{customGlyphs:o.customGlyphs,devicePixelRatio:p,deviceMaxTextureSize:l,letterSpacing:o.letterSpacing,lineHeight:o.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:s,fontFamily:o.fontFamily,fontSize:o.fontSize,fontWeight:o.fontWeight,fontWeightBold:o.fontWeightBold,allowTransparency:o.allowTransparency,drawBoldTextInBrightColors:o.drawBoldTextInBrightColors,minimumContrastRatio:o.minimumContrastRatio,colors:h}}function u1(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function VM(e){return(e&50331648)===16777216||(e&50331648)===33554432}var Yi=[];function sC(e,t,i,s,o,d,p,l,h){let f=KM(s,o,d,p,t,i,l,h);for(let S=0;S<Yi.length;S++){let C=Yi[S],T=C.ownedBy.indexOf(e);if(T>=0){if(u1(C.config,f))return C.atlas;C.ownedBy.length===1?(C.atlas.dispose(),Yi.splice(S,1)):C.ownedBy.splice(T,1);break}}for(let S=0;S<Yi.length;S++){let C=Yi[S];if(u1(C.config,f))return C.ownedBy.push(e),C.atlas}let v=e._core,m={atlas:new ws(document,f,v.unicodeService),config:f,ownedBy:[e]};return Yi.push(m),m.atlas}function h1(e){for(let t=0;t<Yi.length;t++){let i=Yi[t].ownedBy.indexOf(e);if(i!==-1){Yi[t].ownedBy.length===1?(Yi[t].atlas.dispose(),Yi.splice(t,1)):Yi[t].ownedBy.splice(i,1);break}}}var Xu=600,YM=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=Xu){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Xu-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=Xu-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Xu)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function d1(e,t,i){let s=new t.ResizeObserver(o=>{let d=o.find(h=>h.target===e);if(!d)return;if(!("devicePixelContentBoxSize"in d)){s?.disconnect(),s=void 0;return}let p=d.devicePixelContentBoxSize[0].inlineSize,l=d.devicePixelContentBoxSize[0].blockSize;p>0&&l>0&&i(p,l)});try{s.observe(e,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return Wn(()=>s?.disconnect())}function XM(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var f1=class aC extends uo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Jw,this.combinedData=""}static fromCharData(t){let i=new aC;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?XM(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(s-55296)*1024+o-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},oC=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function lC(e,t,i){let s=yn(e.createProgram());if(e.attachShader(s,yn(p1(e,e.VERTEX_SHADER,t))),e.attachShader(s,yn(p1(e,e.FRAGMENT_SHADER,i))),e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS))return s;console.error(e.getProgramInfoLog(s)),e.deleteProgram(s)}function p1(e,t,i){let s=yn(e.createShader(t));if(e.shaderSource(s,i),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS))return s;console.error(e.getShaderInfoLog(s)),e.deleteShader(s)}function ZM(e,t){let i=Math.min(e.length*2,t),s=new Float32Array(i);for(let o=0;o<e.length;o++)s[o]=e[o];return s}var JM=class{constructor(e){this.texture=e,this.version=-1}},QM=`#version 300 es
18
+ layout (location = 0) in vec2 a_unitquad;
19
+ layout (location = 1) in vec2 a_cellpos;
20
+ layout (location = 2) in vec2 a_offset;
21
+ layout (location = 3) in vec2 a_size;
22
+ layout (location = 4) in float a_texpage;
23
+ layout (location = 5) in vec2 a_texcoord;
24
+ layout (location = 6) in vec2 a_texsize;
25
+
26
+ uniform mat4 u_projection;
27
+ uniform vec2 u_resolution;
28
+
29
+ out vec2 v_texcoord;
30
+ flat out int v_texpage;
31
+
32
+ void main() {
33
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
34
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
35
+ v_texpage = int(a_texpage);
36
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
37
+ }`;function e6(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
38
+ precision lowp float;
39
+
40
+ in vec2 v_texcoord;
41
+ flat in int v_texpage;
42
+
43
+ uniform sampler2D u_texture[${e}];
44
+
45
+ out vec4 outColor;
46
+
47
+ void main() {
48
+ if (v_texpage == 0) {
49
+ outColor = texture(u_texture[0], v_texcoord);
50
+ } ${t}
51
+ }`}var Cs=11,Ja=Cs*Float32Array.BYTES_PER_ELEMENT,t6=2,on=0,Ft,qp=0,Il=0,n6=class extends or{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let o=this._gl;ws.maxAtlasPages===void 0&&(ws.maxAtlasPages=Math.min(32,yn(o.getParameter(o.MAX_TEXTURE_IMAGE_UNITS))),ws.maxTextureSize=yn(o.getParameter(o.MAX_TEXTURE_SIZE))),this._program=yn(lC(o,QM,e6(ws.maxAtlasPages))),this._register(Wn(()=>o.deleteProgram(this._program))),this._projectionLocation=yn(o.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=yn(o.getUniformLocation(this._program,"u_resolution")),this._textureLocation=yn(o.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let d=new Float32Array([0,0,1,0,0,1,1,1]),p=o.createBuffer();this._register(Wn(()=>o.deleteBuffer(p))),o.bindBuffer(o.ARRAY_BUFFER,p),o.bufferData(o.ARRAY_BUFFER,d,o.STATIC_DRAW),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),h=o.createBuffer();this._register(Wn(()=>o.deleteBuffer(h))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h),o.bufferData(o.ELEMENT_ARRAY_BUFFER,l,o.STATIC_DRAW),this._attributesBuffer=yn(o.createBuffer()),this._register(Wn(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,2,o.FLOAT,!1,Ja,0),o.vertexAttribDivisor(2,1),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,o.FLOAT,!1,Ja,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(3,1),o.enableVertexAttribArray(4),o.vertexAttribPointer(4,1,o.FLOAT,!1,Ja,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(4,1),o.enableVertexAttribArray(5),o.vertexAttribPointer(5,2,o.FLOAT,!1,Ja,5*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(5,1),o.enableVertexAttribArray(6),o.vertexAttribPointer(6,2,o.FLOAT,!1,Ja,7*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(6,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Ja,9*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.useProgram(this._program);let f=new Int32Array(ws.maxAtlasPages);for(let v=0;v<ws.maxAtlasPages;v++)f[v]=v;o.uniform1iv(this._textureLocation,f),o.uniformMatrix4fv(this._projectionLocation,!1,oC),this._atlasTextures=[];for(let v=0;v<ws.maxAtlasPages;v++){let m=new JM(yn(o.createTexture()));this._register(Wn(()=>o.deleteTexture(m.texture))),o.activeTexture(o.TEXTURE0+v),o.bindTexture(o.TEXTURE_2D,m.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[v]=m}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(e,t,i,s,o,d,p,l,h){this._updateCell(this._vertices.attributes,e,t,i,s,o,d,p,l,h)}_updateCell(e,t,i,s,o,d,p,l,h,f){if(on=(i*this._terminal.cols+t)*Cs,s===0||s===void 0){e.fill(0,on,on+Cs-1-t6);return}this._atlas&&(l&&l.length>1?Ft=this._atlas.getRasterizedGlyphCombinedChar(l,o,d,p,!1,this._terminal.element):Ft=this._atlas.getRasterizedGlyph(s,o,d,p,!1,this._terminal.element),qp=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),o!==f&&Ft.offset.x>qp?(Il=Ft.offset.x-qp,e[on]=-(Ft.offset.x-Il)+this._dimensions.device.char.left,e[on+1]=-Ft.offset.y+this._dimensions.device.char.top,e[on+2]=(Ft.size.x-Il)/this._dimensions.device.canvas.width,e[on+3]=Ft.size.y/this._dimensions.device.canvas.height,e[on+4]=Ft.texturePage,e[on+5]=Ft.texturePositionClipSpace.x+Il/this._atlas.pages[Ft.texturePage].canvas.width,e[on+6]=Ft.texturePositionClipSpace.y,e[on+7]=Ft.sizeClipSpace.x-Il/this._atlas.pages[Ft.texturePage].canvas.width,e[on+8]=Ft.sizeClipSpace.y):(e[on]=-Ft.offset.x+this._dimensions.device.char.left,e[on+1]=-Ft.offset.y+this._dimensions.device.char.top,e[on+2]=Ft.size.x/this._dimensions.device.canvas.width,e[on+3]=Ft.size.y/this._dimensions.device.canvas.height,e[on+4]=Ft.texturePage,e[on+5]=Ft.texturePositionClipSpace.x,e[on+6]=Ft.texturePositionClipSpace.y,e[on+7]=Ft.sizeClipSpace.x,e[on+8]=Ft.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&vM(s,h,Ft.size.x,this._dimensions.device.cell.width)&&(e[on+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*Cs;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==t?this._vertices.attributesBuffers[i]=new Float32Array(t):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=t,i=0;for(let s=0;s<e.rows;s++)for(let o=0;o<e.cols;o++)this._vertices.attributes[i+9]=o/e.cols,this._vertices.attributes[i+10]=s/e.rows,i+=Cs}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],s=0;for(let o=0;o<e.lineLengths.length;o++){let d=o*this._terminal.cols*Cs,p=this._vertices.attributes.subarray(d,d+e.lineLengths[o]*Cs);i.set(p,s),s+=p.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,s),t.STREAM_DRAW);for(let o=0;o<this._atlas.pages.length;o++)this._atlas.pages[o].version!==this._atlasTextures[o].version&&this._bindAtlasPageTexture(t,this._atlas,o);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,s/Cs)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[i].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[i].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[i].version=t.pages[i].version}setDimensions(e){this._dimensions=e}},i6=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let o=e.buffers.active.ydisp,d=t[1]-o,p=i[1]-o,l=Math.max(d,0),h=Math.min(p,e.rows-1);if(l>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=d,this.viewportEndRow=p,this.viewportCappedStartRow=l,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function r6(){return new i6}var zh=4,yh=1,Sh=2,Kp=3,s6=2147483648,a6=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=r6()}resize(e,t){let i=e*t*zh;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},o6=`#version 300 es
52
+ layout (location = 0) in vec2 a_position;
53
+ layout (location = 1) in vec2 a_size;
54
+ layout (location = 2) in vec4 a_color;
55
+ layout (location = 3) in vec2 a_unitquad;
56
+
57
+ uniform mat4 u_projection;
58
+
59
+ out vec4 v_color;
60
+
61
+ void main() {
62
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
63
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
64
+ v_color = a_color;
65
+ }`,l6=`#version 300 es
66
+ precision lowp float;
67
+
68
+ in vec4 v_color;
69
+
70
+ out vec4 outColor;
71
+
72
+ void main() {
73
+ outColor = v_color;
74
+ }`,Fr=8,Vp=Fr*Float32Array.BYTES_PER_ELEMENT,c6=20*Fr,m1=class{constructor(){this.attributes=new Float32Array(c6),this.count=0}},$r=0,g1=0,_1=0,v1=0,b1=0,y1=0,S1=0,u6=class extends or{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=s,this._vertices=new m1,this._verticesCursor=new m1;let o=this._gl;this._program=yn(lC(o,o6,l6)),this._register(Wn(()=>o.deleteProgram(this._program))),this._projectionLocation=yn(o.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=o.createVertexArray(),o.bindVertexArray(this._vertexArrayObject);let d=new Float32Array([0,0,1,0,0,1,1,1]),p=o.createBuffer();this._register(Wn(()=>o.deleteBuffer(p))),o.bindBuffer(o.ARRAY_BUFFER,p),o.bufferData(o.ARRAY_BUFFER,d,o.STATIC_DRAW),o.enableVertexAttribArray(3),o.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),h=o.createBuffer();this._register(Wn(()=>o.deleteBuffer(h))),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h),o.bufferData(o.ELEMENT_ARRAY_BUFFER,l,o.STATIC_DRAW),this._attributesBuffer=yn(o.createBuffer()),this._register(Wn(()=>o.deleteBuffer(this._attributesBuffer))),o.bindBuffer(o.ARRAY_BUFFER,this._attributesBuffer),o.enableVertexAttribArray(0),o.vertexAttribPointer(0,2,o.FLOAT,!1,Vp,0),o.vertexAttribDivisor(0,1),o.enableVertexAttribArray(1),o.vertexAttribPointer(1,2,o.FLOAT,!1,Vp,2*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(1,1),o.enableVertexAttribArray(2),o.vertexAttribPointer(2,4,o.FLOAT,!1,Vp,4*Float32Array.BYTES_PER_ELEMENT),o.vertexAttribDivisor(2,1),this._updateCachedColors(s.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,oC),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,i=this._vertices,s=1,o,d,p,l,h,f,v,m,S,C,T;for(o=0;o<t.rows;o++){for(p=-1,l=0,h=0,f=!1,d=0;d<t.cols;d++)v=(o*t.cols+d)*zh,m=e.cells[v+yh],S=e.cells[v+Sh],C=!!(S&67108864),(m!==l||S!==h&&(f||C))&&((l!==0||f&&h!==0)&&(T=s++*Fr,this._updateRectangle(i,T,h,l,p,d,o)),p=d,l=m,h=S,f=C);(l!==0||f&&h!==0)&&(T=s++*Fr,this._updateRectangle(i,T,h,l,p,t.cols,o))}i.count=s}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let s,o=0;(i.style==="bar"||i.style==="outline")&&(s=o++*Fr,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(s=o++*Fr,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(s=o++*Fr,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),s=o++*Fr,this._addRectangleFloat(t.attributes,s,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=o}_updateRectangle(e,t,i,s,o,d,p){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:$r=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:$r=(i&16777215)<<8;break;default:$r=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:$r=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:$r=(s&16777215)<<8;break;default:$r=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=ZM(e.attributes,this._terminal.rows*this._terminal.cols*Fr)),g1=o*this._dimensions.device.cell.width,_1=p*this._dimensions.device.cell.height,v1=($r>>24&255)/255,b1=($r>>16&255)/255,y1=($r>>8&255)/255,S1=1,this._addRectangle(e.attributes,t,g1,_1,(d-o)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,v1,b1,y1,S1)}_addRectangle(e,t,i,s,o,d,p,l,h,f){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=o/this._dimensions.device.canvas.width,e[t+3]=d/this._dimensions.device.canvas.height,e[t+4]=p,e[t+5]=l,e[t+6]=h,e[t+7]=f}_addRectangleFloat(e,t,i,s,o,d,p){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=o/this._dimensions.device.canvas.width,e[t+3]=d/this._dimensions.device.canvas.height,e[t+4]=p[0],e[t+5]=p[1],e[t+6]=p[2],e[t+7]=p[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])}},h6=class extends or{constructor(e,t,i,s,o,d,p,l){super(),this._container=t,this._alpha=o,this._coreBrowserService=d,this._optionsService=p,this._themeService=l,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(e,h),this.reset(e)})),this._register(Wn(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=yn(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,s=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=sC(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,i,s){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,s){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=Kw,this._clipCell(i,s,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let s=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${s} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},d6=class extends h6{constructor(e,t,i,s,o,d,p){super(i,e,"link",t,!0,o,d,p),this._register(s.onShowLinkUnderline(l=>this._handleShowLinkUnderline(l))),this._register(s.onHideLinkUnderline(l=>this._handleHideLinkUnderline(l)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&VM(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},ia=typeof window=="object"?window:globalThis,eg=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Wt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Wt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};eg.INSTANCE=new eg;var cC=eg;function f6(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}cC.INSTANCE.onDidChangeZoomLevel;cC.INSTANCE.onDidChangeFullscreen;var jo=typeof navigator=="object"?navigator.userAgent:"";jo.indexOf("Firefox")>=0;jo.indexOf("AppleWebKit")>=0;var p6=jo.indexOf("Chrome")>=0;!p6&&jo.indexOf("Safari")>=0;jo.indexOf("Electron/")>=0;jo.indexOf("Android")>=0;var Yp=!1;if(typeof ia.matchMedia=="function"){let e=ia.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ia.matchMedia("(display-mode: fullscreen)");Yp=e.matches,f6(ia,e,({matches:i})=>{Yp&&t.matches||(Yp=i)})}var ho="en",Xp=!1,uC=!1,Zu,xh=ho,x1=ho,m6,Ur,la=globalThis,Li;typeof la.vscode<"u"&&typeof la.vscode.process<"u"?Li=la.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Li=process);var g6=typeof Li?.versions?.electron=="string",_6=g6&&Li?.type==="renderer";if(typeof Li=="object"){Li.platform,Li.platform,Xp=Li.platform==="linux",Xp&&Li.env.SNAP&&Li.env.SNAP_REVISION,Li.env.CI||Li.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Zu=ho,xh=ho;let e=Li.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Zu=t.userLocale,x1=t.osLocale,xh=t.resolvedLanguage||ho,m6=t.languagePack?.translationsConfigFile}catch{}uC=!0}else typeof navigator=="object"&&!_6?(Ur=navigator.userAgent,Ur.indexOf("Windows")>=0,Ur.indexOf("Macintosh")>=0,(Ur.indexOf("Macintosh")>=0||Ur.indexOf("iPad")>=0||Ur.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Xp=Ur.indexOf("Linux")>=0,Ur?.indexOf("Mobi")>=0,xh=globalThis._VSCODE_NLS_LANGUAGE||ho,Zu=navigator.language.toLowerCase(),x1=Zu):console.error("Unable to resolve platform.");var w1=uC,br=Ur,ys=xh,v6;(e=>{function t(){return ys}e.value=t;function i(){return ys.length===2?ys==="en":ys.length>=3?ys[0]==="e"&&ys[1]==="n"&&ys[2]==="-":!1}e.isDefaultVariant=i;function s(){return ys==="en"}e.isDefault=s})(v6||={});var b6=typeof la.postMessage=="function"&&!la.importScripts;(()=>{if(b6){let e=[];la.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,o=e.length;s<o;s++){let d=e[s];if(d.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),d.callback();return}}});let t=0;return i=>{let s=++t;e.push({id:s,callback:i}),la.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})();var y6=!!(br&&br.indexOf("Chrome")>=0);br&&br.indexOf("Firefox")>=0;!y6&&br&&br.indexOf("Safari")>=0;br&&br.indexOf("Edg/")>=0;br&&br.indexOf("Android")>=0;var Qa=typeof navigator=="object"?navigator:{};w1||document.queryCommandSupported&&document.queryCommandSupported("copy")||Qa&&Qa.clipboard&&Qa.clipboard.writeText,w1||Qa&&Qa.clipboard&&Qa.clipboard.readText;var d_=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}},Zp=new d_,C1=new d_,E1=new d_;new Array(230);var S6;(e=>{function t(l){return Zp.keyCodeToStr(l)}e.toString=t;function i(l){return Zp.strToKeyCode(l)}e.fromString=i;function s(l){return C1.keyCodeToStr(l)}e.toUserSettingsUS=s;function o(l){return E1.keyCodeToStr(l)}e.toUserSettingsGeneral=o;function d(l){return C1.strToKeyCode(l)||E1.strToKeyCode(l)}e.fromUserSettings=d;function p(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Zp.keyCodeToStr(l)}e.toElectronAccelerator=p})(S6||={});var hC=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),x6;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof w6?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Gr.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:hC})})(x6||={});var w6=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?hC:(this._emitter||(this._emitter=new Wt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},C6;(e=>{async function t(s){let o,d=await Promise.all(s.map(p=>p.then(l=>l,l=>{o||(o=l)})));if(typeof o<"u")throw o;return d}e.settled=t;function i(s){return new Promise(async(o,d)=>{try{await s(o,d)}catch(p){d(p)}})}e.withAsyncBody=i})(C6||={});var k1=class Ki{static fromArray(t){return new Ki(i=>{i.emitMany(t)})}static fromPromise(t){return new Ki(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Ki(async i=>{await Promise.all(t.map(async s=>i.emitOne(await s)))})}static merge(t){return new Ki(async i=>{await Promise.all(t.map(async s=>{for await(let o of s)i.emitOne(o)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new Wt,queueMicrotask(async()=>{let s={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(t(s)),this.resolve()}catch(o){this.reject(o)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Gr.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Ki(async s=>{for await(let o of t)s.emitOne(i(o))})}map(t){return Ki.map(this,t)}static filter(t,i){return new Ki(async s=>{for await(let o of t)i(o)&&s.emitOne(o)})}filter(t){return Ki.filter(this,t)}static coalesce(t){return Ki.filter(t,i=>!!i)}coalesce(){return Ki.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return Ki.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())}};k1.EMPTY=k1.fromArray([]);var{getWindow:E6}=(function(){let e=new Map,t={window:ia,disposables:new vo};e.set(ia.vscodeWindowId,t);let i=new Wt,s=new Wt,o=new Wt;function d(p,l){return(typeof p=="number"?e.get(p):void 0)??(l?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:s.event,registerWindow(p){if(e.has(p.vscodeWindowId))return or.None;let l=new vo,h={window:p,disposables:l.add(new vo)};return e.set(p.vscodeWindowId,h),l.add(Wn(()=>{e.delete(p.vscodeWindowId),s.fire(p)})),l.add(tg(p,T6.BEFORE_UNLOAD,()=>{o.fire(p)})),i.fire(h),l},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(p){return p.vscodeWindowId},hasWindow(p){return e.has(p)},getWindowById:d,getWindow(p){let l=p;if(l?.ownerDocument?.defaultView)return l.ownerDocument.defaultView.window;let h=p;return h?.view?h.view.window:ia},getDocument(p){return E6(p).document}}})(),k6=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function tg(e,t,i,s){return new k6(e,t,i,s)}var T6={BEFORE_UNLOAD:"beforeunload"},A6=class extends or{constructor(e,t,i,s,o,d,p,l,h){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=s,this._coreService=o,this._decorationService=d,this._optionsService=p,this._themeService=l,this._cursorBlinkStateManager=new Ol,this._charAtlasDisposable=this._register(new Ol),this._observerDisposable=this._register(new Ol),this._model=new a6,this._workCell=new f1,this._workCell2=new f1,this._rectangleRenderer=this._register(new Ol),this._glyphRenderer=this._register(new Ol),this._onChangeTextureAtlas=this._register(new Wt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Wt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Wt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Wt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Wt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let f={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",f),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new SM(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new d6(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,p,this._themeService)],this.dimensions=bM(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(p.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(tg(this._canvas,"webglcontextlost",v=>{console.log("webglcontextlost event received"),v.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(v)},3e3)})),this._register(tg(this._canvas,"webglcontextrestored",v=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,h1(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=d1(this._canvas,this._coreBrowserService.window,(v,m)=>this._setCanvasDevicePixelDimensions(v,m)),this._register(this._coreBrowserService.onWindowChange(v=>{this._observerDisposable.value=d1(this._canvas,v,(m,S)=>this._setCanvasDevicePixelDimensions(m,S))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Wn(()=>{for(let v of this._renderLayers)v.dispose();this._canvas.parentElement?.removeChild(this._canvas),h1(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new u6(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new n6(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=sC(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=Uw(Gr.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Gr.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new YM(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,s=this._workCell,o,d,p,l,h,f,v=0,m=!0,S,C,T,w,_,b,g,y,k;e=T1(e,i.rows-1,0),t=T1(t,i.rows-1,0);let M=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",A=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,N=A-i.buffer.ydisp,R=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),B=-1,q=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let W=!1;for(d=e;d<=t;d++)for(p=d+i.buffer.ydisp,l=i.buffer.lines.get(p),this._model.lineLengths[d]=0,T=A===p,v=0,h=this._characterJoinerService.getJoinedCharacters(p),y=0;y<i.cols;y++){if(o=this._cellColorResolver.result.bg,l.loadCell(y,s),y===0&&(o=this._cellColorResolver.result.bg),f=!1,m=y>=v,S=y,h.length>0&&y===h[0][0]&&m){C=h.shift();let G=this._model.selection.isCellSelected(this._terminal,C[0],p);for(g=C[0]+1;g<C[1];g++)m&&=G===this._model.selection.isCellSelected(this._terminal,g,p);m&&=!T||R<C[0]||R>=C[1],m?(f=!0,s=new R6(s,l.translateToString(!0,C[0],C[1]),C[1]-C[0]),S=C[1]-1):v=C[1]}if(w=s.getChars(),_=s.getCode(),g=(d*i.cols+y)*zh,this._cellColorResolver.resolve(s,y,p,this.dimensions.device.cell.width),q&&p===A&&(y===R&&(this._model.cursor={x:R,y:N,width:s.getWidth(),style:this._coreBrowserService.isFocused?M:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},B=R+s.getWidth()-1),y>=R&&y<=B&&(this._coreBrowserService.isFocused&&M==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),_!==0&&(this._model.lineLengths[d]=y+1),!(this._model.cells[g]===_&&this._model.cells[g+yh]===this._cellColorResolver.result.bg&&this._model.cells[g+Sh]===this._cellColorResolver.result.fg&&this._model.cells[g+Kp]===this._cellColorResolver.result.ext)&&(W=!0,w.length>1&&(_|=s6),this._model.cells[g]=_,this._model.cells[g+yh]=this._cellColorResolver.result.bg,this._model.cells[g+Sh]=this._cellColorResolver.result.fg,this._model.cells[g+Kp]=this._cellColorResolver.result.ext,b=s.getWidth(),this._glyphRenderer.value.updateCell(y,d,_,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,w,b,o),f)){for(s=this._workCell,y++;y<=S;y++)k=(d*i.cols+y)*zh,this._glyphRenderer.value.updateCell(y,d,0,0,0,0,dM,0,0),this._model.cells[k]=0,this._model.cells[k+yh]=this._cellColorResolver.result.bg,this._model.cells[k+Sh]=this._cellColorResolver.result.fg,this._model.cells[k+Kp]=this._cellColorResolver.result.ext;y--}}W&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},R6=class extends uo{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function T1(e,t,i=0){return Math.max(Math.min(e,t),i)}var A1="di$target",R1="di$dependencies",Jp=new Map;function Sr(e){if(Jp.has(e))return Jp.get(e);let t=function(i,s,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");L6(t,i,o)};return t._id=e,Jp.set(e,t),t}function L6(e,t,i){t[A1]===t?t[R1].push({id:e,index:i}):(t[R1]=[{id:e,index:i}],t[A1]=t)}Sr("BufferService");Sr("CoreMouseService");Sr("CoreService");Sr("CharsetService");Sr("InstantiationService");Sr("LogService");var M6=Sr("OptionsService");Sr("OscLinkService");Sr("UnicodeService");Sr("DecorationService");var N6={trace:0,debug:1,info:2,warn:3,error:4,off:5},O6="xterm.js: ",L1=class extends or{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=N6[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":O6)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};L1=eM([tM(0,M6)],L1);var D6=class extends or{constructor(e){if(Gw&&hM()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new Wt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Wt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Wt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Wt),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let i=t.coreService,s=t.optionsService,o=t,d=o._renderService,p=o._characterJoinerService,l=o._charSizeService,h=o._coreBrowserService,f=o._decorationService;o._logService;let v=o._themeService;this._renderer=this._register(new A6(e,p,l,h,i,f,s,v,this._preserveDrawingBuffer)),this._register(Gr.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Gr.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Gr.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Gr.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),d.setRenderer(this._renderer),this._register(Wn(()=>{if(this._terminal._core._store._isDisposed)return;let m=this._terminal._core._renderService;m.setRenderer(this._terminal._core._createRenderer()),m.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},Qp={exports:{}},M1;function j6(){return M1||(M1=1,(function(e,t){(function(i,s){e.exports=s()})(globalThis,(()=>(()=>{var i={4567:function(p,l,h){var f=this&&this.__decorate||function(g,y,k,M){var A,N=arguments.length,R=N<3?y:M===null?M=Object.getOwnPropertyDescriptor(y,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(g,y,k,M);else for(var B=g.length-1;B>=0;B--)(A=g[B])&&(R=(N<3?A(R):N>3?A(y,k,R):A(y,k))||R);return N>3&&R&&Object.defineProperty(y,k,R),R},v=this&&this.__param||function(g,y){return function(k,M){y(k,M,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const m=h(9042),S=h(9924),C=h(844),T=h(4725),w=h(2585),_=h(3656);let b=l.AccessibilityManager=class extends C.Disposable{constructor(g,y,k,M){super(),this._terminal=g,this._coreBrowserService=k,this._renderService=M,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let A=0;A<this._terminal.rows;A++)this._rowElements[A]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[A]);if(this._topBoundaryFocusListener=A=>this._handleBoundaryFocus(A,0),this._bottomBoundaryFocusListener=A=>this._handleBoundaryFocus(A,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new S.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((A=>this._handleResize(A.rows)))),this.register(this._terminal.onRender((A=>this._refreshRows(A.start,A.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((A=>this._handleChar(A)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
75
+ `)))),this.register(this._terminal.onA11yTab((A=>this._handleTab(A)))),this.register(this._terminal.onKey((A=>this._handleKey(A.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,_.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,C.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(g){for(let y=0;y<g;y++)this._handleChar(" ")}_handleChar(g){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==g&&(this._charsToAnnounce+=g):this._charsToAnnounce+=g,g===`
76
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=m.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(g){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(g)||this._charsToConsume.push(g)}_refreshRows(g,y){this._liveRegionDebouncer.refresh(g,y,this._terminal.rows)}_renderRows(g,y){const k=this._terminal.buffer,M=k.lines.length.toString();for(let A=g;A<=y;A++){const N=k.lines.get(k.ydisp+A),R=[],B=N?.translateToString(!0,void 0,void 0,R)||"",q=(k.ydisp+A+1).toString(),W=this._rowElements[A];W&&(B.length===0?(W.innerText=" ",this._rowColumns.set(W,[0,1])):(W.textContent=B,this._rowColumns.set(W,R)),W.setAttribute("aria-posinset",q),W.setAttribute("aria-setsize",M))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(g,y){const k=g.target,M=this._rowElements[y===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(y===0?"1":`${this._terminal.buffer.lines.length}`)||g.relatedTarget!==M)return;let A,N;if(y===0?(A=k,N=this._rowElements.pop(),this._rowContainer.removeChild(N)):(A=this._rowElements.shift(),N=k,this._rowContainer.removeChild(A)),A.removeEventListener("focus",this._topBoundaryFocusListener),N.removeEventListener("focus",this._bottomBoundaryFocusListener),y===0){const R=this._createAccessibilityTreeNode();this._rowElements.unshift(R),this._rowContainer.insertAdjacentElement("afterbegin",R)}else{const R=this._createAccessibilityTreeNode();this._rowElements.push(R),this._rowContainer.appendChild(R)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(y===0?-1:1),this._rowElements[y===0?1:this._rowElements.length-2].focus(),g.preventDefault(),g.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;const g=document.getSelection();if(!g)return;if(g.isCollapsed)return void(this._rowContainer.contains(g.anchorNode)&&this._terminal.clearSelection());if(!g.anchorNode||!g.focusNode)return void console.error("anchorNode and/or focusNode are null");let y={node:g.anchorNode,offset:g.anchorOffset},k={node:g.focusNode,offset:g.focusOffset};if((y.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||y.node===k.node&&y.offset>k.offset)&&([y,k]=[k,y]),y.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(y={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(y.node))return;const M=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(M)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:M,offset:M.textContent?.length??0}),!this._rowContainer.contains(k.node))return;const A=({node:B,offset:q})=>{const W=B instanceof Text?B.parentNode:B;let G=parseInt(W?.getAttribute("aria-posinset"),10)-1;if(isNaN(G))return console.warn("row is invalid. Race condition?"),null;const I=this._rowColumns.get(W);if(!I)return console.warn("columns is null. Race condition?"),null;let K=q<I.length?I[q]:I.slice(-1)[0]+1;return K>=this._terminal.cols&&(++G,K=0),{row:G,column:K}},N=A(y),R=A(k);if(N&&R){if(N.row>R.row||N.row===R.row&&N.column>=R.column)throw new Error("invalid range");this._terminal.select(N.column,N.row,(R.row-N.row)*this._terminal.cols-N.column+R.column)}}_handleResize(g){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let y=this._rowContainer.children.length;y<this._terminal.rows;y++)this._rowElements[y]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[y]);for(;this._rowElements.length>g;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const g=this._coreBrowserService.mainDocument.createElement("div");return g.setAttribute("role","listitem"),g.tabIndex=-1,this._refreshRowDimensions(g),g}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let g=0;g<this._terminal.rows;g++)this._refreshRowDimensions(this._rowElements[g])}}_refreshRowDimensions(g){g.style.height=`${this._renderService.dimensions.css.cell.height}px`}};l.AccessibilityManager=b=f([v(1,w.IInstantiationService),v(2,T.ICoreBrowserService),v(3,T.IRenderService)],b)},3614:(p,l)=>{function h(S){return S.replace(/\r?\n/g,"\r")}function f(S,C){return C?"\x1B[200~"+S+"\x1B[201~":S}function v(S,C,T,w){S=f(S=h(S),T.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),T.triggerDataEvent(S,!0),C.value=""}function m(S,C,T){const w=T.getBoundingClientRect(),_=S.clientX-w.left-10,b=S.clientY-w.top-10;C.style.width="20px",C.style.height="20px",C.style.left=`${_}px`,C.style.top=`${b}px`,C.style.zIndex="1000",C.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=h,l.bracketTextForPaste=f,l.copyHandler=function(S,C){S.clipboardData&&S.clipboardData.setData("text/plain",C.selectionText),S.preventDefault()},l.handlePasteEvent=function(S,C,T,w){S.stopPropagation(),S.clipboardData&&v(S.clipboardData.getData("text/plain"),C,T,w)},l.paste=v,l.moveTextAreaUnderMouseCursor=m,l.rightClickHandler=function(S,C,T,w,_){m(S,C,T),_&&w.rightClickSelect(S),C.value=w.selectionText,C.select()}},7239:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const f=h(1505);l.ColorContrastCache=class{constructor(){this._color=new f.TwoKeyMap,this._css=new f.TwoKeyMap}setCss(v,m,S){this._css.set(v,m,S)}getCss(v,m){return this._css.get(v,m)}setColor(v,m,S){this._color.set(v,m,S)}getColor(v,m){return this._color.get(v,m)}clear(){this._color.clear(),this._css.clear()}}},3656:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(h,f,v,m){h.addEventListener(f,v,m);let S=!1;return{dispose:()=>{S||(S=!0,h.removeEventListener(f,v,m))}}}},3551:function(p,l,h){var f=this&&this.__decorate||function(b,g,y,k){var M,A=arguments.length,N=A<3?g:k===null?k=Object.getOwnPropertyDescriptor(g,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,g,y,k);else for(var R=b.length-1;R>=0;R--)(M=b[R])&&(N=(A<3?M(N):A>3?M(g,y,N):M(g,y))||N);return A>3&&N&&Object.defineProperty(g,y,N),N},v=this&&this.__param||function(b,g){return function(y,k){g(y,k,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const m=h(3656),S=h(8460),C=h(844),T=h(2585),w=h(4725);let _=l.Linkifier=class extends C.Disposable{get currentLink(){return this._currentLink}constructor(b,g,y,k,M){super(),this._element=b,this._mouseService=g,this._renderService=y,this._bufferService=k,this._linkProviderService=M,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new S.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new S.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,C.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,C.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,m.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,m.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,m.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const g=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!g)return;this._isMouseOut=!1;const y=b.composedPath();for(let k=0;k<y.length;k++){const M=y[k];if(M.classList.contains("xterm"))break;if(M.classList.contains("xterm-hover"))return}this._lastBufferCell&&g.x===this._lastBufferCell.x&&g.y===this._lastBufferCell.y||(this._handleHover(g),this._lastBufferCell=g)}_handleHover(b){if(this._activeLine!==b.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(b,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,b)||(this._clearCurrentLink(),this._askForLink(b,!0))}_askForLink(b,g){this._activeProviderReplies&&g||(this._activeProviderReplies?.forEach((k=>{k?.forEach((M=>{M.link.dispose&&M.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let y=!1;for(const[k,M]of this._linkProviderService.linkProviders.entries())g?this._activeProviderReplies?.get(k)&&(y=this._checkLinkProviderResult(k,b,y)):M.provideLinks(b.y,(A=>{if(this._isMouseOut)return;const N=A?.map((R=>({link:R})));this._activeProviderReplies?.set(k,N),y=this._checkLinkProviderResult(k,b,y),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,g){const y=new Set;for(let k=0;k<g.size;k++){const M=g.get(k);if(M)for(let A=0;A<M.length;A++){const N=M[A],R=N.link.range.start.y<b?0:N.link.range.start.x,B=N.link.range.end.y>b?this._bufferService.cols:N.link.range.end.x;for(let q=R;q<=B;q++){if(y.has(q)){M.splice(A--,1);break}y.add(q)}}}}_checkLinkProviderResult(b,g,y){if(!this._activeProviderReplies)return y;const k=this._activeProviderReplies.get(b);let M=!1;for(let A=0;A<b;A++)this._activeProviderReplies.has(A)&&!this._activeProviderReplies.get(A)||(M=!0);if(!M&&k){const A=k.find((N=>this._linkAtPosition(N.link,g)));A&&(y=!0,this._handleNewLink(A))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!y)for(let A=0;A<this._activeProviderReplies.size;A++){const N=this._activeProviderReplies.get(A)?.find((R=>this._linkAtPosition(R.link,g)));if(N){y=!0,this._handleNewLink(N);break}}return y}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const g=this._positionFromMouseEvent(b,this._element,this._mouseService);g&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,g)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,g){this._currentLink&&this._lastMouseEvent&&(!b||!g||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=g)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,C.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const g=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);g&&this._linkAtPosition(b.link,g)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:y=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==y&&(this._currentLink.state.decorations.pointerCursor=y,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",y))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:y=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==y&&(this._currentLink.state.decorations.underline=y,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,y))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((y=>{if(!this._currentLink)return;const k=y.start===0?0:y.start+1+this._bufferService.buffer.ydisp,M=this._bufferService.buffer.ydisp+1+y.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=M&&(this._clearCurrentLink(k,M),this._lastMouseEvent)){const A=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);A&&this._askForLink(A,!1)}}))))}_linkHover(b,g,y){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(g,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),g.hover&&g.hover(y,g.text)}_fireUnderlineEvent(b,g){const y=b.range,k=this._bufferService.buffer.ydisp,M=this._createLinkUnderlineEvent(y.start.x-1,y.start.y-k-1,y.end.x,y.end.y-k-1,void 0);(g?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(M)}_linkLeave(b,g,y){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(g,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),g.leave&&g.leave(y,g.text)}_linkAtPosition(b,g){const y=b.range.start.y*this._bufferService.cols+b.range.start.x,k=b.range.end.y*this._bufferService.cols+b.range.end.x,M=g.y*this._bufferService.cols+g.x;return y<=M&&M<=k}_positionFromMouseEvent(b,g,y){const k=y.getCoords(b,g,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,g,y,k,M){return{x1:b,y1:g,x2:y,y2:k,cols:this._bufferService.cols,fg:M}}};l.Linkifier=_=f([v(1,w.IMouseService),v(2,w.IRenderService),v(3,T.IBufferService),v(4,w.ILinkProviderService)],_)},9042:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(p,l,h){var f=this&&this.__decorate||function(w,_,b,g){var y,k=arguments.length,M=k<3?_:g===null?g=Object.getOwnPropertyDescriptor(_,b):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(w,_,b,g);else for(var A=w.length-1;A>=0;A--)(y=w[A])&&(M=(k<3?y(M):k>3?y(_,b,M):y(_,b))||M);return k>3&&M&&Object.defineProperty(_,b,M),M},v=this&&this.__param||function(w,_){return function(b,g){_(b,g,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const m=h(511),S=h(2585);let C=l.OscLinkProvider=class{constructor(w,_,b){this._bufferService=w,this._optionsService=_,this._oscLinkService=b}provideLinks(w,_){const b=this._bufferService.buffer.lines.get(w-1);if(!b)return void _(void 0);const g=[],y=this._optionsService.rawOptions.linkHandler,k=new m.CellData,M=b.getTrimmedLength();let A=-1,N=-1,R=!1;for(let B=0;B<M;B++)if(N!==-1||b.hasContent(B)){if(b.loadCell(B,k),k.hasExtendedAttrs()&&k.extended.urlId){if(N===-1){N=B,A=k.extended.urlId;continue}R=k.extended.urlId!==A}else N!==-1&&(R=!0);if(R||N!==-1&&B===M-1){const q=this._oscLinkService.getLinkData(A)?.uri;if(q){const W={start:{x:N+1,y:w},end:{x:B+(R||B!==M-1?0:1),y:w}};let G=!1;if(!y?.allowNonHttpProtocols)try{const I=new URL(q);["http:","https:"].includes(I.protocol)||(G=!0)}catch{G=!0}G||g.push({text:q,range:W,activate:(I,K)=>y?y.activate(I,K,W):T(0,K),hover:(I,K)=>y?.hover?.(I,K,W),leave:(I,K)=>y?.leave?.(I,K,W)})}R=!1,k.hasExtendedAttrs()&&k.extended.urlId?(N=B,A=k.extended.urlId):(N=-1,A=-1)}}_(g)}};function T(w,_){if(confirm(`Do you want to navigate to ${_}?
77
+
78
+ WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=_}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=C=f([v(0,S.IBufferService),v(1,S.IOptionsService),v(2,S.IOscLinkService)],C)},6193:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(h,f){this._renderCallback=h,this._coreBrowserService=f,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(h){return this._refreshCallbacks.push(h),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(h,f,v){this._rowCount=v,h=h!==void 0?h:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const h=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,f),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const h of this._refreshCallbacks)h(0);this._refreshCallbacks=[]}}},3236:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const f=h(3614),v=h(3656),m=h(3551),S=h(9042),C=h(3730),T=h(1680),w=h(3107),_=h(5744),b=h(2950),g=h(1296),y=h(428),k=h(4269),M=h(5114),A=h(8934),N=h(3230),R=h(9312),B=h(4725),q=h(6731),W=h(8055),G=h(8969),I=h(8460),K=h(844),H=h(6114),P=h(8437),Y=h(2584),X=h(7399),j=h(5941),z=h(9074),D=h(2585),U=h(5435),V=h(4567),J=h(779);class le extends G.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(te={}){super(te),this.browser=H,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new K.MutableDisposable),this._onCursorMove=this.register(new I.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new I.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new I.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new I.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new I.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new I.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new I.EventEmitter),this._onBlur=this.register(new I.EventEmitter),this._onA11yCharEmitter=this.register(new I.EventEmitter),this._onA11yTabEmitter=this.register(new I.EventEmitter),this._onWillOpen=this.register(new I.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(z.DecorationService),this._instantiationService.setService(D.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(J.LinkProviderService),this._instantiationService.setService(B.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(C.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((F,ae)=>this.refresh(F,ae)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((F=>this._reportWindowsOptions(F)))),this.register(this._inputHandler.onColor((F=>this._handleColorEvent(F)))),this.register((0,I.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,I.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,I.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,I.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((F=>this._afterResize(F.cols,F.rows)))),this.register((0,K.toDisposable)((()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)})))}_handleColorEvent(te){if(this._themeService)for(const F of te){let ae,re="";switch(F.index){case 256:ae="foreground",re="10";break;case 257:ae="background",re="11";break;case 258:ae="cursor",re="12";break;default:ae="ansi",re="4;"+F.index}switch(F.type){case 0:const ge=W.color.toColorRGB(ae==="ansi"?this._themeService.colors.ansi[F.index]:this._themeService.colors[ae]);this.coreService.triggerDataEvent(`${Y.C0.ESC}]${re};${(0,j.toRgbString)(ge)}${Y.C1_ESCAPED.ST}`);break;case 1:if(ae==="ansi")this._themeService.modifyColors((de=>de.ansi[F.index]=W.channels.toColor(...F.color)));else{const de=ae;this._themeService.modifyColors((we=>we[de]=W.channels.toColor(...F.color)))}break;case 2:this._themeService.restoreColor(F.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(te){te?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(V.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(te){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Y.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const te=this.buffer.ybase+this.buffer.y,F=this.buffer.lines.get(te);if(!F)return;const ae=Math.min(this.buffer.x,this.cols-1),re=this._renderService.dimensions.css.cell.height,ge=F.getWidth(ae),de=this._renderService.dimensions.css.cell.width*ge,we=this.buffer.y*this._renderService.dimensions.css.cell.height,Ie=ae*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Ie+"px",this.textarea.style.top=we+"px",this.textarea.style.width=de+"px",this.textarea.style.height=re+"px",this.textarea.style.lineHeight=re+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,v.addDisposableDomListener)(this.element,"copy",(F=>{this.hasSelection()&&(0,f.copyHandler)(F,this._selectionService)})));const te=F=>(0,f.handlePasteEvent)(F,this.textarea,this.coreService,this.optionsService);this.register((0,v.addDisposableDomListener)(this.textarea,"paste",te)),this.register((0,v.addDisposableDomListener)(this.element,"paste",te)),H.isFirefox?this.register((0,v.addDisposableDomListener)(this.element,"mousedown",(F=>{F.button===2&&(0,f.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,v.addDisposableDomListener)(this.element,"contextmenu",(F=>{(0,f.rightClickHandler)(F,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),H.isLinux&&this.register((0,v.addDisposableDomListener)(this.element,"auxclick",(F=>{F.button===1&&(0,f.moveTextAreaUnderMouseCursor)(F,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,v.addDisposableDomListener)(this.textarea,"keyup",(te=>this._keyUp(te)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"keydown",(te=>this._keyDown(te)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"keypress",(te=>this._keyPress(te)),!0)),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionupdate",(te=>this._compositionHelper.compositionupdate(te)))),this.register((0,v.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,v.addDisposableDomListener)(this.textarea,"input",(te=>this._inputEvent(te)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(te){if(!te)throw new Error("Terminal requires a parent element.");if(te.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=te.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"),te.appendChild(this.element);const F=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),F.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,v.addDisposableDomListener)(this.screenElement,"mousemove",(ae=>this.updateCursorStyle(ae)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),F.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",S.promptLabel),H.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(M.CoreBrowserService,this.textarea,te.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(B.ICoreBrowserService,this._coreBrowserService),this.register((0,v.addDisposableDomListener)(this.textarea,"focus",(ae=>this._handleTextAreaFocus(ae)))),this.register((0,v.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(y.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(B.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(q.ThemeService),this._instantiationService.setService(B.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(k.CharacterJoinerService),this._instantiationService.setService(B.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(N.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(B.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((ae=>this._onRender.fire(ae)))),this.onResize((ae=>this._renderService.resize(ae.cols,ae.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(b.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(A.MouseService),this._instantiationService.setService(B.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(m.Linkifier,this.screenElement)),this.element.appendChild(F);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(T.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((ae=>this.scrollLines(ae.amount,ae.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(R.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(B.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((ae=>this.scrollLines(ae.amount,ae.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((ae=>this._renderService.handleSelectionChanged(ae.start,ae.end,ae.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((ae=>{this.textarea.value=ae,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((ae=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,v.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(w.BufferDecorationRenderer,this.screenElement)),this.register((0,v.addDisposableDomListener)(this.element,"mousedown",(ae=>this._selectionService.handleMouseDown(ae)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(V.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(ae=>this._handleScreenReaderModeOptionChange(ae)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(_.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(ae=>{!this._overviewRulerRenderer&&ae&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(_.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(g.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const te=this,F=this.element;function ae(de){const we=te._mouseService.getMouseReportCoords(de,te.screenElement);if(!we)return!1;let Ie,Ne;switch(de.overrideType||de.type){case"mousemove":Ne=32,de.buttons===void 0?(Ie=3,de.button!==void 0&&(Ie=de.button<3?de.button:3)):Ie=1&de.buttons?0:4&de.buttons?1:2&de.buttons?2:3;break;case"mouseup":Ne=0,Ie=de.button<3?de.button:3;break;case"mousedown":Ne=1,Ie=de.button<3?de.button:3;break;case"wheel":if(te._customWheelEventHandler&&te._customWheelEventHandler(de)===!1||te.viewport.getLinesScrolled(de)===0)return!1;Ne=de.deltaY<0?0:1,Ie=4;break;default:return!1}return!(Ne===void 0||Ie===void 0||Ie>4)&&te.coreMouseService.triggerMouseEvent({col:we.col,row:we.row,x:we.x,y:we.y,button:Ie,action:Ne,ctrl:de.ctrlKey,alt:de.altKey,shift:de.shiftKey})}const re={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ge={mouseup:de=>(ae(de),de.buttons||(this._document.removeEventListener("mouseup",re.mouseup),re.mousedrag&&this._document.removeEventListener("mousemove",re.mousedrag)),this.cancel(de)),wheel:de=>(ae(de),this.cancel(de,!0)),mousedrag:de=>{de.buttons&&ae(de)},mousemove:de=>{de.buttons||ae(de)}};this.register(this.coreMouseService.onProtocolChange((de=>{de?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(de)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&de?re.mousemove||(F.addEventListener("mousemove",ge.mousemove),re.mousemove=ge.mousemove):(F.removeEventListener("mousemove",re.mousemove),re.mousemove=null),16&de?re.wheel||(F.addEventListener("wheel",ge.wheel,{passive:!1}),re.wheel=ge.wheel):(F.removeEventListener("wheel",re.wheel),re.wheel=null),2&de?re.mouseup||(re.mouseup=ge.mouseup):(this._document.removeEventListener("mouseup",re.mouseup),re.mouseup=null),4&de?re.mousedrag||(re.mousedrag=ge.mousedrag):(this._document.removeEventListener("mousemove",re.mousedrag),re.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,v.addDisposableDomListener)(F,"mousedown",(de=>{if(de.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(de))return ae(de),re.mouseup&&this._document.addEventListener("mouseup",re.mouseup),re.mousedrag&&this._document.addEventListener("mousemove",re.mousedrag),this.cancel(de)}))),this.register((0,v.addDisposableDomListener)(F,"wheel",(de=>{if(!re.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(de)===!1)return!1;if(!this.buffer.hasScrollback){const we=this.viewport.getLinesScrolled(de);if(we===0)return;const Ie=Y.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(de.deltaY<0?"A":"B");let Ne="";for(let Ge=0;Ge<Math.abs(we);Ge++)Ne+=Ie;return this.coreService.triggerDataEvent(Ne,!0),this.cancel(de,!0)}return this.viewport.handleWheel(de)?this.cancel(de):void 0}}),{passive:!1})),this.register((0,v.addDisposableDomListener)(F,"touchstart",(de=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(de),this.cancel(de)}),{passive:!0})),this.register((0,v.addDisposableDomListener)(F,"touchmove",(de=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(de)?void 0:this.cancel(de)}),{passive:!1}))}refresh(te,F){this._renderService?.refreshRows(te,F)}updateCursorStyle(te){this._selectionService?.shouldColumnSelect(te)?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(te,F,ae=0){ae===1?(super.scrollLines(te,F,ae),this.refresh(0,this.rows-1)):this.viewport?.scrollLines(te)}paste(te){(0,f.paste)(te,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(te){this._customKeyEventHandler=te}attachCustomWheelEventHandler(te){this._customWheelEventHandler=te}registerLinkProvider(te){return this._linkProviderService.registerLinkProvider(te)}registerCharacterJoiner(te){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const F=this._characterJoinerService.register(te);return this.refresh(0,this.rows-1),F}deregisterCharacterJoiner(te){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(te)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(te){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+te)}registerDecoration(te){return this._decorationService.registerDecoration(te)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(te,F,ae){this._selectionService.setSelection(te,F,ae)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(te,F){this._selectionService?.selectLines(te,F)}_keyDown(te){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(te)===!1)return!1;const F=this.browser.isMac&&this.options.macOptionIsMeta&&te.altKey;if(!F&&!this._compositionHelper.keydown(te))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;F||te.key!=="Dead"&&te.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ae=(0,X.evaluateKeyboardEvent)(te,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(te),ae.type===3||ae.type===2){const re=this.rows-1;return this.scrollLines(ae.type===2?-re:re),this.cancel(te,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,te)||(ae.cancel&&this.cancel(te,!0),!ae.key||!!(te.key&&!te.ctrlKey&&!te.altKey&&!te.metaKey&&te.key.length===1&&te.key.charCodeAt(0)>=65&&te.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==Y.C0.ETX&&ae.key!==Y.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:te}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),!this.optionsService.rawOptions.screenReaderMode||te.altKey||te.ctrlKey?this.cancel(te,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(te,F){const ae=te.isMac&&!this.options.macOptionIsMeta&&F.altKey&&!F.ctrlKey&&!F.metaKey||te.isWindows&&F.altKey&&F.ctrlKey&&!F.metaKey||te.isWindows&&F.getModifierState("AltGraph");return F.type==="keypress"?ae:ae&&(!F.keyCode||F.keyCode>47)}_keyUp(te){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(te)===!1||((function(F){return F.keyCode===16||F.keyCode===17||F.keyCode===18})(te)||this.focus(),this.updateCursorStyle(te),this._keyPressHandled=!1)}_keyPress(te){let F;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(te)===!1)return!1;if(this.cancel(te),te.charCode)F=te.charCode;else if(te.which===null||te.which===void 0)F=te.keyCode;else{if(te.which===0||te.charCode===0)return!1;F=te.which}return!(!F||(te.altKey||te.ctrlKey||te.metaKey)&&!this._isThirdLevelShift(this.browser,te)||(F=String.fromCharCode(F),this._onKey.fire({key:F,domEvent:te}),this._showCursor(),this.coreService.triggerDataEvent(F,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(te){if(te.data&&te.inputType==="insertText"&&(!te.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const F=te.data;return this.coreService.triggerDataEvent(F,!0),this.cancel(te),!0}return!1}resize(te,F){te!==this.cols||F!==this.rows?super.resize(te,F):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(te,F){this._charSizeService?.measure(),this.viewport?.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let te=1;te<this.rows;te++)this.buffer.lines.push(this.buffer.getBlankLine(P.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),this.viewport?.reset(),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;const te=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this.viewport?.reset(),this._customKeyEventHandler=te,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(Y.C0.ESC+"[I"):this.coreService.triggerDataEvent(Y.C0.ESC+"[O")}_reportWindowsOptions(te){if(this._renderService)switch(te){case U.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const F=this._renderService.dimensions.css.canvas.width.toFixed(0),ae=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[4;${ae};${F}t`);break;case U.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const re=this._renderService.dimensions.css.cell.width.toFixed(0),ge=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Y.C0.ESC}[6;${ge};${re}t`)}}cancel(te,F){if(this.options.cancelEvents||F)return te.preventDefault(),te.stopPropagation(),!1}}l.Terminal=le},9924:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(h,f=1e3){this._renderCallback=h,this._debounceThresholdMS=f,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(h,f,v){this._rowCount=v,h=h!==void 0?h:0,f=f!==void 0?f:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,f):f;const m=Date.now();if(m-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=m,this._innerRefresh();else if(!this._additionalRefreshRequested){const S=m-this._lastRefreshMs,C=this._debounceThresholdMS-S;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),C)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const h=Math.max(this._rowStart,0),f=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,f)}}},1680:function(p,l,h){var f=this&&this.__decorate||function(b,g,y,k){var M,A=arguments.length,N=A<3?g:k===null?k=Object.getOwnPropertyDescriptor(g,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,g,y,k);else for(var R=b.length-1;R>=0;R--)(M=b[R])&&(N=(A<3?M(N):A>3?M(g,y,N):M(g,y))||N);return A>3&&N&&Object.defineProperty(g,y,N),N},v=this&&this.__param||function(b,g){return function(y,k){g(y,k,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const m=h(3656),S=h(4725),C=h(8460),T=h(844),w=h(2585);let _=l.Viewport=class extends T.Disposable{constructor(b,g,y,k,M,A,N,R){super(),this._viewportElement=b,this._scrollArea=g,this._bufferService=y,this._optionsService=k,this._charSizeService=M,this._renderService=A,this._coreBrowserService=N,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new C.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,m.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((B=>this._activeBuffer=B.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((B=>this._renderDimensions=B))),this._handleThemeChange(R.colors),this.register(R.onChangeColors((B=>this._handleThemeChange(B)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(b){this._viewportElement.style.backgroundColor=b.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(b){if(b)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const g=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==g&&(this._lastRecordedBufferHeight=g,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const b=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==b&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=b),this._refreshAnimationFrame=null}syncScrollArea(b=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(b);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(b)}_handleScroll(b){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const g=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:g,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const b=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(b*(this._smoothScrollState.target-this._smoothScrollState.origin)),b<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(b,g){const y=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(g<0&&this._viewportElement.scrollTop!==0||g>0&&y<this._lastRecordedBufferHeight)||(b.cancelable&&b.preventDefault(),!1)}handleWheel(b){const g=this._getPixelsScrolled(b);return g!==0&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target===-1?this._smoothScrollState.target=this._viewportElement.scrollTop+g:this._smoothScrollState.target+=g,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=g,this._bubbleScroll(b,g))}scrollLines(b){if(b!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const g=b*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+g,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:b,suppressScrollEvent:!1})}_getPixelsScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let g=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_LINE?g*=this._currentRowHeight:b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(g*=this._currentRowHeight*this._bufferService.rows),g}getBufferElements(b,g){let y,k="";const M=[],A=g??this._bufferService.buffer.lines.length,N=this._bufferService.buffer.lines;for(let R=b;R<A;R++){const B=N.get(R);if(!B)continue;const q=N.get(R+1)?.isWrapped;if(k+=B.translateToString(!q),!q||R===N.length-1){const W=document.createElement("div");W.textContent=k,M.push(W),k.length>0&&(y=W),k=""}}return{bufferElements:M,cursorElement:y}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let g=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(g/=this._currentRowHeight+0,this._wheelPartialScroll+=g,g=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(g*=this._bufferService.rows),g}_applyScrollModifier(b,g){const y=this._optionsService.rawOptions.fastScrollModifier;return y==="alt"&&g.altKey||y==="ctrl"&&g.ctrlKey||y==="shift"&&g.shiftKey?b*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:b*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(b){this._lastTouchY=b.touches[0].pageY}handleTouchMove(b){const g=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,g!==0&&(this._viewportElement.scrollTop+=g,this._bubbleScroll(b,g))}};l.Viewport=_=f([v(2,w.IBufferService),v(3,w.IOptionsService),v(4,S.ICharSizeService),v(5,S.IRenderService),v(6,S.ICoreBrowserService),v(7,S.IThemeService)],_)},3107:function(p,l,h){var f=this&&this.__decorate||function(w,_,b,g){var y,k=arguments.length,M=k<3?_:g===null?g=Object.getOwnPropertyDescriptor(_,b):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(w,_,b,g);else for(var A=w.length-1;A>=0;A--)(y=w[A])&&(M=(k<3?y(M):k>3?y(_,b,M):y(_,b))||M);return k>3&&M&&Object.defineProperty(_,b,M),M},v=this&&this.__param||function(w,_){return function(b,g){_(b,g,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const m=h(4725),S=h(844),C=h(2585);let T=l.BufferDecorationRenderer=class extends S.Disposable{constructor(w,_,b,g,y){super(),this._screenElement=w,this._bufferService=_,this._coreBrowserService=b,this._decorationService=g,this._renderService=y,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((k=>this._removeDecoration(k)))),this.register((0,S.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const w of this._decorationService.decorations)this._renderDecoration(w);this._dimensionsChanged=!1}_renderDecoration(w){this._refreshStyle(w),this._dimensionsChanged&&this._refreshXPosition(w)}_createElement(w){const _=this._coreBrowserService.mainDocument.createElement("div");_.classList.add("xterm-decoration"),_.classList.toggle("xterm-decoration-top-layer",w?.options?.layer==="top"),_.style.width=`${Math.round((w.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,_.style.height=(w.options.height||1)*this._renderService.dimensions.css.cell.height+"px",_.style.top=(w.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",_.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=w.options.x??0;return b&&b>this._bufferService.cols&&(_.style.display="none"),this._refreshXPosition(w,_),_}_refreshStyle(w){const _=w.marker.line-this._bufferService.buffers.active.ydisp;if(_<0||_>=this._bufferService.rows)w.element&&(w.element.style.display="none",w.onRenderEmitter.fire(w.element));else{let b=this._decorationElements.get(w);b||(b=this._createElement(w),w.element=b,this._decorationElements.set(w,b),this._container.appendChild(b),w.onDispose((()=>{this._decorationElements.delete(w),b.remove()}))),b.style.top=_*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",w.onRenderEmitter.fire(b)}}_refreshXPosition(w,_=w.element){if(!_)return;const b=w.options.x??0;(w.options.anchor||"left")==="right"?_.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":_.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(w){this._decorationElements.get(w)?.remove(),this._decorationElements.delete(w),w.dispose()}};l.BufferDecorationRenderer=T=f([v(1,C.IBufferService),v(2,m.ICoreBrowserService),v(3,C.IDecorationService),v(4,m.IRenderService)],T)},5871:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(h){if(h.options.overviewRulerOptions){for(const f of this._zones)if(f.color===h.options.overviewRulerOptions.color&&f.position===h.options.overviewRulerOptions.position){if(this._lineIntersectsZone(f,h.marker.line))return;if(this._lineAdjacentToZone(f,h.marker.line,h.options.overviewRulerOptions.position))return void this._addLineToZone(f,h.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=h.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=h.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=h.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=h.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:h.options.overviewRulerOptions.color,position:h.options.overviewRulerOptions.position,startBufferLine:h.marker.line,endBufferLine:h.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(h){this._linePadding=h}_lineIntersectsZone(h,f){return f>=h.startBufferLine&&f<=h.endBufferLine}_lineAdjacentToZone(h,f,v){return f>=h.startBufferLine-this._linePadding[v||"full"]&&f<=h.endBufferLine+this._linePadding[v||"full"]}_addLineToZone(h,f){h.startBufferLine=Math.min(h.startBufferLine,f),h.endBufferLine=Math.max(h.endBufferLine,f)}}},5744:function(p,l,h){var f=this&&this.__decorate||function(y,k,M,A){var N,R=arguments.length,B=R<3?k:A===null?A=Object.getOwnPropertyDescriptor(k,M):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(y,k,M,A);else for(var q=y.length-1;q>=0;q--)(N=y[q])&&(B=(R<3?N(B):R>3?N(k,M,B):N(k,M))||B);return R>3&&B&&Object.defineProperty(k,M,B),B},v=this&&this.__param||function(y,k){return function(M,A){k(M,A,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const m=h(5871),S=h(4725),C=h(844),T=h(2585),w={full:0,left:0,center:0,right:0},_={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let g=l.OverviewRulerRenderer=class extends C.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(y,k,M,A,N,R,B){super(),this._viewportElement=y,this._screenElement=k,this._bufferService=M,this._decorationService=A,this._renderService=N,this._optionsService=R,this._coreBrowserService=B,this._colorZoneStore=new m.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement);const q=this._canvas.getContext("2d");if(!q)throw new Error("Ctx cannot be null");this._ctx=q,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,C.toDisposable)((()=>{this._canvas?.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const y=Math.floor(this._canvas.width/3),k=Math.ceil(this._canvas.width/3);_.full=this._canvas.width,_.left=y,_.center=k,_.right=y,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=_.left,b.right=_.left+_.center}_refreshDrawHeightConstants(){w.full=Math.round(2*this._coreBrowserService.dpr);const y=this._canvas.height/this._bufferService.buffer.lines.length,k=Math.round(Math.max(Math.min(y,12),6)*this._coreBrowserService.dpr);w.left=k,w.center=k,w.right=k}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const k of this._decorationService.decorations)this._colorZoneStore.addDecoration(k);this._ctx.lineWidth=1;const y=this._colorZoneStore.zones;for(const k of y)k.position!=="full"&&this._renderColorZone(k);for(const k of y)k.position==="full"&&this._renderColorZone(k);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(y){this._ctx.fillStyle=y.color,this._ctx.fillRect(b[y.position||"full"],Math.round((this._canvas.height-1)*(y.startBufferLine/this._bufferService.buffers.active.lines.length)-w[y.position||"full"]/2),_[y.position||"full"],Math.round((this._canvas.height-1)*((y.endBufferLine-y.startBufferLine)/this._bufferService.buffers.active.lines.length)+w[y.position||"full"]))}_queueRefresh(y,k){this._shouldUpdateDimensions=y||this._shouldUpdateDimensions,this._shouldUpdateAnchor=k||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=g=f([v(2,T.IBufferService),v(3,T.IDecorationService),v(4,S.IRenderService),v(5,T.IOptionsService),v(6,S.ICoreBrowserService)],g)},2950:function(p,l,h){var f=this&&this.__decorate||function(w,_,b,g){var y,k=arguments.length,M=k<3?_:g===null?g=Object.getOwnPropertyDescriptor(_,b):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(w,_,b,g);else for(var A=w.length-1;A>=0;A--)(y=w[A])&&(M=(k<3?y(M):k>3?y(_,b,M):y(_,b))||M);return k>3&&M&&Object.defineProperty(_,b,M),M},v=this&&this.__param||function(w,_){return function(b,g){_(b,g,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const m=h(4725),S=h(2585),C=h(2584);let T=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(w,_,b,g,y,k){this._textarea=w,this._compositionView=_,this._bufferService=b,this._optionsService=g,this._coreService=y,this._renderService=k,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(w){this._compositionView.textContent=w.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(w){if(this._isComposing||this._isSendingComposition){if(w.keyCode===229||w.keyCode===16||w.keyCode===17||w.keyCode===18)return!1;this._finalizeComposition(!1)}return w.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(w){if(this._compositionView.classList.remove("active"),this._isComposing=!1,w){const _={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,_.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(_.start,_.end):this._textarea.value.substring(_.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const _=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(_,!0)}}_handleAnyTextareaChanges(){const w=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const _=this._textarea.value,b=_.replace(w,"");this._dataAlreadySent=b,_.length>w.length?this._coreService.triggerDataEvent(b,!0):_.length<w.length?this._coreService.triggerDataEvent(`${C.C0.DEL}`,!0):_.length===w.length&&_!==w&&this._coreService.triggerDataEvent(_,!0)}}),0)}updateCompositionElements(w){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const _=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),b=this._renderService.dimensions.css.cell.height,g=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,y=_*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=y+"px",this._compositionView.style.top=g+"px",this._compositionView.style.height=b+"px",this._compositionView.style.lineHeight=b+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const k=this._compositionView.getBoundingClientRect();this._textarea.style.left=y+"px",this._textarea.style.top=g+"px",this._textarea.style.width=Math.max(k.width,1)+"px",this._textarea.style.height=Math.max(k.height,1)+"px",this._textarea.style.lineHeight=k.height+"px"}w||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};l.CompositionHelper=T=f([v(2,S.IBufferService),v(3,S.IOptionsService),v(4,S.ICoreService),v(5,m.IRenderService)],T)},9806:(p,l)=>{function h(f,v,m){const S=m.getBoundingClientRect(),C=f.getComputedStyle(m),T=parseInt(C.getPropertyValue("padding-left")),w=parseInt(C.getPropertyValue("padding-top"));return[v.clientX-S.left-T,v.clientY-S.top-w]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=h,l.getCoords=function(f,v,m,S,C,T,w,_,b){if(!T)return;const g=h(f,v,m);return g?(g[0]=Math.ceil((g[0]+(b?w/2:0))/w),g[1]=Math.ceil(g[1]/_),g[0]=Math.min(Math.max(g[0],1),S+(b?1:0)),g[1]=Math.min(Math.max(g[1],1),C),g):void 0}},9504:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const f=h(2584);function v(_,b,g,y){const k=_-m(_,g),M=b-m(b,g),A=Math.abs(k-M)-(function(N,R,B){let q=0;const W=N-m(N,B),G=R-m(R,B);for(let I=0;I<Math.abs(W-G);I++){const K=S(N,R)==="A"?-1:1;B.buffer.lines.get(W+K*I)?.isWrapped&&q++}return q})(_,b,g);return w(A,T(S(_,b),y))}function m(_,b){let g=0,y=b.buffer.lines.get(_),k=y?.isWrapped;for(;k&&_>=0&&_<b.rows;)g++,y=b.buffer.lines.get(--_),k=y?.isWrapped;return g}function S(_,b){return _>b?"A":"B"}function C(_,b,g,y,k,M){let A=_,N=b,R="";for(;A!==g||N!==y;)A+=k?1:-1,k&&A>M.cols-1?(R+=M.buffer.translateBufferLineToString(N,!1,_,A),A=0,_=0,N++):!k&&A<0&&(R+=M.buffer.translateBufferLineToString(N,!1,0,_+1),A=M.cols-1,_=A,N--);return R+M.buffer.translateBufferLineToString(N,!1,_,A)}function T(_,b){const g=b?"O":"[";return f.C0.ESC+g+_}function w(_,b){_=Math.floor(_);let g="";for(let y=0;y<_;y++)g+=b;return g}l.moveToCellSequence=function(_,b,g,y){const k=g.buffer.x,M=g.buffer.y;if(!g.buffer.hasScrollback)return(function(R,B,q,W,G,I){return v(B,W,G,I).length===0?"":w(C(R,B,R,B-m(B,G),!1,G).length,T("D",I))})(k,M,0,b,g,y)+v(M,b,g,y)+(function(R,B,q,W,G,I){let K;K=v(B,W,G,I).length>0?W-m(W,G):B;const H=W,P=(function(Y,X,j,z,D,U){let V;return V=v(j,z,D,U).length>0?z-m(z,D):X,Y<j&&V<=z||Y>=j&&V<z?"C":"D"})(R,B,q,W,G,I);return w(C(R,K,q,H,P==="C",G).length,T(P,I))})(k,M,_,b,g,y);let A;if(M===b)return A=k>_?"D":"C",w(Math.abs(k-_),T(A,y));A=M>b?"D":"C";const N=Math.abs(M-b);return w((function(R,B){return B.cols-R})(M>b?_:k,g)+(N-1)*g.cols+1+((M>b?k:_)-1),T(A,y))}},1296:function(p,l,h){var f=this&&this.__decorate||function(I,K,H,P){var Y,X=arguments.length,j=X<3?K:P===null?P=Object.getOwnPropertyDescriptor(K,H):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(I,K,H,P);else for(var z=I.length-1;z>=0;z--)(Y=I[z])&&(j=(X<3?Y(j):X>3?Y(K,H,j):Y(K,H))||j);return X>3&&j&&Object.defineProperty(K,H,j),j},v=this&&this.__param||function(I,K){return function(H,P){K(H,P,I)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const m=h(3787),S=h(2550),C=h(2223),T=h(6171),w=h(6052),_=h(4725),b=h(8055),g=h(8460),y=h(844),k=h(2585),M="xterm-dom-renderer-owner-",A="xterm-rows",N="xterm-fg-",R="xterm-bg-",B="xterm-focus",q="xterm-selection";let W=1,G=l.DomRenderer=class extends y.Disposable{constructor(I,K,H,P,Y,X,j,z,D,U,V,J,le){super(),this._terminal=I,this._document=K,this._element=H,this._screenElement=P,this._viewportElement=Y,this._helperContainer=X,this._linkifier2=j,this._charSizeService=D,this._optionsService=U,this._bufferService=V,this._coreBrowserService=J,this._themeService=le,this._terminalClass=W++,this._rowElements=[],this._selectionRenderModel=(0,w.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new g.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(A),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(q),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,T.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((pe=>this._injectCss(pe)))),this._injectCss(this._themeService.colors),this._rowFactory=z.createInstance(m.DomRendererRowFactory,document),this._element.classList.add(M+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((pe=>this._handleLinkHover(pe)))),this.register(this._linkifier2.onHideLinkUnderline((pe=>this._handleLinkLeave(pe)))),this.register((0,y.toDisposable)((()=>{this._element.classList.remove(M+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new S.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const I=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*I,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*I),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/I),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/I),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const K=`${this._terminalSelector} .${A} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=K,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(I){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let K=`${this._terminalSelector} .${A} { color: ${I.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;K+=`${this._terminalSelector} .${A} .xterm-dim { color: ${b.color.multiplyOpacity(I.foreground,.5).css};}`,K+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const H=`blink_underline_${this._terminalClass}`,P=`blink_bar_${this._terminalClass}`,Y=`blink_block_${this._terminalClass}`;K+=`@keyframes ${H} { 50% { border-bottom-style: hidden; }}`,K+=`@keyframes ${P} { 50% { box-shadow: none; }}`,K+=`@keyframes ${Y} { 0% { background-color: ${I.cursor.css}; color: ${I.cursorAccent.css}; } 50% { background-color: inherit; color: ${I.cursor.css}; }}`,K+=`${this._terminalSelector} .${A}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${A}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${P} 1s step-end infinite;}${this._terminalSelector} .${A}.${B} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-block { background-color: ${I.cursor.css}; color: ${I.cursorAccent.css};}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${I.cursor.css} !important; color: ${I.cursorAccent.css} !important;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${I.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${I.cursor.css} inset;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${I.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,K+=`${this._terminalSelector} .${q} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${q} div { position: absolute; background-color: ${I.selectionBackgroundOpaque.css};}${this._terminalSelector} .${q} div { position: absolute; background-color: ${I.selectionInactiveBackgroundOpaque.css};}`;for(const[X,j]of I.ansi.entries())K+=`${this._terminalSelector} .${N}${X} { color: ${j.css}; }${this._terminalSelector} .${N}${X}.xterm-dim { color: ${b.color.multiplyOpacity(j,.5).css}; }${this._terminalSelector} .${R}${X} { background-color: ${j.css}; }`;K+=`${this._terminalSelector} .${N}${C.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque(I.background).css}; }${this._terminalSelector} .${N}${C.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque(I.background),.5).css}; }${this._terminalSelector} .${R}${C.INVERTED_DEFAULT_COLOR} { background-color: ${I.foreground.css}; }`,this._themeStyleElement.textContent=K}_setDefaultSpacing(){const I=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${I}px`,this._rowFactory.defaultSpacing=I}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(I,K){for(let H=this._rowElements.length;H<=K;H++){const P=this._document.createElement("div");this._rowContainer.appendChild(P),this._rowElements.push(P)}for(;this._rowElements.length>K;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(I,K){this._refreshRowElements(I,K),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(B),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(B),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(I,K,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(I,K,H),this.renderRows(0,this._bufferService.rows-1),!I||!K)return;this._selectionRenderModel.update(this._terminal,I,K,H);const P=this._selectionRenderModel.viewportStartRow,Y=this._selectionRenderModel.viewportEndRow,X=this._selectionRenderModel.viewportCappedStartRow,j=this._selectionRenderModel.viewportCappedEndRow;if(X>=this._bufferService.rows||j<0)return;const z=this._document.createDocumentFragment();if(H){const D=I[0]>K[0];z.appendChild(this._createSelectionElement(X,D?K[0]:I[0],D?I[0]:K[0],j-X+1))}else{const D=P===X?I[0]:0,U=X===Y?K[0]:this._bufferService.cols;z.appendChild(this._createSelectionElement(X,D,U));const V=j-X-1;if(z.appendChild(this._createSelectionElement(X+1,0,this._bufferService.cols,V)),X!==j){const J=Y===j?K[0]:this._bufferService.cols;z.appendChild(this._createSelectionElement(j,0,J))}}this._selectionContainer.appendChild(z)}_createSelectionElement(I,K,H,P=1){const Y=this._document.createElement("div"),X=K*this.dimensions.css.cell.width;let j=this.dimensions.css.cell.width*(H-K);return X+j>this.dimensions.css.canvas.width&&(j=this.dimensions.css.canvas.width-X),Y.style.height=P*this.dimensions.css.cell.height+"px",Y.style.top=I*this.dimensions.css.cell.height+"px",Y.style.left=`${X}px`,Y.style.width=`${j}px`,Y}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const I of this._rowElements)I.replaceChildren()}renderRows(I,K){const H=this._bufferService.buffer,P=H.ybase+H.y,Y=Math.min(H.x,this._bufferService.cols-1),X=this._optionsService.rawOptions.cursorBlink,j=this._optionsService.rawOptions.cursorStyle,z=this._optionsService.rawOptions.cursorInactiveStyle;for(let D=I;D<=K;D++){const U=D+H.ydisp,V=this._rowElements[D],J=H.lines.get(U);if(!V||!J)break;V.replaceChildren(...this._rowFactory.createRow(J,U,U===P,j,z,Y,X,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${M}${this._terminalClass}`}_handleLinkHover(I){this._setCellUnderline(I.x1,I.x2,I.y1,I.y2,I.cols,!0)}_handleLinkLeave(I){this._setCellUnderline(I.x1,I.x2,I.y1,I.y2,I.cols,!1)}_setCellUnderline(I,K,H,P,Y,X){H<0&&(I=0),P<0&&(K=0);const j=this._bufferService.rows-1;H=Math.max(Math.min(H,j),0),P=Math.max(Math.min(P,j),0),Y=Math.min(Y,this._bufferService.cols);const z=this._bufferService.buffer,D=z.ybase+z.y,U=Math.min(z.x,Y-1),V=this._optionsService.rawOptions.cursorBlink,J=this._optionsService.rawOptions.cursorStyle,le=this._optionsService.rawOptions.cursorInactiveStyle;for(let pe=H;pe<=P;++pe){const te=pe+z.ydisp,F=this._rowElements[pe],ae=z.lines.get(te);if(!F||!ae)break;F.replaceChildren(...this._rowFactory.createRow(ae,te,te===D,J,le,U,V,this.dimensions.css.cell.width,this._widthCache,X?pe===H?I:0:-1,X?(pe===P?K:Y)-1:-1))}}};l.DomRenderer=G=f([v(7,k.IInstantiationService),v(8,_.ICharSizeService),v(9,k.IOptionsService),v(10,k.IBufferService),v(11,_.ICoreBrowserService),v(12,_.IThemeService)],G)},3787:function(p,l,h){var f=this&&this.__decorate||function(A,N,R,B){var q,W=arguments.length,G=W<3?N:B===null?B=Object.getOwnPropertyDescriptor(N,R):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")G=Reflect.decorate(A,N,R,B);else for(var I=A.length-1;I>=0;I--)(q=A[I])&&(G=(W<3?q(G):W>3?q(N,R,G):q(N,R))||G);return W>3&&G&&Object.defineProperty(N,R,G),G},v=this&&this.__param||function(A,N){return function(R,B){N(R,B,A)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const m=h(2223),S=h(643),C=h(511),T=h(2585),w=h(8055),_=h(4725),b=h(4269),g=h(6171),y=h(3734);let k=l.DomRendererRowFactory=class{constructor(A,N,R,B,q,W,G){this._document=A,this._characterJoinerService=N,this._optionsService=R,this._coreBrowserService=B,this._coreService=q,this._decorationService=W,this._themeService=G,this._workCell=new C.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(A,N,R){this._selectionStart=A,this._selectionEnd=N,this._columnSelectMode=R}createRow(A,N,R,B,q,W,G,I,K,H,P){const Y=[],X=this._characterJoinerService.getJoinedCharacters(N),j=this._themeService.colors;let z,D=A.getNoBgTrimmedLength();R&&D<W+1&&(D=W+1);let U=0,V="",J=0,le=0,pe=0,te=!1,F=0,ae=!1,re=0;const ge=[],de=H!==-1&&P!==-1;for(let we=0;we<D;we++){A.loadCell(we,this._workCell);let Ie=this._workCell.getWidth();if(Ie===0)continue;let Ne=!1,Ge=we,Ee=this._workCell;if(X.length>0&&we===X[0][0]){Ne=!0;const dt=X.shift();Ee=new b.JoinedCellData(this._workCell,A.translateToString(!0,dt[0],dt[1]),dt[1]-dt[0]),Ge=dt[1]-1,Ie=Ee.getWidth()}const ct=this._isCellInSelection(we,N),wt=R&&we===W,Xt=de&&we>=H&&we<=P;let Ln=!1;this._decorationService.forEachDecorationAtCell(we,N,void 0,(dt=>{Ln=!0}));let $n=Ee.getChars()||S.WHITESPACE_CELL_CHAR;if($n===" "&&(Ee.isUnderline()||Ee.isOverline())&&($n=" "),re=Ie*I-K.get($n,Ee.isBold(),Ee.isItalic()),z){if(U&&(ct&&ae||!ct&&!ae&&Ee.bg===J)&&(ct&&ae&&j.selectionForeground||Ee.fg===le)&&Ee.extended.ext===pe&&Xt===te&&re===F&&!wt&&!Ne&&!Ln){Ee.isInvisible()?V+=S.WHITESPACE_CELL_CHAR:V+=$n,U++;continue}U&&(z.textContent=V),z=this._document.createElement("span"),U=0,V=""}else z=this._document.createElement("span");if(J=Ee.bg,le=Ee.fg,pe=Ee.extended.ext,te=Xt,F=re,ae=ct,Ne&&W>=we&&W<=Ge&&(W=we),!this._coreService.isCursorHidden&&wt&&this._coreService.isCursorInitialized){if(ge.push("xterm-cursor"),this._coreBrowserService.isFocused)G&&ge.push("xterm-cursor-blink"),ge.push(B==="bar"?"xterm-cursor-bar":B==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(q)switch(q){case"outline":ge.push("xterm-cursor-outline");break;case"block":ge.push("xterm-cursor-block");break;case"bar":ge.push("xterm-cursor-bar");break;case"underline":ge.push("xterm-cursor-underline")}}if(Ee.isBold()&&ge.push("xterm-bold"),Ee.isItalic()&&ge.push("xterm-italic"),Ee.isDim()&&ge.push("xterm-dim"),V=Ee.isInvisible()?S.WHITESPACE_CELL_CHAR:Ee.getChars()||S.WHITESPACE_CELL_CHAR,Ee.isUnderline()&&(ge.push(`xterm-underline-${Ee.extended.underlineStyle}`),V===" "&&(V=" "),!Ee.isUnderlineColorDefault()))if(Ee.isUnderlineColorRGB())z.style.textDecorationColor=`rgb(${y.AttributeData.toColorRGB(Ee.getUnderlineColor()).join(",")})`;else{let dt=Ee.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&Ee.isBold()&&dt<8&&(dt+=8),z.style.textDecorationColor=j.ansi[dt].css}Ee.isOverline()&&(ge.push("xterm-overline"),V===" "&&(V=" ")),Ee.isStrikethrough()&&ge.push("xterm-strikethrough"),Xt&&(z.style.textDecoration="underline");let en=Ee.getFgColor(),ft=Ee.getFgColorMode(),qt=Ee.getBgColor(),Ht=Ee.getBgColorMode();const yt=!!Ee.isInverse();if(yt){const dt=en;en=qt,qt=dt;const hn=ft;ft=Ht,Ht=hn}let Bt,vi,Zt,Mn=!1;switch(this._decorationService.forEachDecorationAtCell(we,N,void 0,(dt=>{dt.options.layer!=="top"&&Mn||(dt.backgroundColorRGB&&(Ht=50331648,qt=dt.backgroundColorRGB.rgba>>8&16777215,Bt=dt.backgroundColorRGB),dt.foregroundColorRGB&&(ft=50331648,en=dt.foregroundColorRGB.rgba>>8&16777215,vi=dt.foregroundColorRGB),Mn=dt.options.layer==="top")})),!Mn&&ct&&(Bt=this._coreBrowserService.isFocused?j.selectionBackgroundOpaque:j.selectionInactiveBackgroundOpaque,qt=Bt.rgba>>8&16777215,Ht=50331648,Mn=!0,j.selectionForeground&&(ft=50331648,en=j.selectionForeground.rgba>>8&16777215,vi=j.selectionForeground)),Mn&&ge.push("xterm-decoration-top"),Ht){case 16777216:case 33554432:Zt=j.ansi[qt],ge.push(`xterm-bg-${qt}`);break;case 50331648:Zt=w.channels.toColor(qt>>16,qt>>8&255,255&qt),this._addStyle(z,`background-color:#${M((qt>>>0).toString(16),"0",6)}`);break;default:yt?(Zt=j.foreground,ge.push(`xterm-bg-${m.INVERTED_DEFAULT_COLOR}`)):Zt=j.background}switch(Bt||Ee.isDim()&&(Bt=w.color.multiplyOpacity(Zt,.5)),ft){case 16777216:case 33554432:Ee.isBold()&&en<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(en+=8),this._applyMinimumContrast(z,Zt,j.ansi[en],Ee,Bt,void 0)||ge.push(`xterm-fg-${en}`);break;case 50331648:const dt=w.channels.toColor(en>>16&255,en>>8&255,255&en);this._applyMinimumContrast(z,Zt,dt,Ee,Bt,vi)||this._addStyle(z,`color:#${M(en.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(z,Zt,j.foreground,Ee,Bt,vi)||yt&&ge.push(`xterm-fg-${m.INVERTED_DEFAULT_COLOR}`)}ge.length&&(z.className=ge.join(" "),ge.length=0),wt||Ne||Ln?z.textContent=V:U++,re!==this.defaultSpacing&&(z.style.letterSpacing=`${re}px`),Y.push(z),we=Ge}return z&&U&&(z.textContent=V),Y}_applyMinimumContrast(A,N,R,B,q,W){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,g.treatGlyphAsBackgroundColor)(B.getCode()))return!1;const G=this._getContrastCache(B);let I;if(q||W||(I=G.getColor(N.rgba,R.rgba)),I===void 0){const K=this._optionsService.rawOptions.minimumContrastRatio/(B.isDim()?2:1);I=w.color.ensureContrastRatio(q||N,W||R,K),G.setColor((q||N).rgba,(W||R).rgba,I??null)}return!!I&&(this._addStyle(A,`color:${I.css}`),!0)}_getContrastCache(A){return A.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(A,N){A.setAttribute("style",`${A.getAttribute("style")||""}${N};`)}_isCellInSelection(A,N){const R=this._selectionStart,B=this._selectionEnd;return!(!R||!B)&&(this._columnSelectMode?R[0]<=B[0]?A>=R[0]&&N>=R[1]&&A<B[0]&&N<=B[1]:A<R[0]&&N>=R[1]&&A>=B[0]&&N<=B[1]:N>R[1]&&N<B[1]||R[1]===B[1]&&N===R[1]&&A>=R[0]&&A<B[0]||R[1]<B[1]&&N===B[1]&&A<B[0]||R[1]<B[1]&&N===R[1]&&A>=R[0])}};function M(A,N,R){for(;A.length<R;)A=N+A;return A}l.DomRendererRowFactory=k=f([v(1,_.ICharacterJoinerService),v(2,T.IOptionsService),v(3,_.ICoreBrowserService),v(4,T.ICoreService),v(5,T.IDecorationService),v(6,_.IThemeService)],k)},2550:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(h,f){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=h.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const v=h.createElement("span");v.classList.add("xterm-char-measure-element");const m=h.createElement("span");m.classList.add("xterm-char-measure-element"),m.style.fontWeight="bold";const S=h.createElement("span");S.classList.add("xterm-char-measure-element"),S.style.fontStyle="italic";const C=h.createElement("span");C.classList.add("xterm-char-measure-element"),C.style.fontWeight="bold",C.style.fontStyle="italic",this._measureElements=[v,m,S,C],this._container.appendChild(v),this._container.appendChild(m),this._container.appendChild(S),this._container.appendChild(C),f.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(h,f,v,m){h===this._font&&f===this._fontSize&&v===this._weight&&m===this._weightBold||(this._font=h,this._fontSize=f,this._weight=v,this._weightBold=m,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${v}`,this._measureElements[1].style.fontWeight=`${m}`,this._measureElements[2].style.fontWeight=`${v}`,this._measureElements[3].style.fontWeight=`${m}`,this.clear())}get(h,f,v){let m=0;if(!f&&!v&&h.length===1&&(m=h.charCodeAt(0))<256){if(this._flat[m]!==-9999)return this._flat[m];const T=this._measure(h,0);return T>0&&(this._flat[m]=T),T}let S=h;f&&(S+="B"),v&&(S+="I");let C=this._holey.get(S);if(C===void 0){let T=0;f&&(T|=1),v&&(T|=2),C=this._measure(h,T),C>0&&this._holey.set(S,C)}return C}_measure(h,f){const v=this._measureElements[f];return v.textContent=h.repeat(32),v.offsetWidth/32}}},2223:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const f=h(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=f.isFirefox||f.isLegacyEdge?"bottom":"ideographic"},6171:(p,l)=>{function h(v){return 57508<=v&&v<=57558}function f(v){return v>=128512&&v<=128591||v>=127744&&v<=128511||v>=128640&&v<=128767||v>=9728&&v<=9983||v>=9984&&v<=10175||v>=65024&&v<=65039||v>=129280&&v<=129535||v>=127462&&v<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(v){if(!v)throw new Error("value must not be falsy");return v},l.isPowerlineGlyph=h,l.isRestrictedPowerlineGlyph=function(v){return 57520<=v&&v<=57527},l.isEmoji=f,l.allowRescaling=function(v,m,S,C){return m===1&&S>Math.ceil(1.5*C)&&v!==void 0&&v>255&&!f(v)&&!h(v)&&!(function(T){return 57344<=T&&T<=63743})(v)},l.treatGlyphAsBackgroundColor=function(v){return h(v)||(function(m){return 9472<=m&&m<=9631})(v)},l.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},l.computeNextVariantOffset=function(v,m,S=0){return(v-(2*Math.round(m)-S))%(2*Math.round(m))}},6052:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class h{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(v,m,S,C=!1){if(this.selectionStart=m,this.selectionEnd=S,!m||!S||m[0]===S[0]&&m[1]===S[1])return void this.clear();const T=v.buffers.active.ydisp,w=m[1]-T,_=S[1]-T,b=Math.max(w,0),g=Math.min(_,v.rows-1);b>=v.rows||g<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=C,this.viewportStartRow=w,this.viewportEndRow=_,this.viewportCappedStartRow=b,this.viewportCappedEndRow=g,this.startCol=m[0],this.endCol=S[0])}isCellSelected(v,m,S){return!!this.hasSelection&&(S-=v.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?m>=this.startCol&&S>=this.viewportCappedStartRow&&m<this.endCol&&S<=this.viewportCappedEndRow:m<this.startCol&&S>=this.viewportCappedStartRow&&m>=this.endCol&&S<=this.viewportCappedEndRow:S>this.viewportStartRow&&S<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&S===this.viewportStartRow&&m>=this.startCol&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportEndRow&&m<this.endCol||this.viewportStartRow<this.viewportEndRow&&S===this.viewportStartRow&&m>=this.startCol)}}l.createSelectionRenderModel=function(){return new h}},456:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(h){this._bufferService=h,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?h%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)-1]:[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[h,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[Math.max(h,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const h=this.selectionStart,f=this.selectionEnd;return!(!h||!f)&&(h[1]>f[1]||h[1]===f[1]&&h[0]>f[0])}handleTrim(h){return this.selectionStart&&(this.selectionStart[1]-=h),this.selectionEnd&&(this.selectionEnd[1]-=h),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(p,l,h){var f=this&&this.__decorate||function(g,y,k,M){var A,N=arguments.length,R=N<3?y:M===null?M=Object.getOwnPropertyDescriptor(y,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(g,y,k,M);else for(var B=g.length-1;B>=0;B--)(A=g[B])&&(R=(N<3?A(R):N>3?A(y,k,R):A(y,k))||R);return N>3&&R&&Object.defineProperty(y,k,R),R},v=this&&this.__param||function(g,y){return function(k,M){y(k,M,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const m=h(2585),S=h(8460),C=h(844);let T=l.CharSizeService=class extends C.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(g,y,k){super(),this._optionsService=k,this.width=0,this.height=0,this._onCharSizeChange=this.register(new S.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new _(g,y,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const g=this._measureStrategy.measure();g.width===this.width&&g.height===this.height||(this.width=g.width,this.height=g.height,this._onCharSizeChange.fire())}};l.CharSizeService=T=f([v(2,m.IOptionsService)],T);class w extends C.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(y,k){y!==void 0&&y>0&&k!==void 0&&k>0&&(this._result.width=y,this._result.height=k)}}class _ extends w{constructor(y,k,M){super(),this._document=y,this._parentElement=k,this._optionsService=M,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class b extends w{constructor(y){super(),this._optionsService=y,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const k=this._ctx.measureText("W");if(!("width"in k&&"fontBoundingBoxAscent"in k&&"fontBoundingBoxDescent"in k))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const y=this._ctx.measureText("W");return this._validateAndSet(y.width,y.fontBoundingBoxAscent+y.fontBoundingBoxDescent),this._result}}},4269:function(p,l,h){var f=this&&this.__decorate||function(b,g,y,k){var M,A=arguments.length,N=A<3?g:k===null?k=Object.getOwnPropertyDescriptor(g,y):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(b,g,y,k);else for(var R=b.length-1;R>=0;R--)(M=b[R])&&(N=(A<3?M(N):A>3?M(g,y,N):M(g,y))||N);return A>3&&N&&Object.defineProperty(g,y,N),N},v=this&&this.__param||function(b,g){return function(y,k){g(y,k,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const m=h(3734),S=h(643),C=h(511),T=h(2585);class w extends m.AttributeData{constructor(g,y,k){super(),this.content=0,this.combinedData="",this.fg=g.fg,this.bg=g.bg,this.combinedData=y,this._width=k}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(g){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=w;let _=l.CharacterJoinerService=class dC{constructor(g){this._bufferService=g,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new C.CellData}register(g){const y={id:this._nextCharacterJoinerId++,handler:g};return this._characterJoiners.push(y),y.id}deregister(g){for(let y=0;y<this._characterJoiners.length;y++)if(this._characterJoiners[y].id===g)return this._characterJoiners.splice(y,1),!0;return!1}getJoinedCharacters(g){if(this._characterJoiners.length===0)return[];const y=this._bufferService.buffer.lines.get(g);if(!y||y.length===0)return[];const k=[],M=y.translateToString(!0);let A=0,N=0,R=0,B=y.getFg(0),q=y.getBg(0);for(let W=0;W<y.getTrimmedLength();W++)if(y.loadCell(W,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==B||this._workCell.bg!==q){if(W-A>1){const G=this._getJoinedRanges(M,R,N,y,A);for(let I=0;I<G.length;I++)k.push(G[I])}A=W,R=N,B=this._workCell.fg,q=this._workCell.bg}N+=this._workCell.getChars().length||S.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-A>1){const W=this._getJoinedRanges(M,R,N,y,A);for(let G=0;G<W.length;G++)k.push(W[G])}return k}_getJoinedRanges(g,y,k,M,A){const N=g.substring(y,k);let R=[];try{R=this._characterJoiners[0].handler(N)}catch(B){console.error(B)}for(let B=1;B<this._characterJoiners.length;B++)try{const q=this._characterJoiners[B].handler(N);for(let W=0;W<q.length;W++)dC._mergeRanges(R,q[W])}catch(q){console.error(q)}return this._stringRangesToCellRanges(R,M,A),R}_stringRangesToCellRanges(g,y,k){let M=0,A=!1,N=0,R=g[M];if(R){for(let B=k;B<this._bufferService.cols;B++){const q=y.getWidth(B),W=y.getString(B).length||S.WHITESPACE_CELL_CHAR.length;if(q!==0){if(!A&&R[0]<=N&&(R[0]=B,A=!0),R[1]<=N){if(R[1]=B,R=g[++M],!R)break;R[0]<=N?(R[0]=B,A=!0):A=!1}N+=W}}R&&(R[1]=this._bufferService.cols)}}static _mergeRanges(g,y){let k=!1;for(let M=0;M<g.length;M++){const A=g[M];if(k){if(y[1]<=A[0])return g[M-1][1]=y[1],g;if(y[1]<=A[1])return g[M-1][1]=Math.max(y[1],A[1]),g.splice(M,1),g;g.splice(M,1),M--}else{if(y[1]<=A[0])return g.splice(M,0,y),g;if(y[1]<=A[1])return A[0]=Math.min(y[0],A[0]),g;y[0]<A[1]&&(A[0]=Math.min(y[0],A[0]),k=!0)}}return k?g[g.length-1][1]=y[1]:g.push(y),g}};l.CharacterJoinerService=_=f([v(0,T.IBufferService)],_)},5114:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const f=h(844),v=h(8460),m=h(3656);class S extends f.Disposable{constructor(w,_,b){super(),this._textarea=w,this._window=_,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new C(this._window),this._onDprChange=this.register(new v.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new v.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((g=>this._screenDprMonitor.setWindow(g)))),this.register((0,v.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(w){this._window!==w&&(this._window=w,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}}l.CoreBrowserService=S;class C extends f.Disposable{constructor(w){super(),this._parentWindow=w,this._windowResizeListener=this.register(new f.MutableDisposable),this._onDprChange=this.register(new v.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,f.toDisposable)((()=>this.clearListener())))}setWindow(w){this._parentWindow=w,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,m.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const f=h(844);class v extends f.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,f.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(S){return this.linkProviders.push(S),{dispose:()=>{const C=this.linkProviders.indexOf(S);C!==-1&&this.linkProviders.splice(C,1)}}}}l.LinkProviderService=v},8934:function(p,l,h){var f=this&&this.__decorate||function(T,w,_,b){var g,y=arguments.length,k=y<3?w:b===null?b=Object.getOwnPropertyDescriptor(w,_):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(T,w,_,b);else for(var M=T.length-1;M>=0;M--)(g=T[M])&&(k=(y<3?g(k):y>3?g(w,_,k):g(w,_))||k);return y>3&&k&&Object.defineProperty(w,_,k),k},v=this&&this.__param||function(T,w){return function(_,b){w(_,b,T)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const m=h(4725),S=h(9806);let C=l.MouseService=class{constructor(T,w){this._renderService=T,this._charSizeService=w}getCoords(T,w,_,b,g){return(0,S.getCoords)(window,T,w,_,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,g)}getMouseReportCoords(T,w){const _=(0,S.getCoordsRelativeToElement)(window,T,w);if(this._charSizeService.hasValidSize)return _[0]=Math.min(Math.max(_[0],0),this._renderService.dimensions.css.canvas.width-1),_[1]=Math.min(Math.max(_[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(_[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(_[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(_[0]),y:Math.floor(_[1])}}};l.MouseService=C=f([v(0,m.IRenderService),v(1,m.ICharSizeService)],C)},3230:function(p,l,h){var f=this&&this.__decorate||function(g,y,k,M){var A,N=arguments.length,R=N<3?y:M===null?M=Object.getOwnPropertyDescriptor(y,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(g,y,k,M);else for(var B=g.length-1;B>=0;B--)(A=g[B])&&(R=(N<3?A(R):N>3?A(y,k,R):A(y,k))||R);return N>3&&R&&Object.defineProperty(y,k,R),R},v=this&&this.__param||function(g,y){return function(k,M){y(k,M,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const m=h(6193),S=h(4725),C=h(8460),T=h(844),w=h(7226),_=h(2585);let b=l.RenderService=class extends T.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(g,y,k,M,A,N,R,B){super(),this._rowCount=g,this._charSizeService=M,this._renderer=this.register(new T.MutableDisposable),this._pausedResizeTask=new w.DebouncedIdleTask,this._observerDisposable=this.register(new T.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new C.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new C.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new C.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new C.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new m.RenderDebouncer(((q,W)=>this._renderRows(q,W)),R),this.register(this._renderDebouncer),this.register(R.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(N.onResize((()=>this._fullRefresh()))),this.register(N.buffers.onBufferActivate((()=>this._renderer.value?.clear()))),this.register(k.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(A.onDecorationRegistered((()=>this._fullRefresh()))),this.register(A.onDecorationRemoved((()=>this._fullRefresh()))),this.register(k.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(N.cols,N.rows),this._fullRefresh()}))),this.register(k.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(N.buffer.y,N.buffer.y,!0)))),this.register(B.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(R.window,y),this.register(R.onWindowChange((q=>this._registerIntersectionObserver(q,y))))}_registerIntersectionObserver(g,y){if("IntersectionObserver"in g){const k=new g.IntersectionObserver((M=>this._handleIntersectionChange(M[M.length-1])),{threshold:0});k.observe(y),this._observerDisposable.value=(0,T.toDisposable)((()=>k.disconnect()))}}_handleIntersectionChange(g){this._isPaused=g.isIntersecting===void 0?g.intersectionRatio===0:!g.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(g,y,k=!1){this._isPaused?this._needsFullRefresh=!0:(k||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(g,y,this._rowCount))}_renderRows(g,y){this._renderer.value&&(g=Math.min(g,this._rowCount-1),y=Math.min(y,this._rowCount-1),this._renderer.value.renderRows(g,y),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:g,end:y}),this._onRender.fire({start:g,end:y}),this._isNextRenderRedrawOnly=!0)}resize(g,y){this._rowCount=y,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(g){this._renderer.value=g,this._renderer.value&&(this._renderer.value.onRequestRedraw((y=>this.refreshRows(y.start,y.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(g){return this._renderDebouncer.addRefreshCallback(g)}_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(g,y){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>this._renderer.value?.handleResize(g,y))):this._renderer.value.handleResize(g,y),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(g,y,k){this._selectionState.start=g,this._selectionState.end=y,this._selectionState.columnSelectMode=k,this._renderer.value?.handleSelectionChanged(g,y,k)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};l.RenderService=b=f([v(2,_.IOptionsService),v(3,S.ICharSizeService),v(4,_.IDecorationService),v(5,_.IBufferService),v(6,S.ICoreBrowserService),v(7,S.IThemeService)],b)},9312:function(p,l,h){var f=this&&this.__decorate||function(R,B,q,W){var G,I=arguments.length,K=I<3?B:W===null?W=Object.getOwnPropertyDescriptor(B,q):W;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")K=Reflect.decorate(R,B,q,W);else for(var H=R.length-1;H>=0;H--)(G=R[H])&&(K=(I<3?G(K):I>3?G(B,q,K):G(B,q))||K);return I>3&&K&&Object.defineProperty(B,q,K),K},v=this&&this.__param||function(R,B){return function(q,W){B(q,W,R)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const m=h(9806),S=h(9504),C=h(456),T=h(4725),w=h(8460),_=h(844),b=h(6114),g=h(4841),y=h(511),k=h(2585),M=" ",A=new RegExp(M,"g");let N=l.SelectionService=class extends _.Disposable{constructor(R,B,q,W,G,I,K,H,P){super(),this._element=R,this._screenElement=B,this._linkifier=q,this._bufferService=W,this._coreService=G,this._mouseService=I,this._optionsService=K,this._renderService=H,this._coreBrowserService=P,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new y.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new w.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new w.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=Y=>this._handleMouseMove(Y),this._mouseUpListener=Y=>this._handleMouseUp(Y),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Y=>this._handleTrim(Y))),this.register(this._bufferService.buffers.onBufferActivate((Y=>this._handleBufferActivate(Y)))),this.enable(),this._model=new C.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,_.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const R=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!R||!B||R[0]===B[0]&&R[1]===B[1])}get selectionText(){const R=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;if(!R||!B)return"";const q=this._bufferService.buffer,W=[];if(this._activeSelectionMode===3){if(R[0]===B[0])return"";const G=R[0]<B[0]?R[0]:B[0],I=R[0]<B[0]?B[0]:R[0];for(let K=R[1];K<=B[1];K++){const H=q.translateBufferLineToString(K,!0,G,I);W.push(H)}}else{const G=R[1]===B[1]?B[0]:void 0;W.push(q.translateBufferLineToString(R[1],!0,R[0],G));for(let I=R[1]+1;I<=B[1]-1;I++){const K=q.lines.get(I),H=q.translateBufferLineToString(I,!0);K?.isWrapped?W[W.length-1]+=H:W.push(H)}if(R[1]!==B[1]){const I=q.lines.get(B[1]),K=q.translateBufferLineToString(B[1],!0,0,B[0]);I&&I.isWrapped?W[W.length-1]+=K:W.push(K)}}return W.map((G=>G.replace(A," "))).join(b.isWindows?`\r
79
+ `:`
80
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(R){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&R&&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(R){const B=this._getMouseBufferCoords(R),q=this._model.finalSelectionStart,W=this._model.finalSelectionEnd;return!!(q&&W&&B)&&this._areCoordsInSelection(B,q,W)}isCellInSelection(R,B){const q=this._model.finalSelectionStart,W=this._model.finalSelectionEnd;return!(!q||!W)&&this._areCoordsInSelection([R,B],q,W)}_areCoordsInSelection(R,B,q){return R[1]>B[1]&&R[1]<q[1]||B[1]===q[1]&&R[1]===B[1]&&R[0]>=B[0]&&R[0]<q[0]||B[1]<q[1]&&R[1]===q[1]&&R[0]<q[0]||B[1]<q[1]&&R[1]===B[1]&&R[0]>=B[0]}_selectWordAtCursor(R,B){const q=this._linkifier.currentLink?.link?.range;if(q)return this._model.selectionStart=[q.start.x-1,q.start.y-1],this._model.selectionStartLength=(0,g.getRangeLength)(q,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const W=this._getMouseBufferCoords(R);return!!W&&(this._selectWordAt(W,B),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(R,B){this._model.clearSelection(),R=Math.max(R,0),B=Math.min(B,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,R],this._model.selectionEnd=[this._bufferService.cols,B],this.refresh(),this._onSelectionChange.fire()}_handleTrim(R){this._model.handleTrim(R)&&this.refresh()}_getMouseBufferCoords(R){const B=this._mouseService.getCoords(R,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(B)return B[0]--,B[1]--,B[1]+=this._bufferService.buffer.ydisp,B}_getMouseEventScrollAmount(R){let B=(0,m.getCoordsRelativeToElement)(this._coreBrowserService.window,R,this._screenElement)[1];const q=this._renderService.dimensions.css.canvas.height;return B>=0&&B<=q?0:(B>q&&(B-=q),B=Math.min(Math.max(B,-50),50),B/=50,B/Math.abs(B)+Math.round(14*B))}shouldForceSelection(R){return b.isMac?R.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:R.shiftKey}handleMouseDown(R){if(this._mouseDownTimeStamp=R.timeStamp,(R.button!==2||!this.hasSelection)&&R.button===0){if(!this._enabled){if(!this.shouldForceSelection(R))return;R.stopPropagation()}R.preventDefault(),this._dragScrollAmount=0,this._enabled&&R.shiftKey?this._handleIncrementalClick(R):R.detail===1?this._handleSingleClick(R):R.detail===2?this._handleDoubleClick(R):R.detail===3&&this._handleTripleClick(R),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(R){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(R))}_handleSingleClick(R){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(R)?3:0,this._model.selectionStart=this._getMouseBufferCoords(R),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const B=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);B&&B.length!==this._model.selectionStart[0]&&B.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(R){this._selectWordAtCursor(R,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(R){const B=this._getMouseBufferCoords(R);B&&(this._activeSelectionMode=2,this._selectLineAt(B[1]))}shouldColumnSelect(R){return R.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(R){if(R.stopImmediatePropagation(),!this._model.selectionStart)return;const B=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(R),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(R),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const q=this._bufferService.buffer;if(this._model.selectionEnd[1]<q.lines.length){const W=q.lines.get(this._model.selectionEnd[1]);W&&W.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}B&&B[0]===this._model.selectionEnd[0]&&B[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const R=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(R.ydisp+this._bufferService.rows,R.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=R.ydisp),this.refresh()}}_handleMouseUp(R){const B=R.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&B<500&&R.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const q=this._mouseService.getCoords(R,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(q&&q[0]!==void 0&&q[1]!==void 0){const W=(0,S.moveToCellSequence)(q[0]-1,q[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(W,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const R=this._model.finalSelectionStart,B=this._model.finalSelectionEnd,q=!(!R||!B||R[0]===B[0]&&R[1]===B[1]);q?R&&B&&(this._oldSelectionStart&&this._oldSelectionEnd&&R[0]===this._oldSelectionStart[0]&&R[1]===this._oldSelectionStart[1]&&B[0]===this._oldSelectionEnd[0]&&B[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(R,B,q)):this._oldHasSelection&&this._fireOnSelectionChange(R,B,q)}_fireOnSelectionChange(R,B,q){this._oldSelectionStart=R,this._oldSelectionEnd=B,this._oldHasSelection=q,this._onSelectionChange.fire()}_handleBufferActivate(R){this.clearSelection(),this._trimListener.dispose(),this._trimListener=R.activeBuffer.lines.onTrim((B=>this._handleTrim(B)))}_convertViewportColToCharacterIndex(R,B){let q=B;for(let W=0;B>=W;W++){const G=R.loadCell(W,this._workCell).getChars().length;this._workCell.getWidth()===0?q--:G>1&&B!==W&&(q+=G-1)}return q}setSelection(R,B,q){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[R,B],this._model.selectionStartLength=q,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(R){this._isClickInSelection(R)||(this._selectWordAtCursor(R,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(R,B,q=!0,W=!0){if(R[0]>=this._bufferService.cols)return;const G=this._bufferService.buffer,I=G.lines.get(R[1]);if(!I)return;const K=G.translateBufferLineToString(R[1],!1);let H=this._convertViewportColToCharacterIndex(I,R[0]),P=H;const Y=R[0]-H;let X=0,j=0,z=0,D=0;if(K.charAt(H)===" "){for(;H>0&&K.charAt(H-1)===" ";)H--;for(;P<K.length&&K.charAt(P+1)===" ";)P++}else{let J=R[0],le=R[0];I.getWidth(J)===0&&(X++,J--),I.getWidth(le)===2&&(j++,le++);const pe=I.getString(le).length;for(pe>1&&(D+=pe-1,P+=pe-1);J>0&&H>0&&!this._isCharWordSeparator(I.loadCell(J-1,this._workCell));){I.loadCell(J-1,this._workCell);const te=this._workCell.getChars().length;this._workCell.getWidth()===0?(X++,J--):te>1&&(z+=te-1,H-=te-1),H--,J--}for(;le<I.length&&P+1<K.length&&!this._isCharWordSeparator(I.loadCell(le+1,this._workCell));){I.loadCell(le+1,this._workCell);const te=this._workCell.getChars().length;this._workCell.getWidth()===2?(j++,le++):te>1&&(D+=te-1,P+=te-1),P++,le++}}P++;let U=H+Y-X+z,V=Math.min(this._bufferService.cols,P-H+X+j-z-D);if(B||K.slice(H,P).trim()!==""){if(q&&U===0&&I.getCodePoint(0)!==32){const J=G.lines.get(R[1]-1);if(J&&I.isWrapped&&J.getCodePoint(this._bufferService.cols-1)!==32){const le=this._getWordAt([this._bufferService.cols-1,R[1]-1],!1,!0,!1);if(le){const pe=this._bufferService.cols-le.start;U-=pe,V+=pe}}}if(W&&U+V===this._bufferService.cols&&I.getCodePoint(this._bufferService.cols-1)!==32){const J=G.lines.get(R[1]+1);if(J?.isWrapped&&J.getCodePoint(0)!==32){const le=this._getWordAt([0,R[1]+1],!1,!1,!0);le&&(V+=le.length)}}return{start:U,length:V}}}_selectWordAt(R,B){const q=this._getWordAt(R,B);if(q){for(;q.start<0;)q.start+=this._bufferService.cols,R[1]--;this._model.selectionStart=[q.start,R[1]],this._model.selectionStartLength=q.length}}_selectToWordAt(R){const B=this._getWordAt(R,!0);if(B){let q=R[1];for(;B.start<0;)B.start+=this._bufferService.cols,q--;if(!this._model.areSelectionValuesReversed())for(;B.start+B.length>this._bufferService.cols;)B.length-=this._bufferService.cols,q++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?B.start:B.start+B.length,q]}}_isCharWordSeparator(R){return R.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(R.getChars())>=0}_selectLineAt(R){const B=this._bufferService.buffer.getWrappedRangeForLine(R),q={start:{x:0,y:B.first},end:{x:this._bufferService.cols-1,y:B.last}};this._model.selectionStart=[0,B.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,g.getRangeLength)(q,this._bufferService.cols)}};l.SelectionService=N=f([v(3,k.IBufferService),v(4,k.ICoreService),v(5,T.IMouseService),v(6,k.IOptionsService),v(7,T.IRenderService),v(8,T.ICoreBrowserService)],N)},4725:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ILinkProviderService=l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const f=h(8343);l.ICharSizeService=(0,f.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,f.createDecorator)("CoreBrowserService"),l.IMouseService=(0,f.createDecorator)("MouseService"),l.IRenderService=(0,f.createDecorator)("RenderService"),l.ISelectionService=(0,f.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,f.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,f.createDecorator)("ThemeService"),l.ILinkProviderService=(0,f.createDecorator)("LinkProviderService")},6731:function(p,l,h){var f=this&&this.__decorate||function(N,R,B,q){var W,G=arguments.length,I=G<3?R:q===null?q=Object.getOwnPropertyDescriptor(R,B):q;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(N,R,B,q);else for(var K=N.length-1;K>=0;K--)(W=N[K])&&(I=(G<3?W(I):G>3?W(R,B,I):W(R,B))||I);return G>3&&I&&Object.defineProperty(R,B,I),I},v=this&&this.__param||function(N,R){return function(B,q){R(B,q,N)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const m=h(7239),S=h(8055),C=h(8460),T=h(844),w=h(2585),_=S.css.toColor("#ffffff"),b=S.css.toColor("#000000"),g=S.css.toColor("#ffffff"),y=S.css.toColor("#000000"),k={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const N=[S.css.toColor("#2e3436"),S.css.toColor("#cc0000"),S.css.toColor("#4e9a06"),S.css.toColor("#c4a000"),S.css.toColor("#3465a4"),S.css.toColor("#75507b"),S.css.toColor("#06989a"),S.css.toColor("#d3d7cf"),S.css.toColor("#555753"),S.css.toColor("#ef2929"),S.css.toColor("#8ae234"),S.css.toColor("#fce94f"),S.css.toColor("#729fcf"),S.css.toColor("#ad7fa8"),S.css.toColor("#34e2e2"),S.css.toColor("#eeeeec")],R=[0,95,135,175,215,255];for(let B=0;B<216;B++){const q=R[B/36%6|0],W=R[B/6%6|0],G=R[B%6];N.push({css:S.channels.toCss(q,W,G),rgba:S.channels.toRgba(q,W,G)})}for(let B=0;B<24;B++){const q=8+10*B;N.push({css:S.channels.toCss(q,q,q),rgba:S.channels.toRgba(q,q,q)})}return N})());let M=l.ThemeService=class extends T.Disposable{get colors(){return this._colors}constructor(N){super(),this._optionsService=N,this._contrastCache=new m.ColorContrastCache,this._halfContrastCache=new m.ColorContrastCache,this._onChangeColors=this.register(new C.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:_,background:b,cursor:g,cursorAccent:y,selectionForeground:void 0,selectionBackgroundTransparent:k,selectionBackgroundOpaque:S.color.blend(b,k),selectionInactiveBackgroundTransparent:k,selectionInactiveBackgroundOpaque:S.color.blend(b,k),ansi:l.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(N={}){const R=this._colors;if(R.foreground=A(N.foreground,_),R.background=A(N.background,b),R.cursor=A(N.cursor,g),R.cursorAccent=A(N.cursorAccent,y),R.selectionBackgroundTransparent=A(N.selectionBackground,k),R.selectionBackgroundOpaque=S.color.blend(R.background,R.selectionBackgroundTransparent),R.selectionInactiveBackgroundTransparent=A(N.selectionInactiveBackground,R.selectionBackgroundTransparent),R.selectionInactiveBackgroundOpaque=S.color.blend(R.background,R.selectionInactiveBackgroundTransparent),R.selectionForeground=N.selectionForeground?A(N.selectionForeground,S.NULL_COLOR):void 0,R.selectionForeground===S.NULL_COLOR&&(R.selectionForeground=void 0),S.color.isOpaque(R.selectionBackgroundTransparent)&&(R.selectionBackgroundTransparent=S.color.opacity(R.selectionBackgroundTransparent,.3)),S.color.isOpaque(R.selectionInactiveBackgroundTransparent)&&(R.selectionInactiveBackgroundTransparent=S.color.opacity(R.selectionInactiveBackgroundTransparent,.3)),R.ansi=l.DEFAULT_ANSI_COLORS.slice(),R.ansi[0]=A(N.black,l.DEFAULT_ANSI_COLORS[0]),R.ansi[1]=A(N.red,l.DEFAULT_ANSI_COLORS[1]),R.ansi[2]=A(N.green,l.DEFAULT_ANSI_COLORS[2]),R.ansi[3]=A(N.yellow,l.DEFAULT_ANSI_COLORS[3]),R.ansi[4]=A(N.blue,l.DEFAULT_ANSI_COLORS[4]),R.ansi[5]=A(N.magenta,l.DEFAULT_ANSI_COLORS[5]),R.ansi[6]=A(N.cyan,l.DEFAULT_ANSI_COLORS[6]),R.ansi[7]=A(N.white,l.DEFAULT_ANSI_COLORS[7]),R.ansi[8]=A(N.brightBlack,l.DEFAULT_ANSI_COLORS[8]),R.ansi[9]=A(N.brightRed,l.DEFAULT_ANSI_COLORS[9]),R.ansi[10]=A(N.brightGreen,l.DEFAULT_ANSI_COLORS[10]),R.ansi[11]=A(N.brightYellow,l.DEFAULT_ANSI_COLORS[11]),R.ansi[12]=A(N.brightBlue,l.DEFAULT_ANSI_COLORS[12]),R.ansi[13]=A(N.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),R.ansi[14]=A(N.brightCyan,l.DEFAULT_ANSI_COLORS[14]),R.ansi[15]=A(N.brightWhite,l.DEFAULT_ANSI_COLORS[15]),N.extendedAnsi){const B=Math.min(R.ansi.length-16,N.extendedAnsi.length);for(let q=0;q<B;q++)R.ansi[q+16]=A(N.extendedAnsi[q],l.DEFAULT_ANSI_COLORS[q+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(N){this._restoreColor(N),this._onChangeColors.fire(this.colors)}_restoreColor(N){if(N!==void 0)switch(N){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[N]=this._restoreColors.ansi[N]}else for(let R=0;R<this._restoreColors.ansi.length;++R)this._colors.ansi[R]=this._restoreColors.ansi[R]}modifyColors(N){N(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function A(N,R){if(N!==void 0)try{return S.css.toColor(N)}catch{}return R}l.ThemeService=M=f([v(0,w.IOptionsService)],M)},6349:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const f=h(8460),v=h(844);class m extends v.Disposable{constructor(C){super(),this._maxLength=C,this.onDeleteEmitter=this.register(new f.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new f.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new f.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(C){if(this._maxLength===C)return;const T=new Array(C);for(let w=0;w<Math.min(C,this.length);w++)T[w]=this._array[this._getCyclicIndex(w)];this._array=T,this._maxLength=C,this._startIndex=0}get length(){return this._length}set length(C){if(C>this._length)for(let T=this._length;T<C;T++)this._array[T]=void 0;this._length=C}get(C){return this._array[this._getCyclicIndex(C)]}set(C,T){this._array[this._getCyclicIndex(C)]=T}push(C){this._array[this._getCyclicIndex(this._length)]=C,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(C,T,...w){if(T){for(let _=C;_<this._length-T;_++)this._array[this._getCyclicIndex(_)]=this._array[this._getCyclicIndex(_+T)];this._length-=T,this.onDeleteEmitter.fire({index:C,amount:T})}for(let _=this._length-1;_>=C;_--)this._array[this._getCyclicIndex(_+w.length)]=this._array[this._getCyclicIndex(_)];for(let _=0;_<w.length;_++)this._array[this._getCyclicIndex(C+_)]=w[_];if(w.length&&this.onInsertEmitter.fire({index:C,amount:w.length}),this._length+w.length>this._maxLength){const _=this._length+w.length-this._maxLength;this._startIndex+=_,this._length=this._maxLength,this.onTrimEmitter.fire(_)}else this._length+=w.length}trimStart(C){C>this._length&&(C=this._length),this._startIndex+=C,this._length-=C,this.onTrimEmitter.fire(C)}shiftElements(C,T,w){if(!(T<=0)){if(C<0||C>=this._length)throw new Error("start argument out of range");if(C+w<0)throw new Error("Cannot shift elements in list beyond index 0");if(w>0){for(let b=T-1;b>=0;b--)this.set(C+b+w,this.get(C+b));const _=C+T+w-this._length;if(_>0)for(this._length+=_;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let _=0;_<T;_++)this.set(C+_+w,this.get(C+_))}}_getCyclicIndex(C){return(this._startIndex+C)%this._maxLength}}l.CircularList=m},1439:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function h(f,v=5){if(typeof f!="object")return f;const m=Array.isArray(f)?[]:{};for(const S in f)m[S]=v<=1?f[S]:f[S]&&h(f[S],v-1);return m}},8055:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let h=0,f=0,v=0,m=0;var S,C,T,w,_;function b(y){const k=y.toString(16);return k.length<2?"0"+k:k}function g(y,k){return y<k?(k+.05)/(y+.05):(y+.05)/(k+.05)}l.NULL_COLOR={css:"#00000000",rgba:0},(function(y){y.toCss=function(k,M,A,N){return N!==void 0?`#${b(k)}${b(M)}${b(A)}${b(N)}`:`#${b(k)}${b(M)}${b(A)}`},y.toRgba=function(k,M,A,N=255){return(k<<24|M<<16|A<<8|N)>>>0},y.toColor=function(k,M,A,N){return{css:y.toCss(k,M,A,N),rgba:y.toRgba(k,M,A,N)}}})(S||(l.channels=S={})),(function(y){function k(M,A){return m=Math.round(255*A),[h,f,v]=_.toChannels(M.rgba),{css:S.toCss(h,f,v,m),rgba:S.toRgba(h,f,v,m)}}y.blend=function(M,A){if(m=(255&A.rgba)/255,m===1)return{css:A.css,rgba:A.rgba};const N=A.rgba>>24&255,R=A.rgba>>16&255,B=A.rgba>>8&255,q=M.rgba>>24&255,W=M.rgba>>16&255,G=M.rgba>>8&255;return h=q+Math.round((N-q)*m),f=W+Math.round((R-W)*m),v=G+Math.round((B-G)*m),{css:S.toCss(h,f,v),rgba:S.toRgba(h,f,v)}},y.isOpaque=function(M){return(255&M.rgba)==255},y.ensureContrastRatio=function(M,A,N){const R=_.ensureContrastRatio(M.rgba,A.rgba,N);if(R)return S.toColor(R>>24&255,R>>16&255,R>>8&255)},y.opaque=function(M){const A=(255|M.rgba)>>>0;return[h,f,v]=_.toChannels(A),{css:S.toCss(h,f,v),rgba:A}},y.opacity=k,y.multiplyOpacity=function(M,A){return m=255&M.rgba,k(M,m*A/255)},y.toColorRGB=function(M){return[M.rgba>>24&255,M.rgba>>16&255,M.rgba>>8&255]}})(C||(l.color=C={})),(function(y){let k,M;try{const A=document.createElement("canvas");A.width=1,A.height=1;const N=A.getContext("2d",{willReadFrequently:!0});N&&(k=N,k.globalCompositeOperation="copy",M=k.createLinearGradient(0,0,1,1))}catch{}y.toColor=function(A){if(A.match(/#[\da-f]{3,8}/i))switch(A.length){case 4:return h=parseInt(A.slice(1,2).repeat(2),16),f=parseInt(A.slice(2,3).repeat(2),16),v=parseInt(A.slice(3,4).repeat(2),16),S.toColor(h,f,v);case 5:return h=parseInt(A.slice(1,2).repeat(2),16),f=parseInt(A.slice(2,3).repeat(2),16),v=parseInt(A.slice(3,4).repeat(2),16),m=parseInt(A.slice(4,5).repeat(2),16),S.toColor(h,f,v,m);case 7:return{css:A,rgba:(parseInt(A.slice(1),16)<<8|255)>>>0};case 9:return{css:A,rgba:parseInt(A.slice(1),16)>>>0}}const N=A.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(N)return h=parseInt(N[1]),f=parseInt(N[2]),v=parseInt(N[3]),m=Math.round(255*(N[5]===void 0?1:parseFloat(N[5]))),S.toColor(h,f,v,m);if(!k||!M)throw new Error("css.toColor: Unsupported css format");if(k.fillStyle=M,k.fillStyle=A,typeof k.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(k.fillRect(0,0,1,1),[h,f,v,m]=k.getImageData(0,0,1,1).data,m!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:S.toRgba(h,f,v,m),css:A}}})(T||(l.css=T={})),(function(y){function k(M,A,N){const R=M/255,B=A/255,q=N/255;return .2126*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))+.7152*(B<=.03928?B/12.92:Math.pow((B+.055)/1.055,2.4))+.0722*(q<=.03928?q/12.92:Math.pow((q+.055)/1.055,2.4))}y.relativeLuminance=function(M){return k(M>>16&255,M>>8&255,255&M)},y.relativeLuminance2=k})(w||(l.rgb=w={})),(function(y){function k(A,N,R){const B=A>>24&255,q=A>>16&255,W=A>>8&255;let G=N>>24&255,I=N>>16&255,K=N>>8&255,H=g(w.relativeLuminance2(G,I,K),w.relativeLuminance2(B,q,W));for(;H<R&&(G>0||I>0||K>0);)G-=Math.max(0,Math.ceil(.1*G)),I-=Math.max(0,Math.ceil(.1*I)),K-=Math.max(0,Math.ceil(.1*K)),H=g(w.relativeLuminance2(G,I,K),w.relativeLuminance2(B,q,W));return(G<<24|I<<16|K<<8|255)>>>0}function M(A,N,R){const B=A>>24&255,q=A>>16&255,W=A>>8&255;let G=N>>24&255,I=N>>16&255,K=N>>8&255,H=g(w.relativeLuminance2(G,I,K),w.relativeLuminance2(B,q,W));for(;H<R&&(G<255||I<255||K<255);)G=Math.min(255,G+Math.ceil(.1*(255-G))),I=Math.min(255,I+Math.ceil(.1*(255-I))),K=Math.min(255,K+Math.ceil(.1*(255-K))),H=g(w.relativeLuminance2(G,I,K),w.relativeLuminance2(B,q,W));return(G<<24|I<<16|K<<8|255)>>>0}y.blend=function(A,N){if(m=(255&N)/255,m===1)return N;const R=N>>24&255,B=N>>16&255,q=N>>8&255,W=A>>24&255,G=A>>16&255,I=A>>8&255;return h=W+Math.round((R-W)*m),f=G+Math.round((B-G)*m),v=I+Math.round((q-I)*m),S.toRgba(h,f,v)},y.ensureContrastRatio=function(A,N,R){const B=w.relativeLuminance(A>>8),q=w.relativeLuminance(N>>8);if(g(B,q)<R){if(q<B){const I=k(A,N,R),K=g(B,w.relativeLuminance(I>>8));if(K<R){const H=M(A,N,R);return K>g(B,w.relativeLuminance(H>>8))?I:H}return I}const W=M(A,N,R),G=g(B,w.relativeLuminance(W>>8));if(G<R){const I=k(A,N,R);return G>g(B,w.relativeLuminance(I>>8))?W:I}return W}},y.reduceLuminance=k,y.increaseLuminance=M,y.toChannels=function(A){return[A>>24&255,A>>16&255,A>>8&255,255&A]}})(_||(l.rgba=_={})),l.toPaddedHex=b,l.contrastRatio=g},8969:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const f=h(844),v=h(2585),m=h(4348),S=h(7866),C=h(744),T=h(7302),w=h(6975),_=h(8460),b=h(1753),g=h(1480),y=h(7994),k=h(9282),M=h(5435),A=h(5981),N=h(2660);let R=!1;class B extends f.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new _.EventEmitter),this._onScroll.event((W=>{this._onScrollApi?.fire(W.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(W){for(const G in W)this.optionsService.options[G]=W[G]}constructor(W){super(),this._windowsWrappingHeuristics=this.register(new f.MutableDisposable),this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new _.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new _.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new _.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new _.EventEmitter),this._instantiationService=new m.InstantiationService,this.optionsService=this.register(new T.OptionsService(W)),this._instantiationService.setService(v.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(C.BufferService)),this._instantiationService.setService(v.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(S.LogService)),this._instantiationService.setService(v.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(w.CoreService)),this._instantiationService.setService(v.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(v.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(g.UnicodeService)),this._instantiationService.setService(v.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(y.CharsetService),this._instantiationService.setService(v.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(N.OscLinkService),this._instantiationService.setService(v.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new M.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,_.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,_.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,_.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,_.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((G=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((G=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new A.WriteBuffer(((G,I)=>this._inputHandler.parse(G,I)))),this.register((0,_.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(W,G){this._writeBuffer.write(W,G)}writeSync(W,G){this._logService.logLevel<=v.LogLevelEnum.WARN&&!R&&(this._logService.warn("writeSync is unreliable and will be removed soon."),R=!0),this._writeBuffer.writeSync(W,G)}input(W,G=!0){this.coreService.triggerDataEvent(W,G)}resize(W,G){isNaN(W)||isNaN(G)||(W=Math.max(W,C.MINIMUM_COLS),G=Math.max(G,C.MINIMUM_ROWS),this._bufferService.resize(W,G))}scroll(W,G=!1){this._bufferService.scroll(W,G)}scrollLines(W,G,I){this._bufferService.scrollLines(W,G,I)}scrollPages(W){this.scrollLines(W*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(W){const G=W-this._bufferService.buffer.ydisp;G!==0&&this.scrollLines(G)}registerEscHandler(W,G){return this._inputHandler.registerEscHandler(W,G)}registerDcsHandler(W,G){return this._inputHandler.registerDcsHandler(W,G)}registerCsiHandler(W,G){return this._inputHandler.registerCsiHandler(W,G)}registerOscHandler(W,G){return this._inputHandler.registerOscHandler(W,G)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let W=!1;const G=this.optionsService.rawOptions.windowsPty;G&&G.buildNumber!==void 0&&G.buildNumber!==void 0?W=G.backend==="conpty"&&G.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(W=!0),W?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const W=[];W.push(this.onLineFeed(k.updateWindowsModeWrappedState.bind(null,this._bufferService))),W.push(this.registerCsiHandler({final:"H"},(()=>((0,k.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,f.toDisposable)((()=>{for(const G of W)G.dispose()}))}}}l.CoreTerminal=B},8460:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===h)return void this._listeners.splice(f,1)}}})),this._event}fire(h,f){const v=[];for(let m=0;m<this._listeners.length;m++)v.push(this._listeners[m]);for(let m=0;m<v.length;m++)v[m].call(void 0,h,f)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},l.forwardEvent=function(h,f){return h((v=>f.fire(v)))},l.runAndSubscribe=function(h,f){return f(void 0),h((v=>f(v)))}},5435:function(p,l,h){var f=this&&this.__decorate||function(X,j,z,D){var U,V=arguments.length,J=V<3?j:D===null?D=Object.getOwnPropertyDescriptor(j,z):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")J=Reflect.decorate(X,j,z,D);else for(var le=X.length-1;le>=0;le--)(U=X[le])&&(J=(V<3?U(J):V>3?U(j,z,J):U(j,z))||J);return V>3&&J&&Object.defineProperty(j,z,J),J},v=this&&this.__param||function(X,j){return function(z,D){j(z,D,X)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const m=h(2584),S=h(7116),C=h(2015),T=h(844),w=h(482),_=h(8437),b=h(8460),g=h(643),y=h(511),k=h(3734),M=h(2585),A=h(1480),N=h(6242),R=h(6351),B=h(5941),q={"(":0,")":1,"*":2,"+":3,"-":1,".":2},W=131072;function G(X,j){if(X>24)return j.setWinLines||!1;switch(X){case 1:return!!j.restoreWin;case 2:return!!j.minimizeWin;case 3:return!!j.setWinPosition;case 4:return!!j.setWinSizePixels;case 5:return!!j.raiseWin;case 6:return!!j.lowerWin;case 7:return!!j.refreshWin;case 8:return!!j.setWinSizeChars;case 9:return!!j.maximizeWin;case 10:return!!j.fullscreenWin;case 11:return!!j.getWinState;case 13:return!!j.getWinPosition;case 14:return!!j.getWinSizePixels;case 15:return!!j.getScreenSizePixels;case 16:return!!j.getCellSizePixels;case 18:return!!j.getWinSizeChars;case 19:return!!j.getScreenSizeChars;case 20:return!!j.getIconTitle;case 21:return!!j.getWinTitle;case 22:return!!j.pushTitle;case 23:return!!j.popTitle;case 24:return!!j.setWinLines}return!1}var I;(function(X){X[X.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",X[X.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(I||(l.WindowsOptionsReportType=I={}));let K=0;class H extends T.Disposable{getAttrData(){return this._curAttrData}constructor(j,z,D,U,V,J,le,pe,te=new C.EscapeSequenceParser){super(),this._bufferService=j,this._charsetService=z,this._coreService=D,this._logService=U,this._optionsService=V,this._oscLinkService=J,this._coreMouseService=le,this._unicodeService=pe,this._parser=te,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w.StringToUtf32,this._utf8Decoder=new w.Utf8ToUtf32,this._workCell=new y.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=_.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=_.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new b.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new b.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new b.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new b.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new b.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new b.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new b.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new b.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new b.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new b.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new P(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((F=>this._activeBuffer=F.activeBuffer))),this._parser.setCsiHandlerFallback(((F,ae)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(F),params:ae.toArray()})})),this._parser.setEscHandlerFallback((F=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(F)})})),this._parser.setExecuteHandlerFallback((F=>{this._logService.debug("Unknown EXECUTE code: ",{code:F})})),this._parser.setOscHandlerFallback(((F,ae,re)=>{this._logService.debug("Unknown OSC code: ",{identifier:F,action:ae,data:re})})),this._parser.setDcsHandlerFallback(((F,ae,re)=>{ae==="HOOK"&&(re=re.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(F),action:ae,payload:re})})),this._parser.setPrintHandler(((F,ae,re)=>this.print(F,ae,re))),this._parser.registerCsiHandler({final:"@"},(F=>this.insertChars(F))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(F=>this.scrollLeft(F))),this._parser.registerCsiHandler({final:"A"},(F=>this.cursorUp(F))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(F=>this.scrollRight(F))),this._parser.registerCsiHandler({final:"B"},(F=>this.cursorDown(F))),this._parser.registerCsiHandler({final:"C"},(F=>this.cursorForward(F))),this._parser.registerCsiHandler({final:"D"},(F=>this.cursorBackward(F))),this._parser.registerCsiHandler({final:"E"},(F=>this.cursorNextLine(F))),this._parser.registerCsiHandler({final:"F"},(F=>this.cursorPrecedingLine(F))),this._parser.registerCsiHandler({final:"G"},(F=>this.cursorCharAbsolute(F))),this._parser.registerCsiHandler({final:"H"},(F=>this.cursorPosition(F))),this._parser.registerCsiHandler({final:"I"},(F=>this.cursorForwardTab(F))),this._parser.registerCsiHandler({final:"J"},(F=>this.eraseInDisplay(F,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(F=>this.eraseInDisplay(F,!0))),this._parser.registerCsiHandler({final:"K"},(F=>this.eraseInLine(F,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(F=>this.eraseInLine(F,!0))),this._parser.registerCsiHandler({final:"L"},(F=>this.insertLines(F))),this._parser.registerCsiHandler({final:"M"},(F=>this.deleteLines(F))),this._parser.registerCsiHandler({final:"P"},(F=>this.deleteChars(F))),this._parser.registerCsiHandler({final:"S"},(F=>this.scrollUp(F))),this._parser.registerCsiHandler({final:"T"},(F=>this.scrollDown(F))),this._parser.registerCsiHandler({final:"X"},(F=>this.eraseChars(F))),this._parser.registerCsiHandler({final:"Z"},(F=>this.cursorBackwardTab(F))),this._parser.registerCsiHandler({final:"`"},(F=>this.charPosAbsolute(F))),this._parser.registerCsiHandler({final:"a"},(F=>this.hPositionRelative(F))),this._parser.registerCsiHandler({final:"b"},(F=>this.repeatPrecedingCharacter(F))),this._parser.registerCsiHandler({final:"c"},(F=>this.sendDeviceAttributesPrimary(F))),this._parser.registerCsiHandler({prefix:">",final:"c"},(F=>this.sendDeviceAttributesSecondary(F))),this._parser.registerCsiHandler({final:"d"},(F=>this.linePosAbsolute(F))),this._parser.registerCsiHandler({final:"e"},(F=>this.vPositionRelative(F))),this._parser.registerCsiHandler({final:"f"},(F=>this.hVPosition(F))),this._parser.registerCsiHandler({final:"g"},(F=>this.tabClear(F))),this._parser.registerCsiHandler({final:"h"},(F=>this.setMode(F))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(F=>this.setModePrivate(F))),this._parser.registerCsiHandler({final:"l"},(F=>this.resetMode(F))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(F=>this.resetModePrivate(F))),this._parser.registerCsiHandler({final:"m"},(F=>this.charAttributes(F))),this._parser.registerCsiHandler({final:"n"},(F=>this.deviceStatus(F))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(F=>this.deviceStatusPrivate(F))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(F=>this.softReset(F))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(F=>this.setCursorStyle(F))),this._parser.registerCsiHandler({final:"r"},(F=>this.setScrollRegion(F))),this._parser.registerCsiHandler({final:"s"},(F=>this.saveCursor(F))),this._parser.registerCsiHandler({final:"t"},(F=>this.windowOptions(F))),this._parser.registerCsiHandler({final:"u"},(F=>this.restoreCursor(F))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(F=>this.insertColumns(F))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(F=>this.deleteColumns(F))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(F=>this.selectProtected(F))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(F=>this.requestMode(F,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(F=>this.requestMode(F,!1))),this._parser.setExecuteHandler(m.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(m.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(m.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(m.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(m.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(m.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(m.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(m.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(m.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(m.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new N.OscHandler((F=>(this.setTitle(F),this.setIconName(F),!0)))),this._parser.registerOscHandler(1,new N.OscHandler((F=>this.setIconName(F)))),this._parser.registerOscHandler(2,new N.OscHandler((F=>this.setTitle(F)))),this._parser.registerOscHandler(4,new N.OscHandler((F=>this.setOrReportIndexedColor(F)))),this._parser.registerOscHandler(8,new N.OscHandler((F=>this.setHyperlink(F)))),this._parser.registerOscHandler(10,new N.OscHandler((F=>this.setOrReportFgColor(F)))),this._parser.registerOscHandler(11,new N.OscHandler((F=>this.setOrReportBgColor(F)))),this._parser.registerOscHandler(12,new N.OscHandler((F=>this.setOrReportCursorColor(F)))),this._parser.registerOscHandler(104,new N.OscHandler((F=>this.restoreIndexedColor(F)))),this._parser.registerOscHandler(110,new N.OscHandler((F=>this.restoreFgColor(F)))),this._parser.registerOscHandler(111,new N.OscHandler((F=>this.restoreBgColor(F)))),this._parser.registerOscHandler(112,new N.OscHandler((F=>this.restoreCursorColor(F)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const F in S.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:F},(()=>this.selectCharset("("+F))),this._parser.registerEscHandler({intermediates:")",final:F},(()=>this.selectCharset(")"+F))),this._parser.registerEscHandler({intermediates:"*",final:F},(()=>this.selectCharset("*"+F))),this._parser.registerEscHandler({intermediates:"+",final:F},(()=>this.selectCharset("+"+F))),this._parser.registerEscHandler({intermediates:"-",final:F},(()=>this.selectCharset("-"+F))),this._parser.registerEscHandler({intermediates:".",final:F},(()=>this.selectCharset("."+F))),this._parser.registerEscHandler({intermediates:"/",final:F},(()=>this.selectCharset("/"+F)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((F=>(this._logService.error("Parsing error: ",F),F))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new R.DcsHandler(((F,ae)=>this.requestStatusString(F,ae))))}_preserveStack(j,z,D,U){this._parseStack.paused=!0,this._parseStack.cursorStartX=j,this._parseStack.cursorStartY=z,this._parseStack.decodedLength=D,this._parseStack.position=U}_logSlowResolvingAsync(j){this._logService.logLevel<=M.LogLevelEnum.WARN&&Promise.race([j,new Promise(((z,D)=>setTimeout((()=>D("#SLOW_TIMEOUT")),5e3)))]).catch((z=>{if(z!=="#SLOW_TIMEOUT")throw z;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(j,z){let D,U=this._activeBuffer.x,V=this._activeBuffer.y,J=0;const le=this._parseStack.paused;if(le){if(D=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,z))return this._logSlowResolvingAsync(D),D;U=this._parseStack.cursorStartX,V=this._parseStack.cursorStartY,this._parseStack.paused=!1,j.length>W&&(J=this._parseStack.position+W)}if(this._logService.logLevel<=M.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof j=="string"?` "${j}"`:` "${Array.prototype.map.call(j,(F=>String.fromCharCode(F))).join("")}"`),typeof j=="string"?j.split("").map((F=>F.charCodeAt(0))):j),this._parseBuffer.length<j.length&&this._parseBuffer.length<W&&(this._parseBuffer=new Uint32Array(Math.min(j.length,W))),le||this._dirtyRowTracker.clearRange(),j.length>W)for(let F=J;F<j.length;F+=W){const ae=F+W<j.length?F+W:j.length,re=typeof j=="string"?this._stringDecoder.decode(j.substring(F,ae),this._parseBuffer):this._utf8Decoder.decode(j.subarray(F,ae),this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,re))return this._preserveStack(U,V,re,F),this._logSlowResolvingAsync(D),D}else if(!le){const F=typeof j=="string"?this._stringDecoder.decode(j,this._parseBuffer):this._utf8Decoder.decode(j,this._parseBuffer);if(D=this._parser.parse(this._parseBuffer,F))return this._preserveStack(U,V,F,0),this._logSlowResolvingAsync(D),D}this._activeBuffer.x===U&&this._activeBuffer.y===V||this._onCursorMove.fire();const pe=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),te=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);te<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(te,this._bufferService.rows-1),Math.min(pe,this._bufferService.rows-1))}print(j,z,D){let U,V;const J=this._charsetService.charset,le=this._optionsService.rawOptions.screenReaderMode,pe=this._bufferService.cols,te=this._coreService.decPrivateModes.wraparound,F=this._coreService.modes.insertMode,ae=this._curAttrData;let re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&D-z>0&&re.getWidth(this._activeBuffer.x-1)===2&&re.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ae);let ge=this._parser.precedingJoinState;for(let de=z;de<D;++de){if(U=j[de],U<127&&J){const Ge=J[String.fromCharCode(U)];Ge&&(U=Ge.charCodeAt(0))}const we=this._unicodeService.charProperties(U,ge);V=A.UnicodeService.extractWidth(we);const Ie=A.UnicodeService.extractShouldJoin(we),Ne=Ie?A.UnicodeService.extractWidth(ge):0;if(ge=we,le&&this._onA11yChar.fire((0,w.stringFromCodePoint)(U)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+V-Ne>pe){if(te){const Ge=re;let Ee=this._activeBuffer.x-Ne;for(this._activeBuffer.x=Ne,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),re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Ne>0&&re instanceof _.BufferLine&&re.copyCellsFrom(Ge,Ee,0,Ne,!1);Ee<pe;)Ge.setCellFromCodepoint(Ee++,0,1,ae)}else if(this._activeBuffer.x=pe-1,V===2)continue}if(Ie&&this._activeBuffer.x){const Ge=re.getWidth(this._activeBuffer.x-1)?1:2;re.addCodepointToCell(this._activeBuffer.x-Ge,U,V);for(let Ee=V-Ne;--Ee>=0;)re.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}else if(F&&(re.insertCells(this._activeBuffer.x,V-Ne,this._activeBuffer.getNullCell(ae)),re.getWidth(pe-1)===2&&re.setCellFromCodepoint(pe-1,g.NULL_CELL_CODE,g.NULL_CELL_WIDTH,ae)),re.setCellFromCodepoint(this._activeBuffer.x++,U,V,ae),V>0)for(;--V;)re.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}this._parser.precedingJoinState=ge,this._activeBuffer.x<pe&&D-z>0&&re.getWidth(this._activeBuffer.x)===0&&!re.hasContent(this._activeBuffer.x)&&re.setCellFromCodepoint(this._activeBuffer.x,0,1,ae),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(j,z){return j.final!=="t"||j.prefix||j.intermediates?this._parser.registerCsiHandler(j,z):this._parser.registerCsiHandler(j,(D=>!G(D.params[0],this._optionsService.rawOptions.windowOptions)||z(D)))}registerDcsHandler(j,z){return this._parser.registerDcsHandler(j,new R.DcsHandler(z))}registerEscHandler(j,z){return this._parser.registerEscHandler(j,z)}registerOscHandler(j,z){return this._parser.registerOscHandler(j,new N.OscHandler(z))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);j.hasWidth(this._activeBuffer.x)&&!j.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const j=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-j),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(j=this._bufferService.cols-1){this._activeBuffer.x=Math.min(j,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(j,z){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=j,this._activeBuffer.y=this._activeBuffer.scrollTop+z):(this._activeBuffer.x=j,this._activeBuffer.y=z),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(j,z){this._restrictCursor(),this._setCursor(this._activeBuffer.x+j,this._activeBuffer.y+z)}cursorUp(j){const z=this._activeBuffer.y-this._activeBuffer.scrollTop;return z>=0?this._moveCursor(0,-Math.min(z,j.params[0]||1)):this._moveCursor(0,-(j.params[0]||1)),!0}cursorDown(j){const z=this._activeBuffer.scrollBottom-this._activeBuffer.y;return z>=0?this._moveCursor(0,Math.min(z,j.params[0]||1)):this._moveCursor(0,j.params[0]||1),!0}cursorForward(j){return this._moveCursor(j.params[0]||1,0),!0}cursorBackward(j){return this._moveCursor(-(j.params[0]||1),0),!0}cursorNextLine(j){return this.cursorDown(j),this._activeBuffer.x=0,!0}cursorPrecedingLine(j){return this.cursorUp(j),this._activeBuffer.x=0,!0}cursorCharAbsolute(j){return this._setCursor((j.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(j){return this._setCursor(j.length>=2?(j.params[1]||1)-1:0,(j.params[0]||1)-1),!0}charPosAbsolute(j){return this._setCursor((j.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(j){return this._moveCursor(j.params[0]||1,0),!0}linePosAbsolute(j){return this._setCursor(this._activeBuffer.x,(j.params[0]||1)-1),!0}vPositionRelative(j){return this._moveCursor(0,j.params[0]||1),!0}hVPosition(j){return this.cursorPosition(j),!0}tabClear(j){const z=j.params[0];return z===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:z===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(j){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let z=j.params[0]||1;for(;z--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(j){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let z=j.params[0]||1;for(;z--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(j){const z=j.params[0];return z===1&&(this._curAttrData.bg|=536870912),z!==2&&z!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(j,z,D,U=!1,V=!1){const J=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);J.replaceCells(z,D,this._activeBuffer.getNullCell(this._eraseAttrData()),V),U&&(J.isWrapped=!1)}_resetBufferLine(j,z=!1){const D=this._activeBuffer.lines.get(this._activeBuffer.ybase+j);D&&(D.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),z),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+j),D.isWrapped=!1)}eraseInDisplay(j,z=!1){let D;switch(this._restrictCursor(this._bufferService.cols),j.params[0]){case 0:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,z);D<this._bufferService.rows;D++)this._resetBufferLine(D,z);this._dirtyRowTracker.markDirty(D);break;case 1:for(D=this._activeBuffer.y,this._dirtyRowTracker.markDirty(D),this._eraseInBufferLine(D,0,this._activeBuffer.x+1,!0,z),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(D+1).isWrapped=!1);D--;)this._resetBufferLine(D,z);this._dirtyRowTracker.markDirty(0);break;case 2:for(D=this._bufferService.rows,this._dirtyRowTracker.markDirty(D-1);D--;)this._resetBufferLine(D,z);this._dirtyRowTracker.markDirty(0);break;case 3:const U=this._activeBuffer.lines.length-this._bufferService.rows;U>0&&(this._activeBuffer.lines.trimStart(U),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-U,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-U,0),this._onScroll.fire(0))}return!0}eraseInLine(j,z=!1){switch(this._restrictCursor(this._bufferService.cols),j.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,z);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,z);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,z)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(j){this._restrictCursor();let z=j.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=this._activeBuffer.ybase+this._activeBuffer.y,U=this._bufferService.rows-1-this._activeBuffer.scrollBottom,V=this._bufferService.rows-1+this._activeBuffer.ybase-U+1;for(;z--;)this._activeBuffer.lines.splice(V-1,1),this._activeBuffer.lines.splice(D,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(j){this._restrictCursor();let z=j.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const D=this._activeBuffer.ybase+this._activeBuffer.y;let U;for(U=this._bufferService.rows-1-this._activeBuffer.scrollBottom,U=this._bufferService.rows-1+this._activeBuffer.ybase-U;z--;)this._activeBuffer.lines.splice(D,1),this._activeBuffer.lines.splice(U,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(j){this._restrictCursor();const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return z&&(z.insertCells(this._activeBuffer.x,j.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(j){this._restrictCursor();const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return z&&(z.deleteCells(this._activeBuffer.x,j.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(j){let z=j.params[0]||1;for(;z--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(j){let z=j.params[0]||1;for(;z--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(_.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const z=j.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);U.deleteCells(0,z,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const z=j.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);U.insertCells(0,z,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const z=j.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);U.insertCells(this._activeBuffer.x,z,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(j){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const z=j.params[0]||1;for(let D=this._activeBuffer.scrollTop;D<=this._activeBuffer.scrollBottom;++D){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+D);U.deleteCells(this._activeBuffer.x,z,this._activeBuffer.getNullCell(this._eraseAttrData())),U.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(j){this._restrictCursor();const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return z&&(z.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(j.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(j){const z=this._parser.precedingJoinState;if(!z)return!0;const D=j.params[0]||1,U=A.UnicodeService.extractWidth(z),V=this._activeBuffer.x-U,J=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(V),le=new Uint32Array(J.length*D);let pe=0;for(let F=0;F<J.length;){const ae=J.codePointAt(F)||0;le[pe++]=ae,F+=ae>65535?2:1}let te=pe;for(let F=1;F<D;++F)le.copyWithin(te,0,pe),te+=pe;return this.print(le,0,te),!0}sendDeviceAttributesPrimary(j){return j.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(m.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(m.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(j){return j.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(m.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(m.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(j.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(m.C0.ESC+"[>83;40003;0c")),!0}_is(j){return(this._optionsService.rawOptions.termName+"").indexOf(j)===0}setMode(j){for(let z=0;z<j.length;z++)switch(j.params[z]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(j){for(let z=0;z<j.length;z++)switch(j.params[z]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,S.DEFAULT_CHARSET),this._charsetService.setgCharset(1,S.DEFAULT_CHARSET),this._charsetService.setgCharset(2,S.DEFAULT_CHARSET),this._charsetService.setgCharset(3,S.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(j){for(let z=0;z<j.length;z++)switch(j.params[z]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(j){for(let z=0;z<j.length;z++)switch(j.params[z]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),j.params[z]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(j,z){const D=this._coreService.decPrivateModes,{activeProtocol:U,activeEncoding:V}=this._coreMouseService,J=this._coreService,{buffers:le,cols:pe}=this._bufferService,{active:te,alt:F}=le,ae=this._optionsService.rawOptions,re=Ie=>Ie?1:2,ge=j.params[0];return de=ge,we=z?ge===2?4:ge===4?re(J.modes.insertMode):ge===12?3:ge===20?re(ae.convertEol):0:ge===1?re(D.applicationCursorKeys):ge===3?ae.windowOptions.setWinLines?pe===80?2:pe===132?1:0:0:ge===6?re(D.origin):ge===7?re(D.wraparound):ge===8?3:ge===9?re(U==="X10"):ge===12?re(ae.cursorBlink):ge===25?re(!J.isCursorHidden):ge===45?re(D.reverseWraparound):ge===66?re(D.applicationKeypad):ge===67?4:ge===1e3?re(U==="VT200"):ge===1002?re(U==="DRAG"):ge===1003?re(U==="ANY"):ge===1004?re(D.sendFocus):ge===1005?4:ge===1006?re(V==="SGR"):ge===1015?4:ge===1016?re(V==="SGR_PIXELS"):ge===1048?1:ge===47||ge===1047||ge===1049?re(te===F):ge===2004?re(D.bracketedPasteMode):0,J.triggerDataEvent(`${m.C0.ESC}[${z?"":"?"}${de};${we}$y`),!0;var de,we}_updateAttrColor(j,z,D,U,V){return z===2?(j|=50331648,j&=-16777216,j|=k.AttributeData.fromColorRGB([D,U,V])):z===5&&(j&=-50331904,j|=33554432|255&D),j}_extractColor(j,z,D){const U=[0,0,-1,0,0,0];let V=0,J=0;do{if(U[J+V]=j.params[z+J],j.hasSubParams(z+J)){const le=j.getSubParams(z+J);let pe=0;do U[1]===5&&(V=1),U[J+pe+1+V]=le[pe];while(++pe<le.length&&pe+J+1+V<U.length);break}if(U[1]===5&&J+V>=2||U[1]===2&&J+V>=5)break;U[1]&&(V=1)}while(++J+z<j.length&&J+V<U.length);for(let le=2;le<U.length;++le)U[le]===-1&&(U[le]=0);switch(U[0]){case 38:D.fg=this._updateAttrColor(D.fg,U[1],U[3],U[4],U[5]);break;case 48:D.bg=this._updateAttrColor(D.bg,U[1],U[3],U[4],U[5]);break;case 58:D.extended=D.extended.clone(),D.extended.underlineColor=this._updateAttrColor(D.extended.underlineColor,U[1],U[3],U[4],U[5])}return J}_processUnderline(j,z){z.extended=z.extended.clone(),(!~j||j>5)&&(j=1),z.extended.underlineStyle=j,z.fg|=268435456,j===0&&(z.fg&=-268435457),z.updateExtended()}_processSGR0(j){j.fg=_.DEFAULT_ATTR_DATA.fg,j.bg=_.DEFAULT_ATTR_DATA.bg,j.extended=j.extended.clone(),j.extended.underlineStyle=0,j.extended.underlineColor&=-67108864,j.updateExtended()}charAttributes(j){if(j.length===1&&j.params[0]===0)return this._processSGR0(this._curAttrData),!0;const z=j.length;let D;const U=this._curAttrData;for(let V=0;V<z;V++)D=j.params[V],D>=30&&D<=37?(U.fg&=-50331904,U.fg|=16777216|D-30):D>=40&&D<=47?(U.bg&=-50331904,U.bg|=16777216|D-40):D>=90&&D<=97?(U.fg&=-50331904,U.fg|=16777224|D-90):D>=100&&D<=107?(U.bg&=-50331904,U.bg|=16777224|D-100):D===0?this._processSGR0(U):D===1?U.fg|=134217728:D===3?U.bg|=67108864:D===4?(U.fg|=268435456,this._processUnderline(j.hasSubParams(V)?j.getSubParams(V)[0]:1,U)):D===5?U.fg|=536870912:D===7?U.fg|=67108864:D===8?U.fg|=1073741824:D===9?U.fg|=2147483648:D===2?U.bg|=134217728:D===21?this._processUnderline(2,U):D===22?(U.fg&=-134217729,U.bg&=-134217729):D===23?U.bg&=-67108865:D===24?(U.fg&=-268435457,this._processUnderline(0,U)):D===25?U.fg&=-536870913:D===27?U.fg&=-67108865:D===28?U.fg&=-1073741825:D===29?U.fg&=2147483647:D===39?(U.fg&=-67108864,U.fg|=16777215&_.DEFAULT_ATTR_DATA.fg):D===49?(U.bg&=-67108864,U.bg|=16777215&_.DEFAULT_ATTR_DATA.bg):D===38||D===48||D===58?V+=this._extractColor(j,V,U):D===53?U.bg|=1073741824:D===55?U.bg&=-1073741825:D===59?(U.extended=U.extended.clone(),U.extended.underlineColor=-1,U.updateExtended()):D===100?(U.fg&=-67108864,U.fg|=16777215&_.DEFAULT_ATTR_DATA.fg,U.bg&=-67108864,U.bg|=16777215&_.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",D);return!0}deviceStatus(j){switch(j.params[0]){case 5:this._coreService.triggerDataEvent(`${m.C0.ESC}[0n`);break;case 6:const z=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[${z};${D}R`)}return!0}deviceStatusPrivate(j){if(j.params[0]===6){const z=this._activeBuffer.y+1,D=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${m.C0.ESC}[?${z};${D}R`)}return!0}softReset(j){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=_.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(j){const z=j.params[0]||1;switch(z){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const D=z%2==1;return this._optionsService.options.cursorBlink=D,!0}setScrollRegion(j){const z=j.params[0]||1;let D;return(j.length<2||(D=j.params[1])>this._bufferService.rows||D===0)&&(D=this._bufferService.rows),D>z&&(this._activeBuffer.scrollTop=z-1,this._activeBuffer.scrollBottom=D-1,this._setCursor(0,0)),!0}windowOptions(j){if(!G(j.params[0],this._optionsService.rawOptions.windowOptions))return!0;const z=j.length>1?j.params[1]:0;switch(j.params[0]){case 14:z!==2&&this._onRequestWindowsOptionsReport.fire(I.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(I.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${m.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:z!==0&&z!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),z!==0&&z!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:z!==0&&z!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),z!==0&&z!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(j){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(j){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(j){return this._windowTitle=j,this._onTitleChange.fire(j),!0}setIconName(j){return this._iconName=j,!0}setOrReportIndexedColor(j){const z=[],D=j.split(";");for(;D.length>1;){const U=D.shift(),V=D.shift();if(/^\d+$/.exec(U)){const J=parseInt(U);if(Y(J))if(V==="?")z.push({type:0,index:J});else{const le=(0,B.parseColor)(V);le&&z.push({type:1,index:J,color:le})}}}return z.length&&this._onColor.fire(z),!0}setHyperlink(j){const z=j.split(";");return!(z.length<2)&&(z[1]?this._createHyperlink(z[0],z[1]):!z[0]&&this._finishHyperlink())}_createHyperlink(j,z){this._getCurrentLinkId()&&this._finishHyperlink();const D=j.split(":");let U;const V=D.findIndex((J=>J.startsWith("id=")));return V!==-1&&(U=D[V].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:U,uri:z}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(j,z){const D=j.split(";");for(let U=0;U<D.length&&!(z>=this._specialColors.length);++U,++z)if(D[U]==="?")this._onColor.fire([{type:0,index:this._specialColors[z]}]);else{const V=(0,B.parseColor)(D[U]);V&&this._onColor.fire([{type:1,index:this._specialColors[z],color:V}])}return!0}setOrReportFgColor(j){return this._setOrReportSpecialColor(j,0)}setOrReportBgColor(j){return this._setOrReportSpecialColor(j,1)}setOrReportCursorColor(j){return this._setOrReportSpecialColor(j,2)}restoreIndexedColor(j){if(!j)return this._onColor.fire([{type:2}]),!0;const z=[],D=j.split(";");for(let U=0;U<D.length;++U)if(/^\d+$/.exec(D[U])){const V=parseInt(D[U]);Y(V)&&z.push({type:2,index:V})}return z.length&&this._onColor.fire(z),!0}restoreFgColor(j){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(j){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(j){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,S.DEFAULT_CHARSET),!0}selectCharset(j){return j.length!==2?(this.selectDefaultCharset(),!0):(j[0]==="/"||this._charsetService.setgCharset(q[j[0]],S.CHARSETS[j[1]]||S.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const j=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,j,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=_.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=_.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(j){return this._charsetService.setgLevel(j),!0}screenAlignmentPattern(){const j=new y.CellData;j.content=4194373,j.fg=this._curAttrData.fg,j.bg=this._curAttrData.bg,this._setCursor(0,0);for(let z=0;z<this._bufferService.rows;++z){const D=this._activeBuffer.ybase+this._activeBuffer.y+z,U=this._activeBuffer.lines.get(D);U&&(U.fill(j),U.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(j,z){const D=this._bufferService.buffer,U=this._optionsService.rawOptions;return(V=>(this._coreService.triggerDataEvent(`${m.C0.ESC}${V}${m.C0.ESC}\\`),!0))(j==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:j==='"p'?'P1$r61;1"p':j==="r"?`P1$r${D.scrollTop+1};${D.scrollBottom+1}r`:j==="m"?"P1$r0m":j===" q"?`P1$r${{block:2,underline:4,bar:6}[U.cursorStyle]-(U.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(j,z){this._dirtyRowTracker.markRangeDirty(j,z)}}l.InputHandler=H;let P=class{constructor(X){this._bufferService=X,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(X){X<this.start?this.start=X:X>this.end&&(this.end=X)}markRangeDirty(X,j){X>j&&(K=X,X=j,j=K),X<this.start&&(this.start=X),j>this.end&&(this.end=j)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Y(X){return 0<=X&&X<256}P=f([v(0,M.IBufferService)],P)},844:(p,l)=>{function h(f){for(const v of f)v.dispose();f.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const f of this._disposables)f.dispose();this._disposables.length=0}register(f){return this._disposables.push(f),f}unregister(f){const v=this._disposables.indexOf(f);v!==-1&&this._disposables.splice(v,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(f){this._isDisposed||f===this._value||(this._value?.dispose(),this._value=f)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},l.toDisposable=function(f){return{dispose:f}},l.disposeArray=h,l.getDisposeArrayDisposable=function(f){return{dispose:()=>h(f)}}},1505:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class h{constructor(){this._data={}}set(v,m,S){this._data[v]||(this._data[v]={}),this._data[v][m]=S}get(v,m){return this._data[v]?this._data[v][m]:void 0}clear(){this._data={}}}l.TwoKeyMap=h,l.FourKeyMap=class{constructor(){this._data=new h}set(f,v,m,S,C){this._data.get(f,v)||this._data.set(f,v,new h),this._data.get(f,v).set(m,S,C)}get(f,v,m,S){return this._data.get(f,v)?.get(m,S)}clear(){this._data.clear()}}},6114:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof process<"u"&&"title"in process;const h=l.isNode?"node":navigator.userAgent,f=l.isNode?"node":navigator.platform;l.isFirefox=h.includes("Firefox"),l.isLegacyEdge=h.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(h),l.getSafariVersion=function(){if(!l.isSafari)return 0;const v=h.match(/Version\/(\d+)/);return v===null||v.length<2?0:parseInt(v[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(f),l.isIpad=f==="iPad",l.isIphone=f==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(f),l.isLinux=f.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(h)},6106:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let h=0;l.SortedList=class{constructor(f){this._getKey=f,this._array=[]}clear(){this._array.length=0}insert(f){this._array.length!==0?(h=this._search(this._getKey(f)),this._array.splice(h,0,f)):this._array.push(f)}delete(f){if(this._array.length===0)return!1;const v=this._getKey(f);if(v===void 0||(h=this._search(v),h===-1)||this._getKey(this._array[h])!==v)return!1;do if(this._array[h]===f)return this._array.splice(h,1),!0;while(++h<this._array.length&&this._getKey(this._array[h])===v);return!1}*getKeyIterator(f){if(this._array.length!==0&&(h=this._search(f),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===f))do yield this._array[h];while(++h<this._array.length&&this._getKey(this._array[h])===f)}forEachByKey(f,v){if(this._array.length!==0&&(h=this._search(f),!(h<0||h>=this._array.length)&&this._getKey(this._array[h])===f))do v(this._array[h]);while(++h<this._array.length&&this._getKey(this._array[h])===f)}values(){return[...this._array].values()}_search(f){let v=0,m=this._array.length-1;for(;m>=v;){let S=v+m>>1;const C=this._getKey(this._array[S]);if(C>f)m=S-1;else{if(!(C<f)){for(;S>0&&this._getKey(this._array[S-1])===f;)S--;return S}v=S+1}}return v}}},7226:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const f=h(6114);class v{constructor(){this._tasks=[],this._i=0}enqueue(C){this._tasks.push(C),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(C){this._idleCallback=void 0;let T=0,w=0,_=C.timeRemaining(),b=0;for(;this._i<this._tasks.length;){if(T=Date.now(),this._tasks[this._i]()||this._i++,T=Math.max(1,Date.now()-T),w=Math.max(T,w),b=C.timeRemaining(),1.5*w>b)return _-T<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(_-T))}ms`),void this._start();_=b}this.clear()}}class m extends v{_requestCallback(C){return setTimeout((()=>C(this._createDeadline(16))))}_cancelCallback(C){clearTimeout(C)}_createDeadline(C){const T=Date.now()+C;return{timeRemaining:()=>Math.max(0,T-Date.now())}}}l.PriorityTaskQueue=m,l.IdleTaskQueue=!f.isNode&&"requestIdleCallback"in window?class extends v{_requestCallback(S){return requestIdleCallback(S)}_cancelCallback(S){cancelIdleCallback(S)}}:m,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(S){this._queue.clear(),this._queue.enqueue(S)}flush(){this._queue.flush()}}},9282:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const f=h(643);l.updateWindowsModeWrappedState=function(v){const m=v.buffer.lines.get(v.buffer.ybase+v.buffer.y-1),S=m?.get(v.cols-1),C=v.buffer.lines.get(v.buffer.ybase+v.buffer.y);C&&S&&(C.isWrapped=S[f.CHAR_DATA_CODE_INDEX]!==f.NULL_CELL_CODE&&S[f.CHAR_DATA_CODE_INDEX]!==f.WHITESPACE_CELL_CODE)}},3734:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class h{constructor(){this.fg=0,this.bg=0,this.extended=new f}static toColorRGB(m){return[m>>>16&255,m>>>8&255,255&m]}static fromColorRGB(m){return(255&m[0])<<16|(255&m[1])<<8|255&m[2]}clone(){const m=new h;return m.fg=this.fg,m.bg=this.bg,m.extended=this.extended.clone(),m}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}l.AttributeData=h;class f{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(m){this._ext=m}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(m){this._ext&=-469762049,this._ext|=m<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(m){this._ext&=-67108864,this._ext|=67108863&m}get urlId(){return this._urlId}set urlId(m){this._urlId=m}get underlineVariantOffset(){const m=(3758096384&this._ext)>>29;return m<0?4294967288^m:m}set underlineVariantOffset(m){this._ext&=536870911,this._ext|=m<<29&3758096384}constructor(m=0,S=0){this._ext=0,this._urlId=0,this._ext=m,this._urlId=S}clone(){return new f(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=f},9092:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const f=h(6349),v=h(7226),m=h(3734),S=h(8437),C=h(4634),T=h(511),w=h(643),_=h(4863),b=h(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(g,y,k){this._hasScrollback=g,this._optionsService=y,this._bufferService=k,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=S.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=T.CellData.fromCharData([0,w.NULL_CELL_CHAR,w.NULL_CELL_WIDTH,w.NULL_CELL_CODE]),this._whitespaceCell=T.CellData.fromCharData([0,w.WHITESPACE_CELL_CHAR,w.WHITESPACE_CELL_WIDTH,w.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new v.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(g){return g?(this._nullCell.fg=g.fg,this._nullCell.bg=g.bg,this._nullCell.extended=g.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new m.ExtendedAttrs),this._nullCell}getWhitespaceCell(g){return g?(this._whitespaceCell.fg=g.fg,this._whitespaceCell.bg=g.bg,this._whitespaceCell.extended=g.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new m.ExtendedAttrs),this._whitespaceCell}getBlankLine(g,y){return new S.BufferLine(this._bufferService.cols,this.getNullCell(g),y)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const g=this.ybase+this.y-this.ydisp;return g>=0&&g<this._rows}_getCorrectBufferLength(g){if(!this._hasScrollback)return g;const y=g+this._optionsService.rawOptions.scrollback;return y>l.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:y}fillViewportRows(g){if(this.lines.length===0){g===void 0&&(g=S.DEFAULT_ATTR_DATA);let y=this._rows;for(;y--;)this.lines.push(this.getBlankLine(g))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new f.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(g,y){const k=this.getNullCell(S.DEFAULT_ATTR_DATA);let M=0;const A=this._getCorrectBufferLength(y);if(A>this.lines.maxLength&&(this.lines.maxLength=A),this.lines.length>0){if(this._cols<g)for(let R=0;R<this.lines.length;R++)M+=+this.lines.get(R).resize(g,k);let N=0;if(this._rows<y)for(let R=this._rows;R<y;R++)this.lines.length<y+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new S.BufferLine(g,k)):this.ybase>0&&this.lines.length<=this.ybase+this.y+N+1?(this.ybase--,N++,this.ydisp>0&&this.ydisp--):this.lines.push(new S.BufferLine(g,k)));else for(let R=this._rows;R>y;R--)this.lines.length>y+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(A<this.lines.maxLength){const R=this.lines.length-A;R>0&&(this.lines.trimStart(R),this.ybase=Math.max(this.ybase-R,0),this.ydisp=Math.max(this.ydisp-R,0),this.savedY=Math.max(this.savedY-R,0)),this.lines.maxLength=A}this.x=Math.min(this.x,g-1),this.y=Math.min(this.y,y-1),N&&(this.y+=N),this.savedX=Math.min(this.savedX,g-1),this.scrollTop=0}if(this.scrollBottom=y-1,this._isReflowEnabled&&(this._reflow(g,y),this._cols>g))for(let N=0;N<this.lines.length;N++)M+=+this.lines.get(N).resize(g,k);this._cols=g,this._rows=y,this._memoryCleanupQueue.clear(),M>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let g=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,g=!1);let y=0;for(;this._memoryCleanupPosition<this.lines.length;)if(y+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),y>100)return!0;return g}get _isReflowEnabled(){const g=this._optionsService.rawOptions.windowsPty;return g&&g.buildNumber?this._hasScrollback&&g.backend==="conpty"&&g.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(g,y){this._cols!==g&&(g>this._cols?this._reflowLarger(g,y):this._reflowSmaller(g,y))}_reflowLarger(g,y){const k=(0,C.reflowLargerGetLinesToRemove)(this.lines,this._cols,g,this.ybase+this.y,this.getNullCell(S.DEFAULT_ATTR_DATA));if(k.length>0){const M=(0,C.reflowLargerCreateNewLayout)(this.lines,k);(0,C.reflowLargerApplyNewLayout)(this.lines,M.layout),this._reflowLargerAdjustViewport(g,y,M.countRemoved)}}_reflowLargerAdjustViewport(g,y,k){const M=this.getNullCell(S.DEFAULT_ATTR_DATA);let A=k;for(;A-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<y&&this.lines.push(new S.BufferLine(g,M))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-k,0)}_reflowSmaller(g,y){const k=this.getNullCell(S.DEFAULT_ATTR_DATA),M=[];let A=0;for(let N=this.lines.length-1;N>=0;N--){let R=this.lines.get(N);if(!R||!R.isWrapped&&R.getTrimmedLength()<=g)continue;const B=[R];for(;R.isWrapped&&N>0;)R=this.lines.get(--N),B.unshift(R);const q=this.ybase+this.y;if(q>=N&&q<N+B.length)continue;const W=B[B.length-1].getTrimmedLength(),G=(0,C.reflowSmallerGetNewLineLengths)(B,this._cols,g),I=G.length-B.length;let K;K=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+I):Math.max(0,this.lines.length-this.lines.maxLength+I);const H=[];for(let D=0;D<I;D++){const U=this.getBlankLine(S.DEFAULT_ATTR_DATA,!0);H.push(U)}H.length>0&&(M.push({start:N+B.length+A,newLines:H}),A+=H.length),B.push(...H);let P=G.length-1,Y=G[P];Y===0&&(P--,Y=G[P]);let X=B.length-I-1,j=W;for(;X>=0;){const D=Math.min(j,Y);if(B[P]===void 0)break;if(B[P].copyCellsFrom(B[X],j-D,Y-D,D,!0),Y-=D,Y===0&&(P--,Y=G[P]),j-=D,j===0){X--;const U=Math.max(X,0);j=(0,C.getWrappedLineTrimmedLength)(B,U,this._cols)}}for(let D=0;D<B.length;D++)G[D]<g&&B[D].setCell(G[D],k);let z=I-K;for(;z-- >0;)this.ybase===0?this.y<y-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+A)-y&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+I,this.ybase+y-1)}if(M.length>0){const N=[],R=[];for(let P=0;P<this.lines.length;P++)R.push(this.lines.get(P));const B=this.lines.length;let q=B-1,W=0,G=M[W];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+A);let I=0;for(let P=Math.min(this.lines.maxLength-1,B+A-1);P>=0;P--)if(G&&G.start>q+I){for(let Y=G.newLines.length-1;Y>=0;Y--)this.lines.set(P--,G.newLines[Y]);P++,N.push({index:q+1,amount:G.newLines.length}),I+=G.newLines.length,G=M[++W]}else this.lines.set(P,R[q--]);let K=0;for(let P=N.length-1;P>=0;P--)N[P].index+=K,this.lines.onInsertEmitter.fire(N[P]),K+=N[P].amount;const H=Math.max(0,B+A-this.lines.maxLength);H>0&&this.lines.onTrimEmitter.fire(H)}}translateBufferLineToString(g,y,k=0,M){const A=this.lines.get(g);return A?A.translateToString(y,k,M):""}getWrappedRangeForLine(g){let y=g,k=g;for(;y>0&&this.lines.get(y).isWrapped;)y--;for(;k+1<this.lines.length&&this.lines.get(k+1).isWrapped;)k++;return{first:y,last:k}}setupTabStops(g){for(g!=null?this.tabs[g]||(g=this.prevStop(g)):(this.tabs={},g=0);g<this._cols;g+=this._optionsService.rawOptions.tabStopWidth)this.tabs[g]=!0}prevStop(g){for(g==null&&(g=this.x);!this.tabs[--g]&&g>0;);return g>=this._cols?this._cols-1:g<0?0:g}nextStop(g){for(g==null&&(g=this.x);!this.tabs[++g]&&g<this._cols;);return g>=this._cols?this._cols-1:g<0?0:g}clearMarkers(g){this._isClearing=!0;for(let y=0;y<this.markers.length;y++)this.markers[y].line===g&&(this.markers[y].dispose(),this.markers.splice(y--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let g=0;g<this.markers.length;g++)this.markers[g].dispose(),this.markers.splice(g--,1);this._isClearing=!1}addMarker(g){const y=new _.Marker(g);return this.markers.push(y),y.register(this.lines.onTrim((k=>{y.line-=k,y.line<0&&y.dispose()}))),y.register(this.lines.onInsert((k=>{y.line>=k.index&&(y.line+=k.amount)}))),y.register(this.lines.onDelete((k=>{y.line>=k.index&&y.line<k.index+k.amount&&y.dispose(),y.line>k.index&&(y.line-=k.amount)}))),y.register(y.onDispose((()=>this._removeMarker(y)))),y}_removeMarker(g){this._isClearing||this.markers.splice(this.markers.indexOf(g),1)}}},8437:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const f=h(3734),v=h(511),m=h(643),S=h(482);l.DEFAULT_ATTR_DATA=Object.freeze(new f.AttributeData);let C=0;class T{constructor(_,b,g=!1){this.isWrapped=g,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*_);const y=b||v.CellData.fromCharData([0,m.NULL_CELL_CHAR,m.NULL_CELL_WIDTH,m.NULL_CELL_CODE]);for(let k=0;k<_;++k)this.setCell(k,y);this.length=_}get(_){const b=this._data[3*_+0],g=2097151&b;return[this._data[3*_+1],2097152&b?this._combined[_]:g?(0,S.stringFromCodePoint)(g):"",b>>22,2097152&b?this._combined[_].charCodeAt(this._combined[_].length-1):g]}set(_,b){this._data[3*_+1]=b[m.CHAR_DATA_ATTR_INDEX],b[m.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[_]=b[1],this._data[3*_+0]=2097152|_|b[m.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*_+0]=b[m.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[m.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(_){return this._data[3*_+0]>>22}hasWidth(_){return 12582912&this._data[3*_+0]}getFg(_){return this._data[3*_+1]}getBg(_){return this._data[3*_+2]}hasContent(_){return 4194303&this._data[3*_+0]}getCodePoint(_){const b=this._data[3*_+0];return 2097152&b?this._combined[_].charCodeAt(this._combined[_].length-1):2097151&b}isCombined(_){return 2097152&this._data[3*_+0]}getString(_){const b=this._data[3*_+0];return 2097152&b?this._combined[_]:2097151&b?(0,S.stringFromCodePoint)(2097151&b):""}isProtected(_){return 536870912&this._data[3*_+2]}loadCell(_,b){return C=3*_,b.content=this._data[C+0],b.fg=this._data[C+1],b.bg=this._data[C+2],2097152&b.content&&(b.combinedData=this._combined[_]),268435456&b.bg&&(b.extended=this._extendedAttrs[_]),b}setCell(_,b){2097152&b.content&&(this._combined[_]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[_]=b.extended),this._data[3*_+0]=b.content,this._data[3*_+1]=b.fg,this._data[3*_+2]=b.bg}setCellFromCodepoint(_,b,g,y){268435456&y.bg&&(this._extendedAttrs[_]=y.extended),this._data[3*_+0]=b|g<<22,this._data[3*_+1]=y.fg,this._data[3*_+2]=y.bg}addCodepointToCell(_,b,g){let y=this._data[3*_+0];2097152&y?this._combined[_]+=(0,S.stringFromCodePoint)(b):2097151&y?(this._combined[_]=(0,S.stringFromCodePoint)(2097151&y)+(0,S.stringFromCodePoint)(b),y&=-2097152,y|=2097152):y=b|4194304,g&&(y&=-12582913,y|=g<<22),this._data[3*_+0]=y}insertCells(_,b,g){if((_%=this.length)&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_-1,0,1,g),b<this.length-_){const y=new v.CellData;for(let k=this.length-_-b-1;k>=0;--k)this.setCell(_+b+k,this.loadCell(_+k,y));for(let k=0;k<b;++k)this.setCell(_+k,g)}else for(let y=_;y<this.length;++y)this.setCell(y,g);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,g)}deleteCells(_,b,g){if(_%=this.length,b<this.length-_){const y=new v.CellData;for(let k=0;k<this.length-_-b;++k)this.setCell(_+k,this.loadCell(_+b+k,y));for(let k=this.length-b;k<this.length;++k)this.setCell(k,g)}else for(let y=_;y<this.length;++y)this.setCell(y,g);_&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_-1,0,1,g),this.getWidth(_)!==0||this.hasContent(_)||this.setCellFromCodepoint(_,0,1,g)}replaceCells(_,b,g,y=!1){if(y)for(_&&this.getWidth(_-1)===2&&!this.isProtected(_-1)&&this.setCellFromCodepoint(_-1,0,1,g),b<this.length&&this.getWidth(b-1)===2&&!this.isProtected(b)&&this.setCellFromCodepoint(b,0,1,g);_<b&&_<this.length;)this.isProtected(_)||this.setCell(_,g),_++;else for(_&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_-1,0,1,g),b<this.length&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b,0,1,g);_<b&&_<this.length;)this.setCell(_++,g)}resize(_,b){if(_===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const g=3*_;if(_>this.length){if(this._data.buffer.byteLength>=4*g)this._data=new Uint32Array(this._data.buffer,0,g);else{const y=new Uint32Array(g);y.set(this._data),this._data=y}for(let y=this.length;y<_;++y)this.setCell(y,b)}else{this._data=this._data.subarray(0,g);const y=Object.keys(this._combined);for(let M=0;M<y.length;M++){const A=parseInt(y[M],10);A>=_&&delete this._combined[A]}const k=Object.keys(this._extendedAttrs);for(let M=0;M<k.length;M++){const A=parseInt(k[M],10);A>=_&&delete this._extendedAttrs[A]}}return this.length=_,4*g*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const _=new Uint32Array(this._data.length);return _.set(this._data),this._data=_,1}return 0}fill(_,b=!1){if(b)for(let g=0;g<this.length;++g)this.isProtected(g)||this.setCell(g,_);else{this._combined={},this._extendedAttrs={};for(let g=0;g<this.length;++g)this.setCell(g,_)}}copyFrom(_){this.length!==_.length?this._data=new Uint32Array(_._data):this._data.set(_._data),this.length=_.length,this._combined={};for(const b in _._combined)this._combined[b]=_._combined[b];this._extendedAttrs={};for(const b in _._extendedAttrs)this._extendedAttrs[b]=_._extendedAttrs[b];this.isWrapped=_.isWrapped}clone(){const _=new T(0);_._data=new Uint32Array(this._data),_.length=this.length;for(const b in this._combined)_._combined[b]=this._combined[b];for(const b in this._extendedAttrs)_._extendedAttrs[b]=this._extendedAttrs[b];return _.isWrapped=this.isWrapped,_}getTrimmedLength(){for(let _=this.length-1;_>=0;--_)if(4194303&this._data[3*_+0])return _+(this._data[3*_+0]>>22);return 0}getNoBgTrimmedLength(){for(let _=this.length-1;_>=0;--_)if(4194303&this._data[3*_+0]||50331648&this._data[3*_+2])return _+(this._data[3*_+0]>>22);return 0}copyCellsFrom(_,b,g,y,k){const M=_._data;if(k)for(let N=y-1;N>=0;N--){for(let R=0;R<3;R++)this._data[3*(g+N)+R]=M[3*(b+N)+R];268435456&M[3*(b+N)+2]&&(this._extendedAttrs[g+N]=_._extendedAttrs[b+N])}else for(let N=0;N<y;N++){for(let R=0;R<3;R++)this._data[3*(g+N)+R]=M[3*(b+N)+R];268435456&M[3*(b+N)+2]&&(this._extendedAttrs[g+N]=_._extendedAttrs[b+N])}const A=Object.keys(_._combined);for(let N=0;N<A.length;N++){const R=parseInt(A[N],10);R>=b&&(this._combined[R-b+g]=_._combined[R])}}translateToString(_,b,g,y){b=b??0,g=g??this.length,_&&(g=Math.min(g,this.getTrimmedLength())),y&&(y.length=0);let k="";for(;b<g;){const M=this._data[3*b+0],A=2097151&M,N=2097152&M?this._combined[b]:A?(0,S.stringFromCodePoint)(A):m.WHITESPACE_CELL_CHAR;if(k+=N,y)for(let R=0;R<N.length;++R)y.push(b);b+=M>>22||1}return y&&y.push(b),k}}l.BufferLine=T},4841:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(h,f){if(h.start.y>h.end.y)throw new Error(`Buffer range end (${h.end.x}, ${h.end.y}) cannot be before start (${h.start.x}, ${h.start.y})`);return f*(h.end.y-h.start.y)+(h.end.x-h.start.x+1)}},4634:(p,l)=>{function h(f,v,m){if(v===f.length-1)return f[v].getTrimmedLength();const S=!f[v].hasContent(m-1)&&f[v].getWidth(m-1)===1,C=f[v+1].getWidth(0)===2;return S&&C?m-1:m}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(f,v,m,S,C){const T=[];for(let w=0;w<f.length-1;w++){let _=w,b=f.get(++_);if(!b.isWrapped)continue;const g=[f.get(w)];for(;_<f.length&&b.isWrapped;)g.push(b),b=f.get(++_);if(S>=w&&S<_){w+=g.length-1;continue}let y=0,k=h(g,y,v),M=1,A=0;for(;M<g.length;){const R=h(g,M,v),B=R-A,q=m-k,W=Math.min(B,q);g[y].copyCellsFrom(g[M],A,k,W,!1),k+=W,k===m&&(y++,k=0),A+=W,A===R&&(M++,A=0),k===0&&y!==0&&g[y-1].getWidth(m-1)===2&&(g[y].copyCellsFrom(g[y-1],m-1,k++,1,!1),g[y-1].setCell(m-1,C))}g[y].replaceCells(k,m,C);let N=0;for(let R=g.length-1;R>0&&(R>y||g[R].getTrimmedLength()===0);R--)N++;N>0&&(T.push(w+g.length-N),T.push(N)),w+=g.length-1}return T},l.reflowLargerCreateNewLayout=function(f,v){const m=[];let S=0,C=v[S],T=0;for(let w=0;w<f.length;w++)if(C===w){const _=v[++S];f.onDeleteEmitter.fire({index:w-T,amount:_}),w+=_-1,T+=_,C=v[++S]}else m.push(w);return{layout:m,countRemoved:T}},l.reflowLargerApplyNewLayout=function(f,v){const m=[];for(let S=0;S<v.length;S++)m.push(f.get(v[S]));for(let S=0;S<m.length;S++)f.set(S,m[S]);f.length=v.length},l.reflowSmallerGetNewLineLengths=function(f,v,m){const S=[],C=f.map(((b,g)=>h(f,g,v))).reduce(((b,g)=>b+g));let T=0,w=0,_=0;for(;_<C;){if(C-_<m){S.push(C-_);break}T+=m;const b=h(f,w,v);T>b&&(T-=b,w++);const g=f[w].getWidth(T-1)===2;g&&T--;const y=g?m-1:m;S.push(y),_+=y}return S},l.getWrappedLineTrimmedLength=h},5295:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const f=h(8460),v=h(844),m=h(9092);class S extends v.Disposable{constructor(T,w){super(),this._optionsService=T,this._bufferService=w,this._onBufferActivate=this.register(new f.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new m.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new m.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(T){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(T),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(T,w){this._normal.resize(T,w),this._alt.resize(T,w),this.setupTabStops(T)}setupTabStops(T){this._normal.setupTabStops(T),this._alt.setupTabStops(T)}}l.BufferSet=S},511:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const f=h(482),v=h(643),m=h(3734);class S extends m.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new m.ExtendedAttrs,this.combinedData=""}static fromCharData(T){const w=new S;return w.setFromCharData(T),w}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,f.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(T){this.fg=T[v.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(T[v.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(T[v.CHAR_DATA_CHAR_INDEX].length===2){const _=T[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=_&&_<=56319){const b=T[v.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(_-55296)+b-56320+65536|T[v.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=T[v.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|T[v.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=T[v.CHAR_DATA_CHAR_INDEX],this.content=2097152|T[v.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=S},643:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const f=h(8460),v=h(844);class m{get id(){return this._id}constructor(C){this.line=C,this.isDisposed=!1,this._disposables=[],this._id=m._nextId++,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,v.disposeArray)(this._disposables),this._disposables.length=0)}register(C){return this._disposables.push(C),C}}l.Marker=m,m._nextId=1},7116:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(p,l)=>{var h,f,v;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.C0=void 0,(function(m){m.NUL="\0",m.SOH="",m.STX="",m.ETX="",m.EOT="",m.ENQ="",m.ACK="",m.BEL="\x07",m.BS="\b",m.HT=" ",m.LF=`
81
+ `,m.VT="\v",m.FF="\f",m.CR="\r",m.SO="",m.SI="",m.DLE="",m.DC1="",m.DC2="",m.DC3="",m.DC4="",m.NAK="",m.SYN="",m.ETB="",m.CAN="",m.EM="",m.SUB="",m.ESC="\x1B",m.FS="",m.GS="",m.RS="",m.US="",m.SP=" ",m.DEL=""})(h||(l.C0=h={})),(function(m){m.PAD="€",m.HOP="",m.BPH="‚",m.NBH="ƒ",m.IND="„",m.NEL="…",m.SSA="†",m.ESA="‡",m.HTS="ˆ",m.HTJ="‰",m.VTS="Š",m.PLD="‹",m.PLU="Œ",m.RI="",m.SS2="Ž",m.SS3="",m.DCS="",m.PU1="‘",m.PU2="’",m.STS="“",m.CCH="”",m.MW="•",m.SPA="–",m.EPA="—",m.SOS="˜",m.SGCI="™",m.SCI="š",m.CSI="›",m.ST="œ",m.OSC="",m.PM="ž",m.APC="Ÿ"})(f||(l.C1=f={})),(function(m){m.ST=`${h.ESC}\\`})(v||(l.C1_ESCAPED=v={}))},7399:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const f=h(2584),v={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:["'",'"']};l.evaluateKeyboardEvent=function(m,S,C,T){const w={type:0,cancel:!1,key:void 0},_=(m.shiftKey?1:0)|(m.altKey?2:0)|(m.ctrlKey?4:0)|(m.metaKey?8:0);switch(m.keyCode){case 0:m.key==="UIKeyInputUpArrow"?w.key=S?f.C0.ESC+"OA":f.C0.ESC+"[A":m.key==="UIKeyInputLeftArrow"?w.key=S?f.C0.ESC+"OD":f.C0.ESC+"[D":m.key==="UIKeyInputRightArrow"?w.key=S?f.C0.ESC+"OC":f.C0.ESC+"[C":m.key==="UIKeyInputDownArrow"&&(w.key=S?f.C0.ESC+"OB":f.C0.ESC+"[B");break;case 8:w.key=m.ctrlKey?"\b":f.C0.DEL,m.altKey&&(w.key=f.C0.ESC+w.key);break;case 9:if(m.shiftKey){w.key=f.C0.ESC+"[Z";break}w.key=f.C0.HT,w.cancel=!0;break;case 13:w.key=m.altKey?f.C0.ESC+f.C0.CR:f.C0.CR,w.cancel=!0;break;case 27:w.key=f.C0.ESC,m.altKey&&(w.key=f.C0.ESC+f.C0.ESC),w.cancel=!0;break;case 37:if(m.metaKey)break;_?(w.key=f.C0.ESC+"[1;"+(_+1)+"D",w.key===f.C0.ESC+"[1;3D"&&(w.key=f.C0.ESC+(C?"b":"[1;5D"))):w.key=S?f.C0.ESC+"OD":f.C0.ESC+"[D";break;case 39:if(m.metaKey)break;_?(w.key=f.C0.ESC+"[1;"+(_+1)+"C",w.key===f.C0.ESC+"[1;3C"&&(w.key=f.C0.ESC+(C?"f":"[1;5C"))):w.key=S?f.C0.ESC+"OC":f.C0.ESC+"[C";break;case 38:if(m.metaKey)break;_?(w.key=f.C0.ESC+"[1;"+(_+1)+"A",C||w.key!==f.C0.ESC+"[1;3A"||(w.key=f.C0.ESC+"[1;5A")):w.key=S?f.C0.ESC+"OA":f.C0.ESC+"[A";break;case 40:if(m.metaKey)break;_?(w.key=f.C0.ESC+"[1;"+(_+1)+"B",C||w.key!==f.C0.ESC+"[1;3B"||(w.key=f.C0.ESC+"[1;5B")):w.key=S?f.C0.ESC+"OB":f.C0.ESC+"[B";break;case 45:m.shiftKey||m.ctrlKey||(w.key=f.C0.ESC+"[2~");break;case 46:w.key=_?f.C0.ESC+"[3;"+(_+1)+"~":f.C0.ESC+"[3~";break;case 36:w.key=_?f.C0.ESC+"[1;"+(_+1)+"H":S?f.C0.ESC+"OH":f.C0.ESC+"[H";break;case 35:w.key=_?f.C0.ESC+"[1;"+(_+1)+"F":S?f.C0.ESC+"OF":f.C0.ESC+"[F";break;case 33:m.shiftKey?w.type=2:m.ctrlKey?w.key=f.C0.ESC+"[5;"+(_+1)+"~":w.key=f.C0.ESC+"[5~";break;case 34:m.shiftKey?w.type=3:m.ctrlKey?w.key=f.C0.ESC+"[6;"+(_+1)+"~":w.key=f.C0.ESC+"[6~";break;case 112:w.key=_?f.C0.ESC+"[1;"+(_+1)+"P":f.C0.ESC+"OP";break;case 113:w.key=_?f.C0.ESC+"[1;"+(_+1)+"Q":f.C0.ESC+"OQ";break;case 114:w.key=_?f.C0.ESC+"[1;"+(_+1)+"R":f.C0.ESC+"OR";break;case 115:w.key=_?f.C0.ESC+"[1;"+(_+1)+"S":f.C0.ESC+"OS";break;case 116:w.key=_?f.C0.ESC+"[15;"+(_+1)+"~":f.C0.ESC+"[15~";break;case 117:w.key=_?f.C0.ESC+"[17;"+(_+1)+"~":f.C0.ESC+"[17~";break;case 118:w.key=_?f.C0.ESC+"[18;"+(_+1)+"~":f.C0.ESC+"[18~";break;case 119:w.key=_?f.C0.ESC+"[19;"+(_+1)+"~":f.C0.ESC+"[19~";break;case 120:w.key=_?f.C0.ESC+"[20;"+(_+1)+"~":f.C0.ESC+"[20~";break;case 121:w.key=_?f.C0.ESC+"[21;"+(_+1)+"~":f.C0.ESC+"[21~";break;case 122:w.key=_?f.C0.ESC+"[23;"+(_+1)+"~":f.C0.ESC+"[23~";break;case 123:w.key=_?f.C0.ESC+"[24;"+(_+1)+"~":f.C0.ESC+"[24~";break;default:if(!m.ctrlKey||m.shiftKey||m.altKey||m.metaKey)if(C&&!T||!m.altKey||m.metaKey)!C||m.altKey||m.ctrlKey||m.shiftKey||!m.metaKey?m.key&&!m.ctrlKey&&!m.altKey&&!m.metaKey&&m.keyCode>=48&&m.key.length===1?w.key=m.key:m.key&&m.ctrlKey&&(m.key==="_"&&(w.key=f.C0.US),m.key==="@"&&(w.key=f.C0.NUL)):m.keyCode===65&&(w.type=1);else{const b=v[m.keyCode],g=b?.[m.shiftKey?1:0];if(g)w.key=f.C0.ESC+g;else if(m.keyCode>=65&&m.keyCode<=90){const y=m.ctrlKey?m.keyCode-64:m.keyCode+32;let k=String.fromCharCode(y);m.shiftKey&&(k=k.toUpperCase()),w.key=f.C0.ESC+k}else if(m.keyCode===32)w.key=f.C0.ESC+(m.ctrlKey?f.C0.NUL:" ");else if(m.key==="Dead"&&m.code.startsWith("Key")){let y=m.code.slice(3,4);m.shiftKey||(y=y.toLowerCase()),w.key=f.C0.ESC+y,w.cancel=!0}}else m.keyCode>=65&&m.keyCode<=90?w.key=String.fromCharCode(m.keyCode-64):m.keyCode===32?w.key=f.C0.NUL:m.keyCode>=51&&m.keyCode<=55?w.key=String.fromCharCode(m.keyCode-51+27):m.keyCode===56?w.key=f.C0.DEL:m.keyCode===219?w.key=f.C0.ESC:m.keyCode===220?w.key=f.C0.FS:m.keyCode===221&&(w.key=f.C0.GS)}return w}},482:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(h){return h>65535?(h-=65536,String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):String.fromCharCode(h)},l.utf32ToString=function(h,f=0,v=h.length){let m="";for(let S=f;S<v;++S){let C=h[S];C>65535?(C-=65536,m+=String.fromCharCode(55296+(C>>10))+String.fromCharCode(C%1024+56320)):m+=String.fromCharCode(C)}return m},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,f){const v=h.length;if(!v)return 0;let m=0,S=0;if(this._interim){const C=h.charCodeAt(S++);56320<=C&&C<=57343?f[m++]=1024*(this._interim-55296)+C-56320+65536:(f[m++]=this._interim,f[m++]=C),this._interim=0}for(let C=S;C<v;++C){const T=h.charCodeAt(C);if(55296<=T&&T<=56319){if(++C>=v)return this._interim=T,m;const w=h.charCodeAt(C);56320<=w&&w<=57343?f[m++]=1024*(T-55296)+w-56320+65536:(f[m++]=T,f[m++]=w)}else T!==65279&&(f[m++]=T)}return m}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,f){const v=h.length;if(!v)return 0;let m,S,C,T,w=0,_=0,b=0;if(this.interim[0]){let k=!1,M=this.interim[0];M&=(224&M)==192?31:(240&M)==224?15:7;let A,N=0;for(;(A=63&this.interim[++N])&&N<4;)M<<=6,M|=A;const R=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,B=R-N;for(;b<B;){if(b>=v)return 0;if(A=h[b++],(192&A)!=128){b--,k=!0;break}this.interim[N++]=A,M<<=6,M|=63&A}k||(R===2?M<128?b--:f[w++]=M:R===3?M<2048||M>=55296&&M<=57343||M===65279||(f[w++]=M):M<65536||M>1114111||(f[w++]=M)),this.interim.fill(0)}const g=v-4;let y=b;for(;y<v;){for(;!(!(y<g)||128&(m=h[y])||128&(S=h[y+1])||128&(C=h[y+2])||128&(T=h[y+3]));)f[w++]=m,f[w++]=S,f[w++]=C,f[w++]=T,y+=4;if(m=h[y++],m<128)f[w++]=m;else if((224&m)==192){if(y>=v)return this.interim[0]=m,w;if(S=h[y++],(192&S)!=128){y--;continue}if(_=(31&m)<<6|63&S,_<128){y--;continue}f[w++]=_}else if((240&m)==224){if(y>=v)return this.interim[0]=m,w;if(S=h[y++],(192&S)!=128){y--;continue}if(y>=v)return this.interim[0]=m,this.interim[1]=S,w;if(C=h[y++],(192&C)!=128){y--;continue}if(_=(15&m)<<12|(63&S)<<6|63&C,_<2048||_>=55296&&_<=57343||_===65279)continue;f[w++]=_}else if((248&m)==240){if(y>=v)return this.interim[0]=m,w;if(S=h[y++],(192&S)!=128){y--;continue}if(y>=v)return this.interim[0]=m,this.interim[1]=S,w;if(C=h[y++],(192&C)!=128){y--;continue}if(y>=v)return this.interim[0]=m,this.interim[1]=S,this.interim[2]=C,w;if(T=h[y++],(192&T)!=128){y--;continue}if(_=(7&m)<<18|(63&S)<<12|(63&C)<<6|63&T,_<65536||_>1114111)continue;f[w++]=_}}return w}}},225:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const f=h(1480),v=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],m=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let S;l.UnicodeV6=class{constructor(){if(this.version="6",!S){S=new Uint8Array(65536),S.fill(1),S[0]=0,S.fill(0,1,32),S.fill(0,127,160),S.fill(2,4352,4448),S[9001]=2,S[9002]=2,S.fill(2,11904,42192),S[12351]=1,S.fill(2,44032,55204),S.fill(2,63744,64256),S.fill(2,65040,65050),S.fill(2,65072,65136),S.fill(2,65280,65377),S.fill(2,65504,65511);for(let C=0;C<v.length;++C)S.fill(0,v[C][0],v[C][1]+1)}}wcwidth(C){return C<32?0:C<127?1:C<65536?S[C]:(function(T,w){let _,b=0,g=w.length-1;if(T<w[0][0]||T>w[g][1])return!1;for(;g>=b;)if(_=b+g>>1,T>w[_][1])b=_+1;else{if(!(T<w[_][0]))return!0;g=_-1}return!1})(C,m)?0:C>=131072&&C<=196605||C>=196608&&C<=262141?2:1}charProperties(C,T){let w=this.wcwidth(C),_=w===0&&T!==0;if(_){const b=f.UnicodeService.extractWidth(T);b===0?_=!1:b>w&&(w=b)}return f.UnicodeService.createPropertyValue(0,w,_)}}},5981:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const f=h(8460),v=h(844);class m extends v.Disposable{constructor(C){super(),this._action=C,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new f.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(C,T){if(T!==void 0&&this._syncCalls>T)return void(this._syncCalls=0);if(this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let w;for(this._isSyncWriting=!0;w=this._writeBuffer.shift();){this._action(w);const _=this._callbacks.shift();_&&_()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(C,T){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(T),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=C.length,this._writeBuffer.push(C),this._callbacks.push(T)}_innerWrite(C=0,T=!0){const w=C||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const _=this._writeBuffer[this._bufferOffset],b=this._action(_,T);if(b){const y=k=>Date.now()-w>=12?setTimeout((()=>this._innerWrite(0,k))):this._innerWrite(w,k);return void b.catch((k=>(queueMicrotask((()=>{throw k})),Promise.resolve(!1)))).then(y)}const g=this._callbacks[this._bufferOffset];if(g&&g(),this._bufferOffset++,this._pendingData-=_.length,Date.now()-w>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}l.WriteBuffer=m},5941:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const h=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,f=/^[\da-f]+$/;function v(m,S){const C=m.toString(16),T=C.length<2?"0"+C:C;switch(S){case 4:return C[0];case 8:return T;case 12:return(T+T).slice(0,3);default:return T+T}}l.parseColor=function(m){if(!m)return;let S=m.toLowerCase();if(S.indexOf("rgb:")===0){S=S.slice(4);const C=h.exec(S);if(C){const T=C[1]?15:C[4]?255:C[7]?4095:65535;return[Math.round(parseInt(C[1]||C[4]||C[7]||C[10],16)/T*255),Math.round(parseInt(C[2]||C[5]||C[8]||C[11],16)/T*255),Math.round(parseInt(C[3]||C[6]||C[9]||C[12],16)/T*255)]}}else if(S.indexOf("#")===0&&(S=S.slice(1),f.exec(S)&&[3,6,9,12].includes(S.length))){const C=S.length/3,T=[0,0,0];for(let w=0;w<3;++w){const _=parseInt(S.slice(C*w,C*w+C),16);T[w]=C===1?_<<4:C===2?_:C===3?_>>4:_>>8}return T}},l.toRgbString=function(m,S=16){const[C,T,w]=m;return`rgb:${v(C,S)}/${v(T,S)}/${v(w,S)}`}},5770:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const f=h(482),v=h(8742),m=h(5770),S=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=S,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=S}registerHandler(T,w){this._handlers[T]===void 0&&(this._handlers[T]=[]);const _=this._handlers[T];return _.push(w),{dispose:()=>{const b=_.indexOf(w);b!==-1&&_.splice(b,1)}}}clearHandler(T){this._handlers[T]&&delete this._handlers[T]}setHandlerFallback(T){this._handlerFb=T}reset(){if(this._active.length)for(let T=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;T>=0;--T)this._active[T].unhook(!1);this._stack.paused=!1,this._active=S,this._ident=0}hook(T,w){if(this.reset(),this._ident=T,this._active=this._handlers[T]||S,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].hook(w);else this._handlerFb(this._ident,"HOOK",w)}put(T,w,_){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(T,w,_);else this._handlerFb(this._ident,"PUT",(0,f.utf32ToString)(T,w,_))}unhook(T,w=!0){if(this._active.length){let _=!1,b=this._active.length-1,g=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,_=w,g=this._stack.fallThrough,this._stack.paused=!1),!g&&_===!1){for(;b>=0&&(_=this._active[b].unhook(T),_!==!0);b--)if(_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,_;b--}for(;b>=0;b--)if(_=this._active[b].unhook(!1),_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,_}else this._handlerFb(this._ident,"UNHOOK",T);this._active=S,this._ident=0}};const C=new v.Params;C.addParam(0),l.DcsHandler=class{constructor(T){this._handler=T,this._data="",this._params=C,this._hitLimit=!1}hook(T){this._params=T.length>1||T.params[0]?T.clone():C,this._data="",this._hitLimit=!1}put(T,w,_){this._hitLimit||(this._data+=(0,f.utf32ToString)(T,w,_),this._data.length>m.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(T){let w=!1;if(this._hitLimit)w=!1;else if(T&&(w=this._handler(this._data,this._params),w instanceof Promise))return w.then((_=>(this._params=C,this._data="",this._hitLimit=!1,_)));return this._params=C,this._data="",this._hitLimit=!1,w}}},2015:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const f=h(844),v=h(8742),m=h(6242),S=h(6351);class C{constructor(b){this.table=new Uint8Array(b)}setDefault(b,g){this.table.fill(b<<4|g)}add(b,g,y,k){this.table[g<<8|b]=y<<4|k}addMany(b,g,y,k){for(let M=0;M<b.length;M++)this.table[g<<8|b[M]]=y<<4|k}}l.TransitionTable=C;const T=160;l.VT500_TRANSITION_TABLE=(function(){const _=new C(4095),b=Array.apply(null,Array(256)).map(((N,R)=>R)),g=(N,R)=>b.slice(N,R),y=g(32,127),k=g(0,24);k.push(25),k.push.apply(k,g(28,32));const M=g(0,14);let A;for(A in _.setDefault(1,0),_.addMany(y,0,2,0),M)_.addMany([24,26,153,154],A,3,0),_.addMany(g(128,144),A,3,0),_.addMany(g(144,152),A,3,0),_.add(156,A,0,0),_.add(27,A,11,1),_.add(157,A,4,8),_.addMany([152,158,159],A,0,7),_.add(155,A,11,3),_.add(144,A,11,9);return _.addMany(k,0,3,0),_.addMany(k,1,3,1),_.add(127,1,0,1),_.addMany(k,8,0,8),_.addMany(k,3,3,3),_.add(127,3,0,3),_.addMany(k,4,3,4),_.add(127,4,0,4),_.addMany(k,6,3,6),_.addMany(k,5,3,5),_.add(127,5,0,5),_.addMany(k,2,3,2),_.add(127,2,0,2),_.add(93,1,4,8),_.addMany(y,8,5,8),_.add(127,8,5,8),_.addMany([156,27,24,26,7],8,6,0),_.addMany(g(28,32),8,0,8),_.addMany([88,94,95],1,0,7),_.addMany(y,7,0,7),_.addMany(k,7,0,7),_.add(156,7,0,0),_.add(127,7,0,7),_.add(91,1,11,3),_.addMany(g(64,127),3,7,0),_.addMany(g(48,60),3,8,4),_.addMany([60,61,62,63],3,9,4),_.addMany(g(48,60),4,8,4),_.addMany(g(64,127),4,7,0),_.addMany([60,61,62,63],4,0,6),_.addMany(g(32,64),6,0,6),_.add(127,6,0,6),_.addMany(g(64,127),6,0,0),_.addMany(g(32,48),3,9,5),_.addMany(g(32,48),5,9,5),_.addMany(g(48,64),5,0,6),_.addMany(g(64,127),5,7,0),_.addMany(g(32,48),4,9,5),_.addMany(g(32,48),1,9,2),_.addMany(g(32,48),2,9,2),_.addMany(g(48,127),2,10,0),_.addMany(g(48,80),1,10,0),_.addMany(g(81,88),1,10,0),_.addMany([89,90,92],1,10,0),_.addMany(g(96,127),1,10,0),_.add(80,1,11,9),_.addMany(k,9,0,9),_.add(127,9,0,9),_.addMany(g(28,32),9,0,9),_.addMany(g(32,48),9,9,12),_.addMany(g(48,60),9,8,10),_.addMany([60,61,62,63],9,9,10),_.addMany(k,11,0,11),_.addMany(g(32,128),11,0,11),_.addMany(g(28,32),11,0,11),_.addMany(k,10,0,10),_.add(127,10,0,10),_.addMany(g(28,32),10,0,10),_.addMany(g(48,60),10,8,10),_.addMany([60,61,62,63],10,0,11),_.addMany(g(32,48),10,9,12),_.addMany(k,12,0,12),_.add(127,12,0,12),_.addMany(g(28,32),12,0,12),_.addMany(g(32,48),12,9,12),_.addMany(g(48,64),12,0,11),_.addMany(g(64,127),12,12,13),_.addMany(g(64,127),10,12,13),_.addMany(g(64,127),9,12,13),_.addMany(k,13,13,13),_.addMany(y,13,13,13),_.add(127,13,0,13),_.addMany([27,156,24,26],13,14,0),_.add(T,0,2,0),_.add(T,8,5,8),_.add(T,6,0,6),_.add(T,11,0,11),_.add(T,13,13,13),_})();class w extends f.Disposable{constructor(b=l.VT500_TRANSITION_TABLE){super(),this._transitions=b,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new v.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(g,y,k)=>{},this._executeHandlerFb=g=>{},this._csiHandlerFb=(g,y)=>{},this._escHandlerFb=g=>{},this._errorHandlerFb=g=>g,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,f.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new m.OscParser),this._dcsParser=this.register(new S.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,g=[64,126]){let y=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(y=b.prefix.charCodeAt(0),y&&60>y||y>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(b.intermediates){if(b.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let M=0;M<b.intermediates.length;++M){const A=b.intermediates.charCodeAt(M);if(32>A||A>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");y<<=8,y|=A}}if(b.final.length!==1)throw new Error("final must be a single byte");const k=b.final.charCodeAt(0);if(g[0]>k||k>g[1])throw new Error(`final must be in range ${g[0]} .. ${g[1]}`);return y<<=8,y|=k,y}identToString(b){const g=[];for(;b;)g.push(String.fromCharCode(255&b)),b>>=8;return g.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,g){const y=this._identifier(b,[48,126]);this._escHandlers[y]===void 0&&(this._escHandlers[y]=[]);const k=this._escHandlers[y];return k.push(g),{dispose:()=>{const M=k.indexOf(g);M!==-1&&k.splice(M,1)}}}clearEscHandler(b){this._escHandlers[this._identifier(b,[48,126])]&&delete this._escHandlers[this._identifier(b,[48,126])]}setEscHandlerFallback(b){this._escHandlerFb=b}setExecuteHandler(b,g){this._executeHandlers[b.charCodeAt(0)]=g}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,g){const y=this._identifier(b);this._csiHandlers[y]===void 0&&(this._csiHandlers[y]=[]);const k=this._csiHandlers[y];return k.push(g),{dispose:()=>{const M=k.indexOf(g);M!==-1&&k.splice(M,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,g){return this._dcsParser.registerHandler(this._identifier(b),g)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,g){return this._oscParser.registerHandler(b,g)}clearOscHandler(b){this._oscParser.clearHandler(b)}setOscHandlerFallback(b){this._oscParser.setHandlerFallback(b)}setErrorHandler(b){this._errorHandler=b}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(b,g,y,k,M){this._parseStack.state=b,this._parseStack.handlers=g,this._parseStack.handlerPos=y,this._parseStack.transition=k,this._parseStack.chunkPos=M}parse(b,g,y){let k,M=0,A=0,N=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,N=this._parseStack.chunkPos+1;else{if(y===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const R=this._parseStack.handlers;let B=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(y===!1&&B>-1){for(;B>=0&&(k=R[B](this._params),k!==!0);B--)if(k instanceof Promise)return this._parseStack.handlerPos=B,k}this._parseStack.handlers=[];break;case 4:if(y===!1&&B>-1){for(;B>=0&&(k=R[B](),k!==!0);B--)if(k instanceof Promise)return this._parseStack.handlerPos=B,k}this._parseStack.handlers=[];break;case 6:if(M=b[this._parseStack.chunkPos],k=this._dcsParser.unhook(M!==24&&M!==26,y),k)return k;M===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(M=b[this._parseStack.chunkPos],k=this._oscParser.end(M!==24&&M!==26,y),k)return k;M===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,N=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let R=N;R<g;++R){switch(M=b[R],A=this._transitions.table[this.currentState<<8|(M<160?M:T)],A>>4){case 2:for(let I=R+1;;++I){if(I>=g||(M=b[I])<32||M>126&&M<T){this._printHandler(b,R,I),R=I-1;break}if(++I>=g||(M=b[I])<32||M>126&&M<T){this._printHandler(b,R,I),R=I-1;break}if(++I>=g||(M=b[I])<32||M>126&&M<T){this._printHandler(b,R,I),R=I-1;break}if(++I>=g||(M=b[I])<32||M>126&&M<T){this._printHandler(b,R,I),R=I-1;break}}break;case 3:this._executeHandlers[M]?this._executeHandlers[M]():this._executeHandlerFb(M),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:R,code:M,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const B=this._csiHandlers[this._collect<<8|M];let q=B?B.length-1:-1;for(;q>=0&&(k=B[q](this._params),k!==!0);q--)if(k instanceof Promise)return this._preserveStack(3,B,q,A,R),k;q<0&&this._csiHandlerFb(this._collect<<8|M,this._params),this.precedingJoinState=0;break;case 8:do switch(M){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(M-48)}while(++R<g&&(M=b[R])>47&&M<60);R--;break;case 9:this._collect<<=8,this._collect|=M;break;case 10:const W=this._escHandlers[this._collect<<8|M];let G=W?W.length-1:-1;for(;G>=0&&(k=W[G](),k!==!0);G--)if(k instanceof Promise)return this._preserveStack(4,W,G,A,R),k;G<0&&this._escHandlerFb(this._collect<<8|M),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|M,this._params);break;case 13:for(let I=R+1;;++I)if(I>=g||(M=b[I])===24||M===26||M===27||M>127&&M<T){this._dcsParser.put(b,R,I),R=I-1;break}break;case 14:if(k=this._dcsParser.unhook(M!==24&&M!==26),k)return this._preserveStack(6,[],0,A,R),k;M===27&&(A|=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 I=R+1;;I++)if(I>=g||(M=b[I])<32||M>127&&M<T){this._oscParser.put(b,R,I),R=I-1;break}break;case 6:if(k=this._oscParser.end(M!==24&&M!==26),k)return this._preserveStack(5,[],0,A,R),k;M===27&&(A|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&A}}}l.EscapeSequenceParser=w},6242:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const f=h(5770),v=h(482),m=[];l.OscParser=class{constructor(){this._state=0,this._active=m,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(S,C){this._handlers[S]===void 0&&(this._handlers[S]=[]);const T=this._handlers[S];return T.push(C),{dispose:()=>{const w=T.indexOf(C);w!==-1&&T.splice(w,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}reset(){if(this._state===2)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].end(!1);this._stack.paused=!1,this._active=m,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||m,this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].start();else this._handlerFb(this._id,"START")}_put(S,C,T){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(S,C,T);else this._handlerFb(this._id,"PUT",(0,v.utf32ToString)(S,C,T))}start(){this.reset(),this._state=1}put(S,C,T){if(this._state!==3){if(this._state===1)for(;C<T;){const w=S[C++];if(w===59){this._state=2,this._start();break}if(w<48||57<w)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+w-48}this._state===2&&T-C>0&&this._put(S,C,T)}}end(S,C=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let T=!1,w=this._active.length-1,_=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,T=C,_=this._stack.fallThrough,this._stack.paused=!1),!_&&T===!1){for(;w>=0&&(T=this._active[w].end(S),T!==!0);w--)if(T instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!1,T;w--}for(;w>=0;w--)if(T=this._active[w].end(!1),T instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!0,T}else this._handlerFb(this._id,"END",S);this._active=m,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(S){this._handler=S,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(S,C,T){this._hitLimit||(this._data+=(0,v.utf32ToString)(S,C,T),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(S){let C=!1;if(this._hitLimit)C=!1;else if(S&&(C=this._handler(this._data),C instanceof Promise))return C.then((T=>(this._data="",this._hitLimit=!1,T)));return this._data="",this._hitLimit=!1,C}}},8742:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const h=2147483647;class f{static fromArray(m){const S=new f;if(!m.length)return S;for(let C=Array.isArray(m[0])?1:0;C<m.length;++C){const T=m[C];if(Array.isArray(T))for(let w=0;w<T.length;++w)S.addSubParam(T[w]);else S.addParam(T)}return S}constructor(m=32,S=32){if(this.maxLength=m,this.maxSubParamsLength=S,S>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(m),this.length=0,this._subParams=new Int32Array(S),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(m),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const m=new f(this.maxLength,this.maxSubParamsLength);return m.params.set(this.params),m.length=this.length,m._subParams.set(this._subParams),m._subParamsLength=this._subParamsLength,m._subParamsIdx.set(this._subParamsIdx),m._rejectDigits=this._rejectDigits,m._rejectSubDigits=this._rejectSubDigits,m._digitIsSub=this._digitIsSub,m}toArray(){const m=[];for(let S=0;S<this.length;++S){m.push(this.params[S]);const C=this._subParamsIdx[S]>>8,T=255&this._subParamsIdx[S];T-C>0&&m.push(Array.prototype.slice.call(this._subParams,C,T))}return m}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(m){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=m>h?h:m}}addSubParam(m){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(m<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=m>h?h:m,this._subParamsIdx[this.length-1]++}}hasSubParams(m){return(255&this._subParamsIdx[m])-(this._subParamsIdx[m]>>8)>0}getSubParams(m){const S=this._subParamsIdx[m]>>8,C=255&this._subParamsIdx[m];return C-S>0?this._subParams.subarray(S,C):null}getSubParamsAll(){const m={};for(let S=0;S<this.length;++S){const C=this._subParamsIdx[S]>>8,T=255&this._subParamsIdx[S];T-C>0&&(m[S]=this._subParams.slice(C,T))}return m}addDigit(m){let S;if(this._rejectDigits||!(S=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const C=this._digitIsSub?this._subParams:this.params,T=C[S-1];C[S-1]=~T?Math.min(10*T+m,h):m}}l.Params=f},5741:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let h=this._addons.length-1;h>=0;h--)this._addons[h].instance.dispose()}loadAddon(h,f){const v={instance:f,dispose:f.dispose,isDisposed:!1};this._addons.push(v),f.dispose=()=>this._wrappedAddonDispose(v),f.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let f=-1;for(let v=0;v<this._addons.length;v++)if(this._addons[v]===h){f=v;break}if(f===-1)throw new Error("Could not dispose an addon that has not been loaded");h.isDisposed=!0,h.dispose.apply(h.instance),this._addons.splice(f,1)}}},8771:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const f=h(3785),v=h(511);l.BufferApiView=class{constructor(m,S){this._buffer=m,this.type=S}init(m){return this._buffer=m,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(m){const S=this._buffer.lines.get(m);if(S)return new f.BufferLineApiView(S)}getNullCell(){return new v.CellData}}},3785:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const f=h(511);l.BufferLineApiView=class{constructor(v){this._line=v}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(v,m){if(!(v<0||v>=this._line.length))return m?(this._line.loadCell(v,m),m):this._line.loadCell(v,new f.CellData)}translateToString(v,m,S){return this._line.translateToString(v,m,S)}}},8285:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const f=h(8771),v=h(8460),m=h(844);class S extends m.Disposable{constructor(T){super(),this._core=T,this._onBufferChange=this.register(new v.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new f.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new f.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}l.BufferNamespaceApi=S},7975:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(h){this._core=h}registerCsiHandler(h,f){return this._core.registerCsiHandler(h,(v=>f(v.toArray())))}addCsiHandler(h,f){return this.registerCsiHandler(h,f)}registerDcsHandler(h,f){return this._core.registerDcsHandler(h,((v,m)=>f(v,m.toArray())))}addDcsHandler(h,f){return this.registerDcsHandler(h,f)}registerEscHandler(h,f){return this._core.registerEscHandler(h,f)}addEscHandler(h,f){return this.registerEscHandler(h,f)}registerOscHandler(h,f){return this._core.registerOscHandler(h,f)}addOscHandler(h,f){return this.registerOscHandler(h,f)}}},7090:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(h){this._core=h}register(h){this._core.unicodeService.register(h)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(h){this._core.unicodeService.activeVersion=h}}},744:function(p,l,h){var f=this&&this.__decorate||function(_,b,g,y){var k,M=arguments.length,A=M<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,g):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,b,g,y);else for(var N=_.length-1;N>=0;N--)(k=_[N])&&(A=(M<3?k(A):M>3?k(b,g,A):k(b,g))||A);return M>3&&A&&Object.defineProperty(b,g,A),A},v=this&&this.__param||function(_,b){return function(g,y){b(g,y,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const m=h(8460),S=h(844),C=h(5295),T=h(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let w=l.BufferService=class extends S.Disposable{get buffer(){return this.buffers.active}constructor(_){super(),this.isUserScrolling=!1,this._onResize=this.register(new m.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new m.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(_.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(_.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new C.BufferSet(_,this))}resize(_,b){this.cols=_,this.rows=b,this.buffers.resize(_,b),this._onResize.fire({cols:_,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(_,b=!1){const g=this.buffer;let y;y=this._cachedBlankLine,y&&y.length===this.cols&&y.getFg(0)===_.fg&&y.getBg(0)===_.bg||(y=g.getBlankLine(_,b),this._cachedBlankLine=y),y.isWrapped=b;const k=g.ybase+g.scrollTop,M=g.ybase+g.scrollBottom;if(g.scrollTop===0){const A=g.lines.isFull;M===g.lines.length-1?A?g.lines.recycle().copyFrom(y):g.lines.push(y.clone()):g.lines.splice(M+1,0,y.clone()),A?this.isUserScrolling&&(g.ydisp=Math.max(g.ydisp-1,0)):(g.ybase++,this.isUserScrolling||g.ydisp++)}else{const A=M-k+1;g.lines.shiftElements(k+1,A-1,-1),g.lines.set(M,y.clone())}this.isUserScrolling||(g.ydisp=g.ybase),this._onScroll.fire(g.ydisp)}scrollLines(_,b,g){const y=this.buffer;if(_<0){if(y.ydisp===0)return;this.isUserScrolling=!0}else _+y.ydisp>=y.ybase&&(this.isUserScrolling=!1);const k=y.ydisp;y.ydisp=Math.max(Math.min(y.ydisp+_,y.ybase),0),k!==y.ydisp&&(b||this._onScroll.fire(y.ydisp))}};l.BufferService=w=f([v(0,T.IOptionsService)],w)},7994:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(h){this.glevel=h,this.charset=this._charsets[h]}setgCharset(h,f){this._charsets[h]=f,this.glevel===h&&(this.charset=f)}}},1753:function(p,l,h){var f=this&&this.__decorate||function(y,k,M,A){var N,R=arguments.length,B=R<3?k:A===null?A=Object.getOwnPropertyDescriptor(k,M):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(y,k,M,A);else for(var q=y.length-1;q>=0;q--)(N=y[q])&&(B=(R<3?N(B):R>3?N(k,M,B):N(k,M))||B);return R>3&&B&&Object.defineProperty(k,M,B),B},v=this&&this.__param||function(y,k){return function(M,A){k(M,A,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const m=h(2585),S=h(8460),C=h(844),T={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:y=>y.button!==4&&y.action===1&&(y.ctrl=!1,y.alt=!1,y.shift=!1,!0)},VT200:{events:19,restrict:y=>y.action!==32},DRAG:{events:23,restrict:y=>y.action!==32||y.button!==3},ANY:{events:31,restrict:y=>!0}};function w(y,k){let M=(y.ctrl?16:0)|(y.shift?4:0)|(y.alt?8:0);return y.button===4?(M|=64,M|=y.action):(M|=3&y.button,4&y.button&&(M|=64),8&y.button&&(M|=128),y.action===32?M|=32:y.action!==0||k||(M|=3)),M}const _=String.fromCharCode,b={DEFAULT:y=>{const k=[w(y,!1)+32,y.col+32,y.row+32];return k[0]>255||k[1]>255||k[2]>255?"":`\x1B[M${_(k[0])}${_(k[1])}${_(k[2])}`},SGR:y=>{const k=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${w(y,!0)};${y.col};${y.row}${k}`},SGR_PIXELS:y=>{const k=y.action===0&&y.button!==4?"m":"M";return`\x1B[<${w(y,!0)};${y.x};${y.y}${k}`}};let g=l.CoreMouseService=class extends C.Disposable{constructor(y,k){super(),this._bufferService=y,this._coreService=k,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new S.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const M of Object.keys(T))this.addProtocol(M,T[M]);for(const M of Object.keys(b))this.addEncoding(M,b[M]);this.reset()}addProtocol(y,k){this._protocols[y]=k}addEncoding(y,k){this._encodings[y]=k}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(y){if(!this._protocols[y])throw new Error(`unknown protocol "${y}"`);this._activeProtocol=y,this._onProtocolChange.fire(this._protocols[y].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(y){if(!this._encodings[y])throw new Error(`unknown encoding "${y}"`);this._activeEncoding=y}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(y){if(y.col<0||y.col>=this._bufferService.cols||y.row<0||y.row>=this._bufferService.rows||y.button===4&&y.action===32||y.button===3&&y.action!==32||y.button!==4&&(y.action===2||y.action===3)||(y.col++,y.row++,y.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,y,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(y))return!1;const k=this._encodings[this._activeEncoding](y);return k&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(k):this._coreService.triggerDataEvent(k,!0)),this._lastEvent=y,!0}explainEvents(y){return{down:!!(1&y),up:!!(2&y),drag:!!(4&y),move:!!(8&y),wheel:!!(16&y)}}_equalEvents(y,k,M){if(M){if(y.x!==k.x||y.y!==k.y)return!1}else if(y.col!==k.col||y.row!==k.row)return!1;return y.button===k.button&&y.action===k.action&&y.ctrl===k.ctrl&&y.alt===k.alt&&y.shift===k.shift}};l.CoreMouseService=g=f([v(0,m.IBufferService),v(1,m.ICoreService)],g)},6975:function(p,l,h){var f=this&&this.__decorate||function(g,y,k,M){var A,N=arguments.length,R=N<3?y:M===null?M=Object.getOwnPropertyDescriptor(y,k):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(g,y,k,M);else for(var B=g.length-1;B>=0;B--)(A=g[B])&&(R=(N<3?A(R):N>3?A(y,k,R):A(y,k))||R);return N>3&&R&&Object.defineProperty(y,k,R),R},v=this&&this.__param||function(g,y){return function(k,M){y(k,M,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const m=h(1439),S=h(8460),C=h(844),T=h(2585),w=Object.freeze({insertMode:!1}),_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=l.CoreService=class extends C.Disposable{constructor(g,y,k){super(),this._bufferService=g,this._logService=y,this._optionsService=k,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new S.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new S.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new S.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new S.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,m.clone)(w),this.decPrivateModes=(0,m.clone)(_)}reset(){this.modes=(0,m.clone)(w),this.decPrivateModes=(0,m.clone)(_)}triggerDataEvent(g,y=!1){if(this._optionsService.rawOptions.disableStdin)return;const k=this._bufferService.buffer;y&&this._optionsService.rawOptions.scrollOnUserInput&&k.ybase!==k.ydisp&&this._onRequestScrollToBottom.fire(),y&&this._onUserInput.fire(),this._logService.debug(`sending data "${g}"`,(()=>g.split("").map((M=>M.charCodeAt(0))))),this._onData.fire(g)}triggerBinaryEvent(g){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${g}"`,(()=>g.split("").map((y=>y.charCodeAt(0))))),this._onBinary.fire(g))}};l.CoreService=b=f([v(0,T.IBufferService),v(1,T.ILogService),v(2,T.IOptionsService)],b)},9074:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const f=h(8055),v=h(8460),m=h(844),S=h(6106);let C=0,T=0;class w extends m.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new S.SortedList((g=>g?.marker.line)),this._onDecorationRegistered=this.register(new v.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new v.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,m.toDisposable)((()=>this.reset())))}registerDecoration(g){if(g.marker.isDisposed)return;const y=new _(g);if(y){const k=y.marker.onDispose((()=>y.dispose()));y.onDispose((()=>{y&&(this._decorations.delete(y)&&this._onDecorationRemoved.fire(y),k.dispose())})),this._decorations.insert(y),this._onDecorationRegistered.fire(y)}return y}reset(){for(const g of this._decorations.values())g.dispose();this._decorations.clear()}*getDecorationsAtCell(g,y,k){let M=0,A=0;for(const N of this._decorations.getKeyIterator(y))M=N.options.x??0,A=M+(N.options.width??1),g>=M&&g<A&&(!k||(N.options.layer??"bottom")===k)&&(yield N)}forEachDecorationAtCell(g,y,k,M){this._decorations.forEachByKey(y,(A=>{C=A.options.x??0,T=C+(A.options.width??1),g>=C&&g<T&&(!k||(A.options.layer??"bottom")===k)&&M(A)}))}}l.DecorationService=w;class _ extends m.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=f.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=f.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(g){super(),this.options=g,this.onRenderEmitter=this.register(new v.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new v.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=g.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const f=h(2585),v=h(8343);class m{constructor(...C){this._entries=new Map;for(const[T,w]of C)this.set(T,w)}set(C,T){const w=this._entries.get(C);return this._entries.set(C,T),w}forEach(C){for(const[T,w]of this._entries.entries())C(T,w)}has(C){return this._entries.has(C)}get(C){return this._entries.get(C)}}l.ServiceCollection=m,l.InstantiationService=class{constructor(){this._services=new m,this._services.set(f.IInstantiationService,this)}setService(S,C){this._services.set(S,C)}getService(S){return this._services.get(S)}createInstance(S,...C){const T=(0,v.getServiceDependencies)(S).sort(((b,g)=>b.index-g.index)),w=[];for(const b of T){const g=this._services.get(b.id);if(!g)throw new Error(`[createInstance] ${S.name} depends on UNKNOWN service ${b.id}.`);w.push(g)}const _=T.length>0?T[0].index:C.length;if(C.length!==_)throw new Error(`[createInstance] First service dependency of ${S.name} at position ${_+1} conflicts with ${C.length} static arguments`);return new S(...C,...w)}}},7866:function(p,l,h){var f=this&&this.__decorate||function(_,b,g,y){var k,M=arguments.length,A=M<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,g):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,b,g,y);else for(var N=_.length-1;N>=0;N--)(k=_[N])&&(A=(M<3?k(A):M>3?k(b,g,A):k(b,g))||A);return M>3&&A&&Object.defineProperty(b,g,A),A},v=this&&this.__param||function(_,b){return function(g,y){b(g,y,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const m=h(844),S=h(2585),C={trace:S.LogLevelEnum.TRACE,debug:S.LogLevelEnum.DEBUG,info:S.LogLevelEnum.INFO,warn:S.LogLevelEnum.WARN,error:S.LogLevelEnum.ERROR,off:S.LogLevelEnum.OFF};let T,w=l.LogService=class extends m.Disposable{get logLevel(){return this._logLevel}constructor(_){super(),this._optionsService=_,this._logLevel=S.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),T=this}_updateLogLevel(){this._logLevel=C[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(_){for(let b=0;b<_.length;b++)typeof _[b]=="function"&&(_[b]=_[b]())}_log(_,b,g){this._evalLazyOptionalParams(g),_.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...g)}trace(_,...b){this._logLevel<=S.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,_,b)}debug(_,...b){this._logLevel<=S.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,_,b)}info(_,...b){this._logLevel<=S.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,_,b)}warn(_,...b){this._logLevel<=S.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,_,b)}error(_,...b){this._logLevel<=S.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,_,b)}};l.LogService=w=f([v(0,S.IOptionsService)],w),l.setTraceLogger=function(_){T=_},l.traceCall=function(_,b,g){if(typeof g.value!="function")throw new Error("not supported");const y=g.value;g.value=function(...k){if(T.logLevel!==S.LogLevelEnum.TRACE)return y.apply(this,k);T.trace(`GlyphRenderer#${y.name}(${k.map((A=>JSON.stringify(A))).join(", ")})`);const M=y.apply(this,k);return T.trace(`GlyphRenderer#${y.name} return`,M),M}}},7302:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const f=h(8460),v=h(844),m=h(6114);l.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:m.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const S=["normal","bold","100","200","300","400","500","600","700","800","900"];class C extends v.Disposable{constructor(w){super(),this._onOptionChange=this.register(new f.EventEmitter),this.onOptionChange=this._onOptionChange.event;const _={...l.DEFAULT_OPTIONS};for(const b in w)if(b in _)try{const g=w[b];_[b]=this._sanitizeAndValidateOption(b,g)}catch(g){console.error(g)}this.rawOptions=_,this.options={..._},this._setupOptions(),this.register((0,v.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(w,_){return this.onOptionChange((b=>{b===w&&_(this.rawOptions[w])}))}onMultipleOptionChange(w,_){return this.onOptionChange((b=>{w.indexOf(b)!==-1&&_()}))}_setupOptions(){const w=b=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},_=(b,g)=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);g=this._sanitizeAndValidateOption(b,g),this.rawOptions[b]!==g&&(this.rawOptions[b]=g,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const g={get:w.bind(this,b),set:_.bind(this,b)};Object.defineProperty(this.options,b,g)}}_sanitizeAndValidateOption(w,_){switch(w){case"cursorStyle":if(_||(_=l.DEFAULT_OPTIONS[w]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(_))throw new Error(`"${_}" is not a valid value for ${w}`);break;case"wordSeparator":_||(_=l.DEFAULT_OPTIONS[w]);break;case"fontWeight":case"fontWeightBold":if(typeof _=="number"&&1<=_&&_<=1e3)break;_=S.includes(_)?_:l.DEFAULT_OPTIONS[w];break;case"cursorWidth":_=Math.floor(_);case"lineHeight":case"tabStopWidth":if(_<1)throw new Error(`${w} cannot be less than 1, value: ${_}`);break;case"minimumContrastRatio":_=Math.max(1,Math.min(21,Math.round(10*_)/10));break;case"scrollback":if((_=Math.min(_,4294967295))<0)throw new Error(`${w} cannot be less than 0, value: ${_}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(_<=0)throw new Error(`${w} cannot be less than or equal to 0, value: ${_}`);break;case"rows":case"cols":if(!_&&_!==0)throw new Error(`${w} must be numeric, value: ${_}`);break;case"windowsPty":_=_??{}}return _}}l.OptionsService=C},2660:function(p,l,h){var f=this&&this.__decorate||function(C,T,w,_){var b,g=arguments.length,y=g<3?T:_===null?_=Object.getOwnPropertyDescriptor(T,w):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(C,T,w,_);else for(var k=C.length-1;k>=0;k--)(b=C[k])&&(y=(g<3?b(y):g>3?b(T,w,y):b(T,w))||y);return g>3&&y&&Object.defineProperty(T,w,y),y},v=this&&this.__param||function(C,T){return function(w,_){T(w,_,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const m=h(2585);let S=l.OscLinkService=class{constructor(C){this._bufferService=C,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(C){const T=this._bufferService.buffer;if(C.id===void 0){const k=T.addMarker(T.ybase+T.y),M={data:C,id:this._nextId++,lines:[k]};return k.onDispose((()=>this._removeMarkerFromLink(M,k))),this._dataByLinkId.set(M.id,M),M.id}const w=C,_=this._getEntryIdKey(w),b=this._entriesWithId.get(_);if(b)return this.addLineToLink(b.id,T.ybase+T.y),b.id;const g=T.addMarker(T.ybase+T.y),y={id:this._nextId++,key:this._getEntryIdKey(w),data:w,lines:[g]};return g.onDispose((()=>this._removeMarkerFromLink(y,g))),this._entriesWithId.set(y.key,y),this._dataByLinkId.set(y.id,y),y.id}addLineToLink(C,T){const w=this._dataByLinkId.get(C);if(w&&w.lines.every((_=>_.line!==T))){const _=this._bufferService.buffer.addMarker(T);w.lines.push(_),_.onDispose((()=>this._removeMarkerFromLink(w,_)))}}getLinkData(C){return this._dataByLinkId.get(C)?.data}_getEntryIdKey(C){return`${C.id};;${C.uri}`}_removeMarkerFromLink(C,T){const w=C.lines.indexOf(T);w!==-1&&(C.lines.splice(w,1),C.lines.length===0&&(C.data.id!==void 0&&this._entriesWithId.delete(C.key),this._dataByLinkId.delete(C.id)))}};l.OscLinkService=S=f([v(0,m.IBufferService)],S)},8343:(p,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const h="di$target",f="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(v){return v[f]||[]},l.createDecorator=function(v){if(l.serviceRegistry.has(v))return l.serviceRegistry.get(v);const m=function(S,C,T){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,_,b){_[h]===_?_[f].push({id:w,index:b}):(_[f]=[{id:w,index:b}],_[h]=_)})(m,S,T)};return m.toString=()=>v,l.serviceRegistry.set(v,m),m}},2585:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const f=h(8343);var v;l.IBufferService=(0,f.createDecorator)("BufferService"),l.ICoreMouseService=(0,f.createDecorator)("CoreMouseService"),l.ICoreService=(0,f.createDecorator)("CoreService"),l.ICharsetService=(0,f.createDecorator)("CharsetService"),l.IInstantiationService=(0,f.createDecorator)("InstantiationService"),(function(m){m[m.TRACE=0]="TRACE",m[m.DEBUG=1]="DEBUG",m[m.INFO=2]="INFO",m[m.WARN=3]="WARN",m[m.ERROR=4]="ERROR",m[m.OFF=5]="OFF"})(v||(l.LogLevelEnum=v={})),l.ILogService=(0,f.createDecorator)("LogService"),l.IOptionsService=(0,f.createDecorator)("OptionsService"),l.IOscLinkService=(0,f.createDecorator)("OscLinkService"),l.IUnicodeService=(0,f.createDecorator)("UnicodeService"),l.IDecorationService=(0,f.createDecorator)("DecorationService")},1480:(p,l,h)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const f=h(8460),v=h(225);class m{static extractShouldJoin(C){return(1&C)!=0}static extractWidth(C){return C>>1&3}static extractCharKind(C){return C>>3}static createPropertyValue(C,T,w=!1){return(16777215&C)<<3|(3&T)<<1|(w?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new f.EventEmitter,this.onChange=this._onChange.event;const C=new v.UnicodeV6;this.register(C),this._active=C.version,this._activeProvider=C}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(C){if(!this._providers[C])throw new Error(`unknown Unicode version "${C}"`);this._active=C,this._activeProvider=this._providers[C],this._onChange.fire(C)}register(C){this._providers[C.version]=C}wcwidth(C){return this._activeProvider.wcwidth(C)}getStringCellWidth(C){let T=0,w=0;const _=C.length;for(let b=0;b<_;++b){let g=C.charCodeAt(b);if(55296<=g&&g<=56319){if(++b>=_)return T+this.wcwidth(g);const M=C.charCodeAt(b);56320<=M&&M<=57343?g=1024*(g-55296)+M-56320+65536:T+=this.wcwidth(M)}const y=this.charProperties(g,w);let k=m.extractWidth(y);m.extractShouldJoin(y)&&(k-=m.extractWidth(w)),T+=k,w=y}return T}charProperties(C,T){return this._activeProvider.charProperties(C,T)}}l.UnicodeService=m}},s={};function o(p){var l=s[p];if(l!==void 0)return l.exports;var h=s[p]={exports:{}};return i[p].call(h.exports,h,h.exports,o),h.exports}var d={};return(()=>{var p=d;Object.defineProperty(p,"__esModule",{value:!0}),p.Terminal=void 0;const l=o(9042),h=o(3236),f=o(844),v=o(5741),m=o(8285),S=o(7975),C=o(7090),T=["cols","rows"];class w extends f.Disposable{constructor(b){super(),this._core=this.register(new h.Terminal(b)),this._addonManager=this.register(new v.AddonManager),this._publicOptions={...this._core.options};const g=k=>this._core.options[k],y=(k,M)=>{this._checkReadonlyOptions(k),this._core.options[k]=M};for(const k in this._core.options){const M={get:g.bind(this,k),set:y.bind(this,k)};Object.defineProperty(this._publicOptions,k,M)}}_checkReadonlyOptions(b){if(T.includes(b))throw new Error(`Option "${b}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new S.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new C.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new m.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let g="none";switch(this._core.coreMouseService.activeProtocol){case"X10":g="x10";break;case"VT200":g="vt200";break;case"DRAG":g="drag";break;case"ANY":g="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:g,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const g in b)this._publicOptions[g]=b[g]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,g=!0){this._core.input(b,g)}resize(b,g){this._verifyIntegers(b,g),this._core.resize(b,g)}open(b){this._core.open(b)}attachCustomKeyEventHandler(b){this._core.attachCustomKeyEventHandler(b)}attachCustomWheelEventHandler(b){this._core.attachCustomWheelEventHandler(b)}registerLinkProvider(b){return this._core.registerLinkProvider(b)}registerCharacterJoiner(b){return this._checkProposedApi(),this._core.registerCharacterJoiner(b)}deregisterCharacterJoiner(b){this._checkProposedApi(),this._core.deregisterCharacterJoiner(b)}registerMarker(b=0){return this._verifyIntegers(b),this._core.registerMarker(b)}registerDecoration(b){return this._checkProposedApi(),this._verifyPositiveIntegers(b.x??0,b.width??0,b.height??0),this._core.registerDecoration(b)}hasSelection(){return this._core.hasSelection()}select(b,g,y){this._verifyIntegers(b,g,y),this._core.select(b,g,y)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,g){this._verifyIntegers(b,g),this._core.selectLines(b,g)}dispose(){super.dispose()}scrollLines(b){this._verifyIntegers(b),this._core.scrollLines(b)}scrollPages(b){this._verifyIntegers(b),this._core.scrollPages(b)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(b){this._verifyIntegers(b),this._core.scrollToLine(b)}clear(){this._core.clear()}write(b,g){this._core.write(b,g)}writeln(b,g){this._core.write(b),this._core.write(`\r
82
+ `,g)}paste(b){this._core.paste(b)}refresh(b,g){this._verifyIntegers(b,g),this._core.refresh(b,g)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return l}_verifyIntegers(...b){for(const g of b)if(g===1/0||isNaN(g)||g%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const g of b)if(g&&(g===1/0||isNaN(g)||g%1!=0||g<0))throw new Error("This API only accepts positive integers")}}p.Terminal=w})(),d})()))})(Qp)),Qp.exports}var I6=j6();function B6(e){let t=!1,i=!1,s=!1,o=!1,d=null,p=null;const l=()=>{d!==null&&(clearTimeout(d),d=null),s=!1},h=()=>{p!==null&&(clearTimeout(p),p=null),i=!1},f=()=>{h(),i=!0,p=setTimeout(()=>{p=null,i=!1},0)},v=()=>{s=!1,d!==null&&clearTimeout(d),p!==null&&(clearTimeout(p),p=null),d=setTimeout(()=>{d=null,i=!1,e()},0)},m=()=>{t=!1,d===null&&(h(),s=!1)},S=()=>{t=!1,o=!1,h(),l()},C=T=>{if(d===null){if(t||i||z6(T)){s=!0,i&&!t?v():t=!0;return}e()}};return{onCompositionStart(){t=!0},onCompositionEnd(){t=!1,f(),s&&v()},onCompositionCancel:m,handleKeyEvent(T){return P6(T)&&T.shiftKey?(T.preventDefault?.(),T.type==="keydown"?(o=!0,C(T)):T.type==="keypress"?(o||C(T),o=!1):T.type==="keyup"&&(o=!1),!1):!0},dispose:S}}function P6(e){return e.key==="Enter"||e.code==="Enter"||e.keyCode===13||e.which===13}function z6(e){return e.isComposing===!0||e.keyCode===229||e.which===229}const H6={allowProposedApi:!0,convertEol:!1,cursorBlink:!0,cursorStyle:"block",lineHeight:1},$6="Symbols Nerd Font Mono",Ju=`ui-monospace, "SF Mono", Menlo, "${$6}", monospace`,f_=14,fC=10,pC=22,U6={min:fC,max:pC},F6="cascadia",vc=[{id:"cascadia",name:"Cascadia Code",familyName:"Cascadia Code Variable",family:`"Cascadia Code Variable", ${Ju}`,meta:"Variable · terminal tuned"},{id:"jetbrains",name:"JetBrains Mono",familyName:"JetBrains Mono Variable",family:`"JetBrains Mono Variable", ${Ju}`,meta:"Variable · console mono"},{id:"fira-code",name:"Fira Code",familyName:"Fira Code Variable",family:`"Fira Code Variable", ${Ju}`,meta:"Variable · ligatures"},{id:"source-code-pro",name:"Source Code Pro",familyName:"Source Code Pro Variable",family:`"Source Code Pro Variable", ${Ju}`,meta:"Variable · Adobe mono"}],bo=vc[0];function W6(e){return vc.find(t=>t.id===e)??bo}function bc(){return{source:"curated",id:F6,customName:"",family:bo.family,size:f_}}function p_(e,t){const i=W6(e);return{source:"curated",id:i.id,customName:"",family:i.family,size:__(t)}}function m_(e,t){const i=K6(e);return{source:"custom",id:null,customName:i,family:Dh(i,bo.family),size:__(t)}}function mC(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,i=__(typeof t.size=="number"?t.size:f_);return t.source==="custom"&&typeof t.customName=="string"?m_(t.customName,i):typeof t.id=="string"&&q6(t.id)?p_(t.id,i):null}function g_(e){if(!e)return bc();try{const t=mC(JSON.parse(e));if(t!==null)return t}catch{}return bc()}function G6(e){return JSON.stringify({source:e.source,id:e.id,customName:e.customName,size:e.size})}function __(e){return Number.isFinite(e)?Math.min(pC,Math.max(fC,Math.round(e))):f_}function q6(e){return vc.some(t=>t.id===e)}function K6(e){return od(e)}const Hh="fleet-plugin.terminal.renderer",yo="fleet-plugin.terminal.font",N1="fleet-console.terminalRenderer",O1="fleet-console.terminalFont",ng=new Set;let Ls=a4(),yc=null,ca=0;function V6(){if(!(typeof window>"u"))try{if(window.localStorage.getItem(Hh)!==null||window.localStorage.getItem(yo)!==null)return;const e=window.localStorage.getItem(N1),t=window.localStorage.getItem(O1),i=e==="webgl"||e==="dom"?e:"webgl",s=g_(t);window.localStorage.setItem(Hh,i),window.localStorage.setItem(yo,G6(s)),window.localStorage.removeItem(N1),window.localStorage.removeItem(O1)}catch{}}function Y6(e){ca+=1,yc=e,e4()}function gC(){return L.useSyncExternalStore(s4,D1,D1)}function X6(e){i4(e),Co({renderer:e})}function Z6(e){const t=p_(e,Ls.font.size);ca+=1,Co({font:t}),pd(t)}function J6(e){const t=m_(e,Ls.font.size);ca+=1,Co({font:t}),pd(t)}function Q6(e){const t=Ls.font.source==="custom"?m_(Ls.font.customName,e):p_(Ls.font.id,e);ca+=1,Co({font:t}),pd(t)}async function e4(){if(!yc)return;const e=ca;try{const t=await yc.read("terminal");if(t!==null){const i=mC(t.font);if(i!==null){if(e!==ca)return;Co({font:i});try{window.localStorage.removeItem(yo)}catch{}return}}if(typeof window<"u"){let i=null;try{i=window.localStorage.getItem(yo)}catch{}if(i!==null){const s=g_(i);if(e!==ca)return;Co({font:s}),pd(s);try{window.localStorage.removeItem(yo)}catch{}}}}catch{}}async function pd(e){if(yc)try{await yc.write("terminal",{font:{source:e.source,id:e.id,customName:e.customName,size:e.size}})}catch{}}function t4(){if(typeof window>"u")return"webgl";try{const e=window.localStorage.getItem(Hh);return e==="webgl"||e==="dom"?e:"webgl"}catch{return"webgl"}}function n4(){if(typeof window>"u")return bc();try{return g_(window.localStorage.getItem(yo))}catch{return bc()}}function i4(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Hh,e)}catch{}}function r4(){for(const e of ng)e()}function Co(e){Ls={...Ls,...e},r4()}function s4(e){return ng.add(e),()=>{ng.delete(e)}}function D1(){return Ls}function a4(){return typeof window>"u"?{renderer:"webgl",font:bc()}:(V6(),{renderer:t4(),font:n4()})}const o4="Symbols Nerd Font Mono",l4=`1em "${o4}"`,c4=650;let Qu=null;function _C(){return Qu||(Qu=h4(),Qu)}async function u4(){await d4(_C(),c4)}async function h4(){const e=typeof document>"u"?void 0:document.fonts;if(e?.load)try{await e.load(l4)}catch{}}async function d4(e,t){await new Promise(i=>{let s=!1;const o=setTimeout(d,t);e.then(d,d);function d(){s||(s=!0,clearTimeout(o),i())}})}const f4=80,p4=16,m4=250,g4=1024*1024,_4=120,v4={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)"},b4={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)"},y4={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 v_({operationId:e,ticketPath:t,wsPath:i,theme:s="instrument",onExit:o,active:d,zoom:p=1}){const l=s,{renderer:h,font:f}=gC(),v=L.useRef(null),m=L.useRef(null),S=L.useRef(null),C=L.useRef(null),T=L.useRef(null),w=L.useRef(null),[_,b]=L.useState(p),g=L.useRef(o);g.current=o;const y=L.useRef(d);y.current=d;const[k,M]=L.useState("connecting"),[A,N]=L.useState(0);L.useEffect(()=>{const q=v.current;if(!q)return;let W=!1,G=null,I=null,K=null;return(async()=>{if(await u4(),W)return;const P=new I6.Terminal({...H6,fontFamily:f.family,fontSize:f.size*_,theme:j1(l)});m.current=P;const Y=new XL.FitAddon;w.current=Y,P.loadAddon(Y),P.open(q),P.loadAddon(new QL.Unicode11Addon),P.unicode.activeVersion="11";const X=B6(()=>P.input(`
83
+ `)),j=q.querySelector("textarea.xterm-helper-textarea, textarea")??q;j.addEventListener("compositionstart",X.onCompositionStart),j.addEventListener("compositionend",X.onCompositionEnd),j.addEventListener("focusout",X.onCompositionCancel),P.attachCustomKeyEventHandler(X.handleKeyEvent);const z=x4(P,y.current!==!1);T.current=z;const D=WL({operationId:e,ticketPath:t,wsPath:i,terminal:{onData:pe=>P.onData(pe),write:z.write},onExit:()=>g.current?.(),onStatus:(pe,te)=>{M(te?`${pe}: ${te}`:pe)}});S.current=D;const U=()=>{Y.fit(),D.resize(P.cols,P.rows)},V=()=>{U(),P.refresh(0,P.rows-1)},J=()=>{I&&clearTimeout(I),I=setTimeout(()=>{I=null,W||V()},f4)},le=async()=>{await document.fonts?.ready,!W&&(V(),D.start(),y.current!==!1&&P.focus())};G=new ResizeObserver(J),G.observe(q),le(),K=()=>{I&&clearTimeout(I),j.removeEventListener("compositionstart",X.onCompositionStart),j.removeEventListener("compositionend",X.onCompositionEnd),j.removeEventListener("focusout",X.onCompositionCancel),X.dispose(),D.dispose(),z.dispose(),m.current=null,S.current=null,T.current=null,w.current=null;try{P.dispose()}catch{}},N(pe=>pe+1)})(),()=>{W=!0,G?.disconnect(),K?.()}},[e,t,i]),L.useEffect(()=>{if(T.current?.setActive(d!==!1),!d)return;S4(m.current);const q=window.requestAnimationFrame(()=>{y.current===!0&&vC(m.current)});return()=>window.cancelAnimationFrame(q)},[d]),L.useEffect(()=>{const q=m.current;if(!q)return;let W=!1;if(h==="webgl")try{const G=new D6;C.current=G,G.onContextLoss(()=>{if(!W){try{G.dispose()}catch{}C.current===G&&(C.current=null)}}),q.loadAddon(G)}catch{try{C.current?.dispose()}catch{}C.current=null}return()=>{W=!0;const G=C.current;if(G){C.current=null;try{G.dispose()}catch{}}}},[h,e,A]),L.useEffect(()=>{const q=m.current;q&&(q.options.theme=j1(l))},[l,A]),L.useEffect(()=>{const q=m.current;q&&(q.options.fontFamily=f.family,I1(q,w.current,S.current))},[f.family,A]),L.useEffect(()=>{if(p===_)return;const q=setTimeout(()=>b(p),_4);return()=>clearTimeout(q)},[p,_]),L.useEffect(()=>{const q=m.current;q&&(q.options.fontSize=f.size*_,I1(q,w.current,S.current))},[_,f.size,A]);const R=k.startsWith("live"),B=_===1?void 0:{width:`${_*100}%`,height:`${_*100}%`,transform:`scale(${1/_})`,transformOrigin:"0 0"};return u.jsx("section",{className:"terminal-stage","aria-label":"Terminal",children:u.jsxs("div",{className:"terminal-shell",children:[R?null:u.jsxs("div",{className:"terminal-status","aria-live":"polite",children:[u.jsx("span",{className:"terminal-status-dot","aria-hidden":"true"}),k]}),u.jsx("div",{className:"terminal-viewport",children:u.jsx("div",{className:"terminal-canvas",ref:v,style:B})})]})})}function j1(e){return e==="carbon"?y4:e==="maritime"?b4:v4}function S4(e){e&&(e.focus(),vC(e))}function vC(e){e&&(e.scrollToBottom(),e.rows>0&&e.refresh(0,e.rows-1))}function x4(e,t){let i=t,s=!1,o=null,d=0,p=[];const l=()=>{o&&(clearTimeout(o),o=null)},h=()=>{if(l(),s||d===0)return;const v=w4(p,d);p=[],d=0,e.write(v)},f=()=>{s||o||d===0||(o=setTimeout(h,i?p4:m4))};return{write:v=>{if(!(s||v.byteLength===0)){if(p.push(v),d+=v.byteLength,d>=g4){h();return}f()}},setActive:v=>{if(i!==v){if(i=v,l(),i){h();return}f()}},dispose:()=>{h(),s=!0,p=[],d=0,l()}}}function w4(e,t){if(e.length===1)return e[0]??new Uint8Array;const i=new Uint8Array(t);let s=0;for(const o of e)i.set(o,s),s+=o.byteLength;return i}function I1(e,t,i){t?.fit(),i?.resize(e.cols,e.rows),e.refresh(0,e.rows-1)}const C4=["canonicalCwd","cwd","providerSession","ticket","token","transcriptPath","prompt","persona","toolAllowlist"];class ur extends Error{status;constructor(t,i){super(i),this.name="AgentApiError",this.status=t}}async function E4(e){const t=await fetch("/plugins/terminal/agent/state",{signal:e});await Kr(t);const i=await t.json();if(!Array.isArray(i.agentClis))throw new ur(t.status,"Invalid agent state response");return i.agentClis.map(s=>D4(s,t.status))}async function k4(e){const t=await fetch("/plugins/terminal/agent/agent-cli/state",{signal:e});await Kr(t);const i=await t.json();if(!Array.isArray(i.clis))throw new ur(t.status,"Invalid Agent CLI state response");return i}async function T4(e){const t=await fetch("/plugins/terminal/agent/tenants",{signal:e});await Kr(t);const i=await t.json();if(!Array.isArray(i.tenants))throw new ur(t.status,"Invalid tenants response");return i.tenants.map(s=>j4(s,t.status))}async function A4(e){const t=await fetch("/plugins/terminal/agent/jobs",{signal:e});await Kr(t);const i=await t.json();if(!Array.isArray(i.tenants))throw new ur(t.status,"Invalid jobs response");return i.tenants}async function R4(e){const t=await fetch("/plugins/terminal/agent/sessions",{signal:e});await Kr(t);const i=await t.json();if(!Array.isArray(i.sessions))throw new ur(t.status,"Invalid agent sessions response");return i.sessions.map(s=>md(s,t.status))}async function L4(e){const t=await fetch("/api/v1/operations",{signal:e});await Kr(t);const i=await t.json();if(!Array.isArray(i.operations))throw new ur(t.status,"Invalid operations response");return{operations:i.operations.map(s=>I4(s,t.status))}}async function M4(e,t,i){const s=await fetch("/plugins/terminal/agent/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,cliId:t}),signal:i});return await Kr(s),md(await s.json(),s.status)}async function N4(e,t){const i=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}/resume`,{method:"POST",signal:t});return await Kr(i),md(await i.json(),i.status)}async function O4(e,t){const i=await fetch(`/plugins/terminal/agent/sessions/${encodeURIComponent(e)}`,{method:"DELETE",signal:t});await Kr(i)}function md(e,t){const i=e;if(!i||typeof i.sessionId!="string"||typeof i.cwdLabel!="string"||typeof i.status!="string"||typeof i.createdAt!="number"||ig(i))throw new ur(t,"Invalid agent session response");return{sessionId:i.sessionId,terminalSessionId:typeof i.terminalSessionId=="string"?i.terminalSessionId:i.sessionId,cwdLabel:i.cwdLabel,label:typeof i.label=="string"?i.label:void 0,cliId:typeof i.cliId=="string"?i.cliId:void 0,cliLabel:typeof i.cliLabel=="string"?i.cliLabel:void 0,status:i.status,turnState:i.turnState==="running"||i.turnState==="ended"?i.turnState:"none",createdAt:i.createdAt,theaterId:typeof i.theaterId=="string"?i.theaterId:void 0,tenantId:typeof i.tenantId=="string"?i.tenantId:void 0,registrationId:typeof i.registrationId=="string"?i.registrationId:void 0,resumeAvailable:i.resumeAvailable===!0}}async function Kr(e){if(!e.ok)throw new ur(e.status,`Agent plugin request failed: ${e.status}`)}function D4(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.label!="string")throw new ur(t,"Invalid Agent CLI metadata response");return{id:i.id,label:i.label,available:i.available===!0,signedIn:i.signedIn!==!1}}function j4(e,t){const i=e;if(!i||typeof i.tenantId!="string"||typeof i.tenantLabel!="string"||typeof i.createdAt!="number"||typeof i.sessions!="number")throw new ur(t,"Invalid tenant response");return i}function I4(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.theaterId!="string"||typeof i.type!="string"||typeof i.pluginId!="string"||typeof i.title!="string"||!i.payload||typeof i.payload!="object"||Array.isArray(i.payload)||!i.ts||typeof i.ts.createdAt!="number"||typeof i.ts.updatedAt!="number"||ig(i)||ig(i.payload))throw new ur(t,"Invalid operation response");return{id:i.id,theaterId:i.theaterId,type:i.type,pluginId:i.pluginId,title:i.title,payload:i.payload,geometry:i.geometry??null,ts:i.ts}}function ig(e){return rg(e,new Set(C4))}function rg(e,t){return!e||typeof e!="object"?!1:Array.isArray(e)?e.some(i=>rg(i,t)):Object.entries(e).some(([i,s])=>t.has(i)||rg(s,t))}const B4="active",sg=new Set(["done","error","aborted"]);function P4(e,t){let i=ag(e,t.jobId,t.updatedAt);for(const s of t.events)i=bC(i,s);return sg.has(t.status)&&!sg.has(i.status)&&(i={...i,status:t.status}),i}function bC(e,t){if(t.id<=e.lastEventId)return e;const i=t.event,s={...e,updatedAt:t.at,lastEventId:t.id,recentEvents:$4(e.recentEvents,t)};switch(t.type){case"job:registered":return z4(s,i);case"job:finalized":return{...s,status:cn(i.status)??"done",finishedAt:Es(i.finishedAt)??t.at,summary:cn(i.summary),error:cn(i.error)};case"track:begin":return eo(s,i,t.id,o=>({...o,startedAt:Es(i.startedAt)??t.at,requestPreview:cn(i.requestPreview)}));case"track:status":return eo(s,i,t.id,o=>({...o,status:cn(i.status)??o.status}));case"track:text":return eo(s,i,t.id,o=>{const d=o.text+(cn(i.text)??"");return{...o,status:"stream",text:d,sentTextLength:o.sentTextLength+(Es(i.textLength)??cn(i.text)?.length??0),latestLine:U4(d)||o.latestLine}});case"track:thought":return eo(s,i,t.id,o=>{const d=o.thought+(cn(i.text)??"");return{...o,thought:d,sentThoughtLength:o.sentThoughtLength+(Es(i.textLength)??cn(i.text)?.length??0)}});case"track:tool":return eo(s,i,t.id,o=>({...o,status:"stream",tools:H4(o.tools,i)}));case"track:finalized":return eo(s,i,t.id,o=>{const d=B1(o.text,o.sentTextLength,cn(i.fallbackText),Es(i.fallbackTextLength)),p=B1(o.thought,o.sentThoughtLength,cn(i.fallbackThought),Es(i.fallbackThoughtLength));return{...o,status:cn(i.status)??"done",finishedAt:Es(i.finishedAt)??t.at,error:cn(i.error),text:d.text,sentTextLength:d.sentLength,thought:p.text,sentThoughtLength:p.sentLength}});default:return s}}function ag(e,t,i){return{jobId:t,tenantId:e,status:B4,updatedAt:i,trackOrder:[],tracks:{},lastEventId:0,recentEvents:[]}}function Eo(e){return sg.has(e)}function z4(e,t){const i=Array.isArray(t.tracks)?t.tracks:[];let s=e.trackOrder,o=e.tracks;for(const d of i){if(!d.trackId)continue;const p=o[d.trackId],l={...p??yC(d.trackId),displayName:d.displayName??p?.displayName??d.trackId,displayCli:d.displayCli??p?.displayCli,model:d.model??p?.model,effort:d.effort??p?.effort,subtitle:d.subtitle??p?.subtitle,kind:d.kind??p?.kind,startedAt:d.startedAt??p?.startedAt};p||(s=[...s,d.trackId]),o={...o,[d.trackId]:l}}return{...e,label:cn(t.label)??e.label,ownerCarrierId:cn(t.ownerCarrierId)??e.ownerCarrierId,kind:cn(t.kind)??e.kind,signatureCli:cn(t.signatureCli)??e.signatureCli,startedAt:Es(t.startedAt)??e.startedAt,trackOrder:s,tracks:o}}function eo(e,t,i,s){const o=cn(t.trackId);if(!o)return e;const d=e.tracks[o],p={...s(d??yC(o)),lastEventId:i};return{...e,trackOrder:d?e.trackOrder:[...e.trackOrder,o],tracks:{...e.tracks,[o]:p}}}function yC(e){return{trackId:e,displayName:e,status:"active",lastEventId:0,text:"",thought:"",sentTextLength:0,sentThoughtLength:0,tools:[]}}function H4(e,t){const i=cn(t.toolId)??cn(t.id);if(!i)return e;const s={id:i,name:cn(t.name),input:t.input,output:t.output,status:cn(t.status)},o=e.findIndex(d=>d.id===i);return o>=0?[...e.slice(0,o),{...e[o],...s},...e.slice(o+1)]:[...e,s]}function B1(e,t,i,s){return i?t>=(s??i.length)?{text:e,sentLength:t}:{text:i,sentLength:s??i.length}:{text:e,sentLength:t}}function $4(e,t){return[...e,t].slice(-120)}function U4(e){const t=e.trim();if(!t)return"";const i=t.split(`
84
+ `);return i[i.length-1]?.trim()??""}function cn(e){return typeof e=="string"?e:void 0}function Es(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}const F4=new Set(["idle_prompt","permission_prompt","auth_success","elicitation_dialog","elicitation_complete","elicitation_response"]);function W4(){let e="";return t=>{e+=t;const i=[];let s=e.indexOf(`
85
+
86
+ `);for(;s>=0;){const o=e.slice(0,s);e=e.slice(s+2);const d=q4(o);d&&i.push(d),s=e.indexOf(`
87
+
88
+ `)}return i}}function G4(e){if(!e.data)return null;let t;try{t=JSON.parse(e.data)}catch{return null}if(e.event==="observer:truncated"){const s=t.tenant?.tenantId;return!s||!t.truncation?null:{kind:"truncation",tenantId:s,tenantLabel:t.tenant?.tenantLabel,truncation:t.truncation}}if(e.event==="session:updated"){const s=z1(t.session);return s?{kind:"session",tenantId:s.tenantId??s.sessionId,session:s}:null}if(e.event==="session:attention"){const s=z1(t.session);return s?{kind:"attention",tenantId:s.tenantId??s.sessionId,session:s,reason:K4(t.reason)}:null}const i=P1(t.event)??P1(t);return i?{kind:"event",tenantId:i.tenantId,tenantLabel:t.tenant?.tenantLabel,event:i}:null}function q4(e){const t=e.split(`
89
+ `),i=t.find(o=>o.startsWith("event:"))?.slice(6).trim()??"message",s=t.filter(o=>o.startsWith("data:")).map(o=>o.slice(5).trim()).join(`
90
+ `);return!s&&i==="message"?null:{event:i,data:s}}function P1(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 z1(e){try{return md(e,200)}catch{return null}}function K4(e){return typeof e=="string"&&F4.has(e)?e:void 0}const b_={droppedCount:0},og=new Set;let Gt={connection:"connecting",connectionError:null,agentClis:[],sessions:{},sessionOrder:[],tenants:[],tenantJobs:{},tenantOrder:[],activeTerminalSessionId:null,turnState:{}};function V4(){return Mx(Y4,SC)}function SC(){return Gt}function Y4(e){return og.add(e),()=>{og.delete(e)}}function Ni(e){Gt={...Gt,...e},nN()}function X4(e){Ni({agentClis:e})}function Z4(e){const t={};for(const i of e)t[i.sessionId]=i;Ni({sessions:t,sessionOrder:[...e].sort((i,s)=>s.createdAt-i.createdAt).map(i=>i.sessionId)})}function $h(e){const t=!!Gt.sessions[e.sessionId];Ni({sessions:{...Gt.sessions,[e.sessionId]:e},sessionOrder:t?Gt.sessionOrder:[e.sessionId,...Gt.sessionOrder],turnState:{...Gt.turnState,[e.sessionId]:e.turnState}})}function xC(e){const{[e]:t,...i}=Gt.sessions,{[e]:s,...o}=Gt.turnState;Ni({sessions:i,sessionOrder:Gt.sessionOrder.filter(d=>d!==e),activeTerminalSessionId:Gt.activeTerminalSessionId===e?null:Gt.activeTerminalSessionId,turnState:o})}function wC(e){Ni({activeTerminalSessionId:e})}function J4(e){Ni({tenants:e,tenantOrder:[...e.map(t=>t.tenantId),...Gt.tenantOrder.filter(t=>!e.some(i=>i.tenantId===t)&&Gt.tenantJobs[t])]})}function Q4(e){const t={};for(const i of e){const s={};for(const o of i.jobs)s[o.jobId]=P4(i.tenantId,o);t[i.tenantId]={tenantId:i.tenantId,tenantLabel:i.tenantLabel,jobOrder:i.jobs.map(o=>o.jobId),jobs:s,truncation:i.truncation??b_}}Ni({tenantJobs:t,tenantOrder:[...e.map(i=>i.tenantId),...Gt.tenantOrder.filter(i=>t[i])]})}function eN(e,t){const i=e.tenantId,s=e.jobId??iN(e),o=Gt.tenantJobs[i]??{tenantId:i,tenantLabel:t,jobOrder:[],jobs:{},truncation:b_},d=s?o.jobs[s]??ag(i,s,e.at):ag(i,"__unknown__",e.at),p=bC(d,e),l=s&&o.jobOrder.includes(s)?o.jobOrder:s?[s,...o.jobOrder]:o.jobOrder,h={...o,tenantLabel:t??o.tenantLabel,jobOrder:l,jobs:s?{...o.jobs,[s]:p}:o.jobs};return Ni({tenantJobs:{...Gt.tenantJobs,[i]:h},tenantOrder:Gt.tenantOrder.includes(i)?Gt.tenantOrder:[i,...Gt.tenantOrder]}),{job:p,unknownTenant:!Gt.tenantJobs[i]}}function tN(e,t,i){const s=Gt.tenantJobs[e]??{tenantId:e,tenantLabel:t,jobOrder:[],jobs:{},truncation:b_};Ni({tenantJobs:{...Gt.tenantJobs,[e]:{...s,tenantLabel:t??s.tenantLabel,truncation:i}}})}function CC(e){const t=e.tenantId;if(!t)return[];const i=Gt.tenantJobs[t];return i?i.jobOrder.map(s=>i.jobs[s]).filter(s=>!!s):[]}function nN(){for(const e of og)e()}function iN(e){const t=e.event;return typeof t.jobId=="string"?t.jobId:null}const H1=250,rN=5e3,lg=new Map;function sN(e){const t=new AbortController;return aN(t.signal,e),()=>t.abort()}async function aN(e,t){let i=H1;for(;!e.aborted;){Ni({connection:"connecting"});try{await uN(e,t);const s=await fetch("/plugins/terminal/agent/events",{signal:e});if(!s.ok||!s.body)throw new Error(`Agent stream failed: ${s.status}`);Ni({connection:"live",connectionError:null}),i=H1,await oN(s.body.getReader(),e,t),e.aborted||Ni({connection:"connecting",connectionError:null})}catch(s){if(e.aborted)return;Ni({connection:"connecting",connectionError:s instanceof Error?s.message:String(s)})}if(e.aborted)return;await dN(i,e),i=Math.min(i*2,rN)}}async function oN(e,t,i){const s=new TextDecoder,o=W4();for(;!t.aborted;){const d=await e.read();if(d.done)return;for(const p of o(s.decode(d.value,{stream:!0}))){const l=G4(p);if(l){if(l.kind==="truncation"&&l.truncation){tN(l.tenantId,l.tenantLabel,l.truncation);continue}if(l.kind==="session"&&l.session){$h(l.session),Uh(i,l.session.sessionId,y_(l.session));continue}if(l.kind==="attention"&&l.session){$h(l.session),l.reason!=="idle_prompt"&&Uh(i,l.session.sessionId,"awaiting");continue}l.event&&(eN(l.event,l.tenantLabel),cN(i,l.event.tenantId))}}}}function y_(e){return e.status==="dormant"?"dormant":e.turnState==="running"||e.turnState==="ended"&&lN(e)?"running":"idle"}function lN(e){return CC(e).some(t=>!Eo(t.status))}function Uh(e,t,i){const s=lg.get(t);e.status.set(t,i),lg.set(t,i),s!==i&&(i==="awaiting"?e.notifications.emit({kind:"agent.attention",operationId:t,message:"Agent is waiting for input"}):i==="idle"&&(s==="running"||s==="awaiting")&&e.notifications.emit({kind:"agent.ended",operationId:t,message:"Agent turn ended"}))}function cN(e,t){const{sessions:i}=SC();for(const s of Object.values(i))s.tenantId===t&&lg.get(s.sessionId)!=="awaiting"&&Uh(e,s.sessionId,y_(s))}async function uN(e,t){const[i,s,o,d,p]=await Promise.all([E4(e),R4(e),T4(e),A4(e),L4(e)]);X4(i),Z4(s),J4(o),Q4(d);for(const l of s)Uh(t,l.sessionId,y_(l));hN(p.operations,t)}function hN(e,t){for(const i of e)i.pluginId==="terminal"&&i.type==="agent.streaming"&&t.operations.remove(i.id).catch(()=>{})}async function dN(e,t){await new Promise(i=>{const s=()=>{clearTimeout(o),t.removeEventListener("abort",s),i()},o=setTimeout(s,e);t.addEventListener("abort",s)})}const fN=new Set(["nimitz","kirov","genesis","ohio","sentinel","vanguard","tempest","chronicle"]);function pN(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;const i=Math.floor(t/60),s=t%60;return`${i}m ${s}s`}function mN(e){return e<=0?"":e<1e3?`~${e} tokens`:`~${(e/1e3).toFixed(1).replace(/\.0$/,"")}k tokens`}function gN(e){return e.trackOrder.reduce((t,i)=>{const s=e.tracks[i];return s?t+Math.round((s.sentTextLength+s.sentThoughtLength)/4):t},0)}function EC(e){if(e)return fN.has(e)?e:void 0}function _N(e){return e==="conn"||e==="stream"||e==="live"||e==="running"||e==="active"}function gd(e){return e==="err"||e==="error"}function Sc(e,t){return!Eo(e)&&_N(t)}function S_(e,t){return gd(e)?"error":e==="done"||e==="aborted"?e:Eo(t)?t:e}function vN(e,t){const i=new Set(e),s=t.filter(o=>i.has(o)?!1:(i.add(o),!0));return s.length===0?e:[...e,...s]}function bN(e,t,i){const s=new Map(e.map(d=>[d.jobId,d]));let o=!1;for(const d of t)s.get(d)?.expiresAt!==i&&(s.set(d,{jobId:d,expiresAt:i}),o=!0);return o?[...s.values()]:e}function yN(e,t,i){const s=new Set(t.map(d=>d.jobId)),o=e.filter(d=>d.expiresAt>i&&s.has(d.jobId));return o.length===e.length?e:o}function kC(e,t){const i=new Map(e.map(s=>[s.jobId,s]));return t.flatMap(s=>{const o=i.get(s);return o?[o]:[]})}function SN(e){const t=e.flatMap(o=>o.trackOrder.map(d=>({job:o,track:o.tracks[d]}))).filter(o=>!!o.track).sort((o,d)=>d.track.lastEventId-o.track.lastEventId),i=t.filter(({job:o,track:d})=>Sc(o.status,d.status)),s=i.length>0?i:t;for(const{job:o,track:d}of s){if(d.latestLine)return{text:d.latestLine,thinking:!1};if(Sc(o.status,d.status)&&d.thought)return{text:"",thinking:!0}}return{text:"",thinking:!1}}function xN(e,t,i){const s=new Set(e.map(d=>d.jobId)),o=kC(t,i.map(d=>d.jobId)).filter(d=>!s.has(d.jobId));return o.length===0?e:[...e,...o]}class TC extends Error{status;constructor(t,i){super(i),this.name="TerminalSettingsApiError",this.status=t}}async function wN(e){const t=await fetch("/plugins/terminal/settings",{signal:e});return await AC(t),RC(await t.json(),t.status)}async function CN(e,t){const i=await fetch("/plugins/terminal/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});return await AC(i),RC(await i.json(),i.status)}async function AC(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new TC(e.status,t)}function RC(e,t){const i=e;if(!i||typeof i.enableMetaphor!="boolean"||i.codexLaunchMode!=="acp"&&i.codexLaunchMode!=="app-server")throw new TC(t,"Invalid Terminal settings response");return{enableMetaphor:i.enableMetaphor,codexLaunchMode:i.codexLaunchMode}}const cg=new Set;let Fh={loading:!1,state:null,savingField:null,error:null},wh=0;function LC(){return L.useSyncExternalStore(EN,$1,$1)}function $1(){return Fh}function EN(e){return cg.add(e),()=>{cg.delete(e)}}async function kN(e){const t=++wh;So({loading:!0,error:null});try{const i=await wN(e);if(t!==wh)return;So({loading:!1,state:i,error:null})}catch(i){if(e?.aborted||t!==wh)return;So({loading:!1,error:NC(i)})}}async function MC(e,t){const i=Fh.state;if(!i)return!1;wh+=1;const s={...i,[e]:t},o=e==="enableMetaphor"?{enableMetaphor:s.enableMetaphor}:{codexLaunchMode:s.codexLaunchMode};So({state:s,savingField:e,error:null});try{const d=await CN(o);return So({state:d,savingField:null,error:null}),!0}catch(d){return So({state:i,savingField:null,error:NC(d)}),!1}}function So(e){Fh={...Fh,...e};for(const t of cg)t()}function NC(e){return e instanceof Error?e.message:String(e)}const TN=[{id:"webgl",label:"WebGL"},{id:"dom",label:"DOM"}],AN="/plugins/terminal/agent/ticket",RN="/plugins/terminal/ws",em="fleet-plugin.terminal.stream-dock-expanded",LN="fleet-plugin.terminal.stream-dock-collapsed",MN=56,NN=4e3,ON={...U6,step:1,defaultValue:14},DN="The quick brown fox jumps over 0123456789 — terminal output stays crisp.",OC={pluginId:"terminal",type:"agent",title:"Agent",subtitle:e=>Zl(e.payload,"cliLabel")??void 0,render:e=>u.jsx(zN,{context:e})},DC={id:"agent-cli",title:"Agent CLI",render:()=>u.jsx(UN,{})},jC={id:"agent.attention",title:"Agent input waiting"},jN={id:"agent.ended",title:"Agent turn ended"},eh={id:"terminal",operationKinds:[OC],settingsSections:[DC],notificationKinds:[jC,jN],install:e=>IN(e),closeOperation:async e=>{try{await O4(e)}finally{xC(e)}},launch:async({theaterId:e,kind:t})=>{const i=await M4(e,t.id);return $h(i),wC(i.sessionId),{id:i.sessionId}},renderLaunchIcon:e=>e.id==="claude"?u.jsx(iO,{}):e.id==="codex"?u.jsx(sO,{}):e.id==="cursor"?u.jsx(rO,{}):u.jsx(nO,{})};function IN(e){return sN({operations:e.operations,notifications:e.notifications,status:e.status,refreshOperations:e.api.resync})}function IC(e,t){const i=L.useRef(null),s=L.useRef(!0),[o,d]=L.useState(!0),p=L.useCallback(h=>{s.current!==h&&(s.current=h,d(h))},[]);L.useEffect(()=>{const h=i.current;if(!h)return;const f=()=>{const v=h.scrollHeight-h.scrollTop-h.clientHeight;p(v<=MN)};return h.addEventListener("scroll",f,{passive:!0}),()=>h.removeEventListener("scroll",f)},[e,p]),L.useLayoutEffect(()=>{p(!0);const h=i.current;h&&(h.scrollTop=h.scrollHeight)},[e,p]),L.useLayoutEffect(()=>{const h=i.current;!h||!s.current||(h.scrollTop=h.scrollHeight)},[t]);const l=L.useCallback(()=>{const h=i.current;h&&(h.scrollTop=h.scrollHeight,h.focus({preventScroll:!0}),p(!0))},[p]);return{containerRef:i,pinned:o,jumpToLatest:l}}function BN(){const[e,t]=L.useState(()=>{try{return localStorage.removeItem(LN),localStorage.getItem(em)==="true"}catch{return!1}}),i=L.useCallback(s=>{try{s?localStorage.setItem(em,"true"):localStorage.removeItem(em)}catch{}t(s)},[]);return[e,i]}function PN(e,t){const[i,s]=L.useState(Date.now);return L.useEffect(()=>{if(e===void 0||t!==void 0)return;const o=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(o)},[e,t]),e===void 0?"":pN((t??i)-e)}function zN({context:e}){const i=V4().sessions[e.operationId]??YN(e),[s,o]=L.useState(!1),[d,p]=L.useState([]),[l,h]=L.useState([]),f=L.useRef(null),v=L.useRef(null),m=L.useRef(null),S=L.useRef(new Set),C=CC(i),T=C.filter(A=>!Eo(A.status)),w=xN(T,C,l),_=kC(C,d),b=String(s),g=_.map(A=>`${A.jobId}:${A.lastEventId}`).join(","),y=IC(b,g);L.useLayoutEffect(()=>{const A=S.current,N=C.filter(R=>A.has(R.jobId)&&Eo(R.status)).map(R=>R.jobId);S.current=new Set(T.map(R=>R.jobId)),N.length!==0&&h(R=>bN(R,N,Date.now()+NN))},[T,C]),L.useEffect(()=>{if(l.length===0)return;const A=Math.min(...l.map(R=>R.expiresAt)),N=window.setTimeout(()=>{h(R=>yN(R,C,Date.now()))},Math.max(0,A-Date.now()));return()=>window.clearTimeout(N)},[C,l]),L.useEffect(()=>{s&&p(A=>vN(A,T.map(N=>N.jobId)))},[T,s]);const k=L.useCallback(()=>{o(!1),p([]),m.current?.focus()},[]),M=L.useCallback(()=>{p(w.map(A=>A.jobId)),o(!0)},[w]);return L.useLayoutEffect(()=>{s&&f.current?.focus()},[s]),L.useEffect(()=>{if(!s)return;const A=N=>{if(N.key==="Escape"){N.stopPropagation(),k();return}if(N.key==="Tab"){const R=v.current;if(!R)return;const B=Array.from(R.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(G=>!G.hasAttribute("disabled")),q=B[0],W=B[B.length-1];N.shiftKey&&document.activeElement===q?(N.preventDefault(),W?.focus()):!N.shiftKey&&document.activeElement===W&&(N.preventDefault(),q?.focus())}};return document.addEventListener("keydown",A,!0),()=>document.removeEventListener("keydown",A,!0)},[s,k]),i.status==="dormant"?u.jsxs("button",{type:"button",className:"canvas-operation-dormant",onClick:()=>{VN(i.sessionId)},children:[u.jsx("span",{className:"canvas-operation-dormant-status",children:"Dormant"}),u.jsx("span",{className:"canvas-operation-dormant-action",children:"Resume"})]}):u.jsxs("div",{className:"agent-stream-host",children:[u.jsx(v_,{operationId:i.sessionId,ticketPath:AN,wsPath:RN,active:e.active,zoom:e.zoom,theme:e.theme,onExit:()=>xC(i.sessionId)}),w.length>0?u.jsx(HN,{activeJobs:w,onOpenDetail:M,detailBtnRef:m}):null,s?u.jsxs("div",{ref:v,className:"job-overlay",role:"dialog","aria-modal":"true","aria-label":"Carrier stream details",children:[u.jsx("button",{type:"button",className:"job-overlay-scrim","aria-label":"Close",tabIndex:-1,onClick:k}),u.jsxs("div",{className:"job-overlay-card",children:[u.jsx("button",{ref:f,type:"button",className:"job-overlay-close","aria-label":"Close",onClick:k,children:"×"}),u.jsx("div",{ref:y.containerRef,className:"job-overlay-body",tabIndex:-1,children:_.length===0?u.jsx("p",{className:"job-overlay-empty",children:"No active streams."}):_.map(A=>u.jsx(qN,{job:A},A.jobId))}),y.pinned?null:u.jsx("button",{type:"button",className:"follow-button",onClick:y.jumpToLatest,children:"↓ Follow"})]})]}):null]})}function HN({activeJobs:e,onOpenDetail:t,detailBtnRef:i}){const[s,o]=BN(),d=e[0],p=PN(d?.startedAt,d?.finishedAt),l=e.reduce((A,N)=>A+gN(N),0),h=mN(l),f=e.length===1&&d?EC(d.ownerCarrierId):void 0,v=e.length===1&&d?d.label:void 0,m=e.length>1?`${e.length} carriers`:d?.ownerCarrierId??"Carrier",S=SN(e),C=e.map(A=>`${A.jobId}:${A.lastEventId}`).join(","),T=`${s}:${e.map(A=>A.jobId).join(",")}`,{containerRef:w,pinned:_,jumpToLatest:b}=IC(T,C),g=e.some(A=>A.trackOrder.some(N=>{const R=A.tracks[N];return R?Sc(A.status,R.status):!1})),y=e.some(A=>!Eo(A.status)),k=e.some(A=>A.status==="error"||A.trackOrder.some(N=>gd(A.tracks[N]?.status??""))),M=y?"job-dock-dot":k?"job-dock-dot job-dock-dot--error":"job-dock-dot job-dock-dot--idle";return u.jsxs("div",{className:"job-dock",children:[u.jsxs("div",{className:"job-dock-strip",children:[u.jsx("span",{className:M,"aria-hidden":"true"}),u.jsxs("span",{className:"job-dock-carrier",title:v,children:[f?u.jsx("span",{className:"job-dock-captain-dot","data-captain":f,"aria-hidden":"true"}):null,u.jsx("span",{className:"job-dock-captain-tag",children:m})]}),u.jsxs("span",{className:"job-dock-strip-line",style:s?{display:"none"}:void 0,"aria-hidden":"true",children:[S.thinking?u.jsx("span",{className:"thinking-chip",children:"thinking…"}):S.text,!s&&g&&S.text?u.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}),u.jsxs("span",{className:"job-dock-meta",children:[p?u.jsx("span",{children:p}):null,h?u.jsx("span",{children:h}):null]}),u.jsx("button",{type:"button",className:"job-dock-grip","aria-label":s?"Collapse stream dock":"Expand stream dock","aria-expanded":s,onClick:()=>o(!s),children:s?"▼":"▲"}),u.jsx("button",{ref:i,type:"button",className:"job-dock-detail-btn",onClick:t,children:"Details"})]}),u.jsxs("div",{className:`job-dock-body-wrap${s?"":" is-collapsed"}`,children:[u.jsxs("div",{ref:w,className:"job-dock-body",tabIndex:-1,children:[e.length===1&&v?u.jsx("div",{className:"job-dock-row",children:u.jsx("span",{className:"job-dock-row-label",children:v})}):null,e.map(A=>{const N=e.length>1,R=!N&&A.trackOrder.length===1;return A.trackOrder.map(B=>{const q=A.tracks[B];return q?u.jsx($N,{track:q,job:A,multiJob:N,singleTrack:R},`${A.jobId}:${B}`):null})})]}),_?null:u.jsx("button",{type:"button",className:"follow-button",onClick:b,children:"↓ Follow"})]})]})}function $N({track:e,job:t,multiJob:i,singleTrack:s}){const o=Sc(t.status,e.status),p=ZN(e.text),l=!p&&o&&!!e.thought,h=o?XN(e):void 0,f=S_(e.status,t.status),v=i||!s,m=i?EC(t.ownerCarrierId):void 0;return u.jsxs("div",{className:"job-dock-row",children:[v?u.jsxs("span",{className:"job-dock-row-name",children:[m?u.jsx("span",{className:"job-dock-captain-dot","data-captain":m,"aria-hidden":"true"}):null,u.jsx("span",{className:"job-dock-captain-tag",children:e.displayName})]}):null,u.jsxs("span",{className:`job-dock-row-status${o?" job-dock-row-status--live":""}${gd(f)?" job-dock-row-status--error":""}`,children:[f,h?` · ${h}`:""]}),p?u.jsxs("span",{className:"job-dock-row-line",children:[p,o?u.jsx("span",{className:"job-dock-caret","aria-hidden":"true"}):null]}):null,l?u.jsx("span",{className:"thinking-chip",children:"thinking…"}):null]})}function UN(){const[e,t]=L.useState([]),[i,s]=L.useState(null),{renderer:o,font:d}=gC(),p=LC();return L.useEffect(()=>{const l=new AbortController;return k4(l.signal).then(h=>t(h.clis)).catch(h=>{l.signal.aborted||s(h instanceof Error?h.message:String(h))}),()=>l.abort()},[]),u.jsxs(u.Fragment,{children:[u.jsx(FN,{}),u.jsxs("section",{className:"global-settings-card","aria-label":"Agent CLI Available",children:[u.jsx("div",{className:"agent-cli-head",children:u.jsx("p",{className:"global-settings-resp-title",children:"Agent CLI Available"})}),u.jsx("p",{className:"global-settings-help",children:"Whether each Agent CLI is installed and discoverable on this machine's PATH, with its detected version. Carriers can only run on an Agent CLI shown as available here."}),i?u.jsx("p",{className:"settings-error",children:i}):null,u.jsx("div",{className:"agent-cli-list",children:e.map(l=>u.jsx(GN,{cli:l,codexLaunchMode:p.state?.codexLaunchMode,disabled:p.savingField!==null,onCodexLaunchModeChange:h=>{MC("codexLaunchMode",h)}},l.id))}),p.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:p.error}):null,u.jsx("p",{className:"global-settings-help",children:"Codex launch mode controls the unified-agent carrier protocol for new Codex sessions; it does not affect the interactive Codex TUI in terminal panels."}),u.jsx("p",{className:"global-settings-foot",children:"Install or update a CLI, then reopen this page to re-check availability."})]}),u.jsx(JN,{terminalFont:d}),u.jsx(QN,{terminalRenderer:o})]})}function FN(){const e=LC(),t=e.state,i=e.savingField!==null;return L.useEffect(()=>{const s=new AbortController;return kN(s.signal),()=>s.abort()},[]),u.jsxs("section",{className:"global-settings-card","aria-label":"System Prompt",children:[e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,t?u.jsx(u.Fragment,{children:u.jsx(WN,{title:"Metaphor",help:"Adds concise Fleet wording to every session. Off uses the standard prompt.",onLabel:"Enabled",offLabel:"Off",value:t.enableMetaphor,disabled:i,onToggle:()=>{MC("enableMetaphor",!t.enableMetaphor)}})}):u.jsx("p",{className:"global-settings-help",children:e.loading?"Loading settings.":"Settings unavailable."}),u.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function WN({title:e,help:t,onLabel:i,offLabel:s,value:o,disabled:d,onToggle:p}){return u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:e}),u.jsx("p",{className:"global-settings-help",children:t})]}),u.jsx("button",{type:"button",className:`global-settings-toggle ${o?"is-on":""}`,disabled:d,"aria-pressed":o,onClick:p,children:u.jsx("span",{children:o?i:s})})]})}function GN({cli:e,codexLaunchMode:t,disabled:i,onCodexLaunchModeChange:s}){return u.jsxs("div",{className:"agent-cli-row",children:[u.jsx("span",{className:"agent-cli-name",children:e.displayName}),u.jsxs("span",{className:"agent-cli-meta",children:[e.id==="codex"&&t?u.jsxs("span",{className:"segmented",role:"group","aria-label":"Codex launch mode",children:[u.jsx("button",{type:"button","aria-pressed":t==="acp",className:`segmented-option ${t==="acp"?"is-active":""}`,disabled:i,onClick:()=>s("acp"),children:"ACP"}),u.jsx("button",{type:"button","aria-pressed":t==="app-server",className:`segmented-option ${t==="app-server"?"is-active":""}`,disabled:i,onClick:()=>s("app-server"),children:"App Server"})]}):null,e.available&&e.version?u.jsx("span",{className:"agent-cli-version",children:e.version}):null,u.jsx("span",{className:`agent-cli-status ${e.available?"is-on":""}`,children:e.available?"Available":"Missing"})]})]})}function qN({job:e}){return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"job-overlay-head",children:[u.jsx("span",{className:"job-overlay-kicker",children:e.status}),u.jsx("strong",{children:e.label??e.jobId})]}),u.jsx("div",{className:"job-overlay-tracks",children:e.trackOrder.map(t=>{const i=e.tracks[t];return i?u.jsx(KN,{track:i,jobStatus:e.status},i.trackId):null})})]})}function KN({track:e,jobStatus:t}){const i=tO(e.status,t),s=i==="track-card--live",o=S_(e.status,t);return u.jsxs("article",{className:i?`track-card ${i}`:"track-card",children:[u.jsxs("header",{className:"track-card-head",children:[u.jsx("span",{className:"track-card-title",children:e.displayName}),u.jsx("span",{className:"track-card-status",children:o})]}),e.thought?u.jsxs("details",{className:"track-card-thinking",children:[u.jsxs("summary",{children:["thinking · ",e.thought.length," chars"]}),u.jsx("div",{className:"track-card-thought",role:"group","aria-label":"Thinking",children:u.jsx("pre",{children:e.thought})})]}):null,e.text?u.jsxs("div",{className:"track-card-text",role:"group","aria-label":"Output",children:[u.jsx("span",{className:"track-card-section-label track-card-section-label--output","aria-hidden":"true",children:"output"}),u.jsxs("pre",{children:[e.text,s?u.jsx("span",{className:"track-card-caret","aria-hidden":"true"}):null]})]}):null,e.error?u.jsx("div",{className:"track-card-error",role:"group","aria-label":"Error",children:e.error}):null,e.tools.length>0?u.jsx("ul",{className:"track-card-tools",children:e.tools.map(d=>u.jsx("li",{children:d.name??d.id},d.id))}):null]})}async function VN(e){$h(await N4(e)),wC(e)}function YN(e){return{sessionId:e.operation.id,terminalSessionId:e.operation.id,cwdLabel:e.operation.title||"Workspace",label:e.operation.title,cliId:Zl(e.operation.payload,"cliId")??void 0,cliLabel:Zl(e.operation.payload,"cliLabel")??void 0,status:"dormant",turnState:"none",createdAt:e.operation.ts.createdAt,theaterId:e.theaterId,tenantId:Zl(e.operation.payload,"tenantId")??void 0,registrationId:Zl(e.operation.payload,"registrationId")??void 0,resumeAvailable:!0}}function Zl(e,t){const i=e[t];return typeof i=="string"?i:null}function XN(e){const t=e.tools.find(i=>i.status!=="completed"&&i.status!=="failed"&&i.status!=="error");return t?t.name??t.id:void 0}function ZN(e){const t=e.trim();if(!t)return"";const i=t.split(`
91
+ `);return i[i.length-1]?.trim()??""}function JN({terminalFont:e}){const[t,i]=L.useState([]),[s,o]=L.useState(!0),[d,p]=L.useState(null),l=e.source==="curated"||!e.customName?{source:"builtin",id:e.source==="curated"?e.id??bo.id:bo.id}:{source:"system",familyName:e.customName};L.useEffect(()=>{const f=new AbortController;return o(!0),p(null),Pw({signal:f.signal}).then(v=>{f.signal.aborted||i(v.fonts.filter(m=>m.monospace).map(m=>({family:m.family,monospace:m.monospace})))}).catch(v=>{f.signal.aborted||eO(v)||(i([]),p("Installed system fonts are unavailable. Built-in fonts remain available."))}).finally(()=>{f.signal.aborted||o(!1)}),()=>f.abort()},[]);const h=f=>{if(f.source==="system"){J6(f.familyName);return}const v=vc.find(m=>m.id===f.id);v&&Z6(v.id)};return u.jsxs("section",{className:"global-settings-card","aria-label":"Terminal Font",children:[u.jsx("div",{className:"global-settings-row",children:u.jsxs("div",{className:"global-settings-row-text",children:[u.jsxs("p",{className:"global-settings-resp-title",children:["Terminal Font ",u.jsx("span",{className:"new-badge",children:"New"})]}),u.jsx("p",{className:"global-settings-help",id:"terminal-font-help",children:"Typeface and size for every terminal panel — agent-cli and shell alike. Applies live to all open terminals and persists on the Console server across browsers and restarts."})]})}),u.jsx("div",{"aria-describedby":"terminal-font-help",children:u.jsx(Iw,{builtIns:vc.map(f=>({id:f.id,label:f.name,family:f.family,aliases:[f.familyName],description:f.meta})),installedFonts:t,selected:l,selectedSystemFont:e.source==="custom"?e.customName:null,fallbackStack:bo.family,previewText:DN,size:e.size,sizeRange:ON,loading:s,error:d,onSelectionChange:h,onSizeCommit:Q6})}),u.jsx("p",{className:"global-settings-foot",children:"Font preferences apply immediately and are stored on the Console server, separate from session settings and shared across browsers after restart."})]})}function QN({terminalRenderer:e}){return u.jsx("section",{className:"global-settings-card","aria-label":"Terminal Renderer",children:u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Terminal Renderer"}),u.jsx("p",{className:"global-settings-help",children:"WebGL paints the terminal on the GPU for sharper, faster output; DOM is a compatibility fallback. Switching applies to the live terminal instantly without dropping the session."})]}),u.jsx("div",{className:"segmented",role:"group","aria-label":"Terminal renderer",children:TN.map(t=>{const i=t.id===e;return u.jsx("button",{type:"button","aria-pressed":i,className:`segmented-option ${i?"is-active":""}`,onClick:()=>X6(t.id),children:t.label},t.id)})})]})})}function eO(e){return e instanceof DOMException&&e.name==="AbortError"}function tO(e,t){if(Sc(t,e))return"track-card--live";const i=S_(e,t);return gd(i)?"track-card--bad":i==="done"||i==="aborted"?"track-card--idle":""}function nO(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M8 2.6 12.6 5.2v5.6L8 13.4 3.4 10.8V5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinejoin:"round"}),u.jsx("path",{d:"M6.2 7.9h3.6M8 6.1v3.6",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round"})]})}function iO(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",fill:"currentColor"})})}function rO(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23",fill:"currentColor"})})}function sO(){return u.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:u.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",fill:"currentColor"})})}const aO="global-shell",oO="/plugins/terminal/global/ticket",lO="/plugins/terminal/ws",cO=168,uO={height:"100%",minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},hO={id:"global-shell",title:"Shell",icon:dO,preferredExtraWidth:cO,render:e=>u.jsx("div",{style:uO,children:u.jsx(v_,{operationId:aO,ticketPath:oO,wsPath:lO,theme:"instrument",active:!0})})};function dO(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"2.5",y:"4",width:"13",height:"10",rx:"1.6",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M5.3 7 7.4 9 5.3 11M9 11h3.7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}const fO="/plugins/terminal/shell/ticket",pO="/plugins/terminal/ws",BC={pluginId:"terminal",type:"shell",title:"Shell",subtitle:()=>"shell",render:e=>L.createElement(mO,{context:e})},tm={id:"terminal",operationKinds:[BC],install:()=>{},closeOperation:async e=>{await fetch(`/plugins/terminal/shell/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})},launch:async({theaterId:e,operations:t})=>({id:(await t.create({theaterId:e,type:"shell",pluginId:"terminal",title:"Shell",payload:{theaterId:e}})).id}),renderLaunchIcon:()=>u.jsx(gO,{})};function mO({context:e}){return u.jsx(v_,{operationId:e.operationId,active:e.active,zoom:e.zoom,ticketPath:fO,wsPath:pO,theme:e.theme,onExit:e.onClose})}function gO(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"2.8",y:"3.4",width:"10.4",height:"9.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.15"}),u.jsx("path",{d:"M5 6.6 6.8 8.4 5 10.2M8.4 10.2h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.15",strokeLinecap:"round",strokeLinejoin:"round"})]})}const _O=new Set(["agent"]),vO={id:"terminal",operationKinds:[BC,OC],settingsSections:[DC],notificationKinds:[jC],railPanels:[hO],install:e=>(_C(),Y6(e.settings),eh.install?.(e)),closeOperation:async e=>{const t=await yO(e);if(t?.type==="shell"){await tm.closeOperation?.(e);return}t&&_O.has(t.type)&&await eh.closeOperation?.(e)},launch:async e=>e.kind.type==="shell"?tm.launch?.(e)??{id:""}:eh.launch?.(e)??{id:""},renderLaunchIcon:e=>e.type==="shell"?tm.renderLaunchIcon?.(e):eh.renderLaunchIcon?.(e)},bO=[vO];async function yO(e){const t=await fetch(`/api/v1/operations/${encodeURIComponent(e)}`);if(!t.ok)return null;const i=await t.json();return typeof i.operation?.type=="string"?{type:i.operation.type}:null}const se={ts:"ts",js:"js",json:"json",css:"css",html:"html",md:"md",py:"py",go:"go",rust:"rust",shell:"shell",config:"config",image:"image",data:"data",archive:"archive",binary:"binary",ruby:"ruby",folder:"folder",default:"default"},SO={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},U1={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}},xO={dockerfile:{shape:"chip",tone:se.css},"docker-compose.yml":{shape:"gear",tone:se.css},"docker-compose.yaml":{shape:"gear",tone:se.css},makefile:{shape:"gear",tone:se.html},"cmakelists.txt":{shape:"gear",tone:se.html},".gitignore":{shape:"gear",tone:se.html},".gitattributes":{shape:"gear",tone:se.html},".dockerignore":{shape:"gear",tone:se.html},".npmignore":{shape:"gear",tone:se.html},".npmrc":{shape:"gear",tone:se.ruby},"package.json":{shape:"braces",tone:se.shell},"tsconfig.json":{shape:"braces",tone:se.ts},license:{shape:"doc",tone:se.json},"license.md":{shape:"doc",tone:se.json},licence:{shape:"doc",tone:se.json}},wO={shape:"default",tone:se.default},ug={angle:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5.6 4.5 2.4 8l3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.4 4.5 13.6 8l-3.2 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M9.1 3.4 6.9 12.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",opacity:"0.55"})]}),braces:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M6.4 3.4c-1.1 0-1.5.5-1.5 1.5v1.2c0 .9-.4 1.4-1.1 1.6v.6c.7.2 1.1.7 1.1 1.6v1.2c0 1 .4 1.5 1.5 1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M9.6 3.4c1.1 0 1.5.5 1.5 1.5v1.2c0 .9.4 1.4 1.1 1.6v.6c-.7.2-1.1.7-1.1 1.6v1.2c0 1-.4 1.5-1.5 1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("circle",{cx:"8",cy:"8",r:"0.85",fill:"currentColor",opacity:"0.6"})]}),hash:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M6.6 3 5.2 13M10.8 3 9.4 13",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"}),u.jsx("path",{d:"M3.6 6.4h9M3.4 9.6h9",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})]}),doc:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"currentColor",opacity:"0.16"}),u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M5.7 8.6h4.6M5.7 10.5h4.6M5.7 12.1h3",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.7"})]}),image:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"2.5",y:"3.6",width:"11",height:"8.8",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("circle",{cx:"5.9",cy:"6.6",r:"1.1",fill:"currentColor"}),u.jsx("path",{d:"M3 11.4 6.6 7.9l2 2 1.9-1.7 2.5 2.3",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),terminal:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"2.3",y:"3.3",width:"11.4",height:"9.4",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("path",{d:"M5 6.4 7.3 8 5 9.6",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M8.4 9.8h3",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),gear:u.jsxs(u.Fragment,{children:[u.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("circle",{cx:"8",cy:"8",r:"2",fill:"currentColor",opacity:"0.18"}),u.jsx("path",{d:"M8 2.4v2.1M8 11.5v2.1M13.6 8h-2.1M4.5 8H2.4M11.96 4.04l-1.49 1.49M5.53 10.47l-1.49 1.49M11.96 11.96l-1.49-1.49M5.53 5.53 4.04 4.04",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]}),markup:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M5.6 4.2 2.4 8l3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M10.4 4.2 13.6 8l-3.2 3.8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.15",fill:"currentColor"})]}),database:u.jsxs(u.Fragment,{children:[u.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"currentColor",opacity:"0.18"}),u.jsx("path",{d:"M3.6 4.6v6.8c0 1 2 1.8 4.4 1.8s4.4-.8 4.4-1.8V4.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("ellipse",{cx:"8",cy:"4.6",rx:"4.4",ry:"1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("path",{d:"M3.6 8c0 1 2 1.8 4.4 1.8s4.4-.8 4.4-1.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",opacity:"0.65"})]}),archive:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"currentColor",opacity:"0.16"}),u.jsx("path",{d:"M3 5.2 8 3.1l5 2.1v5.6L8 12.9 3 10.8V5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M3 5.2 8 7.3l5-2.1M8 7.3v5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M5.5 4.15 10.5 6.25",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",opacity:"0.6"})]}),chip:u.jsxs(u.Fragment,{children:[u.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"currentColor",opacity:"0.16"}),u.jsx("rect",{x:"4.2",y:"4.2",width:"7.6",height:"7.6",rx:"1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.1"}),u.jsx("rect",{x:"6.6",y:"6.6",width:"2.8",height:"2.8",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("path",{d:"M6.5 2.6v1.6M9.5 2.6v1.6M6.5 11.8v1.6M9.5 11.8v1.6M2.6 6.5h1.6M2.6 9.5h1.6M11.8 6.5h1.6M11.8 9.5h1.6",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round"})]}),default:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"currentColor",opacity:"0.14"}),u.jsx("path",{d:"M4 2.5h5l3 3v8a.6.6 0 0 1-.6.6H4a.6.6 0 0 1-.6-.6V3.1a.6.6 0 0 1 .6-.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M9 2.7V5.5h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderClosed:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M2.4 5.4c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v4.05c0 .69-.56 1.25-1.25 1.25H3.65c-.69 0-1.25-.56-1.25-1.25V5.4Z",fill:"currentColor",opacity:"0.2"}),u.jsx("path",{d:"M2.4 5.4c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v4.05c0 .69-.56 1.25-1.25 1.25H3.65c-.69 0-1.25-.56-1.25-1.25V5.4Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]}),folderOpen:u.jsxs(u.Fragment,{children:[u.jsx("path",{d:"M2.4 5.2c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v1.1H2.4V5.2Z",fill:"currentColor",opacity:"0.18"}),u.jsx("path",{d:"M1.45 7.55h12.1l-1.16 3.88c-.17.56-.69.97-1.28.97H3.89c-.59 0-1.11-.41-1.28-.97L1.45 7.55Z",fill:"currentColor",opacity:"0.26"}),u.jsx("path",{d:"M2.4 5.2c0-.69.56-1.25 1.25-1.25h2.7c.33 0 .65.13.88.37l.72.72c.23.23.55.37.88.37h3.15c.69 0 1.25.56 1.25 1.25v.8",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"}),u.jsx("path",{d:"M1.45 7.55h12.1l-1.16 3.88c-.17.56-.69.97-1.28.97H3.89c-.59 0-1.11-.41-1.28-.97L1.45 7.55Z",fill:"none",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})]})};function CO({name:e}){const t=kO(e);return u.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${t.tone})`},children:ug[t.shape]})}function EO({name:e,open:t}){const i=SO[e.toLowerCase()]??se.folder;return u.jsx("svg",{className:"fexp-file-svg",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",style:{color:`var(--fexp-ic-${i})`},children:t?ug.folderOpen:ug.folderClosed})}function kO(e){const t=e.toLowerCase(),i=xO[t];if(i)return i;if(t.startsWith(".env"))return{shape:"gear",tone:se.config};if(t.startsWith("readme"))return{shape:"doc",tone:se.md};if(t.endsWith(".d.ts"))return U1["d.ts"];const s=t.lastIndexOf(".");if(s>0&&s<t.length-1){const o=t.slice(s+1),d=U1[o];if(d)return d}return wO}function TO(e,t){return`${e??""}:${t??""}`}function hg(e,t){const i=Wh(t);if(i===null)return null;const s=e?Wh(e):"";return s===null?null:s?i?`${s}/${i}`:s:i}function Ch(e,t){const i=Wh(t),s=e?Wh(e):"";return i===null||s===null?null:s?i===s?"":i.startsWith(`${s}/`)?i.slice(s.length+1):null:i}function PC(e,t){const i=Ch(e,t.relativePath);if(i===null)return null;const s=i===""||t.parentRelativePath===null?null:Ch(e,t.parentRelativePath);if(i!==""&&t.parentRelativePath!==null&&s===null)return null;const o=[];for(const d of t.entries){const p=Ch(e,d.relativePath);p!==null&&o.push({...d,relativePath:p})}return{...t,relativePath:i,parentRelativePath:s,entries:o}}function AO(e,t){return Ch(e,t)}function Wh(e){if(e.includes("\0")||e.startsWith("/")||e.startsWith("\\")||/^[A-Za-z]:/.test(e))return null;const t=[];for(const i of e.replaceAll("\\","/").split("/"))if(!(!i||i===".")){if(i==="..")return null;t.push(i)}return t.join("/")}const RO=200,th=30,F1=5,zC="fleet-console.fileExplorer.showHidden",W1=500;function er(e,t){return e===t}async function LO({entries:e,cachedResults:t,files:i,showHidden:s,isCurrent:o,onFolderResult:d}){const p=[],l=new Map(t),h=new Set,f=new Set;let v=0;const m=S=>{for(const C of S)if(!(!NO(C,s)||h.has(C.relativePath))){if(h.size>=W1)return;h.add(C.relativePath),p.push(C)}};for(m(e);p.length>0&&o();){const S=p.shift();if(!S)return;const C=l.get(S.relativePath);if(C){if(f.has(C.relativePath))continue;f.add(C.relativePath),m(C.entries);continue}if(v>=W1)return;v+=1;try{const T=await i.listFolder(S.relativePath);if(!o())return;if(l.set(S.relativePath,T),d(S.relativePath,T),f.has(T.relativePath))continue;f.add(T.relativePath),m(T.entries)}catch{}}}function HC(e,t,i,s,o,d,p,l,h=new Set){const f=[];for(const v of e){if(!l&&v.name.startsWith("."))continue;const m=d.get(v.relativePath),S=m?.entries,C=m?.relativePath??v.relativePath,T=v.kind==="dir"&&h.has(C),w=v.kind==="dir"&&!T&&$C(S??[],d,p,l);if(p&&!v.name.toLowerCase().includes(p)&&!w)continue;const _=s.has(v.relativePath)||!!(p&&w);if(f.push({entry:v,depth:t,isSelected:i===v.relativePath,isExpanded:_,isLoading:o.has(v.relativePath)}),v.kind==="dir"&&_&&!T&&S){const b=new Set(h);b.add(C),f.push(...HC(S,t+1,i,s,o,d,p,l,b))}}return f}function MO({contextKey:e,contextRelPath:t,files:i,theaterId:s,selectedPath:o,onSelect:d}){const[p,l]=L.useState(null),[h,f]=L.useState(null),[v,m]=L.useState(""),[S,C]=L.useState(new Set),[T,w]=L.useState(new Set),[_,b]=L.useState(new Map),[g,y]=L.useState(""),[k,M]=L.useState(0),[A,N]=L.useState(600),[R,B]=L.useState(()=>OO()),q=L.useRef(null),W=L.useRef(S);W.current=S;const G=L.useRef(v);G.current=v;const I=L.useRef(i);I.current=i;const K=L.useRef(e);K.current=e;const H=L.useRef(_);H.current=_;const P=L.useRef(0),Y=!!g;L.useEffect(()=>{s&&(l(null),f(null),m(""),C(new Set),b(new Map),y(""),M(0))},[e,s]),L.useEffect(()=>{if(!s)return;const de=e;i.listFolder(v||void 0).then(we=>{er(de,K.current)&&(l(we),f(null))}).catch(we=>{er(de,K.current)&&f(we instanceof Error?we.message:"Unable to load folder")})},[e,s,v,i]),L.useEffect(()=>{const de=++P.current;if(!Y||!p)return;let we=!0;const Ie=e,Ne=()=>we&&de===P.current&&er(Ie,K.current);return LO({entries:p.entries,cachedResults:H.current,files:i,showHidden:R,isCurrent:Ne,onFolderResult:(Ge,Ee)=>{Ne()&&b(ct=>new Map(ct).set(Ge,Ee))}}),()=>{we=!1}},[e,i,Y,p,R]),L.useEffect(()=>{const de=q.current;if(!de)return;const we=new ResizeObserver(()=>N(de.clientHeight));return we.observe(de),N(de.clientHeight),()=>we.disconnect()},[]),L.useEffect(()=>{if(!s)return;let de=!0;const we=`/plugins/file-explorer/files/watch?theaterId=${encodeURIComponent(s)}`,Ie=new EventSource(we),Ne=()=>{const Ee=e;I.current.listFolder(G.current||void 0).then(ct=>{er(Ee,K.current)&&(l(ct),f(null))}).catch(()=>{})},Ge=()=>{Ne();for(const Ee of W.current){const ct=e;I.current.listFolder(Ee).then(wt=>{er(ct,K.current)&&b(Xt=>new Map(Xt).set(Ee,wt))}).catch(()=>{})}};return Ie.addEventListener("change",Ee=>{let ct;try{ct=JSON.parse(Ee.data)}catch{return}if(typeof ct!="string")return;const wt=AO(t,ct);if(wt!==null&&((wt===""||wt===G.current)&&Ne(),wt!==""&&W.current.has(wt))){const Xt=e;I.current.listFolder(wt).then(Ln=>{er(Xt,K.current)&&b($n=>new Map($n).set(wt,Ln))}).catch(()=>{})}}),Ie.onopen=()=>{if(de){de=!1;return}Ge()},()=>{Ie.close()}},[t,s,i]);const X=L.useCallback(de=>{const we=de.relativePath,Ie=!S.has(we);if(C(Ne=>{const Ge=new Set(Ne);return Ge.has(we)?(Ge.delete(we),Ge):(Ge.add(we),Ge)}),Ie){const Ne=e;w(Ge=>new Set(Ge).add(we)),i.listFolder(we).then(Ge=>{er(Ne,K.current)&&(b(Ee=>new Map(Ee).set(we,Ge)),w(Ee=>{const ct=new Set(Ee);return ct.delete(we),ct}))}).catch(()=>{er(Ne,K.current)&&w(Ge=>{const Ee=new Set(Ge);return Ee.delete(we),Ee})})}},[e,i,S]),j=L.useCallback(de=>{de.kind==="dir"?X(de):d(de)},[X,d]),z=L.useCallback(de=>{M(de.currentTarget.scrollTop)},[]),D=L.useCallback(()=>{B(de=>{const we=!de;try{localStorage.setItem(zC,we?"1":"0")}catch{}return we})},[]),U=L.useCallback(()=>{if(!s)return;const de=e;i.listFolder(v||void 0).then(we=>{er(de,K.current)&&(l(we),f(null))}).catch(we=>{er(de,K.current)&&f(we instanceof Error?we.message:"Unable to load folder")});for(const we of S)i.listFolder(we).then(Ie=>{er(de,K.current)&&b(Ne=>new Map(Ne).set(we,Ie))}).catch(()=>{})},[e,i,v,S,s]),V=g.toLowerCase(),J=L.useMemo(()=>p?HC(p.entries,0,o,S,T,_,V,R):[],[p,o,S,T,_,V,R]),le=!R&&p!==null&&p.entries.length>0&&J.length===0&&!g,pe=J.length>RO,te=pe?Math.max(0,Math.floor(k/th)-F1):0,F=pe?Math.min(J.length,Math.ceil((k+A)/th)+F1):J.length,ae=J.slice(te,F),re=J.length*th,ge=te*th;return s?h&&!p?u.jsx("div",{className:"fexp-tree-error",children:h}):p?u.jsxs("div",{className:"fexp-tree-container",children:[u.jsxs("div",{className:"fexp-filter",children:[u.jsx("input",{type:"text",className:"fexp-filter-input",placeholder:"Filter…",value:g,onChange:de=>y(de.target.value),"aria-label":"Filter files"}),g&&u.jsx("button",{type:"button",className:"fexp-filter-clear",onClick:()=>y(""),"aria-label":"Clear filter",children:"✕"}),u.jsx("button",{type:"button",className:"fexp-refresh-btn",onClick:U,"aria-label":"Refresh file tree",title:"Refresh file tree",children:"↻"}),u.jsx("button",{type:"button",className:`fexp-hidden-toggle${R?" is-active":""}`,onClick:D,"aria-pressed":R,"aria-label":R?"Hide hidden files":"Show hidden files",title:R?"Hide hidden files":"Show hidden files",children:R?u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[u.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"})]}):u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[u.jsx("ellipse",{cx:"8",cy:"8",rx:"5.5",ry:"3.5",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.8",fill:"currentColor"}),u.jsx("line",{x1:"3",y1:"13",x2:"13",y2:"3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})})]}),u.jsxs("div",{ref:q,className:"fexp-tree",role:"tree","aria-label":"File tree",onScroll:pe?z:void 0,children:[!1,pe?u.jsx("div",{style:{height:re,position:"relative"},children:u.jsx("div",{style:{transform:`translateY(${ge}px)`},children:ae.map(de=>u.jsx(G1,{row:de,onEntryClick:j},de.entry.relativePath))})}):ae.map(de=>u.jsx(G1,{row:de,onEntryClick:j},de.entry.relativePath)),J.length===0&&g&&u.jsx("div",{className:"fexp-tree-empty",children:"No matching items"}),J.length===0&&!g&&p.entries.length===0&&u.jsx("div",{className:"fexp-tree-empty",children:"This folder is empty"}),le&&u.jsx("div",{className:"fexp-tree-empty",children:"Only hidden items — use the eye icon to show them"})]})]}):u.jsx("div",{className:"fexp-tree-loading",children:"Loading…"}):u.jsx("div",{className:"fexp-tree-empty",children:"Select a Theater"})}function $C(e,t,i,s,o=new Set){for(const d of e)if(!(!s&&d.name.startsWith("."))){if(d.name.toLowerCase().includes(i))return!0;if(d.kind==="dir"){const p=t.get(d.relativePath);if(p&&!o.has(p.relativePath)){const l=new Set(o);if(l.add(p.relativePath),$C(p.entries,t,i,s,l))return!0}}}return!1}function NO(e,t){return e.kind==="dir"&&(t||!e.name.startsWith("."))}function G1({row:e,onEntryClick:t}){const{entry:i,depth:s,isSelected:o,isExpanded:d,isLoading:p}=e,l=i.kind==="dir",h=s*16,f=L.useCallback(()=>t(i),[i,t]);return u.jsxs("button",{className:`fexp-tree-row${o?" is-cur":""}${l?" is-dir":" is-file"}`,style:{paddingLeft:`${h+12}px`},type:"button",role:"treeitem","aria-selected":o,"aria-expanded":l?d:void 0,onClick:f,children:[u.jsx("span",{className:"fexp-tree-icon","aria-hidden":"true",children:l?u.jsx(EO,{name:i.name,open:d}):u.jsx(CO,{name:i.name})}),u.jsx("span",{className:"fexp-tree-name",children:i.name}),p&&u.jsx("span",{className:"fexp-tree-spin","aria-hidden":"true",children:"⋯"})]})}function OO(){try{return localStorage.getItem(zC)==="1"}catch{return!1}}function DO({name:e,sizeHint:t}){return u.jsxs("div",{className:"fexp-bin-wrap v-bin",children:[u.jsx("span",{className:"fexp-bin-glyph","aria-hidden":"true",children:"⊘"}),u.jsx("p",{className:"fexp-bin-name",children:e}),t&&u.jsx("p",{className:"fexp-bin-meta",children:t}),u.jsx("p",{className:"fexp-bin-hint",children:"Binary files can't be previewed"})]})}function jO(e,t){switch(t){case"typescript":case"javascript":return BO(e);case"json":return PO(e);case"python":return HO(e);case"css":case"scss":case"sass":case"less":return $O(e);case"html":case"xml":return UO(e);case"bash":case"shell":return FO(e);case"yaml":return WO(e);default:return[{kind:"text",value:e}]}}const IO=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 BO(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("/*",i)){const s=e.indexOf("*/",i+2),o=s===-1?e.slice(i):e.slice(i,s+2);t.push({kind:"com",value:o}),i+=o.length;continue}if(e.startsWith("//",i)){const s=e.indexOf(`
92
+ `,i),o=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:o}),i+=o.length;continue}if(e[i]==="`"){const{slice:s,length:o}=Ns(e,i,"`","`");t.push({kind:"str",value:s}),i+=o;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:o}=Ns(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=o;continue}if(/[0-9]/.test(e[i])||e[i]==="."&&/[0-9]/.test(e[i+1]??"")){const s=e.slice(i).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?[nN]?)/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}if(/[a-zA-Z_$]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z_$][\w$]*/);if(s){const o=s[0],d=e.slice(i+o.length).match(/^\s*\(/);IO.has(o)?t.push({kind:"key",value:o}):d?t.push({kind:"fn",value:o}):t.push({kind:"text",value:o}),i+=o.length;continue}}if(/[{}()[\];,.<>!?:|&^~%*+\-=/\\@#]/.test(e[i])){t.push({kind:"punct",value:e[i]}),i++;continue}t.push({kind:"text",value:e[i]}),i++}return t}function PO(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==='"'){const{slice:s,length:o}=Ns(e,i,'"','"'),p=e.slice(i+o).trimStart().startsWith(":");t.push({kind:p?"attr":"str",value:s}),i+=o;continue}if(/[0-9\-]/.test(e[i])){const s=e.slice(i).match(/^-?[\d]*\.?[\d]+(?:[eE][+-]?\d+)?/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}if(e.startsWith("true",i)||e.startsWith("false",i)||e.startsWith("null",i)){const s=e.slice(i).match(/^(true|false|null)/);if(s){t.push({kind:"key",value:s[0]}),i+=s[0].length;continue}}if(/[{}[\]:,]/.test(e[i])){t.push({kind:"punct",value:e[i]}),i++;continue}t.push({kind:"text",value:e[i]}),i++}return t}const zO=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 HO(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==="#"){const s=e.indexOf(`
93
+ `,i),o=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:o}),i+=o.length;continue}if(e.startsWith('"""',i)||e.startsWith("'''",i)){const s=e.slice(i,i+3),o=e.indexOf(s,i+3),d=o===-1?e.slice(i):e.slice(i,o+3);t.push({kind:"str",value:d}),i+=d.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:o}=Ns(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=o;continue}if(/[0-9]/.test(e[i])){const s=e.slice(i).match(/^(0x[\da-fA-F]+|0o[0-7]+|0b[01]+|[\d]*\.?[\d]+(?:[eE][+-]?\d+)?)/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}if(/[a-zA-Z_]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z_]\w*/);if(s){const o=s[0],d=e.slice(i+o.length).match(/^\s*\(/);zO.has(o)?t.push({kind:"key",value:o}):d?t.push({kind:"fn",value:o}):t.push({kind:"text",value:o}),i+=o.length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function $O(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("/*",i)){const s=e.indexOf("*/",i+2),o=s===-1?e.slice(i):e.slice(i,s+2);t.push({kind:"com",value:o}),i+=o.length;continue}if(e.startsWith("//",i)){const s=e.indexOf(`
94
+ `,i),o=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:o}),i+=o.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:o}=Ns(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=o;continue}if(e[i]==="."||e[i]==="#"||e[i]===":"){const s=e.slice(i).match(/^[.#:][:a-zA-Z_-][\w-]*/);if(s){t.push({kind:"tag",value:s[0]}),i+=s[0].length;continue}}if(/[a-zA-Z-]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z-][\w-]*/);if(s){const o=s[0];e.slice(i+o.length).trimStart().startsWith(":")?t.push({kind:"attr",value:o}):t.push({kind:"text",value:o}),i+=o.length;continue}}if(/[0-9]/.test(e[i])){const s=e.slice(i).match(/^[\d]*\.?[\d]+(?:[a-zA-Z%]*)/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function UO(e){const t=[];let i=0;for(;i<e.length;){if(e.startsWith("<!--",i)){const s=e.indexOf("-->",i+4),o=s===-1?e.slice(i):e.slice(i,s+3);t.push({kind:"com",value:o}),i+=o.length;continue}if(e[i]==="<"){t.push({kind:"punct",value:"<"}),i++,e[i]==="/"&&(t.push({kind:"punct",value:"/"}),i++);const s=e.slice(i).match(/^[a-zA-Z][\w:-]*/);s&&(t.push({kind:"tag",value:s[0]}),i+=s[0].length);continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:o}=Ns(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=o;continue}if(/[a-zA-Z]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z][\w:-]*/);if(s){const o=e.slice(i+s[0].length).trimStart();t.push({kind:o.startsWith("=")?"attr":"text",value:s[0]}),i+=s[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function FO(e){const t=[];let i=0;const s=new Set(["if","then","else","elif","fi","for","in","do","done","while","until","case","esac","function","return","local","export","readonly","declare","unset","echo","exit","shift","source","."]);for(;i<e.length;){if(e[i]==="#"){const o=e.indexOf(`
95
+ `,i),d=o===-1?e.slice(i):e.slice(i,o);t.push({kind:"com",value:d}),i+=d.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:o,length:d}=Ns(e,i,e[i],e[i]);t.push({kind:"str",value:o}),i+=d;continue}if(/[a-zA-Z_]/.test(e[i])){const o=e.slice(i).match(/^[a-zA-Z_][\w]*/);if(o){t.push({kind:s.has(o[0])?"key":"text",value:o[0]}),i+=o[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function WO(e){const t=[];let i=0;for(;i<e.length;){if(e[i]==="#"){const s=e.indexOf(`
96
+ `,i),o=s===-1?e.slice(i):e.slice(i,s);t.push({kind:"com",value:o}),i+=o.length;continue}if(e[i]==='"'||e[i]==="'"){const{slice:s,length:o}=Ns(e,i,e[i],e[i]);t.push({kind:"str",value:s}),i+=o;continue}if(/[a-zA-Z_]/.test(e[i])){const s=e.slice(i).match(/^[a-zA-Z_][\w-]*/);if(s){e.slice(i+s[0].length).trimStart().startsWith(":")?t.push({kind:"attr",value:s[0]}):["true","false","null","yes","no","on","off"].includes(s[0])?t.push({kind:"key",value:s[0]}):t.push({kind:"text",value:s[0]}),i+=s[0].length;continue}}if(/[0-9\-]/.test(e[i])){const s=e.slice(i).match(/^-?[\d]*\.?[\d]+/);if(s){t.push({kind:"num",value:s[0]}),i+=s[0].length;continue}}t.push({kind:"text",value:e[i]}),i++}return t}function Ns(e,t,i,s){let o=t+i.length;for(;o<e.length;){if(e[o]==="\\"){o+=2;continue}if(e.startsWith(s,o)){o+=s.length;break}if(s!=="`"&&e[o]===`
97
+ `)break;o++}return{slice:e.slice(t,o),length:o-t}}function GO({content:e,lang:t,truncated:i}){const s=L.useMemo(()=>qO(e,t),[e,t]);return u.jsxs("div",{className:"fexp-code-wrap",children:[i&&u.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),u.jsx("div",{className:"fexp-code-scroll",children:u.jsx("table",{className:"fexp-code-table","aria-label":"File contents",children:u.jsx("tbody",{children:s.map((o,d)=>u.jsxs("tr",{className:"fexp-code-row",children:[u.jsx("td",{className:"fexp-line-num","aria-hidden":"true",children:d+1}),u.jsx("td",{className:"fexp-line-code",dangerouslySetInnerHTML:{__html:o}})]},d))})})})]})}function qO(e,t){return e.split(`
98
+ `).map(s=>KO(s,t))}function KO(e,t){return t==="plaintext"||t==="markdown"?q1(e)||" ":jO(e,t).map(s=>{const o=q1(s.value);return s.kind==="text"?o:`<span class="syn-${s.kind}">${o}</span>`}).join("")||" "}function q1(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function VO({src:e,name:t}){return u.jsxs("div",{className:"fexp-img-wrap",children:[u.jsx("div",{className:"fexp-img-stage",children:u.jsx("img",{src:e,alt:t,className:"fexp-img",draggable:!1})}),u.jsx("figcaption",{className:"fexp-img-caption",children:t})]})}function x_(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _a=x_();function UC(e){_a=e}var ac={exec:()=>null};function bt(e,t=""){let i=typeof e=="string"?e:e.source,s={replace:(o,d)=>{let p=typeof d=="string"?d:d.source;return p=p.replace(ii.caret,"$1"),i=i.replace(o,p),s},getRegex:()=>new RegExp(i,t)};return s}var YO=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),ii={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")},XO=/^(?:[ \t]*(?:\n|$))+/,ZO=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,JO=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Nc=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,QO=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,w_=/(?:[*+-]|\d{1,9}[.)])/,FC=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,WC=bt(FC).replace(/bull/g,w_).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(),eD=bt(FC).replace(/bull/g,w_).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(),C_=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,tD=/^[^\n]+/,E_=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,nD=bt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",E_).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),iD=bt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,w_).getRegex(),_d="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",k_=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,rD=bt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",k_).replace("tag",_d).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),GC=bt(C_).replace("hr",Nc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_d).getRegex(),sD=bt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",GC).getRegex(),T_={blockquote:sD,code:ZO,def:nD,fences:JO,heading:QO,hr:Nc,html:rD,lheading:WC,list:iD,newline:XO,paragraph:GC,table:ac,text:tD},K1=bt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Nc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_d).getRegex(),aD={...T_,lheading:eD,table:K1,paragraph:bt(C_).replace("hr",Nc).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",K1).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",_d).getRegex()},oD={...T_,html:bt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",k_).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ac,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:bt(C_).replace("hr",Nc).replace("heading",` *#{1,6} *[^
99
+ ]`).replace("lheading",WC).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},lD=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,cD=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qC=/^( {2,}|\\)\n(?!\s*$)/,uD=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,vd=/[\p{P}\p{S}]/u,A_=/[\s\p{P}\p{S}]/u,KC=/[^\s\p{P}\p{S}]/u,hD=bt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,A_).getRegex(),VC=/(?!~)[\p{P}\p{S}]/u,dD=/(?!~)[\s\p{P}\p{S}]/u,fD=/(?:[^\s\p{P}\p{S}]|~)/u,pD=bt(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",YO?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),YC=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,mD=bt(YC,"u").replace(/punct/g,vd).getRegex(),gD=bt(YC,"u").replace(/punct/g,VC).getRegex(),XC="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",_D=bt(XC,"gu").replace(/notPunctSpace/g,KC).replace(/punctSpace/g,A_).replace(/punct/g,vd).getRegex(),vD=bt(XC,"gu").replace(/notPunctSpace/g,fD).replace(/punctSpace/g,dD).replace(/punct/g,VC).getRegex(),bD=bt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,KC).replace(/punctSpace/g,A_).replace(/punct/g,vd).getRegex(),yD=bt(/\\(punct)/,"gu").replace(/punct/g,vd).getRegex(),SD=bt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),xD=bt(k_).replace("(?:-->|$)","-->").getRegex(),wD=bt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",xD).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Gh=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,CD=bt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Gh).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ZC=bt(/^!?\[(label)\]\[(ref)\]/).replace("label",Gh).replace("ref",E_).getRegex(),JC=bt(/^!?\[(ref)\](?:\[\])?/).replace("ref",E_).getRegex(),ED=bt("reflink|nolink(?!\\()","g").replace("reflink",ZC).replace("nolink",JC).getRegex(),V1=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,R_={_backpedal:ac,anyPunctuation:yD,autolink:SD,blockSkip:pD,br:qC,code:cD,del:ac,emStrongLDelim:mD,emStrongRDelimAst:_D,emStrongRDelimUnd:bD,escape:lD,link:CD,nolink:JC,punctuation:hD,reflink:ZC,reflinkSearch:ED,tag:wD,text:uD,url:ac},kD={...R_,link:bt(/^!?\[(label)\]\((.*?)\)/).replace("label",Gh).getRegex(),reflink:bt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Gh).getRegex()},dg={...R_,emStrongRDelimAst:vD,emStrongLDelim:gD,url:bt(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",V1).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:bt(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",V1).getRegex()},TD={...dg,br:bt(qC).replace("{2,}","*").getRegex(),text:bt(dg.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},nh={normal:T_,gfm:aD,pedantic:oD},Bl={normal:R_,gfm:dg,breaks:TD,pedantic:kD},AD={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Y1=e=>AD[e];function _r(e,t){if(t){if(ii.escapeTest.test(e))return e.replace(ii.escapeReplace,Y1)}else if(ii.escapeTestNoEncode.test(e))return e.replace(ii.escapeReplaceNoEncode,Y1);return e}function X1(e){try{e=encodeURI(e).replace(ii.percentDecode,"%")}catch{return null}return e}function Z1(e,t){let i=e.replace(ii.findPipe,(d,p,l)=>{let h=!1,f=p;for(;--f>=0&&l[f]==="\\";)h=!h;return h?"|":" |"}),s=i.split(ii.splitPipe),o=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;o<s.length;o++)s[o]=s[o].trim().replace(ii.slashPipe,"|");return s}function Pl(e,t,i){let s=e.length;if(s===0)return"";let o=0;for(;o<s&&e.charAt(s-o-1)===t;)o++;return e.slice(0,s-o)}function RD(e,t){if(e.indexOf(t[1])===-1)return-1;let i=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])i++;else if(e[s]===t[1]&&(i--,i<0))return s;return i>0?-2:-1}function J1(e,t,i,s,o){let d=t.href,p=t.title||null,l=e[1].replace(o.other.outputLinkReplace,"$1");s.state.inLink=!0;let h={type:e[0].charAt(0)==="!"?"image":"link",raw:i,href:d,title:p,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,h}function LD(e,t,i){let s=e.match(i.other.indentCodeCompensation);if(s===null)return t;let o=s[1];return t.split(`
100
+ `).map(d=>{let p=d.match(i.other.beginningSpace);if(p===null)return d;let[l]=p;return l.length>=o.length?d.slice(o.length):d}).join(`
101
+ `)}var qh=class{options;rules;lexer;constructor(e){this.options=e||_a}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let i=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?i:Pl(i,`
102
+ `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let i=t[0],s=LD(i,t[3]||"",this.rules);return{type:"code",raw:i,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let i=t[2].trim();if(this.rules.other.endingHash.test(i)){let s=Pl(i,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(i=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Pl(t[0],`
103
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let i=Pl(t[0],`
104
+ `).split(`
105
+ `),s="",o="",d=[];for(;i.length>0;){let p=!1,l=[],h;for(h=0;h<i.length;h++)if(this.rules.other.blockquoteStart.test(i[h]))l.push(i[h]),p=!0;else if(!p)l.push(i[h]);else break;i=i.slice(h);let f=l.join(`
106
+ `),v=f.replace(this.rules.other.blockquoteSetextReplace,`
107
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
108
+ ${f}`:f,o=o?`${o}
109
+ ${v}`:v;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(v,d,!0),this.lexer.state.top=m,i.length===0)break;let S=d.at(-1);if(S?.type==="code")break;if(S?.type==="blockquote"){let C=S,T=C.raw+`
110
+ `+i.join(`
111
+ `),w=this.blockquote(T);d[d.length-1]=w,s=s.substring(0,s.length-C.raw.length)+w.raw,o=o.substring(0,o.length-C.text.length)+w.text;break}else if(S?.type==="list"){let C=S,T=C.raw+`
112
+ `+i.join(`
113
+ `),w=this.list(T);d[d.length-1]=w,s=s.substring(0,s.length-S.raw.length)+w.raw,o=o.substring(0,o.length-C.raw.length)+w.raw,i=T.substring(d.at(-1).raw.length).split(`
114
+ `);continue}}return{type:"blockquote",raw:s,tokens:d,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i=t[1].trim(),s=i.length>1,o={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let d=this.rules.other.listItemRegex(i),p=!1;for(;e;){let h=!1,f="",v="";if(!(t=d.exec(e))||this.rules.block.hr.test(e))break;f=t[0],e=e.substring(f.length);let m=t[2].split(`
115
+ `,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),S=e.split(`
116
+ `,1)[0],C=!m.trim(),T=0;if(this.options.pedantic?(T=2,v=m.trimStart()):C?T=t[1].length+1:(T=t[2].search(this.rules.other.nonSpaceChar),T=T>4?1:T,v=m.slice(T),T+=t[1].length),C&&this.rules.other.blankLine.test(S)&&(f+=S+`
117
+ `,e=e.substring(S.length+1),h=!0),!h){let b=this.rules.other.nextBulletRegex(T),g=this.rules.other.hrRegex(T),y=this.rules.other.fencesBeginRegex(T),k=this.rules.other.headingBeginRegex(T),M=this.rules.other.htmlBeginRegex(T);for(;e;){let A=e.split(`
118
+ `,1)[0],N;if(S=A,this.options.pedantic?(S=S.replace(this.rules.other.listReplaceNesting," "),N=S):N=S.replace(this.rules.other.tabCharGlobal," "),y.test(S)||k.test(S)||M.test(S)||b.test(S)||g.test(S))break;if(N.search(this.rules.other.nonSpaceChar)>=T||!S.trim())v+=`
119
+ `+N.slice(T);else{if(C||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(m)||k.test(m)||g.test(m))break;v+=`
120
+ `+S}!C&&!S.trim()&&(C=!0),f+=A+`
121
+ `,e=e.substring(A.length+1),m=N.slice(T)}}o.loose||(p?o.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(p=!0));let w=null,_;this.options.gfm&&(w=this.rules.other.listIsTask.exec(v),w&&(_=w[0]!=="[ ] ",v=v.replace(this.rules.other.listReplaceTask,""))),o.items.push({type:"list_item",raw:f,task:!!w,checked:_,loose:!1,text:v,tokens:[]}),o.raw+=f}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let h=0;h<o.items.length;h++)if(this.lexer.state.top=!1,o.items[h].tokens=this.lexer.blockTokens(o.items[h].text,[]),!o.loose){let f=o.items[h].tokens.filter(m=>m.type==="space"),v=f.length>0&&f.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=v}if(o.loose)for(let h=0;h<o.items.length;h++)o.items[h].loose=!0;return o}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let i=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:i,raw:t[0],href:s,title:o}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let i=Z1(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
122
+ `):[],d={type:"table",raw:t[0],header:[],align:[],rows:[]};if(i.length===s.length){for(let p of s)this.rules.other.tableAlignRight.test(p)?d.align.push("right"):this.rules.other.tableAlignCenter.test(p)?d.align.push("center"):this.rules.other.tableAlignLeft.test(p)?d.align.push("left"):d.align.push(null);for(let p=0;p<i.length;p++)d.header.push({text:i[p],tokens:this.lexer.inline(i[p]),header:!0,align:d.align[p]});for(let p of o)d.rows.push(Z1(p,d.header.length).map((l,h)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:d.align[h]})));return d}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let i=t[1].charAt(t[1].length-1)===`
123
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:i,tokens:this.lexer.inline(i)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let i=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let d=Pl(i.slice(0,-1),"\\");if((i.length-d.length)%2===0)return}else{let d=RD(t[2],"()");if(d===-2)return;if(d>-1){let p=(t[0].indexOf("!")===0?5:4)+t[1].length+d;t[2]=t[2].substring(0,d),t[0]=t[0].substring(0,p).trim(),t[3]=""}}let s=t[2],o="";if(this.options.pedantic){let d=this.rules.other.pedanticHrefTitle.exec(s);d&&(s=d[1],o=d[3])}else o=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?s=s.slice(1):s=s.slice(1,-1)),J1(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){let s=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[s.toLowerCase()];if(!o){let d=i[0].charAt(0);return{type:"text",raw:d,text:d}}return J1(i,o,i[0],this.lexer,this.rules)}}emStrong(e,t,i=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||s[3]&&i.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[2])||!i||this.rules.inline.punctuation.exec(i))){let o=[...s[0]].length-1,d,p,l=o,h=0,f=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,t=t.slice(-1*e.length+o);(s=f.exec(t))!=null;){if(d=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!d)continue;if(p=[...d].length,s[3]||s[4]){l+=p;continue}else if((s[5]||s[6])&&o%3&&!((o+p)%3)){h+=p;continue}if(l-=p,l>0)continue;p=Math.min(p,p+l+h);let v=[...s[0]][0].length,m=e.slice(0,o+s.index+v+p);if(Math.min(o,p)%2){let C=m.slice(1,-1);return{type:"em",raw:m,text:C,tokens:this.lexer.inlineTokens(C)}}let S=m.slice(2,-2);return{type:"strong",raw:m,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let i=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(i),o=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return s&&o&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:t[0],text:i}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let i,s;return t[2]==="@"?(i=t[1],s="mailto:"+i):(i=t[1],s=i),{type:"link",raw:t[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let i,s;if(t[2]==="@")i=t[0],s="mailto:"+i;else{let o;do o=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(o!==t[0]);i=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let i=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:i}}}},tr=class fg{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||_a,this.options.tokenizer=this.options.tokenizer||new qh,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let i={other:ii,block:nh.normal,inline:Bl.normal};this.options.pedantic?(i.block=nh.pedantic,i.inline=Bl.pedantic):this.options.gfm&&(i.block=nh.gfm,this.options.breaks?i.inline=Bl.breaks:i.inline=Bl.gfm),this.tokenizer.rules=i}static get rules(){return{block:nh,inline:Bl}}static lex(t,i){return new fg(i).lex(t)}static lexInline(t,i){return new fg(i).inlineTokens(t)}lex(t){t=t.replace(ii.carriageReturn,`
124
+ `),this.blockTokens(t,this.tokens);for(let i=0;i<this.inlineQueue.length;i++){let s=this.inlineQueue[i];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,i=[],s=!1){for(this.options.pedantic&&(t=t.replace(ii.tabCharGlobal," ").replace(ii.spaceLine,""));t;){let o;if(this.options.extensions?.block?.some(p=>(o=p.call({lexer:this},t,i))?(t=t.substring(o.raw.length),i.push(o),!0):!1))continue;if(o=this.tokenizer.space(t)){t=t.substring(o.raw.length);let p=i.at(-1);o.raw.length===1&&p!==void 0?p.raw+=`
125
+ `:i.push(o);continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length);let p=i.at(-1);p?.type==="paragraph"||p?.type==="text"?(p.raw+=(p.raw.endsWith(`
126
+ `)?"":`
127
+ `)+o.raw,p.text+=`
128
+ `+o.text,this.inlineQueue.at(-1).src=p.text):i.push(o);continue}if(o=this.tokenizer.fences(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.heading(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.hr(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.blockquote(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.list(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.html(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.def(t)){t=t.substring(o.raw.length);let p=i.at(-1);p?.type==="paragraph"||p?.type==="text"?(p.raw+=(p.raw.endsWith(`
129
+ `)?"":`
130
+ `)+o.raw,p.text+=`
131
+ `+o.raw,this.inlineQueue.at(-1).src=p.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},i.push(o));continue}if(o=this.tokenizer.table(t)){t=t.substring(o.raw.length),i.push(o);continue}if(o=this.tokenizer.lheading(t)){t=t.substring(o.raw.length),i.push(o);continue}let d=t;if(this.options.extensions?.startBlock){let p=1/0,l=t.slice(1),h;this.options.extensions.startBlock.forEach(f=>{h=f.call({lexer:this},l),typeof h=="number"&&h>=0&&(p=Math.min(p,h))}),p<1/0&&p>=0&&(d=t.substring(0,p+1))}if(this.state.top&&(o=this.tokenizer.paragraph(d))){let p=i.at(-1);s&&p?.type==="paragraph"?(p.raw+=(p.raw.endsWith(`
132
+ `)?"":`
133
+ `)+o.raw,p.text+=`
134
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):i.push(o),s=d.length!==t.length,t=t.substring(o.raw.length);continue}if(o=this.tokenizer.text(t)){t=t.substring(o.raw.length);let p=i.at(-1);p?.type==="text"?(p.raw+=(p.raw.endsWith(`
135
+ `)?"":`
136
+ `)+o.raw,p.text+=`
137
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):i.push(o);continue}if(t){let p="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return this.state.top=!0,i}inline(t,i=[]){return this.inlineQueue.push({src:t,tokens:i}),i}inlineTokens(t,i=[]){let s=t,o=null;if(this.tokens.links){let h=Object.keys(this.tokens.links);if(h.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)h.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,o.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let d;for(;(o=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)d=o[2]?o[2].length:0,s=s.slice(0,o.index+d)+"["+"a".repeat(o[0].length-d-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let p=!1,l="";for(;t;){p||(l=""),p=!1;let h;if(this.options.extensions?.inline?.some(v=>(h=v.call({lexer:this},t,i))?(t=t.substring(h.raw.length),i.push(h),!0):!1))continue;if(h=this.tokenizer.escape(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.tag(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.link(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(h.raw.length);let v=i.at(-1);h.type==="text"&&v?.type==="text"?(v.raw+=h.raw,v.text+=h.text):i.push(h);continue}if(h=this.tokenizer.emStrong(t,s,l)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.codespan(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.br(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.del(t)){t=t.substring(h.raw.length),i.push(h);continue}if(h=this.tokenizer.autolink(t)){t=t.substring(h.raw.length),i.push(h);continue}if(!this.state.inLink&&(h=this.tokenizer.url(t))){t=t.substring(h.raw.length),i.push(h);continue}let f=t;if(this.options.extensions?.startInline){let v=1/0,m=t.slice(1),S;this.options.extensions.startInline.forEach(C=>{S=C.call({lexer:this},m),typeof S=="number"&&S>=0&&(v=Math.min(v,S))}),v<1/0&&v>=0&&(f=t.substring(0,v+1))}if(h=this.tokenizer.inlineText(f)){t=t.substring(h.raw.length),h.raw.slice(-1)!=="_"&&(l=h.raw.slice(-1)),p=!0;let v=i.at(-1);v?.type==="text"?(v.raw+=h.raw,v.text+=h.text):i.push(h);continue}if(t){let v="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(v);break}else throw new Error(v)}}return i}},Kh=class{options;parser;constructor(e){this.options=e||_a}space(e){return""}code({text:e,lang:t,escaped:i}){let s=(t||"").match(ii.notSpaceStart)?.[0],o=e.replace(ii.endingNewline,"")+`
138
+ `;return s?'<pre><code class="language-'+_r(s)+'">'+(i?o:_r(o,!0))+`</code></pre>
139
+ `:"<pre><code>"+(i?o:_r(o,!0))+`</code></pre>
140
+ `}blockquote({tokens:e}){return`<blockquote>
141
+ ${this.parser.parse(e)}</blockquote>
142
+ `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
143
+ `}hr(e){return`<hr>
144
+ `}list(e){let t=e.ordered,i=e.start,s="";for(let p=0;p<e.items.length;p++){let l=e.items[p];s+=this.listitem(l)}let o=t?"ol":"ul",d=t&&i!==1?' start="'+i+'"':"";return"<"+o+d+`>
145
+ `+s+"</"+o+`>
146
+ `}listitem(e){let t="";if(e.task){let i=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=i+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=i+" "+_r(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):t+=i+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
147
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
148
+ `}table(e){let t="",i="";for(let o=0;o<e.header.length;o++)i+=this.tablecell(e.header[o]);t+=this.tablerow({text:i});let s="";for(let o=0;o<e.rows.length;o++){let d=e.rows[o];i="";for(let p=0;p<d.length;p++)i+=this.tablecell(d[p]);s+=this.tablerow({text:i})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
149
+ <thead>
150
+ `+t+`</thead>
151
+ `+s+`</table>
152
+ `}tablerow({text:e}){return`<tr>
153
+ ${e}</tr>
154
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),i=e.header?"th":"td";return(e.align?`<${i} align="${e.align}">`:`<${i}>`)+t+`</${i}>
155
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${_r(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:i}){let s=this.parser.parseInline(i),o=X1(e);if(o===null)return s;e=o;let d='<a href="'+e+'"';return t&&(d+=' title="'+_r(t)+'"'),d+=">"+s+"</a>",d}image({href:e,title:t,text:i,tokens:s}){s&&(i=this.parser.parseInline(s,this.parser.textRenderer));let o=X1(e);if(o===null)return _r(i);e=o;let d=`<img src="${e}" alt="${i}"`;return t&&(d+=` title="${_r(t)}"`),d+=">",d}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:_r(e.text)}},L_=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""}},nr=class pg{options;renderer;textRenderer;constructor(t){this.options=t||_a,this.options.renderer=this.options.renderer||new Kh,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new L_}static parse(t,i){return new pg(i).parse(t)}static parseInline(t,i){return new pg(i).parseInline(t)}parse(t,i=!0){let s="";for(let o=0;o<t.length;o++){let d=t[o];if(this.options.extensions?.renderers?.[d.type]){let l=d,h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){s+=h||"";continue}}let p=d;switch(p.type){case"space":{s+=this.renderer.space(p);continue}case"hr":{s+=this.renderer.hr(p);continue}case"heading":{s+=this.renderer.heading(p);continue}case"code":{s+=this.renderer.code(p);continue}case"table":{s+=this.renderer.table(p);continue}case"blockquote":{s+=this.renderer.blockquote(p);continue}case"list":{s+=this.renderer.list(p);continue}case"html":{s+=this.renderer.html(p);continue}case"def":{s+=this.renderer.def(p);continue}case"paragraph":{s+=this.renderer.paragraph(p);continue}case"text":{let l=p,h=this.renderer.text(l);for(;o+1<t.length&&t[o+1].type==="text";)l=t[++o],h+=`
156
+ `+this.renderer.text(l);i?s+=this.renderer.paragraph({type:"paragraph",raw:h,text:h,tokens:[{type:"text",raw:h,text:h,escaped:!0}]}):s+=h;continue}default:{let l='Token with "'+p.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}parseInline(t,i=this.renderer){let s="";for(let o=0;o<t.length;o++){let d=t[o];if(this.options.extensions?.renderers?.[d.type]){let l=this.options.extensions.renderers[d.type].call({parser:this},d);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(d.type)){s+=l||"";continue}}let p=d;switch(p.type){case"escape":{s+=i.text(p);break}case"html":{s+=i.html(p);break}case"link":{s+=i.link(p);break}case"image":{s+=i.image(p);break}case"strong":{s+=i.strong(p);break}case"em":{s+=i.em(p);break}case"codespan":{s+=i.codespan(p);break}case"br":{s+=i.br(p);break}case"del":{s+=i.del(p);break}case"text":{s+=i.text(p);break}default:{let l='Token with "'+p.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},Jl=class{options;block;constructor(e){this.options=e||_a}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?tr.lex:tr.lexInline}provideParser(){return this.block?nr.parse:nr.parseInline}},QC=class{defaults=x_();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=nr;Renderer=Kh;TextRenderer=L_;Lexer=tr;Tokenizer=qh;Hooks=Jl;constructor(...e){this.use(...e)}walkTokens(e,t){let i=[];for(let s of e)switch(i=i.concat(t.call(this,s)),s.type){case"table":{let o=s;for(let d of o.header)i=i.concat(this.walkTokens(d.tokens,t));for(let d of o.rows)for(let p of d)i=i.concat(this.walkTokens(p.tokens,t));break}case"list":{let o=s;i=i.concat(this.walkTokens(o.items,t));break}default:{let o=s;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(d=>{let p=o[d].flat(1/0);i=i.concat(this.walkTokens(p,t))}):o.tokens&&(i=i.concat(this.walkTokens(o.tokens,t)))}}return i}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(i=>{let s={...i};if(s.async=this.defaults.async||s.async||!1,i.extensions&&(i.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let d=t.renderers[o.name];d?t.renderers[o.name]=function(...p){let l=o.renderer.apply(this,p);return l===!1&&(l=d.apply(this,p)),l}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let d=t[o.level];d?d.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),s.extensions=t),i.renderer){let o=this.defaults.renderer||new Kh(this.defaults);for(let d in i.renderer){if(!(d in o))throw new Error(`renderer '${d}' does not exist`);if(["options","parser"].includes(d))continue;let p=d,l=i.renderer[p],h=o[p];o[p]=(...f)=>{let v=l.apply(o,f);return v===!1&&(v=h.apply(o,f)),v||""}}s.renderer=o}if(i.tokenizer){let o=this.defaults.tokenizer||new qh(this.defaults);for(let d in i.tokenizer){if(!(d in o))throw new Error(`tokenizer '${d}' does not exist`);if(["options","rules","lexer"].includes(d))continue;let p=d,l=i.tokenizer[p],h=o[p];o[p]=(...f)=>{let v=l.apply(o,f);return v===!1&&(v=h.apply(o,f)),v}}s.tokenizer=o}if(i.hooks){let o=this.defaults.hooks||new Jl;for(let d in i.hooks){if(!(d in o))throw new Error(`hook '${d}' does not exist`);if(["options","block"].includes(d))continue;let p=d,l=i.hooks[p],h=o[p];Jl.passThroughHooks.has(d)?o[p]=f=>{if(this.defaults.async&&Jl.passThroughHooksRespectAsync.has(d))return(async()=>{let m=await l.call(o,f);return h.call(o,m)})();let v=l.call(o,f);return h.call(o,v)}:o[p]=(...f)=>{if(this.defaults.async)return(async()=>{let m=await l.apply(o,f);return m===!1&&(m=await h.apply(o,f)),m})();let v=l.apply(o,f);return v===!1&&(v=h.apply(o,f)),v}}s.hooks=o}if(i.walkTokens){let o=this.defaults.walkTokens,d=i.walkTokens;s.walkTokens=function(p){let l=[];return l.push(d.call(this,p)),o&&(l=l.concat(o.call(this,p))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return tr.lex(e,t??this.defaults)}parser(e,t){return nr.parse(e,t??this.defaults)}parseMarkdown(e){return(t,i)=>{let s={...i},o={...this.defaults,...s},d=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&s.async===!1)return d(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let p=o.hooks?await o.hooks.preprocess(t):t,l=await(o.hooks?await o.hooks.provideLexer():e?tr.lex:tr.lexInline)(p,o),h=o.hooks?await o.hooks.processAllTokens(l):l;o.walkTokens&&await Promise.all(this.walkTokens(h,o.walkTokens));let f=await(o.hooks?await o.hooks.provideParser():e?nr.parse:nr.parseInline)(h,o);return o.hooks?await o.hooks.postprocess(f):f})().catch(d);try{o.hooks&&(t=o.hooks.preprocess(t));let p=(o.hooks?o.hooks.provideLexer():e?tr.lex:tr.lexInline)(t,o);o.hooks&&(p=o.hooks.processAllTokens(p)),o.walkTokens&&this.walkTokens(p,o.walkTokens);let l=(o.hooks?o.hooks.provideParser():e?nr.parse:nr.parseInline)(p,o);return o.hooks&&(l=o.hooks.postprocess(l)),l}catch(p){return d(p)}}}onError(e,t){return i=>{if(i.message+=`
157
+ Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+_r(i.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(i);throw i}}},fa=new QC;function Mt(e,t){return fa.parse(e,t)}Mt.options=Mt.setOptions=function(e){return fa.setOptions(e),Mt.defaults=fa.defaults,UC(Mt.defaults),Mt};Mt.getDefaults=x_;Mt.defaults=_a;Mt.use=function(...e){return fa.use(...e),Mt.defaults=fa.defaults,UC(Mt.defaults),Mt};Mt.walkTokens=function(e,t){return fa.walkTokens(e,t)};Mt.parseInline=fa.parseInline;Mt.Parser=nr;Mt.parser=nr.parse;Mt.Renderer=Kh;Mt.TextRenderer=L_;Mt.Lexer=tr;Mt.lexer=tr.lex;Mt.Tokenizer=qh;Mt.Hooks=Jl;Mt.parse=Mt;Mt.options;Mt.setOptions;Mt.use;Mt.walkTokens;Mt.parseInline;nr.parse;tr.lex;const{entries:e2,setPrototypeOf:Q1,isFrozen:MD,getPrototypeOf:ND,getOwnPropertyDescriptor:OD}=Object;let{freeze:ri,seal:Xi,create:ao}=Object,{apply:mg,construct:gg}=typeof Reflect<"u"&&Reflect;ri||(ri=function(t){return t});Xi||(Xi=function(t){return t});mg||(mg=function(t,i){for(var s=arguments.length,o=new Array(s>2?s-2:0),d=2;d<s;d++)o[d-2]=arguments[d];return t.apply(i,o)});gg||(gg=function(t){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];return new t(...s)});const zl=Sn(Array.prototype.forEach),DD=Sn(Array.prototype.lastIndexOf),eS=Sn(Array.prototype.pop),Hl=Sn(Array.prototype.push),jD=Sn(Array.prototype.splice),ei=Array.isArray,Ql=Sn(String.prototype.toLowerCase),nm=Sn(String.prototype.toString),tS=Sn(String.prototype.match),to=Sn(String.prototype.replace),nS=Sn(String.prototype.indexOf),ID=Sn(String.prototype.trim),BD=Sn(Number.prototype.toString),PD=Sn(Boolean.prototype.toString),iS=typeof BigInt>"u"?null:Sn(BigInt.prototype.toString),rS=typeof Symbol>"u"?null:Sn(Symbol.prototype.toString),ln=Sn(Object.prototype.hasOwnProperty),$l=Sn(Object.prototype.toString),Pn=Sn(RegExp.prototype.test),ih=zD(TypeError);function Sn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];return mg(e,t,s)}}function zD(e){return function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return gg(e,i)}}function Qe(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ql;if(Q1&&Q1(e,null),!ei(t))return e;let s=t.length;for(;s--;){let o=t[s];if(typeof o=="string"){const d=i(o);d!==o&&(MD(t)||(t[s]=d),o=d)}e[o]=!0}return e}function HD(e){for(let t=0;t<e.length;t++)ln(e,t)||(e[t]=null);return e}function mi(e){const t=ao(null);for(const[i,s]of e2(e))ln(e,i)&&(ei(s)?t[i]=HD(s):s&&typeof s=="object"&&s.constructor===Object?t[i]=mi(s):t[i]=s);return t}function $D(e){switch(typeof e){case"string":return e;case"number":return BD(e);case"boolean":return PD(e);case"bigint":return iS?iS(e):"0";case"symbol":return rS?rS(e):"Symbol()";case"undefined":return $l(e);case"function":case"object":{if(e===null)return $l(e);const t=e,i=oo(t,"toString");if(typeof i=="function"){const s=i(t);return typeof s=="string"?s:$l(s)}return $l(e)}default:return $l(e)}}function oo(e,t){for(;e!==null;){const s=OD(e,t);if(s){if(s.get)return Sn(s.get);if(typeof s.value=="function")return Sn(s.value)}e=ND(e)}function i(){return null}return i}function UD(e){try{return Pn(e,""),!0}catch{return!1}}const sS=ri(["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"]),im=ri(["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"]),rm=ri(["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"]),FD=ri(["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"]),sm=ri(["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"]),WD=ri(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),aS=ri(["#text"]),oS=ri(["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"]),am=ri(["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"]),lS=ri(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),rh=ri(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),GD=Xi(/\{\{[\w\W]*|[\w\W]*\}\}/gm),qD=Xi(/<%[\w\W]*|[\w\W]*%>/gm),KD=Xi(/\$\{[\w\W]*/gm),VD=Xi(/^data-[\-\w.\u00B7-\uFFFF]+$/),YD=Xi(/^aria-[\-\w]+$/),t2=Xi(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),XD=Xi(/^(?:\w+script|data):/i),ZD=Xi(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),n2=Xi(/^html$/i),JD=Xi(/^[a-z][.\w]*(-[.\w]+)+$/i);var cS=Object.freeze({__proto__:null,ARIA_ATTR:YD,ATTR_WHITESPACE:ZD,CUSTOM_ELEMENT:JD,DATA_ATTR:VD,DOCTYPE_NAME:n2,ERB_EXPR:qD,IS_ALLOWED_URI:t2,IS_SCRIPT_OR_DATA:XD,MUSTACHE_EXPR:GD,TMPLIT_EXPR:KD});const Ul={element:1,text:3,progressingInstruction:7,comment:8,document:9},QD=function(){return typeof window>"u"?null:window},e8=function(t,i){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null;const o="data-tt-policy-suffix";i&&i.hasAttribute(o)&&(s=i.getAttribute(o));const d="dompurify"+(s?"#"+s:"");try{return t.createPolicy(d,{createHTML(p){return p},createScriptURL(p){return p}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},uS=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function i2(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:QD();const t=Re=>i2(Re);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Ul.document||!e.Element)return t.isSupported=!1,t;let{document:i}=e;const s=i,o=s.currentScript,{DocumentFragment:d,HTMLTemplateElement:p,Node:l,Element:h,NodeFilter:f,NamedNodeMap:v=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:m,DOMParser:S,trustedTypes:C}=e,T=h.prototype,w=oo(T,"cloneNode"),_=oo(T,"remove"),b=oo(T,"nextSibling"),g=oo(T,"childNodes"),y=oo(T,"parentNode");if(typeof p=="function"){const Re=i.createElement("template");Re.content&&Re.content.ownerDocument&&(i=Re.content.ownerDocument)}let k,M="";const{implementation:A,createNodeIterator:N,createDocumentFragment:R,getElementsByTagName:B}=i,{importNode:q}=s;let W=uS();t.isSupported=typeof e2=="function"&&typeof y=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:G,ERB_EXPR:I,TMPLIT_EXPR:K,DATA_ATTR:H,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:Y,ATTR_WHITESPACE:X,CUSTOM_ELEMENT:j}=cS;let{IS_ALLOWED_URI:z}=cS,D=null;const U=Qe({},[...sS,...im,...rm,...sm,...aS]);let V=null;const J=Qe({},[...oS,...am,...lS,...rh]);let le=Object.seal(ao(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}})),pe=null,te=null;const F=Object.seal(ao(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ae=!0,re=!0,ge=!1,de=!0,we=!1,Ie=!0,Ne=!1,Ge=!1,Ee=!1,ct=!1,wt=!1,Xt=!1,Ln=!0,$n=!1;const en="user-content-";let ft=!0,qt=!1,Ht={},yt=null;const Bt=Qe({},["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 vi=null;const Zt=Qe({},["audio","video","img","source","image","track"]);let Mn=null;const dt=Qe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),hn="http://www.w3.org/1998/Math/MathML",Ot="http://www.w3.org/2000/svg",Jt="http://www.w3.org/1999/xhtml";let pt=Jt,bi=!1,Kn=null;const Vr=Qe({},[hn,Ot,Jt],nm);let yi=Qe({},["mi","mo","mn","ms","mtext"]),wn=Qe({},["annotation-xml"]);const Vn=Qe({},["title","style","font","a","script"]);let tn=null;const ee=["application/xhtml+xml","text/html"],_e="text/html";let xe=null,Pe=null;const Ct=i.createElement("form"),mt=function(Z){return Z instanceof RegExp||Z instanceof Function},Le=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Pe&&Pe===Z)return;(!Z||typeof Z!="object")&&(Z={}),Z=mi(Z),tn=ee.indexOf(Z.PARSER_MEDIA_TYPE)===-1?_e:Z.PARSER_MEDIA_TYPE,xe=tn==="application/xhtml+xml"?nm:Ql,D=ln(Z,"ALLOWED_TAGS")&&ei(Z.ALLOWED_TAGS)?Qe({},Z.ALLOWED_TAGS,xe):U,V=ln(Z,"ALLOWED_ATTR")&&ei(Z.ALLOWED_ATTR)?Qe({},Z.ALLOWED_ATTR,xe):J,Kn=ln(Z,"ALLOWED_NAMESPACES")&&ei(Z.ALLOWED_NAMESPACES)?Qe({},Z.ALLOWED_NAMESPACES,nm):Vr,Mn=ln(Z,"ADD_URI_SAFE_ATTR")&&ei(Z.ADD_URI_SAFE_ATTR)?Qe(mi(dt),Z.ADD_URI_SAFE_ATTR,xe):dt,vi=ln(Z,"ADD_DATA_URI_TAGS")&&ei(Z.ADD_DATA_URI_TAGS)?Qe(mi(Zt),Z.ADD_DATA_URI_TAGS,xe):Zt,yt=ln(Z,"FORBID_CONTENTS")&&ei(Z.FORBID_CONTENTS)?Qe({},Z.FORBID_CONTENTS,xe):Bt,pe=ln(Z,"FORBID_TAGS")&&ei(Z.FORBID_TAGS)?Qe({},Z.FORBID_TAGS,xe):mi({}),te=ln(Z,"FORBID_ATTR")&&ei(Z.FORBID_ATTR)?Qe({},Z.FORBID_ATTR,xe):mi({}),Ht=ln(Z,"USE_PROFILES")?Z.USE_PROFILES&&typeof Z.USE_PROFILES=="object"?mi(Z.USE_PROFILES):Z.USE_PROFILES:!1,ae=Z.ALLOW_ARIA_ATTR!==!1,re=Z.ALLOW_DATA_ATTR!==!1,ge=Z.ALLOW_UNKNOWN_PROTOCOLS||!1,de=Z.ALLOW_SELF_CLOSE_IN_ATTR!==!1,we=Z.SAFE_FOR_TEMPLATES||!1,Ie=Z.SAFE_FOR_XML!==!1,Ne=Z.WHOLE_DOCUMENT||!1,ct=Z.RETURN_DOM||!1,wt=Z.RETURN_DOM_FRAGMENT||!1,Xt=Z.RETURN_TRUSTED_TYPE||!1,Ee=Z.FORCE_BODY||!1,Ln=Z.SANITIZE_DOM!==!1,$n=Z.SANITIZE_NAMED_PROPS||!1,ft=Z.KEEP_CONTENT!==!1,qt=Z.IN_PLACE||!1,z=UD(Z.ALLOWED_URI_REGEXP)?Z.ALLOWED_URI_REGEXP:t2,pt=typeof Z.NAMESPACE=="string"?Z.NAMESPACE:Jt,yi=ln(Z,"MATHML_TEXT_INTEGRATION_POINTS")&&Z.MATHML_TEXT_INTEGRATION_POINTS&&typeof Z.MATHML_TEXT_INTEGRATION_POINTS=="object"?mi(Z.MATHML_TEXT_INTEGRATION_POINTS):Qe({},["mi","mo","mn","ms","mtext"]),wn=ln(Z,"HTML_INTEGRATION_POINTS")&&Z.HTML_INTEGRATION_POINTS&&typeof Z.HTML_INTEGRATION_POINTS=="object"?mi(Z.HTML_INTEGRATION_POINTS):Qe({},["annotation-xml"]);const ve=ln(Z,"CUSTOM_ELEMENT_HANDLING")&&Z.CUSTOM_ELEMENT_HANDLING&&typeof Z.CUSTOM_ELEMENT_HANDLING=="object"?mi(Z.CUSTOM_ELEMENT_HANDLING):ao(null);if(le=ao(null),ln(ve,"tagNameCheck")&&mt(ve.tagNameCheck)&&(le.tagNameCheck=ve.tagNameCheck),ln(ve,"attributeNameCheck")&&mt(ve.attributeNameCheck)&&(le.attributeNameCheck=ve.attributeNameCheck),ln(ve,"allowCustomizedBuiltInElements")&&typeof ve.allowCustomizedBuiltInElements=="boolean"&&(le.allowCustomizedBuiltInElements=ve.allowCustomizedBuiltInElements),we&&(re=!1),wt&&(ct=!0),Ht&&(D=Qe({},aS),V=ao(null),Ht.html===!0&&(Qe(D,sS),Qe(V,oS)),Ht.svg===!0&&(Qe(D,im),Qe(V,am),Qe(V,rh)),Ht.svgFilters===!0&&(Qe(D,rm),Qe(V,am),Qe(V,rh)),Ht.mathMl===!0&&(Qe(D,sm),Qe(V,lS),Qe(V,rh))),F.tagCheck=null,F.attributeCheck=null,ln(Z,"ADD_TAGS")&&(typeof Z.ADD_TAGS=="function"?F.tagCheck=Z.ADD_TAGS:ei(Z.ADD_TAGS)&&(D===U&&(D=mi(D)),Qe(D,Z.ADD_TAGS,xe))),ln(Z,"ADD_ATTR")&&(typeof Z.ADD_ATTR=="function"?F.attributeCheck=Z.ADD_ATTR:ei(Z.ADD_ATTR)&&(V===J&&(V=mi(V)),Qe(V,Z.ADD_ATTR,xe))),ln(Z,"ADD_URI_SAFE_ATTR")&&ei(Z.ADD_URI_SAFE_ATTR)&&Qe(Mn,Z.ADD_URI_SAFE_ATTR,xe),ln(Z,"FORBID_CONTENTS")&&ei(Z.FORBID_CONTENTS)&&(yt===Bt&&(yt=mi(yt)),Qe(yt,Z.FORBID_CONTENTS,xe)),ln(Z,"ADD_FORBID_CONTENTS")&&ei(Z.ADD_FORBID_CONTENTS)&&(yt===Bt&&(yt=mi(yt)),Qe(yt,Z.ADD_FORBID_CONTENTS,xe)),ft&&(D["#text"]=!0),Ne&&Qe(D,["html","head","body"]),D.table&&(Qe(D,["tbody"]),delete pe.tbody),Z.TRUSTED_TYPES_POLICY){if(typeof Z.TRUSTED_TYPES_POLICY.createHTML!="function")throw ih('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Z.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ih('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');k=Z.TRUSTED_TYPES_POLICY,M=k.createHTML("")}else k===void 0&&(k=e8(C,o)),k!==null&&typeof M=="string"&&(M=k.createHTML(""));ri&&ri(Z),Pe=Z},Te=Qe({},[...im,...rm,...FD]),ze=Qe({},[...sm,...WD]),Pt=function(Z){let ve=y(Z);(!ve||!ve.tagName)&&(ve={namespaceURI:pt,tagName:"template"});const ke=Ql(Z.tagName),et=Ql(ve.tagName);return Kn[Z.namespaceURI]?Z.namespaceURI===Ot?ve.namespaceURI===Jt?ke==="svg":ve.namespaceURI===hn?ke==="svg"&&(et==="annotation-xml"||yi[et]):!!Te[ke]:Z.namespaceURI===hn?ve.namespaceURI===Jt?ke==="math":ve.namespaceURI===Ot?ke==="math"&&wn[et]:!!ze[ke]:Z.namespaceURI===Jt?ve.namespaceURI===Ot&&!wn[et]||ve.namespaceURI===hn&&!yi[et]?!1:!ze[ke]&&(Vn[ke]||!Te[ke]):!!(tn==="application/xhtml+xml"&&Kn[Z.namespaceURI]):!1},he=function(Z){Hl(t.removed,{element:Z});try{y(Z).removeChild(Z)}catch{_(Z)}},qe=function(Z,ve){try{Hl(t.removed,{attribute:ve.getAttributeNode(Z),from:ve})}catch{Hl(t.removed,{attribute:null,from:ve})}if(ve.removeAttribute(Z),Z==="is")if(ct||wt)try{he(ve)}catch{}else try{ve.setAttribute(Z,"")}catch{}},Dt=function(Z){let ve=null,ke=null;if(Ee)Z="<remove></remove>"+Z;else{const jt=tS(Z,/^[\r\n\t ]+/);ke=jt&&jt[0]}tn==="application/xhtml+xml"&&pt===Jt&&(Z='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Z+"</body></html>");const et=k?k.createHTML(Z):Z;if(pt===Jt)try{ve=new S().parseFromString(et,tn)}catch{}if(!ve||!ve.documentElement){ve=A.createDocument(pt,"template",null);try{ve.documentElement.innerHTML=bi?M:et}catch{}}const tt=ve.body||ve.documentElement;return Z&&ke&&tt.insertBefore(i.createTextNode(ke),tt.childNodes[0]||null),pt===Jt?B.call(ve,Ne?"html":"body")[0]:Ne?ve.documentElement:tt},nt=function(Z){return N.call(Z.ownerDocument||Z,Z,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT|f.SHOW_PROCESSING_INSTRUCTION|f.SHOW_CDATA_SECTION,null)},Ae=function(Z){return Z instanceof m&&(typeof Z.nodeName!="string"||typeof Z.textContent!="string"||typeof Z.removeChild!="function"||!(Z.attributes instanceof v)||typeof Z.removeAttribute!="function"||typeof Z.setAttribute!="function"||typeof Z.namespaceURI!="string"||typeof Z.insertBefore!="function"||typeof Z.hasChildNodes!="function")},We=function(Z){return typeof l=="function"&&Z instanceof l};function Xe(Re,Z,ve){zl(Re,ke=>{ke.call(t,Z,ve,Pe)})}const pn=function(Z){let ve=null;if(Xe(W.beforeSanitizeElements,Z,null),Ae(Z))return he(Z),!0;const ke=xe(Z.nodeName);if(Xe(W.uponSanitizeElement,Z,{tagName:ke,allowedTags:D}),Ie&&Z.hasChildNodes()&&!We(Z.firstElementChild)&&Pn(/<[/\w!]/g,Z.innerHTML)&&Pn(/<[/\w!]/g,Z.textContent)||Ie&&Z.namespaceURI===Jt&&ke==="style"&&We(Z.firstElementChild)||Z.nodeType===Ul.progressingInstruction||Ie&&Z.nodeType===Ul.comment&&Pn(/<[/\w]/g,Z.data))return he(Z),!0;if(pe[ke]||!(F.tagCheck instanceof Function&&F.tagCheck(ke))&&!D[ke]){if(!pe[ke]&&Xn(ke)&&(le.tagNameCheck instanceof RegExp&&Pn(le.tagNameCheck,ke)||le.tagNameCheck instanceof Function&&le.tagNameCheck(ke)))return!1;if(ft&&!yt[ke]){const et=y(Z)||Z.parentNode,tt=g(Z)||Z.childNodes;if(tt&&et){const jt=tt.length;for(let nn=jt-1;nn>=0;--nn){const rn=w(tt[nn],!0);et.insertBefore(rn,b(Z))}}}return he(Z),!0}return Z instanceof h&&!Pt(Z)||(ke==="noscript"||ke==="noembed"||ke==="noframes")&&Pn(/<\/no(script|embed|frames)/i,Z.innerHTML)?(he(Z),!0):(we&&Z.nodeType===Ul.text&&(ve=Z.textContent,zl([G,I,K],et=>{ve=to(ve,et," ")}),Z.textContent!==ve&&(Hl(t.removed,{element:Z.cloneNode()}),Z.textContent=ve)),Xe(W.afterSanitizeElements,Z,null),!1)},Yn=function(Z,ve,ke){if(te[ve]||Ln&&(ve==="id"||ve==="name")&&(ke in i||ke in Ct))return!1;const et=V[ve]||F.attributeCheck instanceof Function&&F.attributeCheck(ve,Z);if(!(re&&!te[ve]&&Pn(H,ve))){if(!(ae&&Pn(P,ve))){if(!et||te[ve]){if(!(Xn(Z)&&(le.tagNameCheck instanceof RegExp&&Pn(le.tagNameCheck,Z)||le.tagNameCheck instanceof Function&&le.tagNameCheck(Z))&&(le.attributeNameCheck instanceof RegExp&&Pn(le.attributeNameCheck,ve)||le.attributeNameCheck instanceof Function&&le.attributeNameCheck(ve,Z))||ve==="is"&&le.allowCustomizedBuiltInElements&&(le.tagNameCheck instanceof RegExp&&Pn(le.tagNameCheck,ke)||le.tagNameCheck instanceof Function&&le.tagNameCheck(ke))))return!1}else if(!Mn[ve]){if(!Pn(z,to(ke,X,""))){if(!((ve==="src"||ve==="xlink:href"||ve==="href")&&Z!=="script"&&nS(ke,"data:")===0&&vi[Z])){if(!(ge&&!Pn(Y,to(ke,X,"")))){if(ke)return!1}}}}}}return!0},ji=Qe({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Xn=function(Z){return!ji[Ql(Z)]&&Pn(j,Z)},hr=function(Z){Xe(W.beforeSanitizeAttributes,Z,null);const{attributes:ve}=Z;if(!ve||Ae(Z))return;const ke={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:V,forceKeepAttr:void 0};let et=ve.length;for(;et--;){const tt=ve[et],{name:jt,namespaceURI:nn,value:rn}=tt,Se=xe(jt),je=rn;let Be=jt==="value"?je:ID(je);if(ke.attrName=Se,ke.attrValue=Be,ke.keepAttr=!0,ke.forceKeepAttr=void 0,Xe(W.uponSanitizeAttribute,Z,ke),Be=ke.attrValue,$n&&(Se==="id"||Se==="name")&&nS(Be,en)!==0&&(qe(jt,Z),Be=en+Be),Ie&&Pn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Be)){qe(jt,Z);continue}if(Se==="attributename"&&tS(Be,"href")){qe(jt,Z);continue}if(ke.forceKeepAttr)continue;if(!ke.keepAttr){qe(jt,Z);continue}if(!de&&Pn(/\/>/i,Be)){qe(jt,Z);continue}we&&zl([G,I,K],Kt=>{Be=to(Be,Kt," ")});const gt=xe(Z.nodeName);if(!Yn(gt,Se,Be)){qe(jt,Z);continue}if(k&&typeof C=="object"&&typeof C.getAttributeType=="function"&&!nn)switch(C.getAttributeType(gt,Se)){case"TrustedHTML":{Be=k.createHTML(Be);break}case"TrustedScriptURL":{Be=k.createScriptURL(Be);break}}if(Be!==je)try{nn?Z.setAttributeNS(nn,jt,Be):Z.setAttribute(jt,Be),Ae(Z)?he(Z):eS(t.removed)}catch{qe(jt,Z)}}Xe(W.afterSanitizeAttributes,Z,null)},Zn=function(Z){let ve=null;const ke=nt(Z);for(Xe(W.beforeSanitizeShadowDOM,Z,null);ve=ke.nextNode();)Xe(W.uponSanitizeShadowNode,ve,null),pn(ve),hr(ve),ve.content instanceof d&&Zn(ve.content);Xe(W.afterSanitizeShadowDOM,Z,null)};return t.sanitize=function(Re){let Z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ve=null,ke=null,et=null,tt=null;if(bi=!Re,bi&&(Re="<!-->"),typeof Re!="string"&&!We(Re)&&(Re=$D(Re),typeof Re!="string"))throw ih("dirty is not a string, aborting");if(!t.isSupported)return Re;if(Ge||Le(Z),t.removed=[],typeof Re=="string"&&(qt=!1),qt){const rn=Re.nodeName;if(typeof rn=="string"){const Se=xe(rn);if(!D[Se]||pe[Se])throw ih("root node is forbidden and cannot be sanitized in-place")}}else if(Re instanceof l)ve=Dt("<!---->"),ke=ve.ownerDocument.importNode(Re,!0),ke.nodeType===Ul.element&&ke.nodeName==="BODY"||ke.nodeName==="HTML"?ve=ke:ve.appendChild(ke);else{if(!ct&&!we&&!Ne&&Re.indexOf("<")===-1)return k&&Xt?k.createHTML(Re):Re;if(ve=Dt(Re),!ve)return ct?null:Xt?M:""}ve&&Ee&&he(ve.firstChild);const jt=nt(qt?Re:ve);for(;et=jt.nextNode();)pn(et),hr(et),et.content instanceof d&&Zn(et.content);if(qt)return Re;if(ct){if(we){ve.normalize();let rn=ve.innerHTML;zl([G,I,K],Se=>{rn=to(rn,Se," ")}),ve.innerHTML=rn}if(wt)for(tt=R.call(ve.ownerDocument);ve.firstChild;)tt.appendChild(ve.firstChild);else tt=ve;return(V.shadowroot||V.shadowrootmode)&&(tt=q.call(s,tt,!0)),tt}let nn=Ne?ve.outerHTML:ve.innerHTML;return Ne&&D["!doctype"]&&ve.ownerDocument&&ve.ownerDocument.doctype&&ve.ownerDocument.doctype.name&&Pn(n2,ve.ownerDocument.doctype.name)&&(nn="<!DOCTYPE "+ve.ownerDocument.doctype.name+`>
158
+ `+nn),we&&zl([G,I,K],rn=>{nn=to(nn,rn," ")}),k&&Xt?k.createHTML(nn):nn},t.setConfig=function(){let Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Le(Re),Ge=!0},t.clearConfig=function(){Pe=null,Ge=!1},t.isValidAttribute=function(Re,Z,ve){Pe||Le({});const ke=xe(Re),et=xe(Z);return Yn(ke,et,ve)},t.addHook=function(Re,Z){typeof Z=="function"&&Hl(W[Re],Z)},t.removeHook=function(Re,Z){if(Z!==void 0){const ve=DD(W[Re],Z);return ve===-1?void 0:jD(W[Re],ve,1)[0]}return eS(W[Re])},t.removeHooks=function(Re){W[Re]=[]},t.removeAllHooks=function(){W=uS()},t}var oc=i2(),om,hS;function t8(){if(hS)return om;hS=1;function e(ee){return ee instanceof Map?ee.clear=ee.delete=ee.set=function(){throw new Error("map is read-only")}:ee instanceof Set&&(ee.add=ee.clear=ee.delete=function(){throw new Error("set is read-only")}),Object.freeze(ee),Object.getOwnPropertyNames(ee).forEach(_e=>{const xe=ee[_e],Pe=typeof xe;(Pe==="object"||Pe==="function")&&!Object.isFrozen(xe)&&e(xe)}),ee}class t{constructor(_e){_e.data===void 0&&(_e.data={}),this.data=_e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function i(ee){return ee.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function s(ee,..._e){const xe=Object.create(null);for(const Pe in ee)xe[Pe]=ee[Pe];return _e.forEach(function(Pe){for(const Ct in Pe)xe[Ct]=Pe[Ct]}),xe}const o="</span>",d=ee=>!!ee.scope,p=(ee,{prefix:_e})=>{if(ee.startsWith("language:"))return ee.replace("language:","language-");if(ee.includes(".")){const xe=ee.split(".");return[`${_e}${xe.shift()}`,...xe.map((Pe,Ct)=>`${Pe}${"_".repeat(Ct+1)}`)].join(" ")}return`${_e}${ee}`};class l{constructor(_e,xe){this.buffer="",this.classPrefix=xe.classPrefix,_e.walk(this)}addText(_e){this.buffer+=i(_e)}openNode(_e){if(!d(_e))return;const xe=p(_e.scope,{prefix:this.classPrefix});this.span(xe)}closeNode(_e){d(_e)&&(this.buffer+=o)}value(){return this.buffer}span(_e){this.buffer+=`<span class="${_e}">`}}const h=(ee={})=>{const _e={children:[]};return Object.assign(_e,ee),_e};class f{constructor(){this.rootNode=h(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(_e){this.top.children.push(_e)}openNode(_e){const xe=h({scope:_e});this.add(xe),this.stack.push(xe)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(_e){return this.constructor._walk(_e,this.rootNode)}static _walk(_e,xe){return typeof xe=="string"?_e.addText(xe):xe.children&&(_e.openNode(xe),xe.children.forEach(Pe=>this._walk(_e,Pe)),_e.closeNode(xe)),_e}static _collapse(_e){typeof _e!="string"&&_e.children&&(_e.children.every(xe=>typeof xe=="string")?_e.children=[_e.children.join("")]:_e.children.forEach(xe=>{f._collapse(xe)}))}}class v extends f{constructor(_e){super(),this.options=_e}addText(_e){_e!==""&&this.add(_e)}startScope(_e){this.openNode(_e)}endScope(){this.closeNode()}__addSublanguage(_e,xe){const Pe=_e.root;xe&&(Pe.scope=`language:${xe}`),this.add(Pe)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function m(ee){return ee?typeof ee=="string"?ee:ee.source:null}function S(ee){return w("(?=",ee,")")}function C(ee){return w("(?:",ee,")*")}function T(ee){return w("(?:",ee,")?")}function w(...ee){return ee.map(xe=>m(xe)).join("")}function _(ee){const _e=ee[ee.length-1];return typeof _e=="object"&&_e.constructor===Object?(ee.splice(ee.length-1,1),_e):{}}function b(...ee){return"("+(_(ee).capture?"":"?:")+ee.map(Pe=>m(Pe)).join("|")+")"}function g(ee){return new RegExp(ee.toString()+"|").exec("").length-1}function y(ee,_e){const xe=ee&&ee.exec(_e);return xe&&xe.index===0}const k=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function M(ee,{joinWith:_e}){let xe=0;return ee.map(Pe=>{xe+=1;const Ct=xe;let mt=m(Pe),Le="";for(;mt.length>0;){const Te=k.exec(mt);if(!Te){Le+=mt;break}Le+=mt.substring(0,Te.index),mt=mt.substring(Te.index+Te[0].length),Te[0][0]==="\\"&&Te[1]?Le+="\\"+String(Number(Te[1])+Ct):(Le+=Te[0],Te[0]==="("&&xe++)}return Le}).map(Pe=>`(${Pe})`).join(_e)}const A=/\b\B/,N="[a-zA-Z]\\w*",R="[a-zA-Z_]\\w*",B="\\b\\d+(\\.\\d+)?",q="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",W="\\b(0b[01]+)",G="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",I=(ee={})=>{const _e=/^#![ ]*\//;return ee.binary&&(ee.begin=w(_e,/.*\b/,ee.binary,/\b.*/)),s({scope:"meta",begin:_e,end:/$/,relevance:0,"on:begin":(xe,Pe)=>{xe.index!==0&&Pe.ignoreMatch()}},ee)},K={begin:"\\\\[\\s\\S]",relevance:0},H={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[K]},P={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[K]},Y={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/},X=function(ee,_e,xe={}){const Pe=s({scope:"comment",begin:ee,end:_e,contains:[]},xe);Pe.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Ct=b("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return Pe.contains.push({begin:w(/[ ]+/,"(",Ct,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),Pe},j=X("//","$"),z=X("/\\*","\\*/"),D=X("#","$"),U={scope:"number",begin:B,relevance:0},V={scope:"number",begin:q,relevance:0},J={scope:"number",begin:W,relevance:0},le={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[K,{begin:/\[/,end:/\]/,relevance:0,contains:[K]}]},pe={scope:"title",begin:N,relevance:0},te={scope:"title",begin:R,relevance:0},F={begin:"\\.\\s*"+R,relevance:0};var re=Object.freeze({__proto__:null,APOS_STRING_MODE:H,BACKSLASH_ESCAPE:K,BINARY_NUMBER_MODE:J,BINARY_NUMBER_RE:W,COMMENT:X,C_BLOCK_COMMENT_MODE:z,C_LINE_COMMENT_MODE:j,C_NUMBER_MODE:V,C_NUMBER_RE:q,END_SAME_AS_BEGIN:function(ee){return Object.assign(ee,{"on:begin":(_e,xe)=>{xe.data._beginMatch=_e[1]},"on:end":(_e,xe)=>{xe.data._beginMatch!==_e[1]&&xe.ignoreMatch()}})},HASH_COMMENT_MODE:D,IDENT_RE:N,MATCH_NOTHING_RE:A,METHOD_GUARD:F,NUMBER_MODE:U,NUMBER_RE:B,PHRASAL_WORDS_MODE:Y,QUOTE_STRING_MODE:P,REGEXP_MODE:le,RE_STARTERS_RE:G,SHEBANG:I,TITLE_MODE:pe,UNDERSCORE_IDENT_RE:R,UNDERSCORE_TITLE_MODE:te});function ge(ee,_e){ee.input[ee.index-1]==="."&&_e.ignoreMatch()}function de(ee,_e){ee.className!==void 0&&(ee.scope=ee.className,delete ee.className)}function we(ee,_e){_e&&ee.beginKeywords&&(ee.begin="\\b("+ee.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",ee.__beforeBegin=ge,ee.keywords=ee.keywords||ee.beginKeywords,delete ee.beginKeywords,ee.relevance===void 0&&(ee.relevance=0))}function Ie(ee,_e){Array.isArray(ee.illegal)&&(ee.illegal=b(...ee.illegal))}function Ne(ee,_e){if(ee.match){if(ee.begin||ee.end)throw new Error("begin & end are not supported with match");ee.begin=ee.match,delete ee.match}}function Ge(ee,_e){ee.relevance===void 0&&(ee.relevance=1)}const Ee=(ee,_e)=>{if(!ee.beforeMatch)return;if(ee.starts)throw new Error("beforeMatch cannot be used with starts");const xe=Object.assign({},ee);Object.keys(ee).forEach(Pe=>{delete ee[Pe]}),ee.keywords=xe.keywords,ee.begin=w(xe.beforeMatch,S(xe.begin)),ee.starts={relevance:0,contains:[Object.assign(xe,{endsParent:!0})]},ee.relevance=0,delete xe.beforeMatch},ct=["of","and","for","in","not","or","if","then","parent","list","value"],wt="keyword";function Xt(ee,_e,xe=wt){const Pe=Object.create(null);return typeof ee=="string"?Ct(xe,ee.split(" ")):Array.isArray(ee)?Ct(xe,ee):Object.keys(ee).forEach(function(mt){Object.assign(Pe,Xt(ee[mt],_e,mt))}),Pe;function Ct(mt,Le){_e&&(Le=Le.map(Te=>Te.toLowerCase())),Le.forEach(function(Te){const ze=Te.split("|");Pe[ze[0]]=[mt,Ln(ze[0],ze[1])]})}}function Ln(ee,_e){return _e?Number(_e):$n(ee)?0:1}function $n(ee){return ct.includes(ee.toLowerCase())}const en={},ft=ee=>{console.error(ee)},qt=(ee,..._e)=>{console.log(`WARN: ${ee}`,..._e)},Ht=(ee,_e)=>{en[`${ee}/${_e}`]||(console.log(`Deprecated as of ${ee}. ${_e}`),en[`${ee}/${_e}`]=!0)},yt=new Error;function Bt(ee,_e,{key:xe}){let Pe=0;const Ct=ee[xe],mt={},Le={};for(let Te=1;Te<=_e.length;Te++)Le[Te+Pe]=Ct[Te],mt[Te+Pe]=!0,Pe+=g(_e[Te-1]);ee[xe]=Le,ee[xe]._emit=mt,ee[xe]._multi=!0}function vi(ee){if(Array.isArray(ee.begin)){if(ee.skip||ee.excludeBegin||ee.returnBegin)throw ft("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),yt;if(typeof ee.beginScope!="object"||ee.beginScope===null)throw ft("beginScope must be object"),yt;Bt(ee,ee.begin,{key:"beginScope"}),ee.begin=M(ee.begin,{joinWith:""})}}function Zt(ee){if(Array.isArray(ee.end)){if(ee.skip||ee.excludeEnd||ee.returnEnd)throw ft("skip, excludeEnd, returnEnd not compatible with endScope: {}"),yt;if(typeof ee.endScope!="object"||ee.endScope===null)throw ft("endScope must be object"),yt;Bt(ee,ee.end,{key:"endScope"}),ee.end=M(ee.end,{joinWith:""})}}function Mn(ee){ee.scope&&typeof ee.scope=="object"&&ee.scope!==null&&(ee.beginScope=ee.scope,delete ee.scope)}function dt(ee){Mn(ee),typeof ee.beginScope=="string"&&(ee.beginScope={_wrap:ee.beginScope}),typeof ee.endScope=="string"&&(ee.endScope={_wrap:ee.endScope}),vi(ee),Zt(ee)}function hn(ee){function _e(Le,Te){return new RegExp(m(Le),"m"+(ee.case_insensitive?"i":"")+(ee.unicodeRegex?"u":"")+(Te?"g":""))}class xe{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Te,ze){ze.position=this.position++,this.matchIndexes[this.matchAt]=ze,this.regexes.push([ze,Te]),this.matchAt+=g(Te)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Te=this.regexes.map(ze=>ze[1]);this.matcherRe=_e(M(Te,{joinWith:"|"}),!0),this.lastIndex=0}exec(Te){this.matcherRe.lastIndex=this.lastIndex;const ze=this.matcherRe.exec(Te);if(!ze)return null;const Pt=ze.findIndex((qe,Dt)=>Dt>0&&qe!==void 0),he=this.matchIndexes[Pt];return ze.splice(0,Pt),Object.assign(ze,he)}}class Pe{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Te){if(this.multiRegexes[Te])return this.multiRegexes[Te];const ze=new xe;return this.rules.slice(Te).forEach(([Pt,he])=>ze.addRule(Pt,he)),ze.compile(),this.multiRegexes[Te]=ze,ze}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Te,ze){this.rules.push([Te,ze]),ze.type==="begin"&&this.count++}exec(Te){const ze=this.getMatcher(this.regexIndex);ze.lastIndex=this.lastIndex;let Pt=ze.exec(Te);if(this.resumingScanAtSamePosition()&&!(Pt&&Pt.index===this.lastIndex)){const he=this.getMatcher(0);he.lastIndex=this.lastIndex+1,Pt=he.exec(Te)}return Pt&&(this.regexIndex+=Pt.position+1,this.regexIndex===this.count&&this.considerAll()),Pt}}function Ct(Le){const Te=new Pe;return Le.contains.forEach(ze=>Te.addRule(ze.begin,{rule:ze,type:"begin"})),Le.terminatorEnd&&Te.addRule(Le.terminatorEnd,{type:"end"}),Le.illegal&&Te.addRule(Le.illegal,{type:"illegal"}),Te}function mt(Le,Te){const ze=Le;if(Le.isCompiled)return ze;[de,Ne,dt,Ee].forEach(he=>he(Le,Te)),ee.compilerExtensions.forEach(he=>he(Le,Te)),Le.__beforeBegin=null,[we,Ie,Ge].forEach(he=>he(Le,Te)),Le.isCompiled=!0;let Pt=null;return typeof Le.keywords=="object"&&Le.keywords.$pattern&&(Le.keywords=Object.assign({},Le.keywords),Pt=Le.keywords.$pattern,delete Le.keywords.$pattern),Pt=Pt||/\w+/,Le.keywords&&(Le.keywords=Xt(Le.keywords,ee.case_insensitive)),ze.keywordPatternRe=_e(Pt,!0),Te&&(Le.begin||(Le.begin=/\B|\b/),ze.beginRe=_e(ze.begin),!Le.end&&!Le.endsWithParent&&(Le.end=/\B|\b/),Le.end&&(ze.endRe=_e(ze.end)),ze.terminatorEnd=m(ze.end)||"",Le.endsWithParent&&Te.terminatorEnd&&(ze.terminatorEnd+=(Le.end?"|":"")+Te.terminatorEnd)),Le.illegal&&(ze.illegalRe=_e(Le.illegal)),Le.contains||(Le.contains=[]),Le.contains=[].concat(...Le.contains.map(function(he){return Jt(he==="self"?Le:he)})),Le.contains.forEach(function(he){mt(he,ze)}),Le.starts&&mt(Le.starts,Te),ze.matcher=Ct(ze),ze}if(ee.compilerExtensions||(ee.compilerExtensions=[]),ee.contains&&ee.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return ee.classNameAliases=s(ee.classNameAliases||{}),mt(ee)}function Ot(ee){return ee?ee.endsWithParent||Ot(ee.starts):!1}function Jt(ee){return ee.variants&&!ee.cachedVariants&&(ee.cachedVariants=ee.variants.map(function(_e){return s(ee,{variants:null},_e)})),ee.cachedVariants?ee.cachedVariants:Ot(ee)?s(ee,{starts:ee.starts?s(ee.starts):null}):Object.isFrozen(ee)?s(ee):ee}var pt="11.11.1";class bi extends Error{constructor(_e,xe){super(_e),this.name="HTMLInjectionError",this.html=xe}}const Kn=i,Vr=s,yi=Symbol("nomatch"),wn=7,Vn=function(ee){const _e=Object.create(null),xe=Object.create(null),Pe=[];let Ct=!0;const mt="Could not find the language '{}', did you forget to load/include a language module?",Le={disableAutodetect:!0,name:"Plain text",contains:[]};let Te={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:v};function ze(Se){return Te.noHighlightRe.test(Se)}function Pt(Se){let je=Se.className+" ";je+=Se.parentNode?Se.parentNode.className:"";const Be=Te.languageDetectRe.exec(je);if(Be){const gt=Z(Be[1]);return gt||(qt(mt.replace("{}",Be[1])),qt("Falling back to no-highlight mode for this block.",Se)),gt?Be[1]:"no-highlight"}return je.split(/\s+/).find(gt=>ze(gt)||Z(gt))}function he(Se,je,Be){let gt="",Kt="";typeof je=="object"?(gt=Se,Be=je.ignoreIllegals,Kt=je.language):(Ht("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ht("10.7.0",`Please use highlight(code, options) instead.
159
+ https://github.com/highlightjs/highlight.js/issues/2277`),Kt=Se,gt=je),Be===void 0&&(Be=!0);const Un={code:gt,language:Kt};nn("before:highlight",Un);const Si=Un.result?Un.result:qe(Un.language,Un.code,Be);return Si.code=Un.code,nn("after:highlight",Si),Si}function qe(Se,je,Be,gt){const Kt=Object.create(null);function Un(Ce,Oe){return Ce.keywords[Oe]}function Si(){if(!Fe.keywords){mn.addText(Et);return}let Ce=0;Fe.keywordPatternRe.lastIndex=0;let Oe=Fe.keywordPatternRe.exec(Et),Ve="";for(;Oe;){Ve+=Et.substring(Ce,Oe.index);const at=Nn.case_insensitive?Oe[0].toLowerCase():Oe[0],Qt=Un(Fe,at);if(Qt){const[Ii,$o]=Qt;if(mn.addText(Ve),Ve="",Kt[at]=(Kt[at]||0)+1,Kt[at]<=wn&&(Yr+=$o),Ii.startsWith("_"))Ve+=Oe[0];else{const Ic=Nn.classNameAliases[Ii]||Ii;xi(Oe[0],Ic)}}else Ve+=Oe[0];Ce=Fe.keywordPatternRe.lastIndex,Oe=Fe.keywordPatternRe.exec(Et)}Ve+=Et.substring(Ce),mn.addText(Ve)}function ai(){if(Et==="")return;let Ce=null;if(typeof Fe.subLanguage=="string"){if(!_e[Fe.subLanguage]){mn.addText(Et);return}Ce=qe(Fe.subLanguage,Et,!0,jc[Fe.subLanguage]),jc[Fe.subLanguage]=Ce._top}else Ce=nt(Et,Fe.subLanguage.length?Fe.subLanguage:null);Fe.relevance>0&&(Yr+=Ce.relevance),mn.__addSublanguage(Ce._emitter,Ce.language)}function zt(){Fe.subLanguage!=null?ai():Si(),Et=""}function xi(Ce,Oe){Ce!==""&&(mn.startScope(Oe),mn.addText(Ce),mn.endScope())}function Oc(Ce,Oe){let Ve=1;const at=Oe.length-1;for(;Ve<=at;){if(!Ce._emit[Ve]){Ve++;continue}const Qt=Nn.classNameAliases[Ce[Ve]]||Ce[Ve],Ii=Oe[Ve];Qt?xi(Ii,Qt):(Et=Ii,Si(),Et=""),Ve++}}function ba(Ce,Oe){return Ce.scope&&typeof Ce.scope=="string"&&mn.openNode(Nn.classNameAliases[Ce.scope]||Ce.scope),Ce.beginScope&&(Ce.beginScope._wrap?(xi(Et,Nn.classNameAliases[Ce.beginScope._wrap]||Ce.beginScope._wrap),Et=""):Ce.beginScope._multi&&(Oc(Ce.beginScope,Oe),Et="")),Fe=Object.create(Ce,{parent:{value:Fe}}),Fe}function Po(Ce,Oe,Ve){let at=y(Ce.endRe,Ve);if(at){if(Ce["on:end"]){const Qt=new t(Ce);Ce["on:end"](Oe,Qt),Qt.isMatchIgnored&&(at=!1)}if(at){for(;Ce.endsParent&&Ce.parent;)Ce=Ce.parent;return Ce}}if(Ce.endsWithParent)return Po(Ce.parent,Oe,Ve)}function ya(Ce){return Fe.matcher.regexIndex===0?(Et+=Ce[0],1):(Xr=!0,0)}function Cd(Ce){const Oe=Ce[0],Ve=Ce.rule,at=new t(Ve),Qt=[Ve.__beforeBegin,Ve["on:begin"]];for(const Ii of Qt)if(Ii&&(Ii(Ce,at),at.isMatchIgnored))return ya(Oe);return Ve.skip?Et+=Oe:(Ve.excludeBegin&&(Et+=Oe),zt(),!Ve.returnBegin&&!Ve.excludeBegin&&(Et=Oe)),ba(Ve,Ce),Ve.returnBegin?0:Oe.length}function oi(Ce){const Oe=Ce[0],Ve=je.substring(Ce.index),at=Po(Fe,Ce,Ve);if(!at)return yi;const Qt=Fe;Fe.endScope&&Fe.endScope._wrap?(zt(),xi(Oe,Fe.endScope._wrap)):Fe.endScope&&Fe.endScope._multi?(zt(),Oc(Fe.endScope,Ce)):Qt.skip?Et+=Oe:(Qt.returnEnd||Qt.excludeEnd||(Et+=Oe),zt(),Qt.excludeEnd&&(Et=Oe));do Fe.scope&&mn.closeNode(),!Fe.skip&&!Fe.subLanguage&&(Yr+=Fe.relevance),Fe=Fe.parent;while(Fe!==at.parent);return at.starts&&ba(at.starts,Ce),Qt.returnEnd?0:Oe.length}function zo(){const Ce=[];for(let Oe=Fe;Oe!==Nn;Oe=Oe.parent)Oe.scope&&Ce.unshift(Oe.scope);Ce.forEach(Oe=>mn.openNode(Oe))}let js={};function Sa(Ce,Oe){const Ve=Oe&&Oe[0];if(Et+=Ce,Ve==null)return zt(),0;if(js.type==="begin"&&Oe.type==="end"&&js.index===Oe.index&&Ve===""){if(Et+=je.slice(Oe.index,Oe.index+1),!Ct){const at=new Error(`0 width match regex (${Se})`);throw at.languageName=Se,at.badRule=js.rule,at}return 1}if(js=Oe,Oe.type==="begin")return Cd(Oe);if(Oe.type==="illegal"&&!Be){const at=new Error('Illegal lexeme "'+Ve+'" for mode "'+(Fe.scope||"<unnamed>")+'"');throw at.mode=Fe,at}else if(Oe.type==="end"){const at=oi(Oe);if(at!==yi)return at}if(Oe.type==="illegal"&&Ve==="")return Et+=`
160
+ `,1;if(Ho>1e5&&Ho>Oe.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Et+=Ve,Ve.length}const Nn=Z(Se);if(!Nn)throw ft(mt.replace("{}",Se)),new Error('Unknown language: "'+Se+'"');const Dc=hn(Nn);let xa="",Fe=gt||Dc;const jc={},mn=new Te.__emitter(Te);zo();let Et="",Yr=0,xr=0,Ho=0,Xr=!1;try{if(Nn.__emitTokens)Nn.__emitTokens(je,mn);else{for(Fe.matcher.considerAll();;){Ho++,Xr?Xr=!1:Fe.matcher.considerAll(),Fe.matcher.lastIndex=xr;const Ce=Fe.matcher.exec(je);if(!Ce)break;const Oe=je.substring(xr,Ce.index),Ve=Sa(Oe,Ce);xr=Ce.index+Ve}Sa(je.substring(xr))}return mn.finalize(),xa=mn.toHTML(),{language:Se,value:xa,relevance:Yr,illegal:!1,_emitter:mn,_top:Fe}}catch(Ce){if(Ce.message&&Ce.message.includes("Illegal"))return{language:Se,value:Kn(je),illegal:!0,relevance:0,_illegalBy:{message:Ce.message,index:xr,context:je.slice(xr-100,xr+100),mode:Ce.mode,resultSoFar:xa},_emitter:mn};if(Ct)return{language:Se,value:Kn(je),illegal:!1,relevance:0,errorRaised:Ce,_emitter:mn,_top:Fe};throw Ce}}function Dt(Se){const je={value:Kn(Se),illegal:!1,relevance:0,_top:Le,_emitter:new Te.__emitter(Te)};return je._emitter.addText(Se),je}function nt(Se,je){je=je||Te.languages||Object.keys(_e);const Be=Dt(Se),gt=je.filter(Z).filter(ke).map(zt=>qe(zt,Se,!1));gt.unshift(Be);const Kt=gt.sort((zt,xi)=>{if(zt.relevance!==xi.relevance)return xi.relevance-zt.relevance;if(zt.language&&xi.language){if(Z(zt.language).supersetOf===xi.language)return 1;if(Z(xi.language).supersetOf===zt.language)return-1}return 0}),[Un,Si]=Kt,ai=Un;return ai.secondBest=Si,ai}function Ae(Se,je,Be){const gt=je&&xe[je]||Be;Se.classList.add("hljs"),Se.classList.add(`language-${gt}`)}function We(Se){let je=null;const Be=Pt(Se);if(ze(Be))return;if(nn("before:highlightElement",{el:Se,language:Be}),Se.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Se);return}if(Se.children.length>0&&(Te.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(Se)),Te.throwUnescapedHTML))throw new bi("One of your code blocks includes unescaped HTML.",Se.innerHTML);je=Se;const gt=je.textContent,Kt=Be?he(gt,{language:Be,ignoreIllegals:!0}):nt(gt);Se.innerHTML=Kt.value,Se.dataset.highlighted="yes",Ae(Se,Be,Kt.language),Se.result={language:Kt.language,re:Kt.relevance,relevance:Kt.relevance},Kt.secondBest&&(Se.secondBest={language:Kt.secondBest.language,relevance:Kt.secondBest.relevance}),nn("after:highlightElement",{el:Se,result:Kt,text:gt})}function Xe(Se){Te=Vr(Te,Se)}const pn=()=>{Xn(),Ht("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function Yn(){Xn(),Ht("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let ji=!1;function Xn(){function Se(){Xn()}if(document.readyState==="loading"){ji||window.addEventListener("DOMContentLoaded",Se,!1),ji=!0;return}document.querySelectorAll(Te.cssSelector).forEach(We)}function hr(Se,je){let Be=null;try{Be=je(ee)}catch(gt){if(ft("Language definition for '{}' could not be registered.".replace("{}",Se)),Ct)ft(gt);else throw gt;Be=Le}Be.name||(Be.name=Se),_e[Se]=Be,Be.rawDefinition=je.bind(null,ee),Be.aliases&&ve(Be.aliases,{languageName:Se})}function Zn(Se){delete _e[Se];for(const je of Object.keys(xe))xe[je]===Se&&delete xe[je]}function Re(){return Object.keys(_e)}function Z(Se){return Se=(Se||"").toLowerCase(),_e[Se]||_e[xe[Se]]}function ve(Se,{languageName:je}){typeof Se=="string"&&(Se=[Se]),Se.forEach(Be=>{xe[Be.toLowerCase()]=je})}function ke(Se){const je=Z(Se);return je&&!je.disableAutodetect}function et(Se){Se["before:highlightBlock"]&&!Se["before:highlightElement"]&&(Se["before:highlightElement"]=je=>{Se["before:highlightBlock"](Object.assign({block:je.el},je))}),Se["after:highlightBlock"]&&!Se["after:highlightElement"]&&(Se["after:highlightElement"]=je=>{Se["after:highlightBlock"](Object.assign({block:je.el},je))})}function tt(Se){et(Se),Pe.push(Se)}function jt(Se){const je=Pe.indexOf(Se);je!==-1&&Pe.splice(je,1)}function nn(Se,je){const Be=Se;Pe.forEach(function(gt){gt[Be]&&gt[Be](je)})}function rn(Se){return Ht("10.7.0","highlightBlock will be removed entirely in v12.0"),Ht("10.7.0","Please use highlightElement now."),We(Se)}Object.assign(ee,{highlight:he,highlightAuto:nt,highlightAll:Xn,highlightElement:We,highlightBlock:rn,configure:Xe,initHighlighting:pn,initHighlightingOnLoad:Yn,registerLanguage:hr,unregisterLanguage:Zn,listLanguages:Re,getLanguage:Z,registerAliases:ve,autoDetection:ke,inherit:Vr,addPlugin:tt,removePlugin:jt}),ee.debugMode=function(){Ct=!1},ee.safeMode=function(){Ct=!0},ee.versionString=pt,ee.regex={concat:w,lookahead:S,either:b,optional:T,anyNumberOfTimes:C};for(const Se in re)typeof re[Se]=="object"&&e(re[Se]);return Object.assign(ee,re),ee},tn=Vn({});return tn.newInstance=()=>Vn({}),om=tn,tn.HighlightJS=tn,tn.default=tn,om}var n8=t8();const Gi=Vg(n8);function dS(e){const t=e.regex,i={},s={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[i]}]};Object.assign(i,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},s]});const o={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},d=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),p={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,i,o]};o.contains.push(l);const h={match:/\\"/},f={className:"string",begin:/'/,end:/'/},v={match:/\\'/},m={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,i]},S=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],C=e.SHEBANG({binary:`(${S.join("|")})`,relevance:10}),T={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},w=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],_=["true","false"],b={match:/(\/[a-z._-]+)+/},g=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],y=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],k=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],M=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:w,literal:_,built_in:[...g,...y,"set","shopt",...k,...M]},contains:[C,e.SHEBANG(),T,m,d,p,b,l,h,f,v,i]}}const fS="[A-Za-z$_][0-9A-Za-z$_]*",i8=["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"],r8=["true","false","null","undefined","NaN","Infinity"],r2=["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"],s2=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],a2=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],s8=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],a8=[].concat(a2,r2,s2);function pS(e){const t=e.regex,i=(X,{after:j})=>{const z="</"+X[0].slice(1);return X.input.indexOf(z,j)!==-1},s=fS,o={begin:"<>",end:"</>"},d=/<[A-Za-z0-9\\._:-]+\s*\/>/,p={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(X,j)=>{const z=X[0].length+X.index,D=X.input[z];if(D==="<"||D===","){j.ignoreMatch();return}D===">"&&(i(X,{after:z})||j.ignoreMatch());let U;const V=X.input.substring(z);if(U=V.match(/^\s*=/)){j.ignoreMatch();return}if((U=V.match(/^\s+extends\s+/))&&U.index===0){j.ignoreMatch();return}}},l={$pattern:fS,keyword:i8,literal:r8,built_in:a8,"variable.language":s8},h="[0-9](_?[0-9])*",f=`\\.(${h})`,v="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",m={className:"number",variants:[{begin:`(\\b(${v})((${f})|\\.)?|(${f}))[eE][+-]?(${h})\\b`},{begin:`\\b(${v})\\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},S={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"xml"}},T={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,S]},g={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},y=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,_,{match:/\$\d+/},m];S.contains=y.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(y)});const k=[].concat(g,S.contains),M=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(k)}]),A={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:M},N={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},R={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:{_:[...r2,...s2]}},B={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},q={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[A],illegal:/%/},W={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function G(X){return t.concat("(?!",X.join("|"),")")}const I={match:t.concat(/\b/,G([...a2,"super","import"].map(X=>`${X}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},K={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},H={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},A]},P="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",Y={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(P)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[A]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:M,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),B,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,_,g,{match:/\$\d+/},m,R,{scope:"attr",match:s+t.lookahead(":"),relevance:0},Y,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[g,e.REGEXP_MODE,{className:"function",begin:P,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:M}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{match:d},{begin:p.begin,"on:begin":p.isTrulyOpeningTag,end:p.end}],subLanguage:"xml",contains:[{begin:p.begin,end:p.end,skip:!0,contains:["self"]}]}]},q,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[A,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},K,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[A]},I,W,N,H,{match:/\$[(.]/}]}}function o8(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},i={match:/[{}[\],:]/,className:"punctuation",relevance:0},s=["true","false","null"],o={scope:"literal",beginKeywords:s.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:s},contains:[t,i,e.QUOTE_STRING_MODE,o,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}function mS(e){const t=e.regex,i={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},s={begin:"^[-\\*]{3,}",end:"$"},o={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},d={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},p={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,h={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),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}/}]},v={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},m=e.inherit(f,{contains:[]}),S=e.inherit(v,{contains:[]});f.contains.push(S),v.contains.push(m);let C=[i,h];return[f,v,m,S].forEach(b=>{b.contains=b.contains.concat(C)}),C=C.concat(f,v),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:C},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:C}]}]},i,d,f,v,{className:"quote",begin:"^>\\s+",contains:C,end:"$"},o,s,h,p,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function gS(e){const t=e.regex,i=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),s=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:s,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},h={className:"meta",begin:/^(>>>|\.\.\.) /},f={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},v={begin:/\{\{/,relevance:0},m={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,h],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,h],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,h,v,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,h,v,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,v,f]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,v,f]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},S="[0-9](_?[0-9])*",C=`(\\b(${S}))?\\.(${S})|\\b(${S})\\.`,T=`\\b|${s.join("|")}`,w={className:"number",relevance:0,variants:[{begin:`(\\b(${S})|(${C}))[eE][+-]?(${S})[jJ]?(?=${T})`},{begin:`(${C})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${T})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${T})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${T})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${T})`},{begin:`\\b(${S})[jJ](?=${T})`}]},_={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},b={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",h,w,m,e.HASH_COMMENT_MODE]}]};return f.contains=[m,w,h],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[h,w,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},m,_,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,i],scope:{1:"keyword",3:"title.function"},contains:[b]},{variants:[{match:[/\bclass/,/\s+/,i,/\s*/,/\(\s*/,i,/\s*\)/]},{match:[/\bclass/,/\s+/,i]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[w,b,m]}]}}const Vh="[A-Za-z$_][0-9A-Za-z$_]*",o2=["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"],l2=["true","false","null","undefined","NaN","Infinity"],c2=["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"],u2=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],h2=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],d2=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],f2=[].concat(h2,c2,u2);function l8(e){const t=e.regex,i=(X,{after:j})=>{const z="</"+X[0].slice(1);return X.input.indexOf(z,j)!==-1},s=Vh,o={begin:"<>",end:"</>"},d=/<[A-Za-z0-9\\._:-]+\s*\/>/,p={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(X,j)=>{const z=X[0].length+X.index,D=X.input[z];if(D==="<"||D===","){j.ignoreMatch();return}D===">"&&(i(X,{after:z})||j.ignoreMatch());let U;const V=X.input.substring(z);if(U=V.match(/^\s*=/)){j.ignoreMatch();return}if((U=V.match(/^\s+extends\s+/))&&U.index===0){j.ignoreMatch();return}}},l={$pattern:Vh,keyword:o2,literal:l2,built_in:f2,"variable.language":d2},h="[0-9](_?[0-9])*",f=`\\.(${h})`,v="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",m={className:"number",variants:[{begin:`(\\b(${v})((${f})|\\.)?|(${f}))[eE][+-]?(${h})\\b`},{begin:`\\b(${v})\\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},S={className:"subst",begin:"\\$\\{",end:"\\}",keywords:l,contains:[]},C={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"xml"}},T={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"css"}},w={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,S],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,S]},g={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:s+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},y=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,_,{match:/\$\d+/},m];S.contains=y.concat({begin:/\{/,end:/\}/,keywords:l,contains:["self"].concat(y)});const k=[].concat(g,S.contains),M=k.concat([{begin:/(\s*)\(/,end:/\)/,keywords:l,contains:["self"].concat(k)}]),A={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:M},N={variants:[{match:[/class/,/\s+/,s,/\s+/,/extends/,/\s+/,t.concat(s,"(",t.concat(/\./,s),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,s],scope:{1:"keyword",3:"title.class"}}]},R={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:{_:[...c2,...u2]}},B={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},q={variants:[{match:[/function/,/\s+/,s,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[A],illegal:/%/},W={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function G(X){return t.concat("(?!",X.join("|"),")")}const I={match:t.concat(/\b/,G([...h2,"super","import"].map(X=>`${X}\\s*\\(`)),s,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},K={begin:t.concat(/\./,t.lookahead(t.concat(s,/(?![0-9A-Za-z$_(])/))),end:s,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},H={match:[/get|set/,/\s+/,s,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},A]},P="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",Y={match:[/const|var|let/,/\s+/,s,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(P)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[A]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:l,exports:{PARAMS_CONTAINS:M,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),B,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,C,T,w,_,g,{match:/\$\d+/},m,R,{scope:"attr",match:s+t.lookahead(":"),relevance:0},Y,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[g,e.REGEXP_MODE,{className:"function",begin:P,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:M}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:o.begin,end:o.end},{match:d},{begin:p.begin,"on:begin":p.isTrulyOpeningTag,end:p.end}],subLanguage:"xml",contains:[{begin:p.begin,end:p.end,skip:!0,contains:["self"]}]}]},q,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[A,e.inherit(e.TITLE_MODE,{begin:s,className:"title.function"})]},{match:/\.\.\./,relevance:0},K,{match:"\\$"+s,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[A]},I,W,N,H,{match:/\$[(.]/}]}}function _S(e){const t=e.regex,i=l8(e),s=Vh,o=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],d={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},p={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:o},contains:[i.exports.CLASS_REFERENCE]},l={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},h=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],f={$pattern:Vh,keyword:o2.concat(h),literal:l2,built_in:f2.concat(o),"variable.language":d2},v={className:"meta",begin:"@"+s},m=(w,_,b)=>{const g=w.contains.findIndex(y=>y.label===_);if(g===-1)throw new Error("can not find mode to replace");w.contains.splice(g,1,b)};Object.assign(i.keywords,f),i.exports.PARAMS_CONTAINS.push(v);const S=i.contains.find(w=>w.scope==="attr"),C=Object.assign({},S,{match:t.concat(s,t.lookahead(/\s*\?:/))});i.exports.PARAMS_CONTAINS.push([i.exports.CLASS_REFERENCE,S,C]),i.contains=i.contains.concat([v,d,p,C]),m(i,"shebang",e.SHEBANG()),m(i,"use_strict",l);const T=i.contains.find(w=>w.label==="func.def");return T.relevance=0,Object.assign(i,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),i}const c8=/\[\[wiki:([^\]]+)\]\]/g,u8=/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)\r?\n---[ \t]*(?:\r?\n|$)/,h8=/^(\S[^:]*?):[ \t]*(.*)$/,d8=new QC({gfm:!0,breaks:!1}),vS={ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto):|[#/]|\.{0,2}\/|[^:]+$)/i,ADD_ATTR:["target","rel","data-entry-id"]},lm=k8();function xc(e,t={}){const{entries:i,content:s}=m8(e),o=v8(s,t.resolveWikiLink),d=d8.parse(o,{async:!1}),p=_8(i),l=oc.sanitize(p+d,vS),h=new DOMParser().parseFromString(l,"text/html");return y8(h,t.omitDuplicateTitle),b8(h),S8(h),w8(h),{html:oc.sanitize(h.body.innerHTML,vS),toc:C8(h)}}function f8(e){const t=new TextEncoder().encode(e);let i="";for(const s of t)i+=String.fromCharCode(s);return btoa(i)}function p8(e){const t=atob(e),i=new Uint8Array(t.length);for(let s=0;s<t.length;s++)i[s]=t.charCodeAt(s);return new TextDecoder().decode(i)}function m8(e){const t=u8.exec(e);return t?{entries:g8(t[1]??""),content:e.slice(t[0].length)}:{entries:[],content:e}}function g8(e){const t=[];for(const i of e.split(/\r?\n/)){const s=i.replace(/\s+$/,"");if(s.trim()==="")continue;const o=h8.exec(s);if(o){const[,l="",h=""]=o;t.push({key:l.trim(),value:h.trim()});continue}const d=t[t.length-1];if(!d)continue;const p=s.trim();d.value=d.value?`${d.value} ${p}`:p}return t}function _8(e){return e.length===0?"":`<dl class="frontmatter">${e.map(i=>`<dt>${lc(i.key)}</dt><dd>${lc(i.value)}</dd>`).join("")}</dl>`}function v8(e,t){return e.replace(c8,(i,s)=>{const o=s.trim();if(!o)return"";if(!t)return lc(`[[wiki:${o}]]`);const d=t(o);if(d===null)return lc(`[[wiki:${o}]]`);const p=lc(o),l=encodeURIComponent(o);return`<a href="${d}" data-entry-id="${l}">${p}</a>`})}function b8(e){const t=new Map;for(const i of e.querySelectorAll("h2, h3")){const s=i.textContent?.trim()??"",o=R8(s||"section"),d=t.get(o)??0;t.set(o,d+1),i.id=d===0?o:`${o}-${d+1}`}}function y8(e,t){if(!t)return;const i=e.body.querySelector("h1, h2, h3, h4, h5, h6");!i||i.tagName.toLowerCase()!=="h1"||bS(i.textContent??"")===bS(t)&&i.remove()}function S8(e){for(const t of e.querySelectorAll("pre > code")){const i=T8(t.className),s=t.textContent??"",o=t.parentElement;if(!o)continue;if(i==="mermaid"){const p=e.createElement("div");p.className="diagram-block",p.setAttribute("data-mermaid-source",f8(s)),p.setAttribute("data-diagram-state","pending"),o.replaceWith(p);continue}const d=E8(s,i);t.innerHTML=d,t.classList.add("hljs"),o.classList.add("code-block"),o.dataset.code=s,o.insertBefore(x8(e,i||"text"),o.firstChild)}}function x8(e,t){const i=e.createElement("div");i.className="code-block-toolbar";const s=e.createElement("span");s.className="code-block-dots",s.setAttribute("aria-hidden","true");for(let p=0;p<3;p++)s.append(e.createElement("span"));const o=e.createElement("span");o.className="code-block-language",o.textContent=t;const d=e.createElement("button");return d.className="copy-code",d.type="button",d.dataset.action="copy-code",d.setAttribute("aria-label",`Copy ${t} code`),d.textContent="Copy",i.append(s,o,d),i}function w8(e){for(const t of e.querySelectorAll("a")){const i=t.getAttribute("href")??"";A8(i)&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))}}function C8(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 E8(e,t){return t&&lm.getLanguage(t)?lm.highlight(e,{language:t}).value:lm.highlightAuto(e).value}function k8(){return Gi.registerLanguage("bash",dS),Gi.registerLanguage("sh",dS),Gi.registerLanguage("javascript",pS),Gi.registerLanguage("js",pS),Gi.registerLanguage("json",o8),Gi.registerLanguage("markdown",mS),Gi.registerLanguage("md",mS),Gi.registerLanguage("python",gS),Gi.registerLanguage("py",gS),Gi.registerLanguage("typescript",_S),Gi.registerLanguage("ts",_S),Gi}function T8(e){return e.match(/language-([a-z0-9_-]+)/i)?.[1]?.toLowerCase()??null}function A8(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(window.location.origin)}function R8(e){return e.trim().toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu,"-").replace(/^-+|-+$/g,"")||"section"}function bS(e){return e.trim().replace(/\s+/g," ").toLocaleLowerCase("en-US")}function lc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const L8="modulepreload",M8=function(e){return"/console/"+e},yS={},N8=function(t,i,s){let o=Promise.resolve();if(i&&i.length>0){let h=function(f){return Promise.all(f.map(v=>Promise.resolve(v).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),l=p?.nonce||p?.getAttribute("nonce");o=h(i.map(f=>{if(f=M8(f),f in yS)return;yS[f]=!0;const v=f.endsWith(".css"),m=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${m}`))return;const S=document.createElement("link");if(S.rel=v?"stylesheet":L8,v||(S.as="script"),S.crossOrigin="",S.href=f,l&&S.setAttribute("nonce",l),document.head.appendChild(S),v)return new Promise((C,T)=>{S.addEventListener("load",C),S.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${f}`)))})}))}function d(p){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=p,window.dispatchEvent(l),!l.defaultPrevented)throw p}return o.then(p=>{for(const l of p||[])l.status==="rejected"&&d(l.reason);return t().catch(d)})},O8=".diagram-block[data-mermaid-source]:not([data-diagram-state='rendered']):not([data-diagram-state='error'])",D8=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),j8=/^on/i,I8={USE_PROFILES:{svg:!0,svgFilters:!1},FORBID_TAGS:["foreignObject","script"],FORBID_ATTR:["href","xlink:href"]},SS="diagramInteractionBound",B8=/^oklch\s*\(\s*([^)]+)\s*\)$/i,P8=/^(-?\d+(?:\.\d+)?)(deg)?$/i,Vi=[25,50,75,100,125,150,200],z8=["pie1","pie2","pie3","pie4","pie5","pie6","pie7","pie8","pie9","pie10","pie11","pie12"];let cm=null;const xS=new WeakSet;let H8=0,$8=0,wc=null;function ks(e){const t=e.trim();if(!t)return t;const i=cj(t);return i?uj(i):t}function M_(e){if(xS.has(e))return;xS.add(e),wS(e);const t=e instanceof Node?e:document.body;new MutationObserver(s=>{let o=!1;for(const d of s)if(d.type==="childList"){wc&&!wc.trigger.isConnected&&ec(!1);for(const p of d.addedNodes)if(p instanceof Element&&(p.matches?.(".diagram-block[data-mermaid-source]")||p.querySelector?.(".diagram-block[data-mermaid-source]"))){o=!0;break}if(o)break}o&&wS(e)}).observe(t,{childList:!0,subtree:!0})}function wS(e){const t=e.querySelectorAll(O8);for(const i of t)i.dataset.diagramHydrating!=="true"&&(i.dataset.diagramHydrating="true",i.dataset.diagramState="pending",U8(i))}async function U8(e){const t=e.getAttribute("data-mermaid-source")??"";let i="";try{i=p8(t)}catch{um(e,"Invalid diagram source");return}if(!i.trim()){um(e,"Empty diagram source");return}try{const s=await W8(),o=`mermaid-diagram-${++H8}`,{svg:d}=await s.render(o,i);e.innerHTML=F8(d),K8(e,d),V8(e),Y8(e),e.dataset.diagramState="rendered"}catch(s){const o=s instanceof Error?s.message:String(s);um(e,o)}}function um(e,t){e.dataset.diagramState="error",e.textContent=`Diagram render failed: ${t}`}function F8(e){const t=(i,s)=>{j8.test(s.attrName)&&(s.keepAttr=!1)};oc.addHook("uponSanitizeAttribute",t);try{return oc.sanitize(e,I8)}finally{oc.removeHook("uponSanitizeAttribute",t)}}async function W8(){return cm||(cm=(async()=>{const e=await N8(()=>import("./mermaid.core-BVka5dgm.js").then(i=>i.bC),[]),t=e.default??e;return t.initialize({securityLevel:"strict",htmlLabels:!1,suppressErrorRendering:!0,startOnLoad:!1,theme:"base",look:"handDrawn",themeVariables:G8(),themeCSS:q8(),flowchart:{htmlLabels:!1,useMaxWidth:!1}}),t})()),cm}function G8(){const e=getComputedStyle(document.documentElement),t=(w,_)=>{const b=e.getPropertyValue(w).trim();return ks(b||_)},i=(w,_)=>e.getPropertyValue(w).trim()||_,s=t("--brass","#c69a4a"),o=t("--brass-bright","#e6b86a"),d=t("--brass-deep","#a0782a"),p=t("--aurora","#8bd7e6"),l=t("--aurora-deep","#1f8aa8"),h=t("--coral","#ef7c63"),f=t("--ink-deep","#1d2734"),v=t("--ink-fog","#a6afbb"),m=t("--ink-pearl","#e6e9ef"),S=t("--ink-spectral","#bcc4d0"),C=[o,s,p,h,ks("oklch(70% 0.11 68)"),l,ks("oklch(76% 0.09 205)"),d,ks("oklch(68% 0.14 30)"),v,ks("oklch(62% 0.08 228)"),ks("oklch(52% 0.05 248)")],T=Object.fromEntries(z8.map((w,_)=>[w,C[_]??f]));return{background:"transparent",primaryColor:"transparent",primaryTextColor:m,primaryBorderColor:s,secondaryColor:"transparent",secondaryTextColor:m,secondaryBorderColor:o,tertiaryColor:"transparent",tertiaryTextColor:S,tertiaryBorderColor:s,lineColor:l,edgeLabelBackground:"transparent",titleColor:o,fontFamily:"JetBrains Mono Variable, ui-monospace, monospace",mainBkg:"transparent",nodeBorder:s,clusterBkg:"transparent",clusterBorder:s,pieTitleTextColor:o,pieTitleTextSize:i("--font-size-title-lg","19px"),pieSectionTextColor:m,pieSectionTextSize:i("--font-size-md","13px"),pieLegendTextColor:m,pieLegendTextSize:i("--font-size-lg","14px"),pieStrokeColor:d,pieStrokeWidth:"1.35px",pieOuterStrokeColor:o,pieOuterStrokeWidth:"2.5px",pieOpacity:"0.96",...T}}function q8(){const e=getComputedStyle(document.documentElement),t=(f,v)=>{const m=e.getPropertyValue(f).trim();return ks(m||v)},i=t("--brass-deep","#a0782a"),s=t("--brass-bright","#e6b86a"),o=t("--aurora-deep","#1f8aa8"),d=t("--ink-abyss","#131920"),p=ks("oklch(15% 0.04 250 / 34%)"),l=t("--surface-glass","#1d2734"),h=t("--ink-pearl","#e6e9ef");return`
161
+ .node rect, .node polygon, .node circle, .node ellipse, .actor, .classGroup rect {
162
+ stroke: ${i};
163
+ fill: ${l};
164
+ }
165
+ .edgePath path, .messageLine0, .messageLine1, .relation {
166
+ stroke: ${o};
167
+ }
168
+ .nodeLabel, .edgeLabel, .actor text, .messageText {
169
+ fill: ${h};
170
+ font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
171
+ }
172
+ .pieCircle {
173
+ stroke: ${i};
174
+ stroke-width: 1.35px;
175
+ opacity: 0.96;
176
+ filter: drop-shadow(0 0 1.5px ${p});
177
+ }
178
+ .pieOuterCircle {
179
+ stroke: ${s};
180
+ opacity: 0.7;
181
+ }
182
+ .slice, .legend text, .pieTitleText {
183
+ fill: ${h};
184
+ paint-order: stroke;
185
+ stroke: ${d};
186
+ stroke-width: 3px;
187
+ stroke-linejoin: round;
188
+ font-family: "Manrope Variable", "Manrope", ui-sans-serif, sans-serif;
189
+ }
190
+ .slice {
191
+ font-weight: 600;
192
+ letter-spacing: 0.04em;
193
+ font-style: italic;
194
+ }
195
+ .pieTitleText {
196
+ font-weight: 600;
197
+ letter-spacing: 0.12em;
198
+ font-style: italic;
199
+ }
200
+ .legend text {
201
+ font-weight: 500;
202
+ letter-spacing: 0.03em;
203
+ }
204
+ .legend rect {
205
+ rx: 999px;
206
+ ry: 999px;
207
+ opacity: 0.9;
208
+ stroke: ${d};
209
+ stroke-width: 1.5px;
210
+ paint-order: stroke;
211
+ filter: saturate(0.78) brightness(0.92) drop-shadow(0 0 0.55px ${s});
212
+ }
213
+ `}function K8(e,t){const i=new DOMParser().parseFromString(t,"image/svg+xml"),s=Array.from(i.querySelectorAll("a")),o=Array.from(e.querySelectorAll("a")),d=Math.min(s.length,o.length);for(let p=0;p<d;p++){const l=s[p],h=o[p];if(!l||!h)continue;const f=l.getAttribute("href")??l.getAttribute("xlink:href")??"",v=m2(f);v&&h.setAttribute("href",v)}}function V8(e){const t=e.querySelector("svg");if(!t)return;let i;try{i=t.getBBox()}catch{return}const{x:s,y:o,width:d,height:p}=i;!Number.isFinite(s)||!Number.isFinite(o)||!Number.isFinite(d)||!Number.isFinite(p)||s<0||o<0||d<=0||p<=0||t.setAttribute("viewBox",`${fo(s)} ${fo(o)} ${fo(d)} ${fo(p)}`)}function Y8(e){e.tabIndex=0,e.setAttribute("aria-label","Open diagram in expanded view"),aj(e),e.dataset[SS]!=="true"&&(e.dataset[SS]="true",e.addEventListener("click",X8),e.addEventListener("keydown",Z8))}function X8(e){if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||Yh(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),p2(t))}function Z8(e){if(e.key!=="Enter"&&e.key!==" "||Yh(e.target))return;const t=e.currentTarget;t instanceof HTMLElement&&(e.preventDefault(),p2(t))}function p2(e){const t=e.querySelector("svg");if(!t)return;ec(!1);const i=typeof HTMLDialogElement<"u"&&typeof HTMLDialogElement.prototype.showModal=="function",s=document.createElement(i?"dialog":"div"),o=++$8,d=`diagram-lightbox-title-${o}`;s.className="diagram-lightbox",s.setAttribute("aria-labelledby",d),i||(s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.tabIndex=-1);const p=document.createElement("div");p.className="diagram-lightbox__frame";const l=document.createElement("div");l.className="diagram-lightbox__header";const h=document.createElement("h2");h.id=d,h.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 v=document.createElement("div");v.className="diagram-lightbox__controls",v.setAttribute("aria-label","Diagram zoom controls");const m=sh("−","Zoom out","out"),S=document.createElement("span");S.className="diagram-lightbox__zoom-readout",S.setAttribute("aria-live","polite");const C=sh("+","Zoom in","in"),T=sh("Fit","Fit diagram to viewport","fit"),w=sh("Reset","Reset diagram zoom","reset");v.append(m,S,C,T,w);const _=document.createElement("div");_.className="diagram-lightbox__viewport";const b=ej(t),g=t.cloneNode(!0);g.removeAttribute("style"),nj(g,`diagram-lightbox-svg-${o}`),_.append(g),l.append(h,v,f),p.append(l,_),s.append(p),document.body.append(s);const y=new J8(_,g,S,b);m.addEventListener("click",()=>y.zoomOut()),C.addEventListener("click",()=>y.zoomIn()),T.addEventListener("click",()=>y.fit()),w.addEventListener("click",()=>y.reset());const k=ij(s),M=R=>{(R.target===s||R.target===f)&&ec(!0)},A=R=>{if(R.key==="Escape"){R.preventDefault(),ec(!0);return}y.handleKeyboard(R)||R.key==="Tab"&&sj(R,s)},N={dialog:s,trigger:e,inertStates:k,onClick:M,onKeyDown:A,cleanupPanZoom:()=>y.destroy()};i&&(N.onCancel=R=>{R.preventDefault(),ec(!0)},s.addEventListener("cancel",N.onCancel),s.showModal()),s.addEventListener("click",M),document.addEventListener("keydown",A,!0),wc=N,y.fit(),f.focus()}function sh(e,t,i){const s=document.createElement("button");return s.className="diagram-lightbox__zoom-button",s.type="button",s.dataset.zoomAction=i,s.setAttribute("aria-label",t),s.textContent=e,s}class J8{constructor(t,i,s,o){this.viewport=t,this.svg=i,this.readout=s,this.baseSize=o,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=Vi.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,Vi.length-1))}zoomOut(){this.zoomAroundViewportCenter(Math.max(this.zoomIndex-1,0))}reset(){this.zoomAroundViewportCenter(Vi.indexOf(100))}fit(){const t=this.viewport.clientWidth||this.viewport.getBoundingClientRect().width||this.baseSize.width,i=this.viewport.clientHeight||this.viewport.getBoundingClientRect().height||this.baseSize.height,s=Math.min(t/this.baseSize.width,i/this.baseSize.height),o=Math.floor(s*100),d=Vi.findIndex(l=>l>o),p=d===-1?Vi.length-1:Math.max(0,d-1);this.applyZoom(p),this.viewport.scrollLeft=Math.max(0,(this.svgWidth-t)/2),this.viewport.scrollTop=Math.max(0,(this.svgHeight-i)/2)}handleKeyboard(t){return t.key==="+"||t.key==="="?(t.preventDefault(),this.zoomIn(),!0):t.key==="-"||t.key==="_"?(t.preventDefault(),this.zoomOut(),!0):t.key==="0"?(t.preventDefault(),this.reset(),!0):t.key.toLowerCase()==="f"?(t.preventDefault(),this.fit(),!0):!1}get svgWidth(){return this.baseSize.width*(ah(this.zoomIndex)/100)}get svgHeight(){return this.baseSize.height*(ah(this.zoomIndex)/100)}applyZoom(t){this.zoomIndex=t;const i=ah(this.zoomIndex),s=i/100;this.svg.setAttribute("width",fo(this.baseSize.width*s)),this.svg.setAttribute("height",fo(this.baseSize.height*s)),this.readout.textContent=`${i}%`}zoomAroundViewportCenter(t){const i=this.viewport.getBoundingClientRect();this.zoomAroundPoint(t,i.left+i.width/2,i.top+i.height/2)}zoomAroundPoint(t,i,s){if(t===this.zoomIndex)return;const o=this.svgWidth,d=this.svgHeight,p=this.viewport.getBoundingClientRect(),l=this.viewport.scrollLeft+i-p.left,h=this.viewport.scrollTop+s-p.top;this.applyZoom(t),this.viewport.scrollLeft=l/o*this.svgWidth-(i-p.left),this.viewport.scrollTop=h/d*this.svgHeight-(s-p.top)}onPointerDown=t=>{if(t.button!==0||Yh(t.target))return;const i=t.pointerId??1;if(this.pointers.set(i,t),this.pointers.size===2){this.pinchStart={distance:this.pointerDistance(),zoomIndex:this.zoomIndex};return}this.dragStart={x:t.clientX,y:t.clientY,scrollLeft:this.viewport.scrollLeft,scrollTop:this.viewport.scrollTop,pointerId:i},this.viewport.setPointerCapture?.(i)};onPointerMove=t=>{const i=t.pointerId??1;if(this.pointers.has(i)&&this.pointers.set(i,t),this.pinchStart&&this.pointers.size>=2){const s=this.pointerDistance()/this.pinchStart.distance,o=ah(this.pinchStart.zoomIndex)*s;this.applyZoom(tj(o));return}!this.dragStart||this.dragStart.pointerId!==i||(t.preventDefault(),this.viewport.scrollLeft=this.dragStart.scrollLeft-(t.clientX-this.dragStart.x),this.viewport.scrollTop=this.dragStart.scrollTop-(t.clientY-this.dragStart.y))};onPointerEnd=t=>{const i=t.pointerId??1;this.pointers.delete(i),this.viewport.releasePointerCapture?.(i),this.dragStart?.pointerId===i&&(this.dragStart=null),this.pointers.size<2&&(this.pinchStart=null)};onWheel=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();const i=t.deltaY<0?Math.min(this.zoomIndex+1,Vi.length-1):Math.max(this.zoomIndex-1,0);this.zoomAroundPoint(i,t.clientX,t.clientY)};onDoubleClick=t=>{Yh(t.target)||(t.preventDefault(),this.zoomAroundPoint(this.zoomIndex===Vi.indexOf(200)?Vi.indexOf(100):Vi.indexOf(200),t.clientX,t.clientY))};onResize=()=>{this.fit()};pointerDistance(){const[t,i]=Array.from(this.pointers.values());return!t||!i?1:Math.hypot(i.clientX-t.clientX,i.clientY-t.clientY)}}function Q8(e){const t=CS(e.getAttribute("width")),i=CS(e.getAttribute("height"));if(t&&i)return{width:t,height:i};const s=e.getAttribute("viewBox")?.trim().split(/[\s,]+/).map(Number)??[],o=s[2],d=s[3],p=o!==void 0&&Number.isFinite(o)&&o>0?o:null,l=d!==void 0&&Number.isFinite(d)&&d>0?d:null;return{width:t??p??800,height:i??l??600}}function ej(e){const t=e.getBoundingClientRect();return t.width>0&&t.height>0?{width:t.width,height:t.height}:Q8(e)}function CS(e){if(!e)return null;const t=/^(\d+(?:\.\d+)?)/.exec(e.trim());if(!t)return null;const i=Number(t[1]);return Number.isFinite(i)&&i>0?i:null}function fo(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/\.?0+$/,"")}function tj(e){let t=0,i=Number.POSITIVE_INFINITY;return Vi.forEach((s,o)=>{const d=Math.abs(s-e);d<i&&(i=d,t=o)}),t}function ah(e){return Vi[e]??Vi[0]}function nj(e,t){const i=e.getAttribute("id")??"";e.setAttribute("id",t);const s=e.querySelector("style");!i||!s?.textContent||(s.textContent=s.textContent.split(`#${i}`).join(`#${t}`))}function ec(e){const t=wc;t&&(t.dialog.removeEventListener("click",t.onClick),document.removeEventListener("keydown",t.onKeyDown,!0),t.onCancel&&t.dialog.removeEventListener("cancel",t.onCancel),t.cleanupPanZoom(),rj(t.inertStates),t.dialog instanceof HTMLDialogElement&&t.dialog.open&&typeof t.dialog.close=="function"&&t.dialog.close(),t.dialog.remove(),wc=null,e&&t.trigger.isConnected&&t.trigger.focus())}function ij(e){const t=[];for(const i of Array.from(document.body.children))!(i instanceof HTMLElement)||i===e||(t.push({element:i,ariaHidden:i.getAttribute("aria-hidden"),inert:i.inert}),i.inert=!0,i.setAttribute("aria-hidden","true"));return t}function rj(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 sj(e,t){const i=Array.from(t.querySelectorAll(D8)).filter(lj);if(i.length===0){e.preventDefault(),t.focus();return}const s=i[0],o=i[i.length-1];!s||!o||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),o.focus()):!e.shiftKey&&document.activeElement===o&&(e.preventDefault(),s.focus()))}function aj(e){e.querySelector("a[href]")?e.removeAttribute("role"):e.setAttribute("role","button")}function Yh(e){if(!(e instanceof Element))return!1;const t=e.closest("a[href]");return!t||!(t.getAttribute("href")?.trim()??"")?!1:!oj(t)}function oj(e){return Array.from(e.children).some(t=>t.tagName.toLowerCase()==="svg")}function lj(e){return!(e.inert||e.hidden||e.getAttribute("aria-hidden")==="true"||"disabled"in e&&e.disabled)}function m2(e){const t=e.trim();if(!t||t.includes(".."))return null;if(/^[a-z][a-z0-9+.-]*:/i.test(t)){if(/^javascript:/i.test(t)||/^data:/i.test(t))return null;let s;try{s=new URL(t)}catch{return null}return s.origin!==window.location.origin?null:m2(s.pathname)}if(/^\/entry\/[^/?#]+$/.exec(t)){const s=t.slice(7);let o;try{o=decodeURIComponent(s)}catch{return null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(o)?`/entry/${encodeURIComponent(o)}`:null}return/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(t)?`/entry/${encodeURIComponent(t)}`:null}function cj(e){const t=B8.exec(e);if(!t)return null;const i=t[1]?.trim();if(!i)return null;const s=i.indexOf("/"),o=s>=0?i.slice(0,s):i,d=s>=0?i.slice(s+1).trim():"",p=o.trim().split(/[\s,]+/).filter(Boolean);if(p.length!==3)return null;const[l,h,f]=p;if(!l||!h||!f)return null;const v=hm(l,1),m=hm(h,.4),S=hj(f);if(v===null||m===null||S===null)return null;let C=1;if(s>=0){const T=hm(d,1);if(T===null)return null;C=T}return{L:v,C:m,h:S,alpha:C}}function uj(e){const t=e.h*Math.PI/180,i=e.C*Math.cos(t),s=e.C*Math.sin(t),o=e.L,d=o+.3963377774*i+.2158037573*s,p=o-.1055613458*i-.0638541728*s,l=o-.0894841775*i-1.291485548*s,h=d**3,f=p**3,v=l**3,m=4.0767416621*h-3.3077115913*f+.2309699292*v,S=-1.2684380046*h+2.6097574011*f-.3413193965*v,C=-.0041960863*h-.7034186147*f+1.707614701*v,T=oh(dm(m)),w=oh(dm(S)),_=oh(dm(C));if(e.alpha<1){const b=oh(e.alpha);return`#${Qs(T)}${Qs(w)}${Qs(_)}${Qs(b)}`}return`#${Qs(T)}${Qs(w)}${Qs(_)}`}function hm(e,t){if(!e)return null;if(e.endsWith("%")){const s=Number(e.slice(0,-1));return Number.isFinite(s)?s/100*t:null}const i=Number(e);return Number.isFinite(i)?i:null}function hj(e){const t=P8.exec(e);if(!t)return null;const i=Number(t[1]);return Number.isFinite(i)?i:null}function dm(e){const t=Math.max(0,Math.min(1,e));return t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t}function oh(e){return Math.round(Math.max(0,Math.min(1,e))*255)}function Qs(e){return e.toString(16).padStart(2,"0")}const dj=new Set([".png",".jpg",".jpeg",".webp",".gif"]),fj=new Set(["img.shields.io"]),pj=/^[a-z][a-z0-9+.-]*:/i;function ES(e,t){const i=e.trim();if(!i||i.startsWith("#")||i.startsWith("//")||pj.test(i))return null;const s=g2(i);if(!s)return null;const o=_j(s);return o===null?null:vj(o,t)}function mj(e){const t=g2(e).toLowerCase();return[...dj].some(i=>t.endsWith(i))}function kS(e,t,i=null){const s=i?`${i.replaceAll("\\","/")}/`:"";return`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(e)}&path=${encodeURIComponent(`${s}${t}`)}`}function gj(e){try{const t=new URL(e);return t.protocol==="https:"&&fj.has(t.hostname)}catch{return!1}}function g2(e){const t=e.search(/[?#]/);return t===-1?e:e.slice(0,t)}function _j(e){try{return decodeURI(e)}catch{return null}}function vj(e,t){const i=e.replace(/\\/g,"/"),s=t.replace(/\\/g,"/"),o=s.includes("/")?s.slice(0,s.lastIndexOf("/")):"",d=i.startsWith("/")?i:`${o}/${i}`,p=[];for(const l of d.split("/"))if(!(!l||l===".")){if(l===".."){if(p.length===0)return null;p.pop();continue}p.push(l)}return p.length>0?p.join("/"):null}function bj({content:e,onOpenPath:t,relativePath:i,theaterId:s,contextRelPath:o,truncated:d}){const p=L.useMemo(()=>{const S=xc(e).html,C=new DOMParser().parseFromString(S,"text/html");return fm(C.body,{allowLocalImageMarkers:!1,currentRelativePath:i,theaterId:s,contextRelPath:o}),C.body.innerHTML},[e,i,s,o]),l=L.useRef(null);L.useEffect(()=>{const S=l.current;if(!S)return;M_(S),fm(S,{allowLocalImageMarkers:!0,currentRelativePath:i,theaterId:s,contextRelPath:o});const C=new MutationObserver(()=>fm(S,{allowLocalImageMarkers:!0,currentRelativePath:i,theaterId:s,contextRelPath:o}));return C.observe(S,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>C.disconnect()},[p,i,s,o]);const h=L.useCallback(S=>{const C=S.target.closest('[data-action="copy-code"]');if(!C)return;const T=C.closest("pre")?.getAttribute("data-code");if(!T)return;navigator.clipboard?.writeText(T);const w=C.textContent;C.textContent="Copied",window.setTimeout(()=>{C.textContent=w},1200)},[]),f=L.useCallback(S=>{const T=S.target.closest("[data-fexp-open-path]");if(!T)return;const w=T.dataset.fexpOpenPath;w&&(S.preventDefault(),t(w))},[t]),v=L.useCallback(S=>{if(S.key!=="Enter"&&S.key!==" ")return;const T=S.target.closest("[data-fexp-open-path]");if(!T)return;const w=T.dataset.fexpOpenPath;w&&(S.preventDefault(),t(w))},[t]),m=L.useCallback(S=>{h(S),f(S)},[h,f]);return u.jsxs("div",{className:"fexp-md-wrap",children:[d&&u.jsx("div",{className:"fexp-truncated-badge",children:"File is too large — showing a partial preview"}),u.jsx("div",{ref:l,className:"markdown-body",onClick:m,onKeyDown:v,dangerouslySetInnerHTML:{__html:p}})]})}function fm(e,t){for(const i of e.querySelectorAll("a[href]")){const s=i.getAttribute("href")??"",o=ES(s,t.currentRelativePath);o?(i.removeAttribute("href"),i.setAttribute("role","link"),i.setAttribute("tabindex","0"),i.setAttribute("data-fexp-open-path",o),i.removeAttribute("aria-disabled")):s&&!/^(https?:|mailto:|#)/i.test(s)&&(i.removeAttribute("href"),i.setAttribute("role","link"),i.setAttribute("aria-disabled","true"))}for(const i of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]")){const s=i.getAttribute("src")??"",o=i.getAttribute("data-fexp-local-image-path");if(i.tagName==="IMG"&&t.allowLocalImageMarkers&&t.theaterId&&o&&s===kS(t.theaterId,o,t.contextRelPath)){i.removeAttribute("srcset");continue}if(i.removeAttribute("data-fexp-local-image-path"),i.tagName==="IMG"&&gj(s)){i.removeAttribute("srcset"),i.removeAttribute("aria-hidden");continue}const d=ES(s,t.currentRelativePath);if(i.removeAttribute("srcset"),i.tagName==="IMG"&&t.theaterId&&d&&mj(d)){i.setAttribute("src",kS(t.theaterId,d,t.contextRelPath)),i.setAttribute("data-fexp-local-image-path",d),i.removeAttribute("aria-hidden");continue}i.removeAttribute("src"),i.tagName==="IMG"&&yj(i)}}function yj(e){const t=e.getAttribute("alt")?.trim(),i=e.ownerDocument.createElement("span");i.className="fexp-md-blocked-image",i.textContent=t?`Image blocked: ${t}`:"Image blocked",e.replaceWith(i)}const Sj=360,N_=248,O_=200,Xh=160,Zh=4;function xj(e){return e-O_-Zh>=Xh}function wj(e,t,i){const s=i-O_-Zh;return s<Xh?e:Math.max(Xh,Math.min(s,e-t))}function Cj(e){const t=O_+Zh;return`minmax(0, 1fr) ${Zh}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function Ej(e){return e?Sj:null}const _2="fleet-console.file-explorer.treePaneWidth",D_={selectedPath:null,viewState:{kind:"none"}},kj={...D_,treePaneWidth:N_},v2=new Map,TS=new Map,_g=new Set;let Jh=Mj();function Tj(e){return L.useSyncExternalStore(Lj,()=>Rj(e),()=>kj)}function AS(e,t){e&&S2(e,{selectedPath:t})}function Ss(e,t){e&&S2(e,{viewState:t})}function Aj(e){Jh=x2(e);try{localStorage.setItem(_2,String(Jh))}catch{}b2()}function b2(){for(const e of _g)e()}function y2(e){return v2.get(e)??D_}function Rj(e){const t=e??"__none__",i=e!=null?y2(e):D_,s=TS.get(t);if(s&&s.selectedPath===i.selectedPath&&s.viewState===i.viewState&&s.treePaneWidth===Jh)return s;const o={...i,treePaneWidth:Jh};return TS.set(t,o),o}function S2(e,t){v2.set(e,{...y2(e),...t}),b2()}function Lj(e){return _g.add(e),()=>{_g.delete(e)}}function Mj(){try{return x2(Number(localStorage.getItem(_2)))}catch{return N_}}function x2(e){return!Number.isFinite(e)||e<=0?N_:Math.max(Xh,Math.round(e))}const Nj=new Set([".png",".jpg",".jpeg",".webp",".gif"]),Oj={id:"file-explorer",title:"Files",icon:Ij,pathAware:!0,render:e=>u.jsx(jj,{...e})};function Dj(e,t){return{listFolder:async i=>{if(!e)throw new Error("no_theater");const s=await fetch("/plugins/file-explorer/files/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e,relativePath:hg(t,i??"")})});if(!s.ok){const p=await s.json();throw new Error(p.error??"list_failed")}const o=await s.json(),d=PC(t,o);if(!d)throw new Error("context_boundary");return d}}}function jj(e){const{theaterId:t}=e,i=e.pathContext.relPath,s=TO(t,i),{selectedPath:o,viewState:d,treePaneWidth:p}=Tj(s),l=L.useRef(p);l.current=p;const h=L.useRef(null),[f,v]=L.useState(!1),m=L.useMemo(()=>Dj(t,i),[t,i]),S=L.useCallback(async(b,g)=>{if(!t){Ss(t,{kind:"error",message:"no_theater"});return}AS(s,b);const y=g??b.split("/").filter(Boolean).at(-1)??b,k=y.slice(y.lastIndexOf(".")).toLowerCase();if(Nj.has(k)){const M=t?`/plugins/file-explorer/files/image?theaterId=${encodeURIComponent(t)}&path=${encodeURIComponent(hg(i,b)??"")}`:"";Ss(s,{kind:"image",relativePath:b,name:y,src:M});return}Ss(s,{kind:"loading"});try{const M=await fetch("/plugins/file-explorer/files/read",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:t,relativePath:hg(i,b)})});if(!M.ok){const R=await M.json();throw new Error(R.error??"read_failed")}const A=await M.json();if(A.binary){Ss(s,{kind:"binary",name:y});return}const N=PC(i,{relativePath:A.relativePath,parentRelativePath:null,entries:[]})?.relativePath;if(N===void 0)throw new Error("context_boundary");Ss(s,{kind:"code",relativePath:N,content:A.content,lang:A.lang,truncated:A.truncated})}catch(M){const A=M instanceof Error?M.message:"Unable to load file";A==="binary_file"?Ss(s,{kind:"binary",name:y}):Ss(s,{kind:"error",message:A})}},[i,s,t]),C=L.useCallback(async b=>{b.kind==="file"&&await S(b.relativePath,b.name)},[S]),T=L.useCallback(()=>{Ss(s,{kind:"none"}),AS(s,null)},[s]),w=L.useCallback(b=>{b.preventDefault();const g=h.current;if(!g)return;const y=g.getBoundingClientRect().width;if(!xj(y))return;const k=b.clientX,M=l.current;v(!0);const A=R=>{const B=R.clientX-k,q=wj(M,B,y);l.current=q,Aj(q)},N=()=>{document.removeEventListener("pointermove",A),document.removeEventListener("pointerup",N),v(!1)};document.addEventListener("pointermove",A),document.addEventListener("pointerup",N)},[]),_=d.kind!=="none";return L.useLayoutEffect(()=>{e.requestExtraWidth?.(Ej(_))},[e,_]),u.jsxs("div",{ref:h,className:`fexp-root${_?" is-split":" is-tree-only"}${f?" is-dragging":""}`,style:_?{gridTemplateColumns:Cj(p)}:void 0,children:[_&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"fexp-viewer-pane",children:[u.jsxs("div",{className:"fexp-viewer-head",children:[u.jsx("span",{className:"fexp-viewer-filename",children:d.kind!=="loading"&&d.kind!=="error"?"relativePath"in d?d.relativePath:d.name:""}),u.jsx("button",{className:"fexp-viewer-close",type:"button",onClick:T,"aria-label":"Close viewer",children:"✕"})]}),u.jsxs("div",{className:"fexp-viewer-body",children:[d.kind==="loading"&&u.jsx("div",{className:"fexp-viewer-loading",children:"Loading…"}),d.kind==="error"&&u.jsx("div",{className:"fexp-viewer-error",children:d.message}),d.kind==="code"&&d.lang==="markdown"&&u.jsx(bj,{content:d.content,onOpenPath:S,relativePath:d.relativePath,theaterId:t,truncated:d.truncated,contextRelPath:i}),d.kind==="code"&&d.lang!=="markdown"&&u.jsx(GO,{content:d.content,lang:d.lang,truncated:d.truncated}),d.kind==="image"&&u.jsx(VO,{src:d.src,name:d.name}),d.kind==="binary"&&u.jsx(DO,{name:d.name})]})]}),u.jsx("div",{className:"fexp-divider",onPointerDown:w,"aria-hidden":"true"})]}),u.jsx("div",{className:"fexp-tree-pane",children:u.jsx(MO,{files:m,theaterId:t,contextKey:s,contextRelPath:i,selectedPath:o,onSelect:C},s)})]})}function Ij(){return u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 5a2 2 0 012-2h3.586a1 1 0 01.707.293L10.707 4.7A1 1 0 0011.414 5H15a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V5z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"})})}const Bj={id:"file-explorer",railPanels:[Oj]},Pj=[Bj];function w2(e,t){return JSON.stringify([e,t])}const vg=12,no=28,pm=3,zj=5,RS=["var(--brass)","var(--aurora)","var(--warn)","var(--positive)","color-mix(in oklch, var(--brass) 70%, var(--aurora))","color-mix(in oklch, var(--aurora) 70%, var(--positive))","color-mix(in oklch, var(--warn) 72%, var(--brass))","color-mix(in oklch, var(--ink-spectral) 76%, var(--aurora))"];function Fl(e){return e*vg+6}function ea(e){return RS[e%RS.length]??"var(--ink-fog)"}function Hj({node:e,laneCount:t,collapsed:i=!1}){const s=Math.max(t,1),o=i?10:0,d=s*vg+o,p=Fl(e.lane),l=no/2;return u.jsxs("svg",{width:d,height:no,viewBox:`0 0 ${d} ${no}`,"aria-hidden":"true",style:{display:"block",flexShrink:0},children:[e.passThroughLanes.map(h=>u.jsx("line",{x1:Fl(h),y1:0,x2:Fl(h),y2:no,stroke:ea(h),strokeWidth:1.5},`pt-${h}`)),e.connectAbove&&u.jsx("line",{x1:p,y1:0,x2:p,y2:l-pm,stroke:ea(e.lane),strokeWidth:1.5}),e.connectBelow&&u.jsx("line",{x1:p,y1:l+pm,x2:p,y2:no,stroke:ea(e.lane),strokeWidth:1.5}),e.mergeFromLanes.map(h=>u.jsx("line",{x1:Fl(h),y1:0,x2:p,y2:l,stroke:ea(h),strokeWidth:1.5,strokeLinecap:"round"},`mf-${h}`)),e.branchToLanes.map(h=>u.jsx("line",{x1:p,y1:l,x2:Fl(h),y2:no,stroke:ea(h),strokeWidth:1.5,strokeLinecap:"round"},`bt-${h}`)),e.isHead&&u.jsx("circle",{cx:p,cy:l,r:zj,fill:"none",stroke:ea(e.lane),strokeWidth:1.5}),u.jsx("circle",{cx:p,cy:l,r:pm,fill:ea(e.lane)}),i&&u.jsx("text",{x:s*vg+2,y:l+4,fontSize:10,fontFamily:"monospace",fill:"var(--ink-fog)",children:"⋯"})]})}const mm=8;function $j(e){if(e.length===0)return{nodes:[],activeLaneCount:0,collapsed:!1};const t=[],i=[];let s=!1,o=0;for(let d=0;d<e.length;d++){const p=e[d],l=p.fullHash,h=[...p.parents],f=[];for(let w=0;w<t.length;w++)t[w]===l&&f.push(w);let v,m=!1;const S=[];if(f.length===0){const w=t.indexOf(null);w>=0?v=w:t.length<mm?(v=t.length,t.push(null)):(s=!0,v=mm-1,t[v]=null,m=!0)}else{v=Math.min(...f);for(const w of f)w!==v&&(S.push(w),t[w]=null)}const C=[];if(h.length===0)t[v]=null;else{t[v]=m?null:h[0]??null;for(const w of h.slice(1))if(!(t.indexOf(w)>=0)){const b=t.indexOf(null);if(b>=0)t[b]=w,C.push(b);else if(t.length<mm){const g=t.length;t.push(w),C.push(g)}else s=!0}}const T=t.map((w,_)=>({h:w,i:_})).filter(({h:w,i:_})=>w!==null&&_!==v).map(({i:w})=>w);o=Math.max(o,v,...C,...T),i.push({lane:v,isHead:p.refs.some(w=>w==="HEAD"||w.startsWith("HEAD ->")),connectAbove:f.length>0,connectBelow:h.length>0&&t[v]===h[0],passThroughLanes:T,mergeFromLanes:S,branchToLanes:C})}return{nodes:i,activeLaneCount:o+1,collapsed:s}}const Uj=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)/,Fj=/^diff --git a\/(.+) b\/(.+)$/;function Wj(e){if(!e)return[];const t=e.split(`
214
+ `);t[t.length-1]===""&&t.pop();const i=[];let s=0,o=0,d=!0;for(const p of t)if(!p.startsWith("\\")){if(p.startsWith("diff --git ")){const l=Fj.exec(p),h=l?.[1],f=l?.[2]??p,v=h!==void 0&&h!==f?h:void 0;i.push({kind:"file-label",text:f,oldPath:v}),d=!0;continue}if(d){if(p.startsWith("index ")||p.startsWith("--- ")||p.startsWith("+++ ")||p.startsWith("new file mode")||p.startsWith("deleted file mode")||p.startsWith("old mode")||p.startsWith("new mode")||p.startsWith("rename from ")||p.startsWith("rename to ")||p.startsWith("similarity index")||p.startsWith("dissimilarity index"))continue;if(!p.startsWith("@@")){p!==""&&i.push({kind:"ctx",text:` ${p}`});continue}}if(p.startsWith("@@")){d=!1;const l=Uj.exec(p);if(l){s=parseInt(l[1]??"0",10),o=parseInt(l[2]??"0",10);const h=l[3]?.trimEnd()??"",f=`@@ -${l[1]??""} +${l[2]??""} @@${h?` ${h.trimStart()}`:""}`;i.push({kind:"hunk-label",text:f})}else i.push({kind:"hunk-label",text:p});continue}p.startsWith("+")?i.push({kind:"add",text:p,newLine:o++}):p.startsWith("-")?i.push({kind:"del",text:p,oldLine:s++}):i.push({kind:"ctx",text:p,oldLine:s++,newLine:o++})}return i}function gm(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function C2({ctx:e,file:t,mode:i,subPath:s,commit:o}){const[d,p]=L.useState({kind:"loading"});if(L.useEffect(()=>{if(!e.theaterId){p({kind:"error",message:"no_theater"});return}let v=!1;return p({kind:"loading"}),o?e.api.fetch("diff","commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:o.theaterId,ref:o.commit.fullHash,subPath:o.subPath})}).then(async m=>{const S=await m.json();v||p({kind:"ok",result:S})}).catch(m=>{v||p({kind:"error",message:m instanceof Error?m.message:"unknown"})}):e.api.fetch("diff","file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,filePath:t.path,mode:i,subPath:s})}).then(async m=>{const S=await m.json();v||p({kind:"ok",result:S})}).catch(m=>{v||p({kind:"error",message:m instanceof Error?m.message:"unknown"})}),()=>{v=!0}},[e.api,e.theaterId,t.path,i,s,o]),d.kind==="loading")return u.jsx("div",{className:"diff-hunk-loading",children:"Loading…"});if(d.kind==="error")return u.jsx("div",{className:"diff-hunk-error",children:d.message});const{result:l}=d,h=Wj(l.content),f=o?h:h.filter(v=>v.kind!=="file-label");return u.jsxs("div",{className:"diff-hunk-wrap",children:[l.truncated&&u.jsx("div",{className:"diff-truncated-badge",children:"Diff truncated"}),u.jsx("div",{className:"diff-hunk-scroll",children:u.jsx("table",{className:"diff-hunk-table",cellSpacing:0,cellPadding:0,children:u.jsx("tbody",{children:f.map((v,m)=>u.jsx("tr",{className:`diff-line diff-line-${v.kind}`,children:v.kind==="hunk-label"?u.jsx("td",{colSpan:4,className:"diff-line-label",dangerouslySetInnerHTML:{__html:gm(v.text)}}):v.kind==="file-label"?u.jsx("td",{colSpan:4,className:"diff-line-file-label",dangerouslySetInnerHTML:{__html:gm(v.text)}}):u.jsxs(u.Fragment,{children:[u.jsx("td",{className:"diff-gutter diff-gutter-old",children:v.oldLine??""}),u.jsx("td",{className:"diff-gutter diff-gutter-new",children:v.newLine??""}),u.jsx("td",{className:"diff-marker",children:v.kind==="add"?"+":v.kind==="del"?"−":""}),u.jsx("td",{className:"diff-line-code",dangerouslySetInnerHTML:{__html:gm(v.text.length>0?v.text.slice(1):v.text)}})]})},m))})})})]})}function Gj(e,t=new Date){const i=new Date(e*1e3);if(!Number.isFinite(i.getTime()))return"—";const s=`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`,o=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),d=new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime(),p=Math.round((o-d)/864e5);return p===0?`Today ${s}`:p===1?`Yesterday ${s}`:`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function E2(e){const t=[];for(const i of e.refs)if(i==="HEAD")t.push({label:"HEAD",kind:"head"});else if(i.startsWith("HEAD -> refs/heads/"))t.push({label:i.slice(19),kind:"branch"});else if(i.startsWith("HEAD -> "))t.push({label:i.slice(8),kind:"branch"});else if(i.startsWith("tag: refs/tags/"))t.push({label:i.slice(15),kind:"tag"});else if(i.startsWith("tag: "))t.push({label:i.slice(5),kind:"tag"});else if(i.startsWith("refs/remotes/")){const s=i.slice(13);s.endsWith("/HEAD")||t.push({label:s,kind:"remote"})}else i.startsWith("refs/worktrees/")?t.push({label:i.slice(15),kind:"worktree"}):i.startsWith("refs/heads/")?t.push({label:i.slice(11),kind:"branch"}):t.push({label:i,kind:"branch"});return t}const k2=140,T2=140,ko=4,qj=null;function A2({startWidth:e,dx:t,containerWidth:i,listPaneMinWidth:s,hunkPaneMinWidth:o,dividerWidth:d}){const p=i-o-d;return p<s?qj:Math.max(s,Math.min(p,e-t))}function Kj(e){const t=k2+ko;return`minmax(0, 1fr) ${ko}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function Vj(e){const t=T2+ko;return`minmax(0, 1fr) ${ko}px minmax(0, min(${e}px, calc(100% - ${t}px)))`}function Yj({documentTarget:e,windowTarget:t,onMove:i,onFinish:s}){let o=!0;const d=()=>{e.removeEventListener("pointermove",i),e.removeEventListener("pointerup",p),e.removeEventListener("pointercancel",p),t.removeEventListener("blur",p)},p=()=>{o&&(o=!1,d(),s())},l=()=>{o&&(o=!1,d())};return e.addEventListener("pointermove",i),e.addEventListener("pointerup",p),e.addEventListener("pointercancel",p),t.addEventListener("blur",p),l}const Xj=400,R2="fleet-console.history.listPaneWidth",Zj=360,L2=220;function Jj(e,t){return t.find(i=>i.branch===null&&i.sha===e.fullHash)??null}function Qj(e,t){const i=t.toLowerCase();return i?e.filter(s=>s.subject.toLowerCase().includes(i)||s.authorName.toLowerCase().includes(i)||s.shortHash.toLowerCase().includes(i)||s.fullHash.toLowerCase().includes(i)||s.refs.some(o=>o.toLowerCase().includes(i))||E2(s).some(o=>o.label.toLowerCase().includes(i))):e}function LS({current:e}){return e?u.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none","aria-label":"Current checkout",children:u.jsx("path",{d:"M2.5 6.2L5 8.7L9.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):u.jsx("svg",{className:"history-badge-icon",viewBox:"0 0 12 12",fill:"none","aria-label":"Checked out in another worktree",children:u.jsx("path",{d:"M1.5 3.4h3l1 1.1h5v5.1a.9.9 0 01-.9.9H2.4a.9.9 0 01-.9-.9V4.3a.9.9 0 01.9-.9z",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function e7({entry:e,checkouts:t,selected:i,graphNode:s,laneCount:o,layoutCollapsed:d,onSelect:p}){const l=E2(e),h=Jj(e,t);return u.jsxs("button",{type:"button",className:`history-commit-row${i?" is-selected":""}${e.onHead?"":" is-off-head"}`,onClick:()=>p(e),children:[u.jsx("span",{className:"history-graph-gutter","aria-hidden":"true",children:u.jsx(Hj,{node:s,laneCount:o,collapsed:d})}),u.jsxs("span",{className:"history-commit-badges",children:[l.map(f=>{const v=f.kind==="branch"?t.find(m=>m.branch===f.label):null;return u.jsxs("span",{className:`history-badge history-badge--${f.kind}`,children:[v?u.jsx(LS,{current:v.isCurrent}):null,f.label]},`${f.kind}:${f.label}`)}),h?u.jsxs("span",{className:"history-badge history-badge--worktree",children:[u.jsx(LS,{current:h.isCurrent}),"detached"]}):null]}),u.jsx("span",{className:"history-commit-subject",children:e.subject}),u.jsx("span",{className:"history-commit-author",children:e.authorName}),u.jsx("span",{className:"history-commit-sha",children:e.shortHash}),u.jsx("span",{className:"history-commit-time",children:Gj(e.authorAt)})]})}function t7({ctx:e}){const t=w2(e.theaterId,e.pathContext.relPath);return u.jsx(n7,{ctx:e},t)}function n7({ctx:e}){const[t,i]=L.useState({kind:"loading"}),[s,o]=L.useState(null),[d,p]=L.useState(""),[l,h]=L.useState(0),[f,v]=L.useState(s7),m=L.useRef(0),S=L.useRef(f),C=L.useRef(null),T=L.useRef(null),[w,_]=L.useState(!1),b=e.pathContext.relPath??"";L.useEffect(()=>{if(!e.theaterId){i({kind:"ok",commits:[],checkouts:[],truncated:!1});return}const N=++m.current;i({kind:"loading"}),e.api.fetch("diff","log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:b})}).then(async R=>{if(N!==m.current)return;if(!R.ok){const q=await R.json();i({kind:"error",message:q.error??"unknown"});return}const B=await R.json();N===m.current&&i({kind:"ok",commits:B.commits,checkouts:B.checkouts,truncated:B.truncated??!1})}).catch(R=>{N===m.current&&i({kind:"error",message:R instanceof Error?R.message:"unknown"})})},[e.api,e.theaterId,l,b]),L.useLayoutEffect(()=>(e.requestExtraWidth?.(s?Xj:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,s]),L.useEffect(()=>()=>{T.current?.(),T.current=null},[]);const g=L.useCallback(N=>{e.theaterId&&o({commit:N,subPath:b,theaterId:e.theaterId})},[e.theaterId,b]),y=L.useCallback(N=>{N.preventDefault();const R=C.current;if(!R)return;const B=R.getBoundingClientRect().width,q=N.clientX,W=S.current;T.current?.(),_(!0);const G=K=>{const P=A2({startWidth:W,dx:K.clientX-q,containerWidth:B,listPaneMinWidth:L2,hunkPaneMinWidth:T2,dividerWidth:ko});P!==null&&(S.current=P,v(P))},I=()=>{T.current=null,_(!1);try{localStorage.setItem(R2,String(S.current))}catch{}};T.current=Yj({documentTarget:document,windowTarget:window,onMove:G,onFinish:I})},[]),k=L.useMemo(()=>t.kind==="ok"?Qj(t.commits,d):[],[d,t]),M=t.kind==="ok"?$j(k):null,A=t.kind==="ok"?d?`${k.length}/${t.commits.length}`:String(t.commits.length):null;return u.jsxs("div",{ref:C,className:`history-root${s?" has-detail":""}${w?" is-dragging":""}`,style:s?{gridTemplateColumns:Vj(f)}:void 0,children:[s?u.jsxs("div",{className:"history-detail-pane",children:[u.jsxs("div",{className:"history-detail-head",children:[u.jsx("span",{className:"history-detail-sha",children:s.commit.shortHash}),u.jsx("span",{className:"history-detail-subject",children:s.commit.subject}),u.jsx("button",{type:"button",className:"history-detail-close","aria-label":"Close commit diff",onClick:()=>o(null),children:"✕"})]}),u.jsx("div",{className:"history-detail-body",children:u.jsx(C2,{ctx:e,file:{path:"",status:"M",additions:0,deletions:0},mode:"unified",subPath:s.subPath,commit:s})})]}):null,s?u.jsx("div",{className:"history-divider",onPointerDown:y,"aria-hidden":"true"}):null,u.jsxs("div",{className:"history-list-pane",children:[u.jsxs("div",{className:"history-toolbar",children:[u.jsxs("div",{className:"history-filter",children:[u.jsx("input",{type:"text",className:"history-filter-input",placeholder:"Filter…","aria-label":"Filter commits",value:d,onChange:N=>p(N.target.value)}),d?u.jsx("button",{type:"button",className:"history-filter-clear","aria-label":"Clear filter",onClick:()=>p(""),children:"✕"}):null]}),A?u.jsx("span",{className:"history-count",children:A}):null]}),u.jsxs("div",{className:"history-list",children:[t.kind==="loading"?u.jsx("div",{className:"history-empty",children:"Loading…"}):null,t.kind==="error"?u.jsxs("div",{className:"history-error",children:[u.jsx("span",{children:t.message}),u.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:()=>h(N=>N+1),children:"Retry"})]}):null,t.kind==="ok"&&t.commits.length===0?u.jsx("div",{className:"history-empty",children:"No history"}):null,t.kind==="ok"&&t.commits.length>0&&k.length===0?u.jsx("div",{className:"history-empty",children:"No matching items"}):null,t.kind==="ok"&&M?k.map((N,R)=>u.jsx(e7,{entry:N,checkouts:t.checkouts,selected:s?.commit.fullHash===N.fullHash,graphNode:M.nodes[R],laneCount:M.activeLaneCount,layoutCollapsed:M.collapsed,onSelect:g},N.fullHash)):null,t.kind==="ok"&&(t.truncated||t.commits.length>=200)?u.jsx("div",{className:"history-truncated",children:"History capped at 200 commits."}):null]})]})]})}function i7(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("path",{d:"M5 3v12M10 7v8M14 11v4",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"}),u.jsx("path",{d:"M5 7c1.8 0 2.4 0 5 0M10 11c1.4 0 2.2 0 4 0",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}const r7={id:"history",title:"History",icon:()=>u.jsx(i7,{}),pathAware:!0,render:e=>u.jsx(t7,{ctx:e})};function s7(){try{const e=localStorage.getItem(R2),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(L2,t)}catch{}return Zj}const a7={M:"M",A:"A",D:"D",R:"R",U:"U"};function o7(e){const t={dirs:{},files:[]};for(const i of e){const s=i.path.split("/");s.pop();let o=t;for(const d of s)o.dirs[d]||(o.dirs[d]={dirs:{},files:[]}),o=o.dirs[d];o.files.push(i)}return t}function l7({files:e,selectedPath:t,onSelect:i}){const s=o7(e);return u.jsx(M2,{node:s,depth:0,selectedPath:t,onSelect:i})}function M2({node:e,depth:t,selectedPath:i,onSelect:s}){return u.jsxs(u.Fragment,{children:[Object.entries(e.dirs).map(([o,d])=>u.jsx(c7,{dirKey:o,node:d,depth:t,selectedPath:i,onSelect:s},o)),e.files.map(o=>u.jsx(u7,{entry:o,depth:t,selectedPath:i,onSelect:s},o.path))]})}function c7({dirKey:e,node:t,depth:i,selectedPath:s,onSelect:o}){const[d,p]=L.useState(!1),l=L.useCallback(()=>p(m=>!m),[]);let h=e,f=t;for(;Object.keys(f.dirs).length===1&&f.files.length===0;){const m=Object.keys(f.dirs)[0];h+="/"+m,f=f.dirs[m]}const v=i*16+12;return u.jsxs("div",{className:`diff-folder${d?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"diff-folder-row",style:{paddingLeft:`${v}px`},onClick:l,"aria-expanded":!d,children:[u.jsx("svg",{className:"diff-folder-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("svg",{className:"diff-folder-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M2 4a1 1 0 011-1h3l1.2 1.2H13a1 1 0 011 1V12a1 1 0 01-1 1H3a1 1 0 01-1-1V4z",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})}),u.jsx("span",{className:"diff-folder-name",children:h})]}),!d&&u.jsx(M2,{node:f,depth:i+1,selectedPath:s,onSelect:o})]})}function u7({entry:e,depth:t,selectedPath:i,onSelect:s}){const o=e.path===i,d=L.useCallback(()=>s(e),[e,s]),p=t*16+12,l=e.path.split("/").pop()??e.path;return u.jsxs("button",{type:"button",className:`diff-file-row${o?" is-cur":""}`,style:{paddingLeft:`${p}px`},title:e.path,onClick:d,children:[u.jsx("span",{className:`diff-status-glyph diff-status-${e.status.toLowerCase()}`,"aria-label":e.status,children:a7[e.status]??e.status}),u.jsx("span",{className:"diff-file-name",children:u.jsx("span",{className:"diff-file-fn",children:l})}),u.jsxs("span",{className:"diff-nums",children:[e.additions>0&&u.jsxs("span",{className:"diff-additions",children:["+",e.additions]}),e.deletions>0&&u.jsxs("span",{className:"diff-deletions",children:["−",e.deletions]})]})]})}const MS="fleet-console.diff.changesCollapsed",h7={M:"modified",A:"added",D:"deleted",R:"renamed",U:"untracked"};function d7(e,t){const i=t.toLowerCase();return i?e.filter(s=>s.path.toLowerCase().includes(i)):e}function f7(e){try{return localStorage.getItem(e)==="1"}catch{return!1}}function p7({ctx:e,viewMode:t,selectedPath:i,subPath:s,onSelect:o,filterText:d}){const[p,l]=L.useState({kind:"loading"}),[h,f]=L.useState(0),[v,m]=L.useState(()=>f7(MS));L.useEffect(()=>{if(!e.theaterId){l({kind:"error",message:"no_theater"});return}let _=!1;return l({kind:"loading"}),fetch("/plugins/diff/changed",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({theaterId:e.theaterId,subPath:s})}).then(async b=>{if(!b.ok){const k=(await b.json()).error??"git_failed";_||l(k==="no_git_repo"||k==="git_unavailable"?{kind:"notice",reason:k}:{kind:"error",message:k});return}const g=await b.json();_||l({kind:"ok",files:g.files})}).catch(b=>{_||l({kind:"error",message:b instanceof Error?b.message:"unknown"})}),()=>{_=!0}},[e.theaterId,s,h]);const S=L.useCallback(()=>f(_=>_+1),[]),C=L.useCallback(()=>{m(_=>{const b=!_;try{localStorage.setItem(MS,b?"1":"0")}catch{}return b})},[]),T=L.useMemo(()=>p.kind==="ok"?d7(p.files,d):[],[d,p]);if(p.kind==="loading")return u.jsx("div",{className:"diff-sections-loading",children:"Loading…"});if(p.kind==="notice"){const _=p.reason==="no_git_repo"?"Not a Git repository":"Git isn't available",b=p.reason==="no_git_repo"?"This folder isn't a Git repository, so there are no changes to show.":"Git was not found on this system. Install Git and make sure it's on your PATH.";return u.jsxs("div",{className:"diff-sections-notice",children:[u.jsx("strong",{className:"diff-notice-title",children:_}),u.jsx("span",{className:"diff-notice-body",children:b}),u.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:S,children:"Retry"})]})}if(p.kind==="error")return u.jsxs("div",{className:"diff-sections-error",children:[u.jsx("span",{children:p.message}),u.jsx("button",{type:"button",className:"diff-refresh-btn",onClick:S,children:"Retry"})]});const w=d?`${T.length}/${p.files.length}`:String(p.files.length);return u.jsx("div",{className:"diff-sections",children:u.jsxs("div",{className:`diff-section${v?" is-collapsed":""}`,children:[u.jsxs("button",{type:"button",className:"diff-section-head",onClick:C,children:[u.jsx("svg",{className:"diff-section-chevron",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})}),u.jsx("span",{className:"diff-section-name",children:"Changes"}),u.jsx("span",{className:"diff-count-badge",children:w})]}),!v&&u.jsx("div",{className:"diff-section-rows",children:T.length===0?u.jsx("div",{className:"diff-empty-row",children:d?"No matching items":"No changes"}):t==="tree"?u.jsx(l7,{files:T,selectedPath:i,onSelect:o}):T.map(_=>u.jsx(m7,{entry:_,isSelected:_.path===i,onSelect:o},_.path))})]})})}function m7({entry:e,isSelected:t,onSelect:i}){const s=L.useCallback(()=>i(e),[e,i]),o=e.path.endsWith("/")?e.path.slice(0,-1):e.path,d=o.lastIndexOf("/"),p=d>=0?o.slice(0,d+1):"",l=(d>=0?o.slice(d+1):o)+(e.path.endsWith("/")?"/":"");return u.jsxs("button",{type:"button",className:`diff-file-row${t?" is-cur":""}`,title:e.path,onClick:s,children:[u.jsx("span",{className:`diff-status-glyph diff-status-${e.status.toLowerCase()}`,"aria-label":h7[e.status]??e.status,children:e.status}),u.jsxs("span",{className:"diff-file-name",children:[u.jsx("span",{className:"diff-file-fn",children:l}),p&&u.jsx("span",{className:"diff-file-dir",children:p})]}),u.jsxs("span",{className:"diff-nums",children:[e.additions>0&&u.jsxs("span",{className:"diff-additions",children:["+",e.additions]}),e.deletions>0&&u.jsxs("span",{className:"diff-deletions",children:["−",e.deletions]})]})]})}const bg=new Set;let j_={file:null};function N2(){for(const e of bg)e()}function g7(e){return bg.add(e),()=>{bg.delete(e)}}function NS(){return j_}function _7(e,t){const i=L.useSyncExternalStore(g7,NS,NS);return!i.file||i.file.theaterId!==e||i.file.subPath!==t?null:i.file}function v7(e,t,i){j_={file:{entry:e,subPath:t,theaterId:i}},N2()}function OS(){j_={file:null},N2()}const O2="fleet-console.diff.viewMode",D2="fleet-console.diff.listPaneWidth",b7=400,y7=248,j2=220;function S7(){try{const e=localStorage.getItem(O2);if(e==="list"||e==="tree")return e}catch{}return"list"}function x7(){try{const e=localStorage.getItem(D2),t=e===null?NaN:Number.parseFloat(e);if(Number.isFinite(t)&&t>0)return Math.max(j2,t)}catch{}return y7}function w7(e){return e.entry.status==="U"?"untracked":"unified"}function C7({ctx:e}){const t=w2(e.theaterId,e.pathContext.relPath);return u.jsx(E7,{ctx:e},t)}function E7({ctx:e}){const[t,i]=L.useState(S7),[s,o]=L.useState(""),d=e.pathContext.relPath??"",p=_7(e.theaterId??null,d),[l,h]=L.useState(x7),f=L.useRef(l),v=L.useRef(null),[m,S]=L.useState(!1);L.useLayoutEffect(()=>()=>OS(),[]);const C=L.useCallback(g=>{e.theaterId&&v7(g,d,e.theaterId)},[e.theaterId,d]),T=L.useCallback(()=>OS(),[]),w=L.useCallback(g=>{i(g);try{localStorage.setItem(O2,g)}catch{}},[]),_=L.useCallback(g=>{g.preventDefault();const y=v.current;if(!y)return;const k=y.getBoundingClientRect().width,M=g.clientX,A=f.current;S(!0);const N=B=>{const q=A2({startWidth:A,dx:B.clientX-M,containerWidth:k,listPaneMinWidth:j2,hunkPaneMinWidth:k2,dividerWidth:ko});q!==null&&(f.current=q,h(q))},R=()=>{document.removeEventListener("pointermove",N),document.removeEventListener("pointerup",R),S(!1);try{localStorage.setItem(D2,String(f.current))}catch{}};document.addEventListener("pointermove",N),document.addEventListener("pointerup",R)},[]);L.useLayoutEffect(()=>(e.requestExtraWidth?.(p?b7:null),()=>e.requestExtraWidth?.(null)),[e.requestExtraWidth,p]);const b=p?w7(p):null;return u.jsxs("div",{ref:v,className:`diff-root${p?" has-hunk":""}${m?" is-dragging":""}`,style:p?{gridTemplateColumns:Kj(l)}:void 0,children:[p&&b?u.jsxs("div",{className:"diff-hunk-pane",children:[u.jsxs("div",{className:"diff-hunk-head",children:[u.jsx("span",{children:p.entry.path}),u.jsx("button",{type:"button",onClick:T,children:"✕"})]}),u.jsx(C2,{ctx:e,file:p.entry,mode:b,subPath:p.subPath})]}):null,p?u.jsx("div",{className:"diff-divider",onPointerDown:_,"aria-hidden":"true"}):null,u.jsxs("div",{className:"diff-list-pane",children:[u.jsxs("div",{className:"diff-toolbar",children:[u.jsxs("div",{className:"diff-filter",children:[u.jsx("input",{type:"text",className:"diff-filter-input",placeholder:"Filter…","aria-label":"Filter changed files",value:s,onChange:g=>o(g.target.value)}),s?u.jsx("button",{type:"button",className:"diff-filter-clear","aria-label":"Clear filter",onClick:()=>o(""),children:"✕"}):null]}),u.jsxs("div",{className:"diff-view-toggle",children:[u.jsx("button",{type:"button",className:`diff-toggle-btn${t==="list"?" is-active":""}`,title:"List view","aria-pressed":t==="list",onClick:()=>w("list"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("line",{x1:"2",y1:"3.5",x2:"12",y2:"3.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"7",x2:"12",y2:"7",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("line",{x1:"2",y1:"10.5",x2:"12",y2:"10.5",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}),u.jsx("button",{type:"button",className:`diff-toggle-btn${t==="tree"?" is-active":""}`,title:"Tree view","aria-pressed":t==="tree",onClick:()=>w("tree"),children:u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"1",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"1",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"1",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("rect",{x:"9",y:"9",width:"4",height:"4",rx:"1",stroke:"currentColor",strokeWidth:"1.3"})]})})]})]}),u.jsx(p7,{ctx:e,viewMode:t,selectedPath:p?.entry.path??null,subPath:d,onSelect:C,filterText:s})]})]})}function k7(){return u.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"4",width:"6",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("rect",{x:"2",y:"7",width:"10",height:"1.5",rx:"0.5",fill:"currentColor"}),u.jsx("rect",{x:"2",y:"10",width:"8",height:"1.5",rx:"0.5",fill:"currentColor",opacity:"0.5"}),u.jsx("rect",{x:"2",y:"13",width:"12",height:"1.5",rx:"0.5",fill:"currentColor"})]})}const T7={id:"diff",title:"Diff",icon:()=>u.jsx(k7,{}),pathAware:!0,render:e=>u.jsx(C7,{ctx:e})},A7={id:"diff",railPanels:[T7,r7]},R7=[A7],lh=["claude-code","codex","cursor","opencode"],L7={"claude-code":"Claude",codex:"Codex",cursor:"Cursor",opencode:"OpenCode"},M7="Skills run with full agent permissions. Review before use — open the name to read SKILL.md.";function N7({source:e,skill:t,theaterId:i,relPath:s,onCancel:o,onStarted:d,jobLog:p}){const[l,h]=L.useState(i?"project":"global"),[f,v]=L.useState(!0),[m,S]=L.useState(new Set(lh)),{status:C,start:T}=p,w=C==="running",_=C==="done",b=C==="error",g=L.useCallback(()=>{v(!0),S(new Set(lh))},[]),y=L.useCallback(M=>{v(!1),S(A=>{const N=new Set(A);return N.has(M)?N.delete(M):N.add(M),N})},[]),k=L.useCallback(()=>{const M=f?lh:Array.from(m);if(M.length===0)return;const A={source:e,skill:t,scope:l,agents:M};l==="project"&&i&&(A.theaterId=i,A.relPath=s),T("/plugins/skills/install",A),d(l)},[f,m,e,t,l,i,s,T,d]);return u.jsxs("div",{className:"skills-install-flow",children:[u.jsxs("div",{className:"skills-scope-toggle",children:[u.jsx("button",{type:"button",className:`skills-scope-btn${l==="project"?" is-active":""}`,onClick:()=>h("project"),disabled:!i||w||_,title:i?void 0:"Select a Theater to install project skills",children:"Project"}),u.jsx("button",{type:"button",className:`skills-scope-btn${l==="global"?" is-active":""}`,onClick:()=>h("global"),disabled:w||_,children:"Global"})]}),u.jsxs("div",{className:"skills-agents-row",children:[u.jsx("button",{type:"button",className:`skills-agent-chip${f?" is-active":""}`,onClick:g,disabled:w||_,children:"All agents"}),lh.map(M=>u.jsx("button",{type:"button",className:`skills-agent-chip${!f&&m.has(M)?" is-active":""}`,onClick:()=>y(M),disabled:w||_,children:L7[M]},M))]}),u.jsx("p",{className:"skills-permission-warning",children:M7}),!w&&!_&&!b&&u.jsxs("div",{className:"skills-card-actions",children:[u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",onClick:o,children:"Cancel"}),u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:k,disabled:!f&&m.size===0,children:"Install now"})]})]})}const O7=4e3;function I2({status:e,lines:t,runningLabel:i,doneLabel:s,errorLabel:o,onDismiss:d,onRetry:p}){const[l,h]=L.useState(!1),f=L.useRef(null),v=L.useRef(null);L.useEffect(()=>{e==="running"&&h(!1)},[e]),L.useEffect(()=>{const _=f.current;_&&(_.scrollTop=_.scrollHeight)},[t]),L.useEffect(()=>{if(e==="done")return v.current=setTimeout(()=>{h(!1),d()},O7),()=>{v.current&&(clearTimeout(v.current),v.current=null)}},[e,d]);const m=L.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null),h(!1),d()},[d]),S=L.useCallback(()=>h(_=>!_),[]);if(e==="idle")return null;const C=e==="running"?"skills-dock-dot is-live":e==="done"?"skills-dock-dot is-ok":"skills-dock-dot is-err",T=e==="done"?"skills-dock-label is-ok":e==="error"?"skills-dock-label is-err":"skills-dock-label",w=e==="running"?i:e==="done"?s:o;return u.jsxs("div",{className:"skills-dock",children:[l&&u.jsxs("div",{ref:f,className:"skills-dock-log",children:[t.map((_,b)=>u.jsx("div",{className:"skills-dock-log-line",children:_},b)),e==="done"&&u.jsxs("div",{className:"skills-dock-log-line skills-dock-log-done",children:["✓ ",s]}),e==="error"&&u.jsxs("div",{className:"skills-dock-log-line skills-dock-log-error",children:["✗ ",o]})]}),u.jsxs("div",{role:"button",tabIndex:0,className:`skills-dock-summary${l?" is-open":""}`,"aria-expanded":l,onClick:S,onKeyDown:_=>{_.target===_.currentTarget&&(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),S())},children:[u.jsx("span",{className:C,"aria-hidden":"true"}),u.jsx("span",{className:T,"aria-live":"polite",children:w}),e==="running"&&t.length>0&&u.jsxs("span",{className:"skills-dock-count",children:[t.length," ",t.length===1?"line":"lines"]}),e==="done"&&u.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:_=>{_.stopPropagation(),m()},children:"✕"}),e==="error"&&u.jsxs(u.Fragment,{children:[p!=null&&u.jsx("button",{type:"button",className:"skills-dock-retry",onClick:_=>{_.stopPropagation(),p()},children:"Retry"}),u.jsx("button",{type:"button",className:"skills-dock-dismiss","aria-label":"Dismiss",onClick:_=>{_.stopPropagation(),m()},children:"✕"})]}),u.jsx("span",{className:`skills-dock-chevron${l?" is-open":""}`,"aria-hidden":"true",children:"▾"})]})]})}const D7={activeTab:"installed",scope:"project",filterText:"",searchQuery:"",searchResults:[],searchLoading:!1,installedList:[],installedLoading:!1,installedContextKey:null,updateJobId:null,updateJobScope:null,installFormOpenId:null},yg=new Set;let Rn=D7;function Ds(){for(const e of yg)e()}function j7(e){return yg.add(e),()=>{yg.delete(e)}}function DS(){return Rn}function I_(){return L.useSyncExternalStore(j7,DS,DS)}function ch(e){Rn={...Rn,activeTab:e},Ds()}function jS(e){Rn={...Rn,scope:e},Ds()}function I7(e){Rn={...Rn,filterText:e},Ds()}function B7(e){Rn={...Rn,searchQuery:e},Ds()}function lo(e,t){Rn={...Rn,searchResults:e,searchLoading:t},Ds()}function Qh(e,t){return JSON.stringify([e,t])}function Sg(e,t){return e.installedContextKey===t}function _m(e,t,i){Rn.installedContextKey===e&&(Rn={...Rn,installedList:t,installedLoading:i},Ds())}function xg(e){Rn={...Rn,installFormOpenId:e},Ds()}function P7(e){Rn={...Rn,installedContextKey:e,installedList:[],installedLoading:!1,installFormOpenId:null},Ds()}const IS=750;function B2(){const[e,t]=L.useState({status:"idle",lines:[]}),i=L.useRef(null),s=L.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]);L.useEffect(()=>()=>s(),[s]);const o=L.useCallback(()=>{s(),t({status:"idle",lines:[]})},[s]),d=L.useCallback((p,l)=>{s(),t({status:"running",lines:[]}),(async()=>{const h=await fetch(p,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}).catch(()=>null);if(!h?.ok){t({status:"error",lines:[]});return}const{jobId:f}=await h.json();let v=0;const m=async()=>{const S=await fetch(`/plugins/skills/jobs?jobId=${encodeURIComponent(f)}&cursor=${v}`).catch(()=>null);if(!S?.ok){t(T=>({...T,status:"error"}));return}const C=await S.json();v=C.nextCursor,t(T=>({...T,lines:[...T.lines,...C.lines]})),C.status==="running"?i.current=setTimeout(()=>{m()},IS):t(T=>({...T,status:C.status}))};i.current=setTimeout(()=>{m()},IS)})()},[s]);return{...e,start:d,reset:o}}const z7=300,Eh=2;function H7(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}async function $7(e){if(e.length<Eh){lo([],!1);return}lo([],!0);try{const t=await fetch(`/plugins/skills/search?q=${encodeURIComponent(e)}&limit=10`);if(!t.ok){lo([],!1);return}const i=await t.json();lo(i.skills??[],!1)}catch{lo([],!1)}}function U7({result:e,theaterId:t,relPath:i,isFormOpen:s,onInstallClick:o,onReadMore:d,onInstallStarted:p,jobLog:l}){const h={name:e.name,scope:"project",agents:[],source:e.source,displayPath:""};return u.jsxs("div",{className:`skills-card${s?" is-expanded":""}`,children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>d(h,e.id),title:"Read SKILL.md preview",children:e.name}),e.installs>0&&u.jsx("span",{className:"skills-card-installs",children:H7(e.installs)})]}),u.jsx("span",{className:"skills-card-meta",children:e.source}),u.jsx("div",{className:"skills-card-actions",children:u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:o,children:s?"Cancel":"Install"})}),s&&u.jsx(N7,{source:e.source,skill:e.name,theaterId:t,relPath:i,onCancel:o,onStarted:f=>p(e.name,f),jobLog:l})]})}function F7({theaterId:e,relPath:t,onReadMore:i,onInstallSuccess:s}){const{searchQuery:o,searchResults:d,searchLoading:p,installFormOpenId:l}=I_(),h=L.useRef(null),f=B2(),[v,m]=L.useState(null),S=L.useCallback(T=>{if(B7(T),h.current&&clearTimeout(h.current),T.length<Eh){lo([],!1);return}h.current=setTimeout(()=>{$7(T)},z7)},[]);L.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),L.useEffect(()=>{f.status!=="done"||!v||(s(v.name,v.scope),xg(null),m(null))},[f.status,v,s]);const C=v?`Installing ${v.name}…`:"Installing…";return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"skills-tab-body",children:[u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Search skills.sh registry…",value:o,onChange:T=>S(T.target.value),"aria-label":"Search skills registry"}),p&&u.jsx("div",{className:"skills-empty-state",children:"Searching…"}),!p&&o.length>=Eh&&d.length===0&&u.jsxs("div",{className:"skills-empty-state",children:['No results for "',o,'".']}),!p&&o.length>0&&o.length<Eh&&u.jsx("div",{className:"skills-empty-state",children:"Type at least 2 characters to search."}),u.jsx("div",{className:"skills-card-list",children:d.map(T=>u.jsx(U7,{result:T,theaterId:e,relPath:t,isFormOpen:l===T.id,onInstallClick:()=>xg(l===T.id?null:T.id),onReadMore:i,onInstallStarted:(w,_)=>m({name:w,scope:_}),jobLog:f},T.id))})]}),u.jsx(I2,{status:f.status,lines:f.lines,runningLabel:C,doneLabel:"Installed",errorLabel:"Install failed",onDismiss:f.reset})]})}const W7=2600;function G7({skill:e,onReadMore:t,onUpdate:i,onRemove:s,isUpdating:o}){const[d,p]=L.useState(!1),l=L.useRef(null),h=L.useCallback(()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),f=L.useCallback(()=>{d?(h(),p(!1),s?.(e.name,e.scope)):(p(!0),l.current=setTimeout(()=>p(!1),W7))},[d,h,s,e.name,e.scope]);return L.useEffect(()=>()=>h(),[h]),u.jsxs("div",{className:"skills-card",children:[u.jsxs("div",{className:"skills-card-header",children:[u.jsx("button",{type:"button",className:"skills-card-name-btn",onClick:()=>t?.(e),title:"Read SKILL.md",children:e.name}),u.jsx("span",{className:`skills-card-scope-badge skills-card-scope-badge--${e.scope}`,children:e.scope})]}),e.source&&u.jsx("span",{className:"skills-card-meta",children:e.source}),u.jsx("span",{className:"skills-card-meta skills-card-agents",children:e.agents.join(", ")}),u.jsxs("div",{className:"skills-card-actions",children:[i&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--ghost",title:`Updates all ${e.scope} skills`,onClick:()=>i(e.scope),disabled:o,children:o?"Updating…":"Update all"}),s&&u.jsx("button",{type:"button",className:`skills-btn skills-btn--remove${d?" is-armed":""}`,onClick:f,"aria-label":d?`Confirm remove ${e.name}`:`Remove ${e.name}`,children:d?"Remove?":"✕"})]})]})}async function q7(e,t){const i=e?`?theaterId=${encodeURIComponent(e)}&relPath=${encodeURIComponent(t??"")}`:"",s=await fetch(`/plugins/skills/list${i}`);return s.ok?(await s.json()).skills??[]:[]}function K7({theaterId:e,relPath:t,onReadMore:i,refreshKey:s}){const o=I_(),{scope:d,filterText:p}=o,l=Qh(e,t),h=Sg(o,l)?o.installedList:[],f=Sg(o,l)&&o.installedLoading,v=B2(),m=L.useRef(null),S=L.useCallback((y,k)=>{const M=Qh(y,k);_m(M,[],!0),q7(y,k).then(A=>_m(M,A,!1)).catch(()=>_m(M,[],!1))},[]);L.useEffect(()=>{S(e,t)},[e,t,S,s]),L.useEffect(()=>{(v.status==="done"||v.status==="error")&&S(e,t)},[v.status,e,t,S]);const C=L.useCallback(y=>{const k=y;m.current=k;const M={scope:k};k==="project"&&e&&(M.theaterId=e,M.relPath=t),v.start("/plugins/skills/update",M)},[e,t,v]),T=L.useCallback((y,k)=>{const M={scope:k,skill:y};k==="project"&&e&&(M.theaterId=e,M.relPath=t),fetch("/plugins/skills/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}).then(()=>S(e,t)).catch(()=>null)},[e,t,S]),w=L.useCallback(()=>{m.current&&C(m.current)},[C]),_=d==="project"&&!e?"global":d,b=h.filter(y=>y.scope!==_?!1:p?y.name.toLowerCase().includes(p.toLowerCase()):!0),g=v.status==="running"&&m.current===_;return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"skills-tab-body",children:[u.jsxs("div",{className:"skills-scope-toggle",children:[u.jsx("button",{type:"button",className:`skills-scope-btn${_==="project"?" is-active":""}`,onClick:()=>jS("project"),disabled:!e,title:e?void 0:"Select a Theater to view project skills",children:"Project"}),u.jsx("button",{type:"button",className:`skills-scope-btn${_==="global"?" is-active":""}`,onClick:()=>jS("global"),children:"Global"})]}),u.jsx("input",{type:"search",className:"skills-filter-input",placeholder:"Filter installed skills…",value:p,onChange:y=>I7(y.target.value),"aria-label":"Filter installed skills"}),f&&u.jsx("div",{className:"skills-empty-state",children:"Loading…"}),!f&&b.length===0&&u.jsx("div",{className:"skills-empty-state",children:p?"No skills match the filter.":`No ${_} skills installed.`}),u.jsx("div",{className:"skills-card-list",children:b.map(y=>u.jsx(G7,{skill:y,onReadMore:i,onUpdate:C,onRemove:T,isUpdating:g},`${y.scope}:${y.name}`))})]}),u.jsx(I2,{status:v.status,lines:v.lines,runningLabel:"Updating skills…",doneLabel:"Updated",errorLabel:"Update failed",onDismiss:v.reset,onRetry:w})]})}function vm(e){for(const t of e.querySelectorAll("a[href]")){const i=t.getAttribute("href")??"";i&&!/^(https?:|mailto:|#)/i.test(i)&&(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img[src], img[srcset], source[src], source[srcset]"))t.removeAttribute("src"),t.removeAttribute("srcset"),t.tagName==="IMG"&&t.setAttribute("aria-hidden","true")}function V7({content:e}){const t=L.useMemo(()=>{const o=xc(e).html,d=new DOMParser().parseFromString(o,"text/html");return vm(d.body),d.body.innerHTML},[e]),i=L.useRef(null);L.useEffect(()=>{const o=i.current;if(!o)return;vm(o);const d=new MutationObserver(()=>vm(o));return d.observe(o,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>d.disconnect()},[t]);const s=L.useCallback(o=>{const d=o.target.closest('[data-action="copy-code"]');if(!d)return;const p=d.closest("pre")?.getAttribute("data-code");if(!p)return;navigator.clipboard?.writeText(p);const l=d.textContent;d.textContent="Copied",window.setTimeout(()=>{d.textContent=l},1200)},[]);return u.jsx("div",{ref:i,className:"markdown-body",onClick:s,dangerouslySetInnerHTML:{__html:t}})}const Y7=["a[href]","button:not([disabled])","input:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),X7="Skills run with full agent permissions. Review before use.";function Z7(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(Y7)),s=i[0],o=i[i.length-1];!s||!o||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),o.focus()):!e.shiftKey&&document.activeElement===o&&(e.preventDefault(),s.focus()))}function J7({skill:e,isInstalled:t,theaterId:i,relPath:s,onClose:o,onInstall:d}){const[p,l]=L.useState(null),[h,f]=L.useState(!1),v=L.useRef(null),m=L.useRef(null),S=L.useRef(null);if(L.useEffect(()=>{e&&v.current===null&&(v.current=document.activeElement)},[e]),L.useEffect(()=>{if(!e){l(null);return}f(!0),l(null);let T=!1;return(async()=>{try{let _;if(t){const g={scope:e.scope,skill:e.name};e.scope==="project"&&i&&(g.theaterId=i,g.relPath=s),_=await fetch("/plugins/skills/installed-file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)})}else _=await fetch("/plugins/skills/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:e.source,skill:e.name,theaterId:i,relPath:s})});if(T)return;if(!_.ok){f(!1);return}const b=await _.json();T||(l(b.markdown??""),f(!1))}catch{T||f(!1)}})(),()=>{T=!0}},[e,t,i,s]),L.useEffect(()=>{if(!e)return;const T=w=>{w.key==="Escape"?(w.preventDefault(),o()):w.key==="Tab"&&Z7(w,S.current),w.stopImmediatePropagation()};return m.current?.focus(),window.addEventListener("keydown",T,!0),()=>{window.removeEventListener("keydown",T,!0);const w=v.current;v.current=null,w?.focus?.()}},[e,o]),L.useEffect(()=>{if(e)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[e]),!e)return null;const C=e.displayPath||e.source||null;return Os.createPortal(u.jsx("div",{className:"skills-overlay-backdrop",onClick:o,"aria-hidden":"true",children:u.jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":`${e.name} SKILL.md`,className:"skills-overlay-dialog",onClick:T=>T.stopPropagation(),children:[u.jsxs("div",{className:"skills-overlay-header",children:[u.jsx("span",{className:"skills-overlay-title",children:e.name}),C&&u.jsx("span",{className:"skills-overlay-meta",children:C}),u.jsx("button",{ref:m,type:"button",className:"skills-overlay-close",onClick:o,"aria-label":"Close",children:"✕"})]}),u.jsxs("div",{className:"skills-overlay-body",children:[h&&u.jsx("div",{className:"skills-empty-state",children:"Loading SKILL.md…"}),!h&&p===null&&u.jsx("div",{className:"skills-empty-state",children:"Could not load SKILL.md."}),p!==null&&u.jsx(V7,{content:p})]}),u.jsxs("div",{className:"skills-overlay-footer",children:[u.jsx("p",{className:"skills-permission-warning",children:X7}),!t&&u.jsx("button",{type:"button",className:"skills-btn skills-btn--primary",onClick:()=>{o(),d()},children:"Install"})]})]})}),document.body)}const Q7=3200;function eI({message:e,onDismiss:t}){return L.useEffect(()=>{if(!e)return;const i=setTimeout(t,Q7);return()=>clearTimeout(i)},[e,t]),e?u.jsx("div",{className:"skills-toast",role:"status","aria-live":"polite",children:e}):null}function tI({ctx:e}){const t=Qh(e.theaterId,e.pathContext.relPath);return u.jsx(nI,{ctx:e},t)}function nI({ctx:e}){const{theaterId:t}=e,i=I_(),{activeTab:s}=i,o=Qh(e.theaterId,e.pathContext.relPath),[d,p]=L.useState(null),[l,h]=L.useState(null),[f,v]=L.useState(0),m=Sg(i,o)?i.installedList.length:0;L.useLayoutEffect(()=>{P7(o)},[o]);const S=L.useCallback(_=>{p({skill:_,isInstalled:!0})},[]),C=L.useCallback((_,b)=>{p({skill:_,isInstalled:!1,registryId:b})},[]),T=L.useCallback((_,b)=>{h(`Installed ${_} to ${b}`),v(g=>g+1),ch("installed")},[]),w=L.useCallback(()=>{d?.registryId&&(xg(d.registryId),ch("find")),p(null)},[d]);return u.jsxs("div",{className:"skills-root",children:[u.jsxs("div",{className:"skills-tab-bar",role:"tablist","aria-label":"Skills panels",children:[u.jsxs("button",{type:"button",role:"tab","aria-selected":s==="installed",className:`skills-tab-btn${s==="installed"?" is-active":""}`,onClick:()=>ch("installed"),children:["Installed",m>0?` ${m}`:""]}),u.jsx("button",{type:"button",role:"tab","aria-selected":s==="find",className:`skills-tab-btn${s==="find"?" is-active":""}`,onClick:()=>ch("find"),children:"Find"})]}),s==="installed"?u.jsx(K7,{theaterId:t,relPath:e.pathContext.relPath,onReadMore:S,refreshKey:f}):u.jsx(F7,{theaterId:t,relPath:e.pathContext.relPath,onReadMore:C,onInstallSuccess:T}),u.jsx(eI,{message:l,onDismiss:()=>h(null)}),u.jsx(J7,{skill:d?.skill??null,isInstalled:d?.isInstalled??!1,theaterId:t,relPath:e.pathContext.relPath,onClose:()=>p(null),onInstall:w})]})}function iI(){return u.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none","aria-hidden":"true",children:u.jsx("path",{d:"M9 2L10.854 6.764L16 7.236L12.25 10.764L13.416 16L9 13.25L4.584 16L5.75 10.764L2 7.236L7.146 6.764Z",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"})})}const rI={id:"skills",title:"Skills",icon:iI,pathAware:!0,render:e=>u.jsx(tI,{ctx:e})},sI={id:"skills",railPanels:[rI]},aI=[sI],P2=[...bO,...Pj,...R7,...aI],oI=H2(P2),z2=L.createContext(oI),lI=z2.Provider;async function cI(){const e=[...P2],t=new Set(e.map(s=>s.id)),i=await uI();for(const s of i){if(t.has(s.id)){console.warn(`Skipping external plugin with duplicate id: ${s.id}`);continue}const o=await hI(s);if(o){if(t.has(o.id)){console.warn(`Skipping external plugin with duplicate id: ${o.id}`);continue}t.add(o.id),e.push(o)}}return H2(e)}function Io(){return L.useContext(z2)}async function uI(){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(fI):[]}catch(e){return console.warn("Plugin runtime manifest failed to load.",e),[]}}async function hI(e){try{const t=await import(e.clientUrl),i=t.default??t.plugin;return dI(i)?i:(console.warn(`Skipping external plugin with invalid client module: ${e.id}`),null)}catch(t){return console.warn(`Skipping external plugin after client load failure: ${e.id}`,t),null}}function H2(e){const t=new Set,i=[];for(const s of e)for(const o of s.railPanels??[]){if(t.has(o.id)){console.warn(`Skipping rail panel with duplicate id: ${o.id}`);continue}t.add(o.id),i.push(o)}return{plugins:e,operationKinds:e.flatMap(s=>s.operationKinds??[]),settingsSections:e.flatMap(s=>s.settingsSections??[]),notificationKinds:e.flatMap(s=>s.notificationKinds??[]),railPanels:i}}function dI(e){return typeof e=="object"&&e!==null&&typeof e.id=="string"}function fI(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id=="string"&&typeof t.clientUrl=="string"&&Number.isInteger(t.apiVersion)}const pI=288,mI=520,Wl=12,xs=[{id:"operations",label:"Operations"},{id:"map",label:"Map"}],gI=/mac|iphone|ipad|ipod/i;function $2({anchor:e,viewportBounds:t,placement:i="cursor",mode:s="full",catalog:o,canLaunch:d,formationView:p=!1,renderKindIcon:l,onLaunchKind:h,onResetView:f,onToggleFormation:v,onClose:m}){const S=L.useRef(null),C=L.useRef(null),T=L.useRef({operations:null,map:null}),[w,_]=L.useState("operations");bI();const b=s==="full",g=s==="full"||s==="launch",y=s==="full";L.useEffect(()=>{const A=R=>{S.current?.contains(R.target)||m()},N=R=>{R.key==="Escape"&&m()};return document.addEventListener("mousedown",A),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("keydown",N)}},[m]),L.useEffect(()=>{C.current?.focus()},[]);const k=(A,N=!1)=>{_(A),N&&window.requestAnimationFrame(()=>T.current[A]?.focus())},M=A=>{const N=xs.findIndex(B=>B.id===w),R=xs.length-1;if(A.key==="ArrowRight"||A.key==="ArrowLeft"){A.preventDefault();const B=A.key==="ArrowRight"?1:-1,q=xs[(N+B+xs.length)%xs.length];k(q.id,!0)}else A.key==="Home"?(A.preventDefault(),k(xs[0].id,!0)):A.key==="End"&&(A.preventDefault(),k(xs[R].id,!0))};return u.jsx("div",{className:`operation-launch-control operation-launch-control--canvas ${i==="above"?"operation-launch-control--up":""}`,ref:S,style:vI(e,t,i),"data-canvas-blocker":!0,children:u.jsxs("div",{className:"operation-launch-menu theater-menu canvas-context-menu",role:"dialog","aria-label":"Canvas controls",tabIndex:-1,ref:C,children:[u.jsxs("div",{className:"canvas-context-menu-head",children:[u.jsx("span",{className:"canvas-context-menu-reticle","aria-hidden":"true",children:u.jsx(_I,{})}),u.jsx("span",{className:"canvas-context-menu-head-text",children:u.jsx("strong",{children:"Canvas controls"})})]}),b?u.jsx("div",{className:"canvas-context-menu-tabs",role:"tablist","aria-label":"Canvas control sections",children:xs.map(A=>u.jsx("button",{ref:N=>{T.current[A.id]=N},type:"button",id:`canvas-control-tab-${A.id}`,className:"canvas-context-menu-tab",role:"tab","aria-selected":w===A.id,"aria-controls":`canvas-control-panel-${A.id}`,tabIndex:w===A.id?0:-1,onClick:()=>k(A.id),onKeyDown:M,children:A.label},A.id))}):null,g?u.jsxs("div",{id:"canvas-control-panel-operations",role:"tabpanel","aria-labelledby":"canvas-control-tab-operations",className:"canvas-context-menu-panel",hidden:b?w!=="operations":void 0,children:[u.jsx("p",{className:"canvas-context-menu-section",children:"Launch"}),o.length>0?o.map((A,N)=>u.jsxs("div",{children:[N>0?u.jsx("div",{className:"theater-menu-divider",role:"separator"}):null,u.jsx("p",{className:"canvas-context-menu-plugin",children:A.title}),A.kinds.map(R=>{const B=R.disabled===!0||!d;return u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item operation-launch-menu-item",disabled:B,title:R.disabledReason,onClick:()=>h(A.id,R),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:l(A.id,R)??u.jsx(xI,{})}),u.jsx("span",{className:"theater-menu-label",children:R.title}),R.disabledReason?u.jsx("span",{className:"operation-launch-menu-reason",children:R.disabledReason}):null]},`${A.id}:${R.id}`)})]},A.id)):u.jsx("p",{className:"theater-menu-empty",children:"No operations available."})]}):null,y?u.jsx(u.Fragment,{children:u.jsxs("div",{id:"canvas-control-panel-map",role:"tabpanel","aria-labelledby":"canvas-control-tab-map",className:"canvas-context-menu-panel",hidden:b?w!=="map":void 0,children:[u.jsx("p",{className:"canvas-context-menu-section",children:"View"}),u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item canvas-context-menu-item",onClick:f,children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(yI,{})}),u.jsx("span",{className:"theater-menu-label",children:"Reset view"})]}),v?u.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":p,className:"theater-menu-item canvas-context-menu-item",onClick:v,children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:p?"✓":u.jsx(SI,{})}),u.jsx("span",{className:"theater-menu-label",children:"Formation view"})]}):null]})}):null]})})}function _I(){return u.jsxs("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"7",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),u.jsx("path",{d:"M12 2.4v3.4M12 18.2v3.4M2.4 12h3.4M18.2 12h3.4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),u.jsx("path",{d:"M12 9.2v5.6M9.2 12h5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function vI(e,t,i){const s=t?Math.max(Wl,Math.min(e.x,t.width-pI-Wl)):e.x;if(i==="above")return{left:s,bottom:Math.max(Wl,e.y)};const o=t?Math.max(Wl,Math.min(e.y,t.height-mI-Wl)):e.y;return{left:s,top:o}}function bI(){const t=navigator.userAgentData?.platform??navigator.platform;return gI.test(t)?"⌘":"Ctrl"}function yI(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M4.4 7.2A4 4 0 1 1 4 9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M2.4 4.6v2.8h2.8",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]})}function SI(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM3 9h4v4H3zM9 9h4v4H9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function xI(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("circle",{cx:"8",cy:"8",r:"3.2",fill:"currentColor",opacity:"0.86"})})}function U2(e,t){const i=document.activeElement;e===null||!(i instanceof Node)||!e.contains(i)||document.querySelector(t)?.focus()}const uh="directory-browser-sectors";function F2({open:e,onCancel:t,onConfirm:i}){const[s,o]=L.useState(null),[d,p]=L.useState(null),[l,h]=L.useState(null),[f,v]=L.useState(""),[m,S]=L.useState(""),[C,T]=L.useState(0),w=L.useRef(null),_=L.useRef(null),b=async(H,P)=>{p(H),h(null),v(""),T(0);try{const Y=await CR(H,P);o(Y)}catch(Y){if(Y instanceof DOMException&&Y.name==="AbortError")return;h(Y instanceof ht?Y.message:String(Y))}finally{p(null)}};L.useEffect(()=>{if(!e)return;const H=new AbortController;return b(null,H.signal),()=>H.abort()},[e]),L.useEffect(()=>{e&&w.current?.focus()},[e,s?.path]);const g=s?.entries??[],y=L.useMemo(()=>{const H=f.trim().toLowerCase();return H===""?g:g.filter(P=>P.name.toLowerCase().includes(H))},[g,f]),k=L.useMemo(()=>s?wI(s):[],[s]),M=s?BS(s.path):null,A=s?.roots??[],N=A.length>1,R=y.length===0?-1:Math.min(C,y.length-1);if(L.useEffect(()=>{if(R<0)return;_.current?.querySelector(`[data-index="${R}"]`)?.scrollIntoView({block:"nearest"})},[R,s?.path]),!e)return null;const B=H=>{H.accessible&&d===null&&b(H.path)},q=()=>{s?.parentPath!=null&&d===null&&b(s.parentPath)},W=()=>{const H=m.trim();H!==""&&d===null&&b(H)},G=s?.path??null,I=R>=0?`${uh}-${R}`:void 0,K=H=>{switch(H.key){case"Escape":f!==""?v(""):t();return;case"ArrowDown":H.preventDefault(),T(P=>Math.min(P+1,Math.max(y.length-1,0)));return;case"ArrowUp":H.preventDefault(),T(P=>Math.max(P-1,0));return;case"Enter":{H.preventDefault();const P=y[R];P&&B(P);return}case"Backspace":f===""&&(H.preventDefault(),q());return;default:return}};return Os.createPortal(u.jsxs("div",{className:"directory-browser-overlay",role:"presentation",children:[u.jsx("button",{type:"button",className:"directory-browser-scrim","aria-label":"Close",onClick:t}),u.jsxs("section",{className:"directory-browser-card",role:"dialog","aria-modal":"true","aria-label":"Add Theater",onKeyDown:K,children:[u.jsxs("header",{className:"directory-browser-header",children:[u.jsx("span",{className:"directory-browser-sigil","aria-hidden":"true",children:u.jsx(kI,{})}),u.jsxs("div",{className:"directory-browser-heading",children:[u.jsx("span",{className:"directory-browser-kicker",children:"Project folder"}),u.jsx("h2",{children:"Add Theater"})]}),u.jsx("button",{type:"button",className:"directory-browser-close",onClick:t,"aria-label":"Close",children:"×"})]}),N?u.jsxs("div",{className:"directory-browser-roots",role:"group","aria-label":"Drives",children:[u.jsx("span",{className:"directory-browser-kicker",children:"Locations"}),u.jsx("div",{className:"directory-browser-root-chips",children:A.map(H=>{const P=M!=null&&BS(H)===M;return u.jsx("button",{type:"button",className:`directory-browser-root-chip ${P?"is-active":""}`,"aria-current":P?"location":void 0,disabled:d!==null,title:H,onClick:()=>{d===null&&b(H)},onKeyDown:Y=>Y.stopPropagation(),children:EI(H)},H)})})]}):null,u.jsx("nav",{className:"directory-browser-course","aria-label":"Path",children:k.map((H,P)=>{const Y=P===k.length-1;return u.jsxs("span",{className:"directory-browser-course-seg",children:[P>0?u.jsx("span",{className:"directory-browser-course-sep","aria-hidden":"true",children:"›"}):null,u.jsx("button",{type:"button",className:`directory-browser-crumb ${Y?"is-current":""}`,"aria-current":Y?"location":void 0,disabled:Y||d!==null,title:H.path,onClick:()=>{b(H.path)},children:H.label})]},H.path)})}),u.jsxs("div",{className:"directory-browser-toolbar",children:[u.jsxs("div",{className:"directory-browser-filter",children:[u.jsx("span",{className:"directory-browser-filter-glyph","aria-hidden":"true",children:u.jsx(AI,{})}),u.jsx("input",{ref:w,type:"text",className:"directory-browser-filter-input",placeholder:"Filter folders…","aria-label":"Filter folders","aria-controls":uh,value:f,spellCheck:!1,autoComplete:"off",onChange:H=>{v(H.target.value),T(0)}})]}),u.jsxs("button",{type:"button",className:"directory-browser-up",disabled:s?.parentPath==null||d!==null,title:"Up one folder (Backspace)",onClick:q,children:[u.jsx(RI,{}),u.jsx("span",{children:"Up"})]})]}),u.jsxs("div",{className:"directory-browser-jump",children:[u.jsx("input",{type:"text",className:"directory-browser-jump-input",placeholder:"Or jump to a path — e.g. D:\\\\projects","aria-label":"Jump to absolute path",value:m,spellCheck:!1,autoComplete:"off",onChange:H=>S(H.target.value),onKeyDown:H=>{H.stopPropagation(),H.key==="Enter"&&(H.preventDefault(),W())}}),u.jsx("button",{type:"button",className:"directory-browser-jump-button",disabled:m.trim()===""||d!==null,onClick:W,onKeyDown:H=>H.stopPropagation(),children:"Go"})]}),l?u.jsx("p",{className:"directory-browser-error",role:"alert",children:l}):null,u.jsx("div",{className:"directory-browser-list",id:uh,role:"listbox","aria-label":"Folders","aria-busy":d!==null,"aria-activedescendant":I,ref:_,children:d!==null?u.jsxs("p",{className:"directory-browser-state is-live",children:[u.jsx("span",{className:"directory-browser-scan-dot","aria-hidden":"true"}),"Loading folders…"]}):y.length===0?u.jsx("p",{className:"directory-browser-state",children:f!==""?"No folders match the filter.":"No folders available."}):y.map((H,P)=>u.jsxs("div",{id:`${uh}-${P}`,"data-index":P,role:"option","aria-selected":P===R,"aria-disabled":!H.accessible,className:`directory-browser-sector ${P===R?"is-active":""} ${H.accessible?"":"is-locked"}`,title:H.path,onClick:()=>{T(P),B(H)},children:[u.jsx("span",{className:"directory-browser-sector-glyph","aria-hidden":"true",children:u.jsx(TI,{})}),u.jsx("span",{className:"directory-browser-sector-name",children:H.name}),H.accessible?u.jsx("span",{className:"directory-browser-sector-advance","aria-hidden":"true",children:"›"}):u.jsxs("span",{className:"directory-browser-sector-lock",children:[u.jsx(LI,{})," Locked"]})]},H.path))}),s?.truncated?u.jsx("p",{className:"directory-browser-note",children:"Showing the first 500 folders."}):null,u.jsxs("footer",{className:"directory-browser-actions",children:[u.jsxs("div",{className:"directory-browser-target",children:[u.jsx("span",{className:"directory-browser-target-label",children:"Theater Root"}),u.jsx("span",{className:"directory-browser-target-path",title:G??"",children:G??"Loading…"})]}),u.jsxs("div",{className:"directory-browser-buttons",children:[u.jsx("button",{type:"button",className:"directory-browser-button",onClick:t,children:"Cancel"}),u.jsx("button",{type:"button",className:"directory-browser-button is-primary",disabled:G===null||d!==null,onClick:()=>G&&i(G),children:"Add Theater"})]})]})]})]}),document.body)}function wI(e){if(CI(e)==="/"){const p=[{label:"/",path:"/"}];let l="";for(const h of e.path.split("/").filter(Boolean))l+=`/${h}`,p.push({label:h,path:l});return p}const i=/^([A-Za-z]:)\\?/.exec(e.path),s=i?`${i[1]}\\`:e.roots[0]??"C:\\",o=[{label:s,path:s}];let d=s.replace(/\\$/,"");for(const p of e.path.slice(s.length).split("\\").filter(Boolean))d+=`\\${p}`,o.push({label:p,path:d});return o}function CI(e){return e.roots.some(t=>/^[A-Za-z]:\\$/.test(t))||/^[A-Za-z]:\\/.test(e.path)?"\\":"/"}function BS(e){return/^([A-Za-z]:)\\?/.exec(e)?.[1]?.toLowerCase()??null}function EI(e){return e.replace(/[\\/]+$/,"")||e}function kI(){return u.jsxs("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:[u.jsx("circle",{cx:"10",cy:"10",r:"6.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("circle",{cx:"10",cy:"10",r:"2.1",fill:"currentColor"}),u.jsx("path",{d:"M10 1.6v3.2M10 15.2v3.2M1.6 10h3.2M15.2 10h3.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function TI(){return u.jsx("svg",{viewBox:"0 0 18 18","aria-hidden":"true",children:u.jsx("path",{d:"M2.4 5.2c0-.7.6-1.3 1.3-1.3h2.7l1.4 1.5h6.5c.7 0 1.3.6 1.3 1.3v6.4c0 .7-.6 1.3-1.3 1.3H3.7c-.7 0-1.3-.6-1.3-1.3z",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinejoin:"round"})})}function AI(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("path",{d:"M10.2 10.2 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function RI(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 12.5V4M4.5 7.5 8 4l3.5 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function LI(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"3.6",y:"7",width:"8.8",height:"6.2",rx:"1.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("path",{d:"M5.6 7V5.4a2.4 2.4 0 0 1 4.8 0V7",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}const bd=[{key:"red",label:"Red",color:"oklch(70% 0.12 25)"},{key:"orange",label:"Orange",color:"oklch(73% 0.12 50)"},{key:"amber",label:"Amber",color:"oklch(78% 0.11 70)"},{key:"yellow",label:"Yellow",color:"oklch(84% 0.11 95)"},{key:"lime",label:"Lime",color:"oklch(81% 0.12 120)"},{key:"green",label:"Green",color:"oklch(74% 0.12 145)"},{key:"emerald",label:"Emerald",color:"oklch(73% 0.10 165)"},{key:"teal",label:"Teal",color:"oklch(74% 0.09 185)"},{key:"cyan",label:"Cyan",color:"oklch(76% 0.09 205)"},{key:"sky",label:"Sky",color:"oklch(74% 0.10 230)"},{key:"blue",label:"Blue",color:"oklch(70% 0.11 255)"},{key:"indigo",label:"Indigo",color:"oklch(68% 0.11 278)"},{key:"violet",label:"Violet",color:"oklch(70% 0.11 300)"},{key:"purple",label:"Purple",color:"oklch(70% 0.12 320)"},{key:"magenta",label:"Magenta",color:"oklch(71% 0.12 340)"},{key:"rose",label:"Rose",color:"oklch(72% 0.11 5)"}];function To(e){return bd.find(t=>t.key===e)?.color??null}function PS(e){return typeof e.accent=="string"?e.accent:null}const zS=8,MI=260;function HS(e){const{anchor:t,onClose:i}=e,[s,o]=L.useState(void 0);return L.useLayoutEffect(()=>{const d=Math.max(8,Math.min(t.left,window.innerWidth-208)),p=t.bottom+zS,l=p+MI>window.innerHeight;o(l?{position:"fixed",left:d,top:"auto",bottom:Math.round(window.innerHeight-t.top+zS)}:{position:"fixed",left:d,top:Math.round(p)})},[t]),L.useEffect(()=>{const d=p=>{p.key==="Escape"&&(p.preventDefault(),i())};return window.addEventListener("keydown",d),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{window.removeEventListener("keydown",d),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[i]),Os.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:i,children:s?u.jsx("div",{className:"group-context-menu-card",role:"menu","aria-label":e.kind==="chip"?"Operation options":`${e.group.name} options`,style:s,onPointerDown:d=>d.stopPropagation(),children:e.kind==="chip"?u.jsx(NI,{...e}):u.jsx(OI,{...e})}):null}),document.body)}function NI({operation:e,groups:t,accentKey:i,actions:s,onClose:o}){const[d,p]=L.useState(!1),[l,h]=L.useState(`Group ${t.length+1}`),f=L.useRef(!1),v=L.useRef(null);L.useEffect(()=>{d&&v.current?.select()},[d]);const m=()=>{const S=l.trim();S&&(s.onCreateGroup(S),o())};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:"Group"}),t.map(S=>{const C=To(S.color),T=e.groupId===S.id;return u.jsxs("button",{type:"button",className:`group-context-menu-item${T?" is-selected":""}`,role:"menuitemradio","aria-checked":T,onClick:()=>{s.onSetGroupId(T?null:S.id),o()},children:[u.jsx("span",{className:"group-context-menu-item__dot",style:C?{background:C}:void 0,"aria-hidden":"true"}),u.jsx("span",{className:"group-context-menu-item__name",children:S.name}),T?u.jsx(DI,{}):null]},S.id)}),d?u.jsx("input",{ref:v,className:"group-context-menu-new-input",type:"text",value:l,onChange:S=>h(S.target.value),onCompositionStart:()=>{f.current=!0},onCompositionEnd:()=>{f.current=!1},onKeyDown:S=>{S.key==="Enter"&&!f.current&&(S.preventDefault(),m()),S.key==="Escape"&&(S.preventDefault(),p(!1))},onBlur:()=>p(!1),"aria-label":"New group name",placeholder:"Group name"}):u.jsx("button",{type:"button",className:"group-context-menu-item group-context-menu-item--new",role:"menuitem",onClick:()=>p(!0),children:u.jsx("span",{className:"group-context-menu-item__new-label",children:"+ New group"})}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("div",{className:"group-context-menu-section-label",children:"Accent"}),u.jsxs("button",{type:"button",className:"accent-popover-swatch accent-popover-swatch--clear",role:"menuitem","aria-label":"No accent","aria-pressed":i===null,onClick:()=>{s.onSetAccent(null),o()},children:[u.jsx("span",{}),"None"]}),u.jsx("div",{className:"group-context-menu-swatches",children:bd.map(S=>u.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":S.label,"aria-pressed":i===S.key,onClick:()=>{s.onSetAccent(S.key),o()},children:u.jsx("span",{style:{background:S.color}})},S.key))})]})}function OI({group:e,actions:t,onClose:i}){const[s,o]=L.useState(e.name),[d,p]=L.useState(!1),l=L.useRef(!1),h=()=>{const f=s.trim();if(!f||f===e.name){i();return}t.onRename(f),i()};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"group-context-menu-section-label",children:"Color"}),u.jsx("div",{className:"group-context-menu-swatches",children:bd.map(f=>u.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":f.label,"aria-pressed":e.color===f.key,onClick:()=>{t.onSetColor(f.key),i()},children:u.jsx("span",{style:{background:f.color}})},f.key))}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("div",{className:"group-context-menu-section-label",children:"Rename"}),u.jsx("input",{className:"group-context-menu-new-input",type:"text",value:s,onChange:f=>o(f.target.value),onCompositionStart:()=>{l.current=!0},onCompositionEnd:()=>{l.current=!1},onKeyDown:f=>{f.key==="Enter"&&!l.current&&(f.preventDefault(),h()),f.key==="Escape"&&(f.preventDefault(),i())},onBlur:h,"aria-label":"Group name"}),u.jsx("div",{className:"group-context-menu-divider","aria-hidden":"true"}),u.jsx("button",{type:"button",className:`group-context-menu-item group-context-menu-item--danger${d?" is-armed":""}`,role:"menuitem",onClick:()=>{if(!d){p(!0);return}t.onUngroupAll(),i()},"aria-label":d?"Confirm: remove all members and delete group":"Ungroup all members and delete group",children:d?"Confirm ungroup all?":"Ungroup all"})]})}function DI(){return u.jsx("svg",{viewBox:"0 0 12 12",className:"group-context-menu-item__check","aria-hidden":"true",children:u.jsx("path",{d:"M2 6l3 3 5-5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const jI="fleet-console.canvas.",II=400,wg=640,Cg=400,$S=40,BI=320,PI=200,zI=8,HI=0,US=96,$I=.25,UI=1,bm=.2,FS=.5,FI=.001,po={x:0,y:0,zoom:1},xo={viewport:po,operations:{},operationOrder:[],operationAccent:{},minimized:[],collapsedGroups:[]},Eg=new Set,kg=new Set,Tg=new Set,Cc=new Map,B_=new Map;let zn=null,Ms=null,Ye=xo,Gn=null,pa=!1,As=po,ua=null,ed=0;function P_(e){return Eg.add(e),()=>{Eg.delete(e)}}function Ao(){return Ye}function Ag(){return Gn}function Rg(){return pa}function WI(){return zn}function W2(){return L.useSyncExternalStore(P_,Ao,Ao)}function G2(){return L.useSyncExternalStore(QI,GS,GS)}function yd(){return L.useSyncExternalStore(JI,Rg,Rg)}function q2(){return L.useSyncExternalStore(P_,qS,qS)}function si(e){Ye={viewport:e.viewport??Ye.viewport,operations:e.operations??Ye.operations,operationOrder:e.operationOrder??Ye.operationOrder,operationAccent:e.operationAccent??Ye.operationAccent,minimized:e.minimized??Ye.minimized,collapsedGroups:e.collapsedGroups??Ye.collapsedGroups},rB(),Y2()}function GI(e){const t=Ye.collapsedGroups.includes(e)?Ye.collapsedGroups.filter(i=>i!==e):[...Ye.collapsedGroups,e];si({collapsedGroups:t})}function qI(){return L.useSyncExternalStore(P_,KS,KS)}function Lg(e){$_();const t=U_(e);As=t,si({viewport:t})}function K2(e){const t=U_(e);if(typeof window>"u"||typeof window.requestAnimationFrame!="function"||iB()){Lg(t);return}As=t,ua===null&&(ua=window.requestAnimationFrame(X2))}function Mg(e,t){const i=ma();si({operations:{...Ye.operations,[e]:{...F_(t,i),zIndex:i}}})}function KI(e,t,i=BI,s=PI,o=zI,d=HI){if(!Number.isFinite(t)||t<=0)return[];const p=Math.ceil(Math.sqrt(t)),l=Math.ceil(t/p),h=Math.max(0,e.width-d*2),f=Math.max(0,e.height-d*2),v=Math.max(0,f-o*(l-1)),m=v/l,S=Math.min(s,m),C=Math.min(Math.max(S,m),v);return Array.from({length:t},(T,w)=>{const _=Math.floor(w/p),b=w%p,g=_===l-1?t-(l-1)*p:p,y=Math.max(0,h-o*(g-1)),k=y/g,M=Math.min(i,k),A=Math.min(Math.max(M,k),y);return{x:e.x+d+b*(A+o),y:e.y+d+_*(C+o),width:A,height:C}})}function VI(e){Ye.minimized.includes(e)||(Gn===e&&ga(),si({minimized:[...Ye.minimized,e]}))}function hh(e){if(!Ye.minimized.includes(e))return;Gn===e&&ga();const t=Ye.minimized.filter(o=>o!==e),i=Ye.operations[e];if(!i){si({minimized:t});return}const s=ma();si({minimized:t,operations:{...Ye.operations,[e]:{...i,zIndex:s}}})}function ym(e){si({operationOrder:Q2(e)})}function ma(){return ed+=1,ed}function YI(e){const t=Ye.operations[e];if(t)return t;const i=Object.keys(Ye.operations).length,s={x:i*$S,y:i*$S,width:wg,height:Cg,zIndex:ma()};return si({operations:{...Ye.operations,[e]:s}}),s}function XI(e){const t=new Set(e),i={};let s=!1;for(const[v,m]of Object.entries(Ye.operations))t.has(v)?i[v]=m:s=!0;const o=Ye.minimized.filter(v=>t.has(v)),d=o.length!==Ye.minimized.length,p=Ye.operationOrder.filter(v=>t.has(v)),l=p.length!==Ye.operationOrder.length,h=Object.fromEntries(Object.entries(Ye.operationAccent).filter(([v])=>t.has(v))),f=Object.keys(h).length!==Object.keys(Ye.operationAccent).length;Gn&&(!t.has(Gn)||o.includes(Gn))&&ga(),(s||d||l||f)&&si({operations:i,minimized:o,operationOrder:p,operationAccent:h})}function ZI(e){sB(),$_(),eB(),zn=e,Ye=e?oB(e):xo;const t=e?Cc.get(e)??null:null,i=Gn!==t;Gn=t;const s=e?B_.has(e):!1,o=pa!==s;pa=s,As=Ye.viewport,ed=Math.max(ed,eE(Ye.operations)),Y2(),i&&H_(),o&&z_()}function WS(e,t){const i=Ye.operations[e];if(!i)return;const s=Math.max($I,Math.min(UI,Math.min((t.width-US)/i.width,(t.height-US)/i.height))),o={x:t.width/2-(i.x+i.width/2)*s,y:t.height/2-(i.y+i.height/2)*s,zoom:s};$_(),As=o;const d=ma(),p=Ye.minimized.includes(e);si({viewport:o,operations:{...Ye.operations,[e]:{...F_(i,d),zIndex:d}},...p?{minimized:Ye.minimized.filter(l=>l!==e)}:{}})}function cc(e){V2(),zn&&Cc.set(zn,e);const t=tB(e),i=!nB(Ye.minimized,t),s=Gn!==e;s&&(Gn=e),i&&si({minimized:t}),s&&H_()}function ga(){zn&&Cc.delete(zn),Gn!==null&&(Gn=null,H_())}function Ng(e){if(zn){if(pa){if(e?.restoreMinimized===!0&&Ye.minimized.length>0){si({minimized:[]});return}V2();return}(e?.restoreMinimized===!0||Gn!==null)&&si({minimized:[]}),ga(),B_.set(zn,!0),pa=!0,z_()}}function V2(){zn&&B_.delete(zn),pa&&(pa=!1,z_())}function JI(e){return Tg.add(e),()=>{Tg.delete(e)}}function Y2(){for(const e of Eg)e()}function QI(e){return kg.add(e),()=>{kg.delete(e)}}function GS(){return Gn}function z_(){for(const e of Tg)e()}function qS(){return Ye.minimized}function KS(){return Ye.collapsedGroups}function H_(){for(const e of kg)e()}function eB(){zn&&(Gn?Cc.set(zn,Gn):Cc.delete(zn))}function tB(e){return Object.keys(Ye.operations).filter(t=>t!==e)}function nB(e,t){return e.length===t.length&&e.every((i,s)=>i===t[s])}function X2(){const e=Ye.viewport,t=As.x-e.x,i=As.y-e.y,s=As.zoom-e.zoom;if(Math.abs(t)<FS&&Math.abs(i)<FS&&Math.abs(s)<FI){ua=null,si({viewport:As});return}si({viewport:{x:e.x+t*bm,y:e.y+i*bm,zoom:e.zoom+s*bm}}),ua=typeof window<"u"?window.requestAnimationFrame(X2):null}function $_(){ua===null||typeof window>"u"||(window.cancelAnimationFrame(ua),ua=null)}function iB(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function rB(){!zn||typeof window>"u"||(aB(),Ms=window.setTimeout(()=>{Ms=null,Z2(zn,Ye)},II))}function sB(){!Ms||!zn||typeof window>"u"||(window.clearTimeout(Ms),Ms=null,Z2(zn,Ye))}function aB(){!Ms||typeof window>"u"||(window.clearTimeout(Ms),Ms=null)}function oB(e){if(typeof window>"u")return xo;try{const t=window.localStorage.getItem(J2(e));if(!t)return xo;const i=JSON.parse(t);return lB(i)}catch{return xo}}function Z2(e,t){if(!(!e||typeof window>"u"))try{window.localStorage.setItem(J2(e),JSON.stringify(t))}catch{}}function J2(e){return`${jI}${e}`}function lB(e){if(!Ro(e))return xo;const t=hB(e.operations);return{viewport:U_(e.viewport),operations:t,operationOrder:Q2(e.operationOrder),operationAccent:cB(e.operationAccent),minimized:uB(e.minimized,t),collapsedGroups:fB(e.collapsedGroups)}}function Q2(e){if(!Array.isArray(e))return[];const t=new Set,i=[];for(const s of e)typeof s!="string"||t.has(s)||(t.add(s),i.push(s));return i}function cB(e){if(!Ro(e))return{};const t={};for(const[i,s]of Object.entries(e))typeof s=="string"&&(t[i]=s);return t}function uB(e,t){if(!Array.isArray(e))return[];const i=new Set,s=[];for(const o of e)typeof o!="string"||i.has(o)||!(o in t)||(i.add(o),s.push(o));return s}function U_(e){if(!Ro(e))return po;const t=uc(e.x,po.x),i=uc(e.y,po.y),s=Og(e.zoom,po.zoom);return{x:t,y:i,zoom:s}}function hB(e){if(!Ro(e))return{};const t={};for(const[i,s]of Object.entries(e))Ro(s)&&(t[i]=F_(s,dB(t)));return t}function F_(e,t){return Ro(e)?{x:uc(e.x,0),y:uc(e.y,0),width:Og(e.width,wg),height:Og(e.height,Cg),zIndex:uc(e.zIndex,t)}:{x:0,y:0,width:wg,height:Cg,zIndex:t}}function dB(e){return eE(e)+1}function eE(e){return Math.max(0,...Object.values(e).map(t=>t.zIndex))}function uc(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function Og(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function Ro(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function fB(e){if(!Array.isArray(e))return[];const t=new Set,i=[];for(const s of e)typeof s!="string"||t.has(s)||(t.add(s),i.push(s));return i}function pB(e,t,i,s){if(!i)return{groupId:null,index:0};for(const d of t){const p=d.groupId??"__ungrouped__",l=i.querySelector(`[data-drop-zone-group-id="${p}"]`);if(!l)continue;const h=l.getBoundingClientRect();if(e<h.top||e>h.bottom)continue;const f=l.querySelector(`[data-group-section-id="${p}"]`);if(!f||e<f.getBoundingClientRect().top)return{groupId:d.groupId,index:0};const v=Array.from(f.querySelectorAll("[data-side-bar-chip-id]"));for(const m of v){const S=m.dataset.sideBarChipId;if(!S||S===s)continue;const C=m.getBoundingClientRect();if(e<=C.top+C.height/2)return{groupId:d.groupId,index:Math.max(0,d.entryIds.indexOf(S))}}return{groupId:d.groupId,index:d.entryIds.length}}const o=t[t.length-1];return{groupId:o?.groupId??null,index:o?.entryIds.length??0}}function mB(e,t,i,s){if(!i)return 0;const o=Array.from(i.querySelectorAll("[data-drop-zone-group-id]"));for(const d of o){const p=d.dataset.dropZoneGroupId;if(!p||p==="__ungrouped__"||p===s)continue;const l=t.indexOf(p);if(l===-1)continue;const h=d.getBoundingClientRect();if(e<=h.top+h.height/2)return l}return t.length}function gB(e,t,i,s){const o=e.filter(v=>v!==t),d=new Set(s),p=o.filter(v=>d.has(v)),l=Math.max(0,Math.min(i,p.length));if(p.length===0)return[...o,t];if(l<p.length){const v=o.indexOf(p[l]),m=[...o];return m.splice(v,0,t),m}const h=o.indexOf(p[p.length-1]),f=[...o];return f.splice(h+1,0,t),f}function _B(e,t,i,s){const o=new Set(s),d=e.filter(m=>o.has(m)),p=d.indexOf(t),l=d.filter(m=>m!==t),h=i>p?i-1:i,f=Math.max(0,Math.min(h,l.length));l.splice(f,0,t);let v=0;return e.map(m=>o.has(m)?l[v++]??m:m)}function vB(e,t,i){if(i.length!==t.length)return[...e];const s=new Set(t);let o=0;return e.map(d=>s.has(d)?i[o++]??d:d)}function bB(e,t,i){const s=e.indexOf(t);if(s===-1)return[...e];const o=e.filter(l=>l!==t),d=i>s?i-1:i,p=Math.max(0,Math.min(d,o.length));return o.splice(p,0,t),o}function yB(e,t,i){if(e.indexOf(t)===-1)return[...e];const o=e.filter(p=>p!==t),d=Math.max(0,Math.min(i,o.length));return o.splice(d,0,t),o}function Sd(e){return e==="running"?"running":e==="awaiting"?"awaiting":e==="dormant"?"dormant":"idle"}function SB(e){const t=Sd(e);return t==="running"?"Running":t==="awaiting"?"Awaiting input":t==="dormant"?"Dormant":"Idle"}function tE(e){const{currentTitle:t,onCommit:i,onBegin:s}=e,o=L.useRef(null),d=L.useRef(!1),p=L.useRef(!1),[l,h]=L.useState(!1),[f,v]=L.useState("");L.useEffect(()=>{l&&(o.current?.focus(),o.current?.select())},[l]);const m=()=>{s?.(),p.current=!1,v(t),h(!0)},S=()=>{p.current=!0,h(!1),v("")},C=()=>{if(!d.current){d.current=!0;try{i(f)}finally{d.current=!1,p.current=!0,h(!1)}}};return{renaming:l,draftTitle:f,inputRef:o,begin:m,cancel:S,commit:C,setDraftTitle:v,handleKeyDown:_=>{if(_.key==="Enter"){_.preventDefault(),C();return}_.key==="Escape"&&(_.preventDefault(),S())},handleBlur:()=>{if(p.current){p.current=!1;return}C()}}}function nE({entry:e,index:t,isCloseArmed:i,accentValue:s,dragging:o,dragOffsetY:d,dropTarget:p,preview:l=!1,onArmClose:h,onDisarmClose:f,onClose:v,onFocus:m,onKeyboardMove:S,onPointerDragStart:C,onOpenAccent:T,onRename:w}){const _=L.useRef(!1),{operation:b,active:g,minimized:y,notificationCount:k,status:M}=e,A=xB(b),N=tE({currentTitle:A,onCommit:H=>w(b.id,H),onBegin:f}),R=["side-bar-chip",g?"side-bar-chip--active":"",y?"side-bar-chip--minimized":"",o?"side-bar-chip--dragging":"",p?"side-bar-chip--drop-target":""].filter(Boolean).join(" "),B=["side-bar-chip-close",i?"is-armed":""].filter(Boolean).join(" "),q={"--i":t,...s?{"--user-accent":s}:{},...o?{"--drag-dy":`${Math.round(d)}px`}:{}},W=()=>{if(f(),_.current){_.current=!1;return}m(b.id)},G=H=>{H.stopPropagation()},I=H=>{if(H.stopPropagation(),!i){h(b.id);return}f(),v(b.id)},K=H=>{H.preventDefault(),f(),T(b.id,H.currentTarget.getBoundingClientRect())};return u.jsxs("li",{"data-side-bar-chip-id":b.id,className:R,role:"button",tabIndex:0,"aria-label":g?`${A} (focused)`:`Focus operation ${A}`,"aria-current":g?"true":void 0,title:l?"Click to open in its Theater":g?"Focused · double-click to rename · right-click to set accent":"Click to focus · double-click to rename · right-click to set accent",style:q,onClick:W,onContextMenu:l?void 0:K,onFocus:()=>{i||f()},onPointerDown:H=>C(H,b.id),onPointerUp:()=>{o&&(_.current=!0)},onKeyDown:H=>{if(H.target===H.currentTarget){if(!l&&H.altKey&&H.shiftKey&&(H.key==="ArrowUp"||H.key==="ArrowDown")){H.preventDefault(),S(b.id,H.key==="ArrowUp"?-1:1);return}(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),W())}},children:[u.jsx("span",{className:"side-bar-chip-beacon-button","aria-hidden":"true",children:u.jsx("span",{className:"side-bar-chip-op-icon",children:e.icon??u.jsx(EB,{})})}),N.renaming?u.jsx("input",{className:"side-bar-chip-rename-input",ref:N.inputRef,value:N.draftTitle,"aria-label":`Rename operation ${A}`,onChange:H=>N.setDraftTitle(H.target.value),onKeyDown:N.handleKeyDown,onBlur:N.handleBlur,onPointerDown:H=>H.stopPropagation(),onClick:H=>H.stopPropagation()}):u.jsx("span",{className:"side-bar-chip-name",onDoubleClick:l?void 0:N.begin,children:A}),k>0?u.jsx("span",{className:"side-bar-chip-count",children:k}):null,u.jsx("span",{className:`side-bar-chip-status ${wB(M)}`,role:"img","aria-label":VS(M),title:VS(M)}),l?null:u.jsx("button",{type:"button",className:B,onPointerDown:G,onClick:I,"aria-label":i?`Confirm close operation ${A}`:`Close operation ${A}`,title:i?"Confirm close":"Close operation",children:i?"Close?":u.jsx(CB,{})})]})}function xB(e){return e.title}function wB(e){const t=Sd(e);return t==="running"?"tenant-beacon is-turn-running":t==="awaiting"?"tenant-beacon is-awaiting":t==="dormant"?"tenant-beacon is-dormant":"is-idle"}function VS(e){return SB(e)}function CB(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M4.6 4.6 11.4 11.4M11.4 4.6 4.6 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})})}function EB(){return u.jsx("svg",{viewBox:"0 0 14 14","aria-hidden":"true",children:u.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})})}function kB({group:e,count:t,collapsed:i,dragging:s,dropTarget:o,dragOffsetY:d,onToggle:p,onContextMenu:l,onPointerDragStart:h}){const f=L.useRef(!1),v=To(e.color),m=["side-bar-group-header",s?"side-bar-group-header--dragging":"",o?"side-bar-group-header--drop-target":""].filter(Boolean).join(" "),S={...v?{"--grp-color":v}:{},...s?{"--drag-dy":`${Math.round(d)}px`}:{}},C=_=>{_.preventDefault(),l(e.id,_.currentTarget.getBoundingClientRect())},T=_=>{_.target instanceof Element&&_.target.closest("button")||h(_,e.id)},w=()=>{s&&(f.current=!0)};return u.jsxs("div",{className:m,style:S,onContextMenu:C,onPointerDown:T,onPointerUp:w,role:"group","aria-label":e.name,children:[u.jsx("button",{type:"button",className:"side-bar-group-header__toggle",onClick:()=>p(e.id),"aria-expanded":!i,"aria-label":i?`Expand group ${e.name}`:`Collapse group ${e.name}`,title:i?"Expand":"Collapse",children:u.jsx(TB,{collapsed:i})}),u.jsx("span",{className:"side-bar-group-header__name",children:e.name}),u.jsx("span",{className:"side-bar-group-header__count","aria-label":`${t} operations`,children:t})]})}function TB({collapsed:e}){return u.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:`side-bar-group-header__arrow${e?" is-collapsed":""}`,children:u.jsx("path",{d:"M3 5l3 3 3-3",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}const iE="fleet-console.operations.side-width",rE="fleet-console.operations.side-collapsed",sE="fleet-console.operations.theater-collapsed",xd=280,YS=xd,Dg=new Set,jg=new Set;let ha={width:MB(),collapsed:NB()},kh=OB();function aE(){return L.useSyncExternalStore(DB,XS,XS)}function AB(){return L.useSyncExternalStore(IB,ZS,ZS)}function RB(e){const t=Math.max(xd,Math.min(lE(),e));if(ha.width!==t){ha={...ha,width:t};try{typeof window<"u"&&localStorage.setItem(iE,String(t))}catch{}cE()}}function oE(e){if(ha.collapsed!==e){ha={...ha,collapsed:e};try{typeof window<"u"&&localStorage.setItem(rE,e?"1":"0")}catch{}cE()}}function LB(e,t){const i=new Set(kh);t?i.add(e):i.delete(e);const s=Array.from(i);if(s.join("\0")!==kh.join("\0")){kh=s;try{typeof window<"u"&&localStorage.setItem(sE,JSON.stringify(s))}catch{}jB()}}function lE(){return typeof window<"u"?Math.max(xd,window.innerWidth-480):800}function MB(){try{if(typeof window>"u")return YS;const e=localStorage.getItem(iE);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t))return Math.max(xd,Math.min(lE(),t))}}catch{}return YS}function NB(){try{return typeof window<"u"&&localStorage.getItem(rE)==="1"}catch{return!1}}function OB(){try{if(typeof window>"u")return[];const e=localStorage.getItem(sE),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(i=>typeof i=="string"):[]}catch{return[]}}function cE(){for(const e of Dg)e()}function XS(){return ha}function DB(e){return Dg.add(e),()=>Dg.delete(e)}function jB(){for(const e of jg)e()}function ZS(){return kh}function IB(e){return jg.add(e),()=>jg.delete(e)}function uE(e,t){const i=e.find(o=>o.id===t.pluginId)?.kinds.filter(o=>o.type===t.type)??[],s=t.payload.launchKindId;if(typeof s=="string"){const o=i.find(d=>d.id===s);if(o)return o}return i.length===1?i[0]:null}const BB=1500,PB=6,JS=34,QS=18,zB=4;function HB({theaters:e,activeTheaterId:t,operations:i,groups:s,minimized:o,activeOperationId:d,operationNotifications:p,catalog:l,canLaunch:h,addingTheater:f,theaterError:v,renderKindIcon:m,onLaunchKind:S,onResetView:C,onClose:T,onFocus:w,onSetAccent:_,onRename:b,onSetGroupId:g,onCreateGroup:y,onSetGroupColor:k,onRenameGroup:M,onReorderGroups:A,onUngroupAll:N,onSelectTheater:R,onAddTheater:B,onCancelAddTheater:q,onForgetTheater:W}){const G=L.useRef(null),I=L.useRef(null),K=aE(),{width:H,collapsed:P}=K,Y=L.useRef(P),X=W2(),j=yd(),z=L.useRef(null),[D,U]=L.useState(null),[V,J]=L.useState(null),le=L.useRef(null),pe=L.useRef([]),te=L.useRef([]),F=L.useRef([]),ae=L.useRef([]),re=L.useRef(g),ge=L.useRef(A),[de,we]=L.useState(null),[Ie,Ne]=L.useState(null),[Ge,Ee]=L.useState(!1),[ct,wt]=L.useState(!1),Xt=qI(),Ln=AB(),{operationStatus:$n}=cr();L.useLayoutEffect(()=>{!Y.current&&P&&U2(G.current,".command-band-sidebar-toggle"),Y.current=P},[P]);const en=i.filter(he=>he.theaterId===t),ft=s.filter(he=>he.theaterId===t),qt=new Set(o),Ht=new Set(Xt),yt=a_(en,X.operationOrder).map(he=>{const qe=uE(l,he),Dt=qe?m(he.pluginId,qe):null;return{operation:he,active:d===he.id,minimized:qt.has(he.id),notificationCount:p[he.id]?1:0,status:$n[he.id],icon:Dt}}),Bt=hE(yt,ft,X.operationOrder),vi=Bt.some(he=>he.group!==null),Zt=Bt.flatMap(he=>he.groupId?[he.groupId]:[]),Mn=Bt.flatMap(he=>Ht.has(he.groupId??"")?[]:he.entries),dt=yt.map(he=>he.operation.id),hn=L.useCallback(()=>{z.current!==null&&(window.clearTimeout(z.current),z.current=null)},[]),Ot=L.useCallback(()=>{hn(),U(null)},[hn]),Jt=L.useCallback(he=>{hn(),U(he),z.current=window.setTimeout(()=>{z.current=null,U(null)},BB)},[hn]);L.useEffect(()=>hn,[hn]),L.useEffect(()=>{D!==null&&(yt.some(he=>he.operation.id===D)||Ot())},[D,yt,Ot]);const pt=de?.kind==="chip"?yt.find(he=>he.operation.id===de.operationId)?.operation??null:null,bi=de?.kind==="group"?s.find(he=>he.id===de.groupId)??null:null,Kn=de?.kind==="theater"?e.find(he=>he.id===de.theaterId)??null:null,Vr=(he,qe)=>{const Dt=Mn.findIndex(Xe=>Xe.operation.id===he);if(Dt===-1)return;const nt=Math.max(0,Math.min(Mn.length-1,Dt+qe));if(nt===Dt)return;const Ae=Mn.map(Xe=>Xe.operation.id),We=yB(Ae,he,nt);ym(vB(dt,Ae,We))},yi=Bt.map(he=>({groupId:he.groupId,entryIds:he.entries.map(qe=>qe.operation.id)}));L.useEffect(()=>{pe.current=yt,te.current=dt,F.current=yi,ae.current=Zt,re.current=g,ge.current=A});const wn=he=>{le.current=he,J(he)},Vn=V?.pointerId??null;L.useEffect(()=>{if(Vn===null)return;const he=nt=>{if(nt.pointerId!==Vn)return;const Ae=le.current;if(!Ae)return;if(nt.buttons===0){wn(null);return}const We=Math.hypot(nt.clientX-Ae.startX,nt.clientY-Ae.startY);if(!Ae.dragging&&We<PB)return;if(Ae.dragging&&nt.preventDefault(),GB(nt.clientY,I.current),Ae.kind==="chip"){const pn=pB(nt.clientY,F.current,I.current,Ae.sourceId);wn({...Ae,currentY:nt.clientY,dragging:!0,dropIndex:pn.index,dropGroupId:pn.groupId});return}const Xe=mB(nt.clientY,ae.current,I.current,Ae.sourceGroupId);wn({...Ae,currentY:nt.clientY,dragging:!0,dropIndex:Xe})},qe=nt=>{if(nt.pointerId!==Vn)return;const Ae=le.current;if(wn(null),!Ae?.dragging)return;if(Ae.kind==="group"){const ve=bB(ae.current,Ae.sourceGroupId,Ae.dropIndex);if(ve.join("\0")===ae.current.join("\0"))return;ge.current(ve);return}const{sourceId:We,sourceGroupId:Xe,dropIndex:pn,dropGroupId:Yn}=Ae,ji=F.current,Xn=te.current;if(Yn!==Xe){const ke=ji.find(et=>et.groupId===Yn)?.entryIds??[];ym(gB(Xn,We,pn,ke)),re.current(We,Yn);return}const Zn=ji.find(ve=>ve.groupId===Xe)?.entryIds??[],Re=Zn.indexOf(We);if(Re===-1||pn===Re)return;const Z=_B(Xn,We,pn,Zn);ym(Z)},Dt=nt=>{nt.pointerId===Vn&&wn(null)};return window.addEventListener("pointermove",he),window.addEventListener("pointerup",qe),window.addEventListener("pointercancel",Dt),()=>{window.removeEventListener("pointermove",he),window.removeEventListener("pointerup",qe),window.removeEventListener("pointercancel",Dt)}},[Vn]);const tn=(he,qe)=>{if(he.button!==0||he.target instanceof Element&&he.target.closest("button"))return;we(null),Ot();const nt=yt.find(Ae=>Ae.operation.id===qe)?.operation.groupId??null;wn({kind:"chip",sourceId:qe,sourceGroupId:nt,pointerId:he.pointerId,startX:he.clientX,startY:he.clientY,currentY:he.clientY,dragging:!1,dropIndex:dt.indexOf(qe),dropGroupId:nt})},ee=(he,qe)=>{he.button===0&&(he.target instanceof Element&&he.target.closest("button")||Zt.includes(qe)&&(we(null),Ot(),wn({kind:"group",sourceGroupId:qe,pointerId:he.pointerId,startX:he.clientX,startY:he.clientY,currentY:he.clientY,dragging:!1,dropIndex:Zt.indexOf(qe)})))},_e=L.useCallback(he=>{he.preventDefault();const qe=he.clientX,Dt=K.width;wt(!0);const nt=We=>{const Xe=We.clientX-qe;RB(Dt+Xe)},Ae=()=>{wt(!1),document.removeEventListener("pointermove",nt),document.removeEventListener("pointerup",Ae),document.removeEventListener("pointercancel",Ae)};document.addEventListener("pointermove",nt),document.addEventListener("pointerup",Ae),document.addEventListener("pointercancel",Ae)},[K.width]),xe=()=>{oE(!P)},Pe=()=>{Ne(null),we(null),Ee(!0)},Ct=()=>{Ee(!1),q()},mt=he=>{Ee(!1),B(he)},Le=he=>{he.defaultPrevented||(he.preventDefault(),we(null),Ne({anchor:{x:he.clientX,y:he.clientY},viewportBounds:{width:window.innerWidth,height:window.innerHeight}}))},Te=L.useCallback(()=>{const he=de?.kind==="theater"?de.returnFocus:null;we(null),he?.focus()},[de]),ze=(he,qe)=>{he.stopPropagation(),qe!==t&&R(qe),we(null);const Dt=he.currentTarget.getBoundingClientRect();Ne({anchor:{x:Dt.right+8,y:Dt.top},viewportBounds:{width:window.innerWidth,height:window.innerHeight}})},Pt=he=>{LB(he,!Ln.includes(he))};return u.jsxs("aside",{className:`operations-side-bar ${P?"is-closed":"is-expanded"}`,ref:G,"data-sidebar-state":P?"closed":"expanded","data-resizing":ct?"true":void 0,"data-canvas-blocker":!0,style:{"--side-bar-width":`${H}px`},inert:P,onContextMenu:Le,children:[u.jsxs("div",{className:"side-bar-theater-add-row",children:[u.jsxs("button",{type:"button",className:"side-bar-theater-add-btn",onClick:Pe,disabled:f,"aria-label":"Add Theater",title:f?"Adding Theater":"Add Theater",children:[u.jsx(W_,{}),u.jsx("span",{children:"Add Theater"})]}),u.jsx("button",{type:"button",className:"side-bar-formation-toggle",onClick:()=>Ng(),disabled:t===null,"aria-pressed":j,"aria-label":"Formation view",title:"Formation view (Alt+F)",children:u.jsx($B,{})})]}),!P&&v?u.jsx("p",{className:"side-bar-theater-error",children:v}):null,u.jsx("ol",{className:"operations-side-bar-chips",ref:I,"aria-label":"Operations",children:e.map(he=>{const qe=he.id===t,Dt=i.filter(Ae=>Ae.theaterId===he.id).length,nt=Ln.includes(he.id);if(!qe){const Ae=UB({theaterId:he.id,operations:i,operationOrder:X.operationOrder,minimizedSet:qt,activeOperationId:null,operationNotifications:p,operationStatus:$n,catalog:l,renderKindIcon:m});return u.jsx(FB,{theater:he,entries:nt?[]:Ae,groups:s.filter(We=>We.theaterId===he.id),operationCount:Dt,collapsed:nt,onSelectTheater:R,onFocus:w,onToggleCollapsed:Pt,onOpenActions:(We,Xe)=>{Ne(null),we({kind:"theater",theaterId:he.id,anchor:We,returnFocus:Xe})},onOpenLaunch:ze,onContextMenu:We=>{Ne(null),we({kind:"theater",theaterId:he.id,anchor:We})}},he.id)}return u.jsxs("li",{className:"side-bar-theater-section side-bar-theater-section--active","data-theater-id":he.id,children:[u.jsx(dE,{theater:he,operationCount:Dt,active:!0,collapsed:nt,onSelectTheater:R,onToggleCollapsed:Pt,onOpenActions:(Ae,We)=>{Ne(null),we({kind:"theater",theaterId:he.id,anchor:Ae,returnFocus:We})},onOpenLaunch:ze,onContextMenu:Ae=>{Ne(null),we({kind:"theater",theaterId:he.id,anchor:Ae})}}),nt?null:u.jsx("ol",{className:"side-bar-theater-groups","aria-label":`${he.label} operations`,children:Bt.map(Ae=>{const We=Ae.groupId!==null&&Ht.has(Ae.groupId),Xe=Ae.group?To(Ae.group.color):null,pn=Xe?{"--grp-color":Xe}:void 0,Yn=Ae.groupId?Zt.indexOf(Ae.groupId):-1,ji=V?.kind==="group"&&V.sourceGroupId===Ae.groupId&&V.dragging,Xn=V?.kind==="group"&&V.dragging&&Ae.groupId!==null&&V.sourceGroupId!==Ae.groupId&&V.dropIndex===Yn,hr=V?.kind==="group"&&V.dragging&&Ae.groupId!==null&&V.sourceGroupId!==Ae.groupId&&Yn===Zt.length-1&&V.dropIndex===Zt.length,Zn=[Ae.groupId?"side-bar-group-section":"side-bar-ungrouped-section",Xn?"side-bar-group-section--drop-before":"",hr?"side-bar-group-section--drop-after":""].filter(Boolean).join(" ");return u.jsxs("li",{"data-drop-zone-group-id":Ae.groupId??"__ungrouped__",className:Zn,style:pn,children:[Ae.group?u.jsx(kB,{group:Ae.group,count:Ae.entries.length,collapsed:We,dragging:ji,dragOffsetY:ji?V.currentY-V.startY:0,dropTarget:Xn,onToggle:GI,onContextMenu:(Re,Z)=>we({kind:"group",groupId:Re,anchor:Z}),onPointerDragStart:ee}):vi&&Ae.entries.length>0?u.jsx("div",{className:"side-bar-ungrouped-label","aria-label":"Ungrouped operations",children:u.jsx("span",{children:"Ungrouped"})}):null,We?null:u.jsx("ol",{className:["side-bar-group-chips",V?.kind==="chip"&&V.dragging&&V.dropGroupId===Ae.groupId&&V.dropGroupId!==V.sourceGroupId?"side-bar-section--drop-target":""].filter(Boolean).join(" "),"data-group-section-id":Ae.groupId??"__ungrouped__","aria-label":Ae.group?Ae.group.name:"Ungrouped",children:Ae.entries.map(Re=>{const Z=yt.indexOf(Re),ve=Ae.entries.indexOf(Re),ke=X.operationAccent[Re.operation.id]??PS(Re.operation),et=ke?To(ke):null;return u.jsx(nE,{entry:Re,index:Z,isCloseArmed:D===Re.operation.id,accentValue:et,dragging:V?.kind==="chip"&&V.sourceId===Re.operation.id&&V.dragging,dragOffsetY:V?.kind==="chip"&&V.sourceId===Re.operation.id&&V.dragging?V.currentY-V.startY:0,dropTarget:V?.kind==="chip"&&V.dragging===!0&&V.dropGroupId===Ae.groupId&&V.dropGroupId===V.sourceGroupId&&V.dropIndex===ve&&V.sourceId!==Re.operation.id,onArmClose:Jt,onDisarmClose:Ot,onClose:T,onFocus:w,onKeyboardMove:Vr,onPointerDragStart:tn,onOpenAccent:(tt,jt)=>we({kind:"chip",operationId:tt,anchor:jt}),onRename:b},Re.operation.id)})})]},Ae.groupId??"__ungrouped__")})})]},he.id)})}),u.jsx("div",{className:"operations-side-bar-resize-handle",onPointerDown:_e,onDoubleClick:xe,"aria-hidden":"true"}),Ie?Os.createPortal(u.jsx($2,{anchor:Ie.anchor,viewportBounds:Ie.viewportBounds,placement:"cursor",mode:"launch",catalog:l,canLaunch:h,renderKindIcon:m,onLaunchKind:(he,qe)=>{Ne(null),S(he,qe)},onResetView:C,onClose:()=>Ne(null)},`${Ie.anchor.x}:${Ie.anchor.y}`),document.body):null,de?.kind==="chip"&&pt?u.jsx(HS,{kind:"chip",operation:pt,groups:s.filter(he=>he.theaterId===pt.theaterId),accentKey:X.operationAccent[pt.id]??PS(pt),anchor:de.anchor,actions:{onSetAccent:he=>_(pt.id,he),onSetGroupId:he=>g(pt.id,he),onCreateGroup:he=>y(pt.theaterId,he,pt.id)},onClose:()=>we(null)}):de?.kind==="group"&&bi?u.jsx(HS,{kind:"group-header",group:bi,anchor:de.anchor,actions:{onSetColor:he=>k(bi.id,he),onRename:he=>M(bi.id,he),onUngroupAll:()=>N(bi.id)},onClose:()=>we(null)}):de?.kind==="theater"&&Kn?u.jsx(WB,{theater:Kn,groupCount:s.filter(he=>he.theaterId===Kn.id).length,anchor:de.anchor,onCreateGroup:he=>{y(Kn.id,he),Te()},onForgetTheater:()=>{W(Kn.id),Te()},onClose:Te}):null,u.jsx(F2,{open:Ge,onCancel:Ct,onConfirm:mt}),P?null:u.jsx(G3,{})]})}function $B(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM3 9h4v4H3zM9 9h4v4H9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}function hE(e,t,i){const s=[...t].sort((l,h)=>l.order-h.order||l.createdAt-h.createdAt),o=s.map(l=>({groupId:l.id,group:l,entries:[]})),d={groupId:null,group:null,entries:[]},p=new Map(s.map(l=>[l.id,l]));for(const l of e){const h=l.operation.groupId??null;h!==null&&p.has(h)?o.find(v=>v.groupId===h)?.entries.push(l):d.entries.push(l)}return[...o,d]}function UB({theaterId:e,operations:t,operationOrder:i,minimizedSet:s,activeOperationId:o,operationNotifications:d,operationStatus:p,catalog:l,renderKindIcon:h}){return a_(t.filter(f=>f.theaterId===e),i).map(f=>{const v=uE(l,f),m=v?h(f.pluginId,v):null;return{operation:f,active:o===f.id,minimized:s.has(f.id),notificationCount:d[f.id]?1:0,status:p[f.id],icon:m}})}function dE({theater:e,operationCount:t,active:i,collapsed:s,onSelectTheater:o,onToggleCollapsed:d,onOpenActions:p,onOpenLaunch:l,onContextMenu:h}){const f=m=>{m.preventDefault(),h(m.currentTarget.getBoundingClientRect())},v=m=>{m.target===m.currentTarget&&(m.key!=="Enter"&&m.key!==" "||(m.preventDefault(),o(e.id)))};return u.jsxs("div",{role:"button",tabIndex:0,className:`side-bar-theater-header${i?" is-active":""}`,onClick:()=>o(e.id),onKeyDown:v,onContextMenu:f,"aria-current":i?"true":void 0,"aria-expanded":!s,title:e.label,children:[u.jsx("span",{className:"side-bar-theater-anchor","aria-hidden":"true",children:fE(e.label)}),u.jsx("span",{className:"side-bar-theater-name",children:e.label}),u.jsx("span",{className:"side-bar-theater-count",children:t}),u.jsxs("span",{className:"side-bar-theater-row-controls","aria-label":`${e.label} controls`,children:[u.jsx("button",{type:"button",className:"side-bar-theater-row-btn side-bar-theater-collapse-btn","aria-label":s?`Expand ${e.label}`:`Collapse ${e.label}`,"aria-expanded":!s,title:s?"Expand":"Collapse",onClick:m=>{m.stopPropagation(),d(e.id)},children:u.jsx(qB,{collapsed:s})}),u.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":"Theater actions",title:"Theater actions",onClick:m=>{m.stopPropagation(),p(m.currentTarget.getBoundingClientRect(),m.currentTarget)},children:u.jsx(KB,{})}),u.jsx("button",{type:"button",className:"side-bar-theater-row-btn","aria-label":`New Operation in ${e.label}`,title:`New Operation in ${e.label}`,onClick:m=>l(m,e.id),children:u.jsx(W_,{})})]})]})}function FB({theater:e,entries:t,groups:i,operationCount:s,collapsed:o,onSelectTheater:d,onFocus:p,onToggleCollapsed:l,onOpenActions:h,onOpenLaunch:f,onContextMenu:v}){const m=hE(t,i);let S=zB,C=0;const T=[];for(const w of m){if(w.entries.length===0)continue;const _=w.entries.slice(0,Math.max(0,S));C+=w.entries.length-_.length,S-=_.length,_.length>0&&T.push({...w,entries:_})}return u.jsxs("li",{className:"side-bar-theater-section side-bar-theater-section--peek","data-theater-id":e.id,children:[u.jsx(dE,{theater:e,operationCount:s,active:!1,collapsed:o,onSelectTheater:d,onToggleCollapsed:l,onOpenActions:h,onOpenLaunch:f,onContextMenu:v}),T.length>0?u.jsxs("ol",{className:"side-bar-peek-chips","aria-label":`${e.label} preview operations`,children:[T.map(w=>{const _=w.group?To(w.group.color):null;return u.jsxs("li",{className:w.groupId?"side-bar-group-section side-bar-group-section--peek":"side-bar-ungrouped-section",style:_?{"--grp-color":_}:void 0,children:[w.group?u.jsxs("div",{className:"side-bar-peek-group-label","aria-label":`Group ${w.group.name}`,children:[u.jsx("span",{children:w.group.name}),u.jsx("span",{className:"side-bar-peek-group-count",children:w.entries.length})]}):null,u.jsx("ol",{className:"side-bar-group-chips","aria-label":w.group?w.group.name:"Ungrouped",children:w.entries.map((b,g)=>u.jsx(nE,{entry:b,index:g,isCloseArmed:!1,accentValue:null,dragging:!1,dragOffsetY:0,dropTarget:!1,preview:!0,onArmClose:()=>{},onDisarmClose:()=>{},onClose:()=>{},onFocus:p,onKeyboardMove:()=>{},onPointerDragStart:()=>{},onOpenAccent:()=>{},onRename:()=>{}},b.operation.id))})]},w.groupId??"__ungrouped__")}),C>0?u.jsxs("li",{className:"side-bar-peek-more",children:["+",C," more"]}):null]}):null]})}function WB({theater:e,groupCount:t,anchor:i,onCreateGroup:s,onForgetTheater:o,onClose:d}){const[p,l]=L.useState(!1),[h,f]=L.useState(`Group ${t+1}`),v=L.useRef(!1),m=L.useRef(null),S=L.useRef(null),[C,T]=L.useState(i.bottom+6);L.useLayoutEffect(()=>{const _=S.current?.getBoundingClientRect().height??0,b=window.innerHeight-_-8;T(Math.max(8,Math.min(i.bottom+6,b)))},[i,p]),L.useEffect(()=>{p&&m.current?.select()},[p]),L.useEffect(()=>{const _=b=>{b.key==="Escape"&&(b.preventDefault(),d())};return window.addEventListener("keydown",_),window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),()=>{window.removeEventListener("keydown",_),window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0)}},[d]);const w=()=>{const _=h.trim();_&&s(_)};return Os.createPortal(u.jsx("div",{className:"group-context-menu-overlay",role:"presentation",onPointerDown:d,children:u.jsxs("div",{ref:S,className:"theater-menu side-bar-theater-menu",role:"menu","aria-label":`${e.label} actions`,style:{position:"fixed",left:i.left,top:C},onPointerDown:_=>_.stopPropagation(),children:[p?u.jsx("input",{ref:m,className:"group-context-menu-new-input theater-menu-new-group-input",type:"text",value:h,onChange:_=>f(_.target.value),onCompositionStart:()=>{v.current=!0},onCompositionEnd:()=>{v.current=!1},onKeyDown:_=>{_.key==="Enter"&&!v.current&&(_.preventDefault(),w()),_.key==="Escape"&&(_.preventDefault(),l(!1))},onBlur:()=>l(!1),"aria-label":"New group name",placeholder:"Group name"}):u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-new-group",onClick:()=>l(!0),children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(W_,{})}),u.jsx("span",{className:"theater-menu-label",children:"New group…"})]}),u.jsx("div",{className:"theater-menu-divider","aria-hidden":"true"}),u.jsxs("button",{type:"button",role:"menuitem",className:"theater-menu-item theater-menu-forget",onClick:o,children:[u.jsx("span",{className:"theater-menu-check","aria-hidden":"true",children:u.jsx(YB,{})}),u.jsx("span",{className:"theater-menu-label",children:"Forget Theater"})]})]})}),document.body)}function GB(e,t){if(!t)return;const i=t.getBoundingClientRect();e<i.top+JS?t.scrollTop-=QS:e>i.bottom-JS&&(t.scrollTop+=QS)}function qB({collapsed:e}){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e?u.jsx("path",{d:"M6 3.8 10.2 8 6 12.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"}):u.jsx("path",{d:"M3.8 6 8 10.2 12.2 6",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"})})}function KB(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"3.5",cy:"8",r:"1.1",fill:"currentColor"}),u.jsx("circle",{cx:"8",cy:"8",r:"1.1",fill:"currentColor"}),u.jsx("circle",{cx:"12.5",cy:"8",r:"1.1",fill:"currentColor"})]})}function W_(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M8 3.4v9.2M3.4 8h9.2",fill:"none",stroke:"currentColor",strokeWidth:"1.45",strokeLinecap:"round"})})}function fE(e){const t=e.trim().split(/[\s\-_.]+/).filter(Boolean);return(t.length>1?t.flatMap(s=>VB(s)):pE(e).filter(s=>/[\p{L}\p{N}]/u.test(s))).slice(0,2).join("").toUpperCase()||"--"}function VB(e){return pE(e).slice(0,1)}function pE(e){return typeof Intl.Segmenter=="function"?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(t=>t.segment):Array.from(e)}function YB(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("path",{d:"M5.2 5.8v6.1M8 5.8v6.1M10.8 5.8v6.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),u.jsx("path",{d:"M3.7 4.1h8.6M6.4 4.1l.4-1h2.4l.4 1M4.6 4.1l.5 9.1h5.8l.5-9.1",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function XB({operationsViewVisible:e}){const t=cr(),i=Io(),s=aE(),o=Nw(),d=t.theaters.find(N=>N.id===t.activeTheaterId)??null,p=t.operations.find(N=>N.id===t.activeOperationId)??null,l=p?i.plugins.find(N=>N.id===p.pluginId):null,h=typeof p?.payload.cliId=="string"?p.payload.cliId:null,f=typeof p?.payload.cliLabel=="string"?p.payload.cliLabel:h,v=p?l?.operationKinds?.find(N=>N.type===p.type)??null:null,m=p&&l?.renderLaunchIcon?l.renderLaunchIcon({id:h??p.type,type:p.type,title:v?.title??p.type}):null,S=Ow(),C=L.useRef(null),T=L.useRef(null),w=L.useRef(null),[_,b]=L.useState(!1),g=tE({currentTitle:p?.title??"",onCommit:N=>{const R=Wy(w.current,t.activeOperationId);w.current=null,R&&Qx(R,N).then(()=>gi(null)).then(_i).catch(()=>{})}});L.useEffect(()=>{!g.renaming||Wy(w.current,t.activeOperationId)||(w.current=null,g.cancel())},[g,t.activeOperationId]),L.useEffect(()=>{if(!_)return;const N=R=>{const B=R.target;!(B instanceof Node)||C.current?.contains(B)||T.current?.contains(B)||b(!1)};return document.addEventListener("pointerdown",N),()=>document.removeEventListener("pointerdown",N)},[_]),L.useEffect(()=>{PR(_,S.isPathContextDeckOpen)&&b(!1)},[_,S.isPathContextDeckOpen]);const y=()=>{b(!1),C.current?.focus()},k=()=>{const N=!_;b(N),vh(zR(N,S.isPathContextDeckOpen))},M=N=>{d&&Lw(d.id,R=>xw(d.id,N,R))},A=()=>{p&&(w.current=p.id,g.begin())};return u.jsxs("header",{className:`command-band${e?" is-operations":" is-utility"}`,style:{"--command-band-left-width":`${s.width}px`},children:[u.jsxs("div",{className:`command-band-left${e&&s.collapsed?" is-collapsed":""}`,children:[u.jsx(q3,{className:"command-band-brand"}),e?u.jsx("button",{type:"button",className:"command-band-button command-band-sidebar-toggle",onClick:()=>oE(!s.collapsed),"aria-label":s.collapsed?"Expand sidebar":"Collapse sidebar",title:s.collapsed?"Expand sidebar":"Collapse sidebar",children:u.jsx(ex,{side:"left"})}):null,u.jsx("button",{type:"button",className:"command-band-button command-band-search",onClick:pw,"aria-label":"Search sessions",title:"Search sessions (⌘K)",children:u.jsx(ZB,{})})]}),u.jsxs("div",{className:"command-band-center",children:[e&&d?u.jsxs("div",{className:"command-band-theater-cluster","aria-label":`Active Theater: ${d.label}`,children:[u.jsxs("span",{className:"command-band-theater-segment",children:[u.jsx("span",{className:"command-band-theater-mark",children:fE(d.label)}),d.label]}),p?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"command-band-theater-separator","aria-hidden":"true",children:"›"}),g.renaming?u.jsx("input",{ref:g.inputRef,className:"command-band-rename-input",value:g.draftTitle,"aria-label":`${p.title} 이름 변경`,onChange:N=>g.setDraftTitle(N.target.value),onKeyDown:g.handleKeyDown,onBlur:g.handleBlur}):u.jsx("button",{type:"button",className:"command-band-operation-name",onDoubleClick:A,title:"Double-click to rename",children:p.title}),f?u.jsxs("span",{className:"command-band-operation-attribute",title:v?.title??f,children:[m?u.jsx("span",{className:"command-band-operation-kind","aria-hidden":"true",children:m}):null,f]}):null]}):null]}):null,e&&d&&S.pathContextHydrated&&S.pathContext?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"command-band-context-separator","aria-hidden":"true"}),u.jsxs("div",{className:"command-band-context",children:[u.jsxs("button",{ref:C,type:"button",className:"command-band-context-trigger",onClick:k,"aria-expanded":_,"aria-haspopup":"dialog",title:S.pathContextError??"Path context — shared with the Activity Rail",children:[u.jsx(JB,{}),S.pathContext.label,u.jsx("span",{"aria-hidden":"true",children:"⌄"})]}),_?u.jsx(Tw,{ref:T,className:"command-band-context-deck",theaterId:d.id,theaterLabel:d.label,context:S.pathContext,isMutating:S.pathContextMutationInProgress,onSelect:M,onClose:y}):null]})]}):null]}),u.jsx("div",{className:"command-band-right",children:e?u.jsx("button",{type:"button",className:"command-band-button command-band-rail-toggle",onClick:wL,"aria-label":o?"Collapse Activity Rail":"Expand Activity Rail",title:o?"Collapse Activity Rail":"Expand Activity Rail",children:u.jsx(ex,{side:"right"})}):null})]})}function ZB(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("circle",{cx:"7",cy:"7",r:"4.2",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("path",{d:"M10.4 10.4 13.5 13.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round"})]})}function ex({side:e}){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"1.75",y:"3",width:"12.5",height:"10",rx:"2.4",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),u.jsx("path",{d:e==="left"?"M6.4 3v10":"M9.6 3v10",stroke:"currentColor",strokeWidth:"1.3"})]})}function JB(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M2.5 4.5a1 1 0 0 1 1-1h3l1.5 1.7h4.5a1 1 0 0 1 1 1v6.3a1 1 0 0 1-1 1h-9a1 1 0 0 1-1-1z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})})}const QB=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function e9({state:e}){const[t,i]=L.useState(!1),s=L.useRef(null),o=L.useRef(null),d=L.useRef(null),p=e.theaters.length>0;if(L.useEffect(()=>{if(e.onboardingOpen)return s.current=document.activeElement,o.current?.focus(),()=>{const v=s.current;s.current=null,v?.focus?.()}},[e.onboardingOpen]),L.useEffect(()=>{if(!e.onboardingOpen)return;const v=m=>{t||(m.key==="Escape"?(m.preventDefault(),Nl()):m.key==="Tab"&&t9(m,d.current),m.stopImmediatePropagation())};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[t,e.onboardingOpen]),!e.onboardingOpen)return null;const l=()=>{i(!0)},h=()=>{i(!1)},f=async v=>{i(!1),hw();try{const m=await Jx(v),S=await Zx(m);dw(S)}catch(m){Gm(m instanceof Error?m.message:String(m))}};return u.jsxs("div",{className:"commissioning-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"commissioning-title",children:[u.jsx("button",{type:"button",className:"commissioning-scrim",onClick:Nl,"aria-label":"Close setup guide"}),u.jsxs("section",{className:"commissioning-card",ref:d,children:[u.jsxs("header",{className:"commissioning-header",children:[u.jsx("span",{className:"commissioning-eyebrow",children:"COMMISSIONING · FLEET CONSOLE"}),u.jsx("h2",{id:"commissioning-title",children:"Set up Fleet Console"}),u.jsx("p",{children:"Add a project folder, start an Operation, and monitor Carriers."})]}),u.jsxs("ol",{className:"commissioning-steps",children:[u.jsxs("li",{className:`commissioning-step commissioning-step--primary ${p?"is-complete":"is-current"}`,children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:p?"✓":"01"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:"Register a Theater"}),u.jsx("p",{children:"A Theater is a project folder. Choose the folder you want to work from."}),p?u.jsx(dc,{ref:v=>{o.current=v},className:"commissioning-primary-action",to:"/operations",onClick:Nl,children:"Go to Operations →"}):u.jsx("button",{ref:v=>{o.current=v},type:"button",className:"commissioning-primary-action is-live",disabled:e.addingTheater,onClick:l,children:e.addingTheater?"Adding Theater…":"Choose a folder…"}),e.theaterError?u.jsx("p",{className:"commissioning-error",role:"alert",children:e.theaterError}):null]})]}),u.jsxs("li",{className:"commissioning-step",children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"02"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:"Open an Operation"}),u.jsx("p",{children:"An Operation is a live terminal session running an Agent CLI. Start one from the Operations tab to begin a working session."}),u.jsx(dc,{className:"commissioning-secondary-link",to:"/operations",onClick:Nl,children:"Go to Operations"})]})]}),u.jsxs("li",{className:"commissioning-step",children:[u.jsx("span",{className:"commissioning-step-node","aria-hidden":"true",children:"03"}),u.jsxs("div",{className:"commissioning-step-body",children:[u.jsx("h3",{children:"Monitor Carriers"}),u.jsx("p",{children:"Carriers are specialist agents. Their activity streams here while they run."})]})]})]}),u.jsxs("footer",{className:"commissioning-footer",children:[u.jsx("p",{children:"Theaters with a Fleet Wiki knowledge root also unlock Codex — your decision log and reference library."}),u.jsx("button",{type:"button",className:"commissioning-skip",onClick:Nl,children:"Skip for now"})]})]}),u.jsx(F2,{open:t,onCancel:h,onConfirm:f})]})}function t9(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(QB)),s=i[0],o=i[i.length-1];!s||!o||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),o.focus()):!e.shiftKey&&document.activeElement===o&&(e.preventDefault(),s.focus()))}const n9="a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex='-1'])",tx="operation-search-listbox",mE="__unassigned__";function i9({state:e}){const t=Lc(),[i,s]=L.useState(""),[o,d]=L.useState(0),p=L.useRef(null),l=L.useRef(null),h=L.useRef(null),f=L.useRef(new Map),v=L.useMemo(()=>E3(e),[e]),m=L.useMemo(()=>UR(v,i),[v,i]),S=L.useMemo(()=>FR(m),[m]),C=L.useMemo(()=>nw(i),[i]),T=nx(o,m.length),w=m[T]?ix(m[T].operationId):void 0;if(L.useEffect(()=>{if(!e.operationSearchOpen)return;h.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const g=document.body.style.overflow;return document.body.style.overflow="hidden",window.setTimeout(()=>p.current?.focus(),0),()=>{document.body.style.overflow=g,h.current?.focus()}},[e.operationSearchOpen]),L.useEffect(()=>{if(!e.operationSearchOpen){s(""),d(0);return}d(0)},[e.operationSearchOpen,i]),L.useEffect(()=>{if(!e.operationSearchOpen)return;const g=m[T];g&&f.current.get(g.operationId)?.scrollIntoView({block:"nearest"})},[T,m,e.operationSearchOpen]),!e.operationSearchOpen)return null;const _=g=>{mc(g),t("/operations"),Pp()},b=g=>{if(g.key==="Escape"){g.preventDefault(),Pp();return}if(g.key==="ArrowDown"||g.key==="ArrowUp"){g.preventDefault(),d(y=>nx(y+(g.key==="ArrowDown"?1:-1),m.length));return}if(g.key==="Enter"){const y=m[T];if(!y)return;g.preventDefault(),_(y.operationId);return}g.key==="Tab"&&o9(g,l.current)};return u.jsx("div",{className:"operation-search-overlay",onMouseDown:g=>{g.target===g.currentTarget&&Pp()},children:u.jsxs("section",{ref:l,className:"operation-search-card",role:"dialog","aria-modal":"true","aria-label":"Operation quick search",tabIndex:-1,onKeyDown:b,children:[u.jsxs("div",{className:"operation-search-field",children:[u.jsx(l9,{}),u.jsx("input",{ref:p,id:"operation-search-input",type:"search",value:i,onChange:g=>s(g.target.value),placeholder:"Search Operations across Theaters",autoComplete:"off",role:"combobox","aria-expanded":!0,"aria-controls":tx,"aria-activedescendant":w,"aria-autocomplete":"list",spellCheck:!1}),u.jsx("kbd",{children:"esc"})]}),u.jsx("div",{id:tx,className:"operation-search-results",role:"listbox","aria-label":"Operation results",children:S.length>0?S.map(g=>{const y=s9(g.theaterId);return u.jsxs("section",{className:"operation-search-section",role:"group","aria-labelledby":y,children:[u.jsx("h2",{id:y,className:"operation-search-section-heading",children:Sm(g.theaterLabel,C)}),g.entries.map(k=>{const M=m.indexOf(k),A=M===T;return u.jsxs("button",{id:ix(k.operationId),ref:N=>{N?f.current.set(k.operationId,N):f.current.delete(k.operationId)},type:"button",className:`operation-search-result ${A?"is-active":""}`,role:"option","aria-selected":A,onMouseEnter:()=>d(M),onClick:()=>_(k.operationId),children:[u.jsxs("span",{className:"operation-search-result-text",children:[u.jsx("strong",{children:Sm(k.operationName,C)}),u.jsx("small",{children:r9(k)})]}),u.jsx("span",{className:"operation-search-theater",children:Sm(k.theaterLabel,C)})]},k.operationId)})]},g.theaterId??mE)}):u.jsx("p",{className:"operation-search-empty",children:"No matching Operations."})})]})})}function nx(e,t){return t<=0?0:Math.max(0,Math.min(e,t-1))}function r9(e){return[e.pluginId,e.status].filter(Boolean).join(" · ")}function s9(e){return`operation-search-heading-${gE(e??mE)}`}function ix(e){return`operation-search-option-${gE(e)}`}function gE(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function Sm(e,t){if(t.length===0)return e;const i=[];let s=0;for(;s<e.length;){const o=a9(e,t,s);if(!o){i.push(e.slice(s));break}o.start>s&&i.push(e.slice(s,o.start)),i.push(u.jsx("mark",{children:e.slice(o.start,o.end)},`${o.start}-${o.end}`)),s=o.end}return i}function a9(e,t,i){const s=e.toLocaleLowerCase();let o=null;for(const d of t){const p=s.indexOf(d,i);p!==-1&&(!o||p<o.start)&&(o={start:p,end:p+d.length})}return o}function o9(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(n9)).filter(d=>d.offsetParent!==null);if(i.length===0)return;const s=i[0],o=i[i.length-1];if(e.shiftKey&&document.activeElement===s){e.preventDefault(),o?.focus();return}!e.shiftKey&&document.activeElement===o&&(e.preventDefault(),s?.focus())}function l9(){return u.jsx("svg",{viewBox:"0 0 20 20","aria-hidden":"true",children:u.jsx("path",{d:"m14.2 14.2 3 3M8.9 15.2a6.3 6.3 0 1 1 0-12.6 6.3 6.3 0 0 1 0 12.6Z",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round"})})}function c9({open:e,title:t,message:i,tone:s="info",onDismiss:o}){return e?u.jsx("div",{className:"app-toast-host",children:u.jsxs("div",{className:`app-toast app-toast--${s}`,role:"status","aria-live":"polite",children:[u.jsx("span",{className:"app-toast-dot","aria-hidden":"true"}),u.jsxs("div",{className:"app-toast-body",children:[u.jsx("p",{className:"app-toast-title",children:t}),i?u.jsx("p",{className:"app-toast-message",children:i}):null]}),o?u.jsx("button",{type:"button",className:"app-toast-close",onClick:o,"aria-label":"Dismiss notification",children:"×"}):null]})}):null}async function _E(e){const t=await fetch("/api/v1/settings/global",{signal:e});return await vE(t),bE(await t.json(),t.status)}async function u9(e,t){const i=await fetch("/api/v1/settings/global",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t});await vE(i);const s=await i.json();if(!s||typeof s!="object"||!("state"in s))throw new ht(i.status,"Invalid global settings mutation response");return{state:bE(s.state,i.status)}}async function vE(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new ht(e.status,t)}function bE(e,t){const i=e;if(!i||i.consolePortMode!=="dynamic"&&i.consolePortMode!=="static"||i.consoleStaticPort!==null&&!h9(i.consoleStaticPort)||i.theme!=="instrument"&&i.theme!=="maritime"&&i.theme!=="carbon"||!d9(i.language))throw new ht(t,"Invalid global settings state response");return{consolePortMode:i.consolePortMode,consoleStaticPort:i.consoleStaticPort,theme:i.theme,uiFont:JR(i.uiFont),language:i.language}}function h9(e){return typeof e=="number"&&Number.isInteger(e)&&e>=1024&&e<=65535}function d9(e){return e==="auto"||e==="en"||e==="ko"}const Ig=new Set;let Ec={loading:!1,state:null,savingField:null,error:null};function G_(){return L.useSyncExternalStore(p9,td,td)}function td(){return Ec}function f9(e){da({loading:!1,state:e,error:null})}function p9(e){return Ig.add(e),()=>{Ig.delete(e)}}async function m9(e){da({loading:!0,error:null});try{const t=await _E(e);da({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;da({loading:!1,error:yE(t)})}}async function Lo(e,t){if(Ec.savingField!==null)return!1;const i=Ec.state,s=i?{...i,[e]:t}:null;da({state:s,savingField:e,error:null});try{const o=await u9({[e]:t});return da({state:o.state,savingField:null,error:null}),!0}catch(o){return da({state:i,savingField:null,error:yE(o)}),!1}}function da(e){Ec={...Ec,...e};for(const t of Ig)t()}function yE(e){return e instanceof Error?e.message:String(e)}let wo=null,tc=0;function SE(e){wo?.abort();const t=new AbortController,i=++tc;return wo=t,s3(),xR({...e,signal:t.signal}).then(s=>{i===tc&&a3(s)}).catch(s=>{t.signal.aborted||i!==tc||o3(s instanceof Error?s.message:String(s))}).finally(()=>{i===tc&&(wo=null)})}function g9(){wo!==null&&(wo.abort(),wo=null,tc+=1)}function xE(e,t=_9()){return e==="en"||e==="ko"?e:t==="ko"||t.startsWith("ko-")?"ko":"en"}function _9(){return typeof navigator>"u"?"":navigator.language.toLowerCase()}const v9=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(","),Gl=10;function b9({state:e}){const t=L.useRef(null),i=L.useRef(null),s=L.useRef(null),o=G_(),d=xE(o.state?.language??"auto"),p=!e.bootstrapped||e.onboardingOpen||e.operationSearchOpen;if(e.whatsNewOpen&&!p&&t.current===null&&(t.current=document.activeElement),L.useEffect(()=>{if(!e.whatsNewOpen||p)return;const g=y=>{y.key==="Escape"?(y.preventDefault(),Ku()):y.key==="Tab"&&x9(y,s.current),y.stopImmediatePropagation()};return i.current?.focus(),window.addEventListener("keydown",g,!0),()=>{window.removeEventListener("keydown",g,!0);const y=t.current;t.current=null,y?.focus?.()}},[e.whatsNewOpen,p]),!e.whatsNewOpen||p||e.releaseNotes.length===0)return null;const l=e.selectedReleaseNoteKey??io(e.releaseNotes[0]?.version??"",0),h=e.releaseNotes.findIndex((g,y)=>io(g.version,y)===l),f=e.releaseNotes[h]??e.releaseNotes[0],v=io(f.version,h>=0?h:0),m=()=>{SE({force:!0,locale:d})},S=async g=>{await Lo("language",g)},C=Math.max(1,Math.ceil(e.releaseNotes.length/Gl)),T=Math.min(C-1,Math.floor((h>=0?h:0)/Gl)),w=T*Gl,_=e.releaseNotes.slice(w,w+Gl),b=g=>{const y=T+g;if(y<0||y>=C)return;const k=y*Gl,M=e.releaseNotes[k];M&&Ky(io(M.version,k))};return u.jsxs("div",{className:"whatsnew-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"whatsnew-title",children:[u.jsx("button",{type:"button",className:"whatsnew-scrim",onClick:Ku,"aria-label":"Close What's new"}),u.jsxs("section",{className:"whatsnew-card",ref:s,children:[u.jsxs("header",{className:"whatsnew-header",children:[u.jsxs("div",{className:"whatsnew-heading-row",children:[u.jsx("h2",{id:"whatsnew-title",children:"What's new"}),u.jsxs("span",{className:"whatsnew-version-badge",children:["v",f.version]})]}),u.jsxs("div",{className:"whatsnew-meta-row",children:[f.date?u.jsxs("time",{className:"whatsnew-date",dateTime:f.date,children:["Released ",f.date]}):u.jsx("span",{className:"whatsnew-date",children:"Unreleased"}),e.releaseNotesStale?u.jsx("span",{className:"whatsnew-stale",children:"Stale"}):null]})]}),u.jsx("button",{ref:i,type:"button",className:"whatsnew-close",onClick:Ku,"aria-label":"Close What's new",children:"x"}),u.jsxs("div",{className:"whatsnew-body",children:[u.jsxs("div",{className:"whatsnew-version-selector",children:[u.jsx("select",{"aria-label":"Release version",value:v,onChange:g=>Ky(g.currentTarget.value),children:_.map((g,y)=>{const k=w+y;return u.jsxs("option",{value:io(g.version,k),children:[g.version==="Unreleased"?"Unreleased":`v${g.version}`,g.date?` · ${g.date}`:""]},io(g.version,k))})}),C>1?u.jsxs("div",{className:"whatsnew-pagination",children:[u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>b(-1),disabled:T===0,"aria-label":"Newer versions",children:"‹"}),u.jsxs("span",{className:"whatsnew-page-status",children:[T+1," / ",C]}),u.jsx("button",{type:"button",className:"whatsnew-page-button",onClick:()=>b(1),disabled:T>=C-1,"aria-label":"Older versions",children:"›"})]}):null,u.jsx("div",{className:"whatsnew-language-picker",role:"group","aria-label":"Release notes language",children:["en","ko"].map(g=>u.jsx("button",{type:"button",className:d===g?"is-active":"","aria-pressed":d===g,disabled:o.savingField==="language",onClick:()=>{S(g)},children:g==="en"?"EN":"한국어"},g))}),u.jsx("button",{type:"button",className:"whatsnew-refresh",onClick:m,disabled:e.releaseNotesLoading,children:e.releaseNotesLoading?"Refreshing":"Refresh"})]}),e.releaseNotesError?u.jsx("p",{className:"whatsnew-error",children:"Release notes could not be refreshed."}):null,f.sections.map((g,y)=>u.jsx(y9,{section:g,index:y},g.heading))]}),u.jsx("footer",{className:"whatsnew-footer",children:u.jsx("button",{type:"button",className:"whatsnew-done",onClick:Ku,children:"Close"})})]})]})}function y9({section:e,index:t}){const i=e.heading.toLowerCase().replaceAll(" ","-"),s={"--whatsnew-delay":`${t*55}ms`};return u.jsxs("section",{className:`whatsnew-section whatsnew-section--${i}`,style:s,children:[u.jsx("h3",{children:u.jsx("span",{className:"whatsnew-section-chip",children:e.heading})}),u.jsx("ul",{children:e.items.map((o,d)=>u.jsx("li",{children:u.jsx(S9,{item:o})},`${o.text}:${d}`))})]})}function S9({item:e}){return u.jsxs(u.Fragment,{children:[e.packageTags.map((t,i)=>u.jsx("span",{className:"whatsnew-package-chip",children:t},`${t}:${i}`)),u.jsx("span",{children:e.text})]})}function io(e,t){return`${e}:${t}`}function x9(e,t){if(!t)return;const i=Array.from(t.querySelectorAll(v9)),s=i[0],o=i[i.length-1];!s||!o||(e.shiftKey&&document.activeElement===s?(e.preventDefault(),o.focus()):!e.shiftKey&&document.activeElement===o&&(e.preventDefault(),s.focus()))}function wd(e=()=>{}){return{...Lx(e),notifications:{emit:i=>g3(i),dismiss:i=>S3(i)},status:{set:(i,s)=>m3(i,s),clear:i=>uw(i)}}}const w9=new Set(["token","credential","cwd","path","persona","prompt","toolAllowlist","allowedExecutorTools"]);async function wE(e){const t=await fetch("/api/v1/settings/carriers",{signal:e});return await K_(t),CE(await t.json(),t.status)}async function C9(e){const t=await fetch("/api/v1/settings/carriers/options",{signal:e});return await K_(t),T9(await t.json(),t.status)}async function xm(e,t,i){return q_(`/api/v1/settings/carriers/${encodeURIComponent(e)}`,"PATCH",t,i)}async function E9(e,t,i,s){return q_(`/api/v1/settings/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"PUT",i,s)}async function k9(e,t,i){return q_(`/api/v1/settings/carriers/${encodeURIComponent(e)}/taskforce/${encodeURIComponent(t)}`,"DELETE",{},i)}async function q_(e,t,i,s){const o=await fetch(e,{method:t,headers:{"Content-Type":"application/json"},body:JSON.stringify(i),signal:s});await K_(o);const d=await o.json();if(!d||typeof d!="object"||!("state"in d))throw new ht(o.status,"Invalid carrier settings mutation response");return{state:CE(d.state,o.status)}}async function K_(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new ht(e.status,t)}function CE(e,t){EE(e,t);const i=e;if(!i||typeof i.generation!="number"||!Array.isArray(i.carriers))throw new ht(t,"Invalid carrier settings state response");return{generation:i.generation,carriers:i.carriers.map(s=>A9(s,t))}}function T9(e,t){EE(e,t);const i=e;if(!i||!Array.isArray(i.cliTypes)||!i.taskForceConstraints||typeof i.taskForceConstraints.minBackends!="number")throw new ht(t,"Invalid carrier settings options response");return{cliTypes:i.cliTypes.map(s=>R9(s,t)),taskForceConstraints:{minBackends:i.taskForceConstraints.minBackends}}}function A9(e,t){const i=e;if(!i||typeof i.carrierId!="string"||typeof i.displayName!="string"||typeof i.sourceDisplayName!="string"||typeof i.role!="string"||typeof i.roleDescription!="string"||typeof i.slot!="number"||typeof i.cliType!="string"||typeof i.defaultCliType!="string"||typeof i.model!="string"||i.effort!==void 0&&typeof i.effort!="string"||typeof i.taskForceBackendCount!="number"||!i.taskforce||!Array.isArray(i.taskforce.backends))throw new ht(t,"Invalid carrier settings carrier response");return{carrierId:i.carrierId,displayName:i.displayName,sourceDisplayName:i.sourceDisplayName,role:i.role,roleDescription:i.roleDescription,...i.category?{category:i.category}:{},slot:i.slot,cliType:i.cliType,defaultCliType:i.defaultCliType,model:i.model,...i.effort?{effort:i.effort}:{},taskForceBackendCount:i.taskForceBackendCount,taskforce:{backends:i.taskforce.backends.map(s=>M9(s,t))}}}function R9(e,t){const i=e;if(!i||typeof i.id!="string"||typeof i.displayName!="string"||!Array.isArray(i.models)||typeof i.defaultModel!="string")throw new ht(t,"Invalid carrier settings CLI option");return{id:i.id,displayName:i.displayName,models:i.models.map(s=>L9(s,t)),defaultModel:i.defaultModel}}function L9(e,t){const i=e;if(!i||typeof i.modelId!="string"||typeof i.name!="string")throw new ht(t,"Invalid carrier settings model option");if(i.effort!==void 0&&(!Array.isArray(i.effort.levels)||typeof i.effort.default!="string"))throw new ht(t,"Invalid carrier settings effort option");return{modelId:i.modelId,name:i.name,...i.effort?{effort:{levels:i.effort.levels.filter(s=>typeof s=="string"),default:i.effort.default}}:{}}}function M9(e,t){const i=e;if(!i||typeof i.cliType!="string"||typeof i.model!="string"||i.effort!==void 0&&typeof i.effort!="string")throw new ht(t,"Invalid carrier settings Task Force backend");return{cliType:i.cliType,model:i.model,...i.effort?{effort:i.effort}:{}}}function EE(e,t){const i=[e];for(;i.length>0;){const s=i.pop();if(!(!s||typeof s!="object"))for(const[o,d]of Object.entries(s)){if(w9.has(o))throw new ht(t,"Carrier settings response leaked a restricted field");d&&typeof d=="object"&&i.push(d)}}}const N9={cliType:"",model:"",effort:"",displayName:"",taskforce:{}},Bg=new Set;let Hn={loading:!1,state:null,options:null,activeCarrierId:null,draft:N9,savingActionId:null,error:null};function kE(){return L.useSyncExternalStore(O9,rx,rx)}function rx(){return Hn}function O9(e){return Bg.add(e),()=>{Bg.delete(e)}}async function sx(e){vr({loading:!0,error:null});try{const[t,i]=await Promise.all([wE(e),C9(e)]);TE(t,i)}catch(t){if(e?.aborted)return;vr({loading:!1,error:RE(t)})}}function D9(e){const t=Hn.state?.carriers.find(i=>i.carrierId===e);vr({activeCarrierId:e,draft:t?V_(t,Hn.options):Hn.draft,error:null})}function mo(e){vr({draft:{...Hn.draft,...e},error:null})}function Pg(e,t){const i=Hn.draft.taskforce[e]??{model:"",effort:""};vr({draft:{...Hn.draft,taskforce:{...Hn.draft.taskforce,[e]:{...i,...t}}},error:null})}function j9(){const e=AE();e&&vr({draft:V_(e,Hn.options),error:null})}async function I9(e){const t=AE();return t?B9("save-all",async()=>{const i=Hn.draft;let s=null;i.displayName!==t.displayName&&(s=(await xm(t.carrierId,{displayName:i.displayName})).state);const o=i.cliType!==t.cliType;return o&&(s=(await xm(t.carrierId,{cli:i.cliType})).state),(o||i.model!==t.model||(i.effort||"")!==(t.effort||""))&&(s=(await xm(t.carrierId,{model:z9(i)})).state),s=await H9(t,e,s),{state:s??await wE()}}):!1}function TE(e,t){const i=$9(e,Hn.activeCarrierId),s=e.carriers.find(o=>o.carrierId===i)??null;vr({loading:!1,state:e,options:t,activeCarrierId:i,draft:s?V_(s,t):Hn.draft,error:null})}async function B9(e,t){vr({savingActionId:e,error:null});try{const i=await t();return TE(i.state,Hn.options??{cliTypes:[],taskForceConstraints:{minBackends:2}}),vr({savingActionId:null}),!0}catch(i){return vr({savingActionId:null,error:RE(i)}),!1}}function V_(e,t){const i=Object.fromEntries((t?.cliTypes??[]).map(s=>{const o=e.taskforce.backends.find(d=>d.cliType===s.id);return[s.id,{model:o?.model??s.defaultModel,effort:o?.effort??P9(s.id,o?.model??s.defaultModel,t)??""}]}));return{cliType:e.cliType,model:e.model,effort:e.effort??"",displayName:e.displayName,taskforce:i}}function P9(e,t,i){return i?.cliTypes.find(d=>d.id===e)?.models.find(d=>d.modelId===t)?.effort?.default??null}function z9(e){return{model:e.model,...e.effort?{effort:e.effort}:{}}}function AE(){return Hn.state?.carriers.find(e=>e.carrierId===Hn.activeCarrierId)??null}async function H9(e,t,i){const s=new Set(t.map(o=>o.cliType));for(const o of e.taskforce.backends)s.has(o.cliType)||(i=(await k9(e.carrierId,o.cliType)).state);for(const o of t){const d=e.taskforce.backends.find(p=>p.cliType===o.cliType);d&&d.model===o.model&&(d.effort||"")===(o.effort||"")||(i=(await E9(e.carrierId,o.cliType,{model:o.model,...o.effort?{effort:o.effort}:{}})).state)}return i}function $9(e,t){return t&&e.carriers.some(i=>i.carrierId===t)?t:e.carriers[0]?.carrierId??null}function vr(e){Hn={...Hn,...e};for(const t of Bg)t()}function RE(e){return e instanceof Error?e.message:String(e)}const U9=50,F9=2400,W9={nimitz:"var(--captain-nimitz)",kirov:"var(--captain-kirov)",genesis:"var(--captain-genesis)",ohio:"var(--captain-ohio)",sentinel:"var(--captain-sentinel)",vanguard:"var(--captain-vanguard)",tempest:"var(--captain-tempest)",chronicle:"var(--captain-chronicle)"};function G9(){const e=kE(),t=e.state?.carriers.find(w=>w.carrierId===e.activeCarrierId)??null,i=e.options?.cliTypes.find(w=>w.id===e.draft.cliType)??null,s=i?.models.find(w=>w.modelId===e.draft.model)??null,[o,d]=L.useState(!1),[p,l]=L.useState([]),[h,f]=L.useState("idle"),v=e.savingActionId==="save-all",m=t?Z9(t,e.draft,p):!1,S=t?.taskforce.backends.map(w=>`${w.cliType}:${w.model}:${w.effort??""}`).join("|")??"";L.useEffect(()=>{const w=new AbortController;return sx(w.signal),()=>w.abort()},[]),L.useEffect(()=>{d(!1),l(t?.taskforce.backends.map(w=>w.cliType)??[]),f("idle")},[t?.carrierId,S]),L.useEffect(()=>{if(h!=="saved")return;const w=window.setTimeout(()=>f("idle"),F9);return()=>window.clearTimeout(w)},[h]);function C(){t&&(j9(),l(t.taskforce.backends.map(w=>w.cliType)),d(!1),f("idle"))}async function T(){if(!t)return;if(f("saving"),!await I9(Q9(p,e.draft.taskforce))){f("idle");return}d(!1),f("saved")}return u.jsxs("main",{className:"carrier-settings-page",children:[u.jsxs("section",{className:"carrier-settings-hero","aria-labelledby":"carrier-settings-title",children:[u.jsxs("div",{children:[u.jsx("p",{className:"bridge-kicker",children:"Configure Carrier settings"}),u.jsx("h2",{id:"carrier-settings-title",children:"Carrier Settings"})]}),u.jsxs("div",{className:"carrier-settings-hero-actions",children:[u.jsx("div",{className:`carrier-settings-save-status ${h==="saved"?"is-positive":""}`,role:"status","aria-live":"polite",children:h==="saving"||v?"Saving…":h==="saved"?"Saved ✓":""}),t?u.jsxs("div",{className:"carrier-settings-save-actions",children:[u.jsx("button",{type:"button",className:`carrier-settings-action-button ${m?"is-dirty":""}`,disabled:!m||v,onClick:()=>{T()},children:"Save"}),u.jsx("button",{type:"button",className:`carrier-settings-action-button ${m?"is-dirty":""}`,disabled:!m||v,onClick:C,children:"Discard"})]}):null,u.jsx("button",{type:"button",className:"carrier-settings-action-button carrier-settings-hero-refresh",disabled:e.loading,onClick:()=>{sx()},children:"Refresh"})]})]}),e.error?u.jsx("p",{className:"carrier-settings-error",role:"alert",children:e.error}):null,u.jsxs("section",{className:"carrier-settings-grid",children:[u.jsxs("div",{className:"carrier-settings-list","aria-label":"Carrier list",children:[e.loading&&!e.state?u.jsx("p",{className:"carrier-settings-empty",children:"Loading carrier settings."}):null,e.state&&e.state.carriers.length===0?u.jsx("p",{className:"carrier-settings-empty",children:"No carriers registered."}):null,e.state?.carriers.map(w=>u.jsx(q9,{carrier:w,active:w.carrierId===e.activeCarrierId,minBackends:e.options?.taskForceConstraints.minBackends??2,onSelect:()=>D9(w.carrierId)},w.carrierId))]}),t&&e.options&&i?u.jsxs("div",{className:"carrier-settings-detail",style:NE(t.carrierId),children:[u.jsxs("div",{className:"carrier-settings-detail-head",children:[u.jsxs("div",{className:"carrier-settings-detail-title-block",children:[u.jsxs("div",{className:"carrier-settings-captain-id",children:[u.jsx("span",{children:"Captain"})," · ",t.carrierId.toUpperCase()]}),u.jsx("div",{className:`carrier-settings-name-line ${o?"is-editing":""}`,children:o?u.jsxs(u.Fragment,{children:[u.jsx("input",{id:"carrier-display-name",className:"carrier-settings-input carrier-settings-name-input",value:e.draft.displayName,maxLength:U9,onChange:w=>mo({displayName:w.target.value})}),u.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Save display name",disabled:v,onClick:()=>{d(!1)},children:u.jsx(tP,{})}),u.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Cancel display name edit",onClick:()=>{mo({displayName:t.displayName}),d(!1)},children:u.jsx(nP,{})})]}):u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"carrier-settings-captain-name",children:t.displayName}),u.jsx("button",{type:"button",className:"carrier-settings-icon-button","aria-label":"Edit display name",onClick:()=>{mo({displayName:t.displayName}),d(!0)},children:u.jsx(eP,{})})]})}),u.jsx("div",{className:"carrier-settings-captain-role",children:t.role})]}),u.jsxs("div",{className:"carrier-settings-cli-badge",children:[u.jsx("span",{className:"ind","aria-hidden":"true"}),t.cliType]})]}),u.jsxs("div",{className:"carrier-settings-body",children:[u.jsxs("div",{className:"carrier-settings-control-group",children:[u.jsx("div",{className:"carrier-settings-resp-title",children:"Identity"}),u.jsx("div",{className:"carrier-settings-mission",children:t.roleDescription})]}),u.jsxs("div",{className:"carrier-settings-control-group",children:[u.jsx("div",{className:"carrier-settings-resp-title",children:"Runtime"}),u.jsxs("div",{className:"carrier-settings-runtime",children:[u.jsx("div",{className:"carrier-settings-runtime-row carrier-settings-runtime-row--cli",children:u.jsxs("div",{className:"carrier-settings-field carrier-settings-field--wide",children:[u.jsx("label",{className:"carrier-settings-label",htmlFor:"carrier-cli",children:"CLI"}),u.jsx("select",{id:"carrier-cli",className:"carrier-settings-select",value:e.draft.cliType,onChange:w=>V9(w.target.value,e.options?.cliTypes??[]),children:e.options.cliTypes.map(w=>u.jsx("option",{value:w.id,children:w.displayName},w.id))})]})}),u.jsxs("div",{className:"carrier-settings-runtime-row carrier-settings-runtime-row--model",children:[u.jsx(LE,{id:"carrier-model",label:"Model",models:i.models,value:e.draft.model,onChange:w=>Y9(i,w)}),u.jsx(ME,{id:"carrier-effort",model:s,value:e.draft.effort,onChange:w=>mo({effort:w})})]})]})]}),u.jsx(K9,{carrier:t,cliOptions:e.options.cliTypes,minBackends:e.options.taskForceConstraints.minBackends,savingActionId:e.savingActionId,rows:p,onRowsChange:l})]})]},t.carrierId):u.jsx("div",{className:"carrier-settings-detail",children:u.jsx("p",{className:"carrier-settings-empty",children:"Select a carrier."})})]})]})}function q9({carrier:e,active:t,minBackends:i,onSelect:s}){const o=e.taskForceBackendCount>=i;return u.jsxs("button",{type:"button",className:`carrier-settings-row ${t?"is-active":""}`,style:NE(e.carrierId),onClick:s,children:[u.jsx("span",{className:"carrier-settings-captain-dot","aria-hidden":"true"}),u.jsxs("span",{className:"carrier-settings-row-text",children:[u.jsx("span",{className:"carrier-settings-row-name",children:e.displayName}),u.jsx("span",{className:"carrier-settings-row-role",children:e.role})]}),u.jsx("span",{className:"carrier-settings-row-live","aria-hidden":"true",children:u.jsx("span",{className:`carrier-settings-live-dot ${o?"is-live":""}`})})]})}function LE({id:e,label:t,models:i,value:s,disabled:o=!1,onChange:d}){return u.jsxs("div",{className:"carrier-settings-field",children:[u.jsx("label",{className:"carrier-settings-label",htmlFor:e,children:t}),u.jsx("select",{id:e,className:"carrier-settings-select",value:s,disabled:o,onChange:p=>d(p.target.value),children:i.map(p=>u.jsx("option",{value:p.modelId,children:p.name},p.modelId))})]})}function ME({id:e,model:t,value:i,disabled:s=!1,onChange:o}){return t?.effort?u.jsxs("div",{className:"carrier-settings-field",children:[u.jsx("label",{className:"carrier-settings-label",htmlFor:e,children:"Effort"}),u.jsx("select",{id:e,className:"carrier-settings-select",value:i||t.effort.default,disabled:s,onChange:d=>o(d.target.value),children:t.effort.levels.map(d=>u.jsx("option",{value:d,children:d},d))})]}):u.jsxs("div",{className:"carrier-settings-field",children:[u.jsx("span",{className:"carrier-settings-label",children:"Effort"}),u.jsx("p",{className:"carrier-settings-help",children:"Not supported for this model."})]})}function K9({carrier:e,cliOptions:t,minBackends:i,savingActionId:s,rows:o,onRowsChange:d}){const p=kE(),l=e.taskforce.backends.length,[h,f]=L.useState(l>0),[v,m]=L.useState(!1),[S,C]=L.useState(""),T=e.taskForceBackendCount>=i,w=t.filter(b=>!o.includes(b.id)),_=S||w[0]?.id||"";return u.jsxs("div",{className:`carrier-settings-control-group carrier-settings-control-group--taskforce ${h?"is-expanded":""}`,children:[u.jsxs("div",{className:"carrier-settings-section-head",children:[u.jsxs("div",{children:[u.jsx("p",{className:"carrier-settings-resp-title",children:"Task Force"}),u.jsx("p",{className:"carrier-settings-help",children:l>0?`${l} backend${l===1?"":"s"} configured${T?" · active":` · needs ${i}+ to activate`}.`:`Run this carrier across multiple CLI backends. Needs at least ${i} to activate.`})]}),u.jsx("div",{className:"carrier-settings-tf-head-actions",children:u.jsx("button",{type:"button",className:"carrier-settings-tf-toggle","aria-expanded":h,onClick:()=>f(b=>!b),children:h?"Hide":"Configure"})})]}),h?u.jsxs("div",{className:"carrier-settings-tf-list",children:[o.length===0?u.jsx("p",{className:"carrier-settings-tf-empty",children:"No Task Force backend drafted."}):null,o.map(b=>{const g=t.find(A=>A.id===b);if(!g)return null;const y=p.draft.taskforce[g.id]??{model:g.defaultModel,effort:""},k=g.models.find(A=>A.modelId===y.model)??g.models[0]??null,M=e.taskforce.backends.some(A=>A.cliType===g.id);return u.jsxs("div",{className:`carrier-settings-tf-item ${M?"is-active":""}`,children:[u.jsxs("div",{className:"carrier-settings-tf-title",children:[u.jsx("span",{className:`carrier-settings-live-dot ${M?"is-live":""}`,"aria-hidden":"true"}),u.jsx("strong",{children:g.displayName})]}),u.jsx(LE,{id:`tf-${g.id}-model`,label:"Model",models:g.models,value:y.model,onChange:A=>X9(g,A)}),u.jsx(ME,{id:`tf-${g.id}-effort`,model:k,value:y.effort,onChange:A=>Pg(g.id,{effort:A})}),u.jsx("div",{className:"carrier-settings-tf-actions",children:u.jsx("button",{type:"button",className:"carrier-settings-ghost-button",disabled:s==="save-all",onClick:()=>d(o.filter(A=>A!==g.id)),children:"Remove"})})]},g.id)}),u.jsxs("div",{className:"carrier-settings-tf-add-row",children:[v&&w.length>0?u.jsx("select",{className:"carrier-settings-select carrier-settings-tf-add-select",value:_,onChange:b=>C(b.target.value),"aria-label":"Task Force CLI to add",children:w.map(b=>u.jsx("option",{value:b.id,children:b.displayName},b.id))}):null,u.jsx("button",{type:"button",className:"carrier-settings-ghost-button",disabled:w.length===0||s==="save-all",onClick:()=>{if(!v){m(!0);return}const b=_,g=t.find(k=>k.id===b),y=g?.models.find(k=>k.modelId===g.defaultModel)??g?.models[0]??null;!g||!y||(Pg(g.id,{model:y.modelId,effort:y.effort?.default??""}),d(o.includes(g.id)?o:[...o,g.id]),C(""),m(!1))},children:"Add"})]})]}):null]})}function V9(e,t){const i=t.find(o=>o.id===e),s=i?.models.find(o=>o.modelId===i.defaultModel)??i?.models[0]??null;mo({cliType:e,model:s?.modelId??"",effort:s?.effort?.default??""})}function Y9(e,t){const i=e.models.find(s=>s.modelId===t);mo({model:t,effort:i?.effort?.default??""})}function X9(e,t){const i=e.models.find(s=>s.modelId===t);Pg(e.id,{model:t,effort:i?.effort?.default??""})}function Z9(e,t,i){return t.displayName!==e.displayName||t.cliType!==e.cliType||t.model!==e.model||(t.effort||"")!==(e.effort||"")?!0:J9(e,i,t.taskforce)}function J9(e,t,i){if(t.length!==e.taskforce.backends.length)return!0;const s=new Set(t);for(const o of e.taskforce.backends){if(!s.has(o.cliType))return!0;const d=i[o.cliType];if(!d||d.model!==o.model||(d.effort||"")!==(o.effort||""))return!0}return!1}function Q9(e,t){return e.map(i=>{const s=t[i];return s?{cliType:i,model:s.model,...s.effort?{effort:s.effort}:{}}:null}).filter(i=>i!==null)}function NE(e){return{"--cap-color":W9[e]??"var(--brass)"}}function eP(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("path",{d:"M10.8 2.2 13.8 5.2 5.2 13.8 2 14.5 2.7 11.3 10.8 2.2Z"}),u.jsx("path",{d:"M9.7 3.4 12.6 6.3"})]})}function tP(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:u.jsx("path",{d:"M3 8.3 6.4 11.7 13.2 4.5"})})}function nP(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[u.jsx("path",{d:"M4.2 4.2 11.8 11.8"}),u.jsx("path",{d:"M11.8 4.2 4.2 11.8"})]})}async function iP(e){const t=await fetch("/api/v1/settings/api-catalog",{signal:e});return await rP(t),sP(await t.json(),t.status).routes}async function rP(e){if(e.ok)return;let t=e.statusText||`HTTP ${e.status}`;try{const i=await e.json();typeof i.error=="string"&&(t=i.error)}catch{}throw new ht(e.status,t)}function sP(e,t){const i=e;if(!i||typeof i!="object"||!("version"in i)||!Array.isArray(i.routes))throw new ht(t,"Invalid backend API catalog response");return{routes:i.routes.map(s=>aP(s,t))}}function aP(e,t){const i=e;if(!i||typeof i!="object"||typeof i.method!="string"||typeof i.path!="string"||typeof i.summary!="string"||typeof i.category!="string"||typeof i.gate!="string")throw new ht(t,"Invalid backend API catalog entry");return{method:i.method,path:i.path,summary:i.summary,category:i.category,gate:i.gate}}const zg=new Set;let Hg={loading:!1,state:null,error:null};function oP(){return L.useSyncExternalStore(lP,ax,ax)}function ax(){return Hg}function lP(e){return zg.add(e),()=>{zg.delete(e)}}async function cP(e){wm({loading:!0,error:null});try{const t=await iP(e);wm({loading:!1,state:t,error:null})}catch(t){if(e?.aborted)return;wm({loading:!1,error:uP(t)})}}function wm(e){Hg={...Hg,...e};for(const t of zg)t()}function uP(e){return e instanceof Error?e.message:String(e)}function hP(){const e=oP(),[t,i]=L.useState(!0),s=L.useMemo(()=>pP(e.state??[]),[e.state]),o=e.state?.length??0,d=s.length;return L.useEffect(()=>{const p=new AbortController;return cP(p.signal),()=>p.abort()},[]),u.jsxs("section",{className:"global-settings-card backend-api-section","aria-label":"Backend API catalog",children:[u.jsx("div",{className:`backend-api-control carrier-settings-control-group--taskforce ${t?"is-expanded":""}`,children:u.jsxs("div",{className:"carrier-settings-section-head",children:[u.jsxs("div",{className:"backend-api-head",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Backend API"}),u.jsx("p",{className:"global-settings-help",children:o>0?`${o} loopback route${o===1?"":"s"} across ${d} categor${d===1?"y":"ies"} reported by backend introspection.`:"Backend introspection route list for this console."})]}),u.jsx("div",{className:"carrier-settings-tf-head-actions",children:u.jsx("button",{type:"button",className:"carrier-settings-tf-toggle","aria-expanded":t,onClick:()=>i(p=>!p),children:t?"Hide":"Show"})})]})}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,e.loading&&!e.state?u.jsx("p",{className:"global-settings-help",children:"Loading backend API catalog."}):null,t?u.jsxs("div",{className:"backend-api-groups",children:[s.length>0?s.map(p=>u.jsx(dP,{group:p},p.category)):null,e.state&&s.length===0?u.jsx("p",{className:"global-settings-help",children:"No backend API routes reported."}):null]}):null,u.jsx("p",{className:"global-settings-foot",children:"Console backend routes are fetched from GET /api/v1/settings/api-catalog, so newly registered routes appear here automatically. The Codex/Fleet Wiki API surface is not included."})]})}function dP({group:e}){return u.jsxs("div",{className:"backend-api-group",children:[u.jsxs("div",{className:"backend-api-group-head",children:[u.jsx("span",{children:e.category}),u.jsx("span",{children:e.entries.length})]}),u.jsx("div",{className:"backend-api-list",children:e.entries.map(t=>u.jsx(fP,{entry:t},`${t.method}:${t.path}`))})]})}function fP({entry:e}){return u.jsxs("div",{className:"backend-api-row",children:[u.jsx("span",{className:"backend-api-method",children:e.method.toUpperCase()}),u.jsx("code",{className:"backend-api-path",children:e.path}),u.jsx("span",{className:"backend-api-summary",children:e.summary}),u.jsx("span",{className:"backend-api-gate",children:e.gate})]})}function pP(e){const t=new Map;for(const i of e){const s=i.category.trim()||"Uncategorized",o=t.get(s);o?o.push(i):t.set(s,[i])}return Array.from(t.entries()).map(([i,s])=>({category:i,entries:s}))}const mP=[{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)"]}],gP=[{id:"dynamic",label:"Dynamic"},{id:"static",label:"Static"}],_P=[{id:"auto",label:"Auto"},{id:"en",label:"English"},{id:"ko",label:"한국어"}],vP=1024,bP=65535,yP=[{id:"general",label:"General",eyebrow:"Theme · Type · Port"},{id:"backend-api",label:"Backend API",eyebrow:"Loopback routes"}];function SP(){const e=G_(),t=e.state,i=e.savingField!==null,[s,o]=L.useState("general"),d=Io(),p=wP(d.plugins),l=CP(p);return L.useEffect(()=>{const h=new AbortController;return m9(h.signal),()=>h.abort()},[]),u.jsxs("main",{className:"global-settings-page",children:[u.jsxs("section",{className:"global-settings-hero","aria-labelledby":"global-settings-title",children:[u.jsxs("div",{children:[u.jsx("p",{className:"bridge-kicker",children:"Console"}),u.jsx("h2",{id:"global-settings-title",children:"Settings"})]}),u.jsx("div",{className:"global-settings-status",role:"status","aria-live":"polite",children:i?"Saving…":""})]}),e.error?u.jsx("p",{className:"global-settings-error",role:"alert",children:e.error}):null,u.jsxs("section",{className:"global-settings-grid",children:[u.jsxs("div",{className:"global-settings-list","aria-label":"Settings sections",children:[u.jsx("p",{className:"global-settings-nav-group",children:"Console"}),yP.map(h=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${h.id===s?"is-active":""}`,"aria-pressed":h.id===s,onClick:()=>o(h.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:h.label}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:h.eyebrow})]},h.id)),p.length>0?u.jsxs(u.Fragment,{children:[u.jsx("p",{className:"global-settings-nav-group",children:"Plugins"}),l.map(h=>u.jsxs("div",{className:"global-settings-plugin-group",children:[u.jsx("p",{className:"global-settings-plugin-heading",children:h.pluginLabel}),h.sections.map(f=>u.jsxs("button",{type:"button",className:`global-settings-nav-item ${f.id===s?"is-active":""}`,"aria-pressed":f.id===s,onClick:()=>o(f.id),children:[u.jsx("span",{className:"global-settings-nav-label",children:f.sectionTitle}),u.jsx("span",{className:"global-settings-nav-eyebrow",children:f.pluginLabel})]},f.id))]},h.pluginId))]}):null]}),u.jsx("div",{className:"global-settings-detail",children:xP(s,t,i,p)},s)]})]})}function xP(e,t,i,s){if(e.includes(":")){const o=s.find(d=>d.id===e);return o?.render?u.jsx(Xg,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin settings failed to render."}),children:o.render()}):u.jsx("p",{className:"global-settings-help",children:"Plugin settings unavailable."})}switch(e){case"general":return u.jsxs(u.Fragment,{children:[u.jsx(kP,{state:t,saving:i}),u.jsx(TP,{state:t,saving:i}),u.jsx(AP,{state:t,saving:i})]});case"backend-api":return u.jsx(hP,{})}}function wP(e){return e.flatMap(t=>(t.settingsSections??[]).map(i=>({id:`${t.id}:${i.id}`,pluginId:t.id,pluginLabel:EP(t.id),sectionTitle:i.title,render:i.render})))}function CP(e){const t=[];for(const i of e){const s=t.at(-1);if(s?.pluginId===i.pluginId){t[t.length-1]={...s,sections:[...s.sections,i]};continue}t.push({pluginId:i.pluginId,pluginLabel:i.pluginLabel,sections:[i]})}return t}function EP(e){return e==="terminal"?"Terminal":e.split(/[-_]/g).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}function kP({state:e,saving:t}){const i=e?.theme??"instrument",s=o=>{if(td().savingField!==null)return;const d=i;Ih(o),Lo("theme",o).then(p=>{p||Ih(d)})};return u.jsxs("section",{className:"global-settings-card","aria-label":"Theme",children:[u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Theme"}),u.jsx("p",{className:"global-settings-help",children:"Console color scheme."})]}),u.jsx("div",{className:"theme-picker",role:"group","aria-label":"Theme",children:mP.map(o=>{const d=o.id===i;return u.jsxs("button",{type:"button","aria-pressed":d,className:`theme-card ${d?"is-active":""}`,disabled:t,onClick:()=>s(o.id),children:[u.jsx("span",{className:"theme-card-swatch","aria-hidden":"true",children:o.swatch.map(p=>u.jsx("i",{style:{background:p}},p))}),u.jsx("span",{className:"theme-card-label",children:o.label}),u.jsx("span",{className:"theme-card-check","aria-hidden":"true",children:d?u.jsx(MP,{}):null})]},o.id)})})]}),u.jsx("p",{className:"global-settings-foot",children:"Theme applies immediately and is stored server-side."})]})}function TP({state:e,saving:t}){const i=e?.uiFont??ic,[s,o]=L.useState([]),[d,p]=L.useState(!0),[l,h]=L.useState(null);L.useEffect(()=>{const m=new AbortController;return Pw({signal:m.signal}).then(S=>{o(S.fonts.filter(C=>C.uiSuitable).map(({family:C,monospace:T})=>({family:C,monospace:T}))),h(null)}).catch(S=>{m.signal.aborted||(o([]),h(S instanceof Error?S.message:"Installed fonts could not be loaded."))}).finally(()=>{m.signal.aborted||p(!1)}),()=>m.abort()},[]);const f=m=>{if(td().savingField!==null)return;const S=i;Wm(m),Lo("uiFont",m).then(C=>{C||Wm(S)})},v=m=>{const S=m.source==="builtin"?{source:"builtin",id:m.id,size:i.size}:{source:"system",familyName:m.familyName,size:i.size};f(S)};return u.jsxs("section",{className:"global-settings-card","aria-label":"Typography",children:[u.jsxs("div",{className:"global-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Typography"}),u.jsx("p",{className:"global-settings-help",children:"Typeface for interface text and reading surfaces. Display, code, and terminal fonts stay unchanged."})]}),u.jsx("button",{type:"button",className:"typography-reset",disabled:!e||t||i.source==="builtin"&&i.id==="manrope"&&i.size===go.defaultValue,onClick:()=>f(ic),children:"Reset to Fleet default"})]}),u.jsx(Iw,{builtIns:jh.map(({id:m,label:S,family:C,aliases:T,description:w})=>({id:m,label:S,family:C,aliases:T,description:w})),installedFonts:s,selected:i.source==="builtin"?{source:"builtin",id:i.id}:{source:"system",familyName:i.familyName},selectedSystemFont:i.source==="system"?i.familyName:null,fallbackStack:rw(ic),previewText:"Fleet typography keeps operations readable.",size:i.size,sizeRange:go,loading:d,error:l,disabled:!e||t,onSelectionChange:v,onSizeCommit:m=>f({...i,size:m})}),u.jsx("p",{className:"global-settings-foot",children:"Typography applies immediately and is stored server-side for every browser and restart."})]})}function AP({state:e,saving:t}){const i=cr();return u.jsxs("section",{className:"global-settings-card","aria-label":"General",children:[e?u.jsxs(u.Fragment,{children:[u.jsx(LP,{state:e,saving:t,consoleState:i}),u.jsx(RP,{state:e,saving:t})]}):u.jsx("p",{className:"global-settings-help",children:"Loading settings."}),u.jsx("p",{className:"global-settings-foot",children:"Changes apply to newly launched sessions. Running sessions keep their current configuration until relaunched."})]})}function RP({state:e,saving:t}){return u.jsxs("div",{className:"global-settings-row is-stack language-settings-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsx("p",{className:"global-settings-resp-title",children:"Release notes language"}),u.jsx("p",{className:"global-settings-help",children:"Choose the language for What's New. Auto follows this browser's language."})]}),u.jsx("div",{className:"segmented language-picker",role:"group","aria-label":"Release notes language",children:_P.map(i=>{const s=e.language===i.id;return u.jsx("button",{type:"button","aria-pressed":s,className:`segmented-option ${s?"is-active":""}`,disabled:t,onClick:()=>{Lo("language",i.id)},children:i.label},i.id)})}),u.jsx("p",{className:"console-port-note",children:"Stored with Console settings and shared across every browser."})]})}function LP({state:e,saving:t,consoleState:i}){const[s,o]=L.useState(e.consoleStaticPort?.toString()??""),d=i.effectivePort,p=i.portMode==="static"&&!i.portHonored,l=i.requestedPort,h=e.consolePortMode==="static"&&e.consoleStaticPort!==null,f=s.trim(),v=Number(f),m=f.length>0,S=m&&ox(v),C=e.consolePortMode==="static"&&m&&!S;return L.useEffect(()=>{o(e.consoleStaticPort?.toString()??"")},[e.consoleStaticPort]),u.jsxs("div",{className:"global-settings-row is-stack console-port-row",children:[u.jsxs("div",{className:"global-settings-row-text",children:[u.jsxs("p",{className:"global-settings-resp-title",children:["Console Port ",u.jsx("span",{className:"new-badge",children:"New"})]}),u.jsx("p",{className:"global-settings-help",children:"Dynamic lets the OS pick a free loopback port each time the console starts. Static pins a port you choose so the console URL stays the same across restarts."})]}),u.jsxs("div",{className:"console-port-control",children:[u.jsx("div",{className:"segmented",role:"group","aria-label":"Console port mode",children:gP.map(T=>{const w=e.consolePortMode===T.id;return u.jsx("button",{type:"button","aria-pressed":w,className:`segmented-option ${w?"is-active":""}`,disabled:t,onClick:()=>{Lo("consolePortMode",T.id)},children:T.label},T.id)})}),u.jsx("div",{className:`console-port-reveal ${e.consolePortMode==="static"?"is-open":""}`,children:u.jsxs("div",{className:"console-port-reveal-inner",children:[u.jsx("label",{className:"console-port-input-label",htmlFor:"console-static-port-input",children:"Static port"}),u.jsx("input",{id:"console-static-port-input",className:`console-port-input ${C?"is-invalid":""}`,inputMode:"numeric",placeholder:"8080",value:s,disabled:t,"aria-invalid":C,"aria-describedby":"console-static-port-hint",onChange:T=>{const w=T.target.value;o(w);const _=Number(w.trim());ox(_)&&Lo("consoleStaticPort",_)}}),u.jsx("span",{id:"console-static-port-hint",className:`console-port-hint ${C?"is-invalid":""}`,children:"1024–65535"})]})}),u.jsxs("div",{className:`console-port-effective ${p?"is-fallback":""}`,"aria-live":"polite",children:[u.jsx("span",{className:"console-port-effective-dot","aria-hidden":"true"}),u.jsxs("div",{children:[u.jsx("p",{className:"console-port-effective-label",children:"Currently reachable on"}),u.jsxs("p",{className:"console-port-effective-value",children:["127.0.0.1:",u.jsx("span",{children:d||"..."}),p?" · Dynamic":""]})]})]}),p&&l?u.jsxs("div",{className:"console-port-warning",role:"status",children:["Port ",u.jsx("strong",{children:l})," was unavailable — the console fell back to a ",u.jsx("strong",{children:"Dynamic"})," port and is running on ",u.jsxs("strong",{children:["127.0.0.1:",d||"..."]}),"."," ",h?u.jsxs(u.Fragment,{children:["Next restart will try ",u.jsx("strong",{children:e.consoleStaticPort}),"."]}):u.jsx(u.Fragment,{children:"Next restart will use a dynamic port."})]}):null,u.jsx("p",{className:"console-port-note",children:"Applies when the console restarts. Console-wide — shared across every browser."})]})]})}function ox(e){return Number.isInteger(e)&&e>=vP&&e<=bP}function MP(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 8.5 6.5 11.5 12.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function NP(e,t){return{x:e.x*t.zoom+t.x,y:e.y*t.zoom+t.y}}function kc(e,t){return{x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}}function OP(e,t){return{...NP(e,t),width:e.width*t.zoom,height:e.height*t.zoom}}const lx=256,cx=176,Cm=12,dh=220,OE="fleet-console.map.radarCollapsed";function DP({operations:e,pluginOperations:t,viewport:i,canvasSize:s,onJump:o}){const d=L.useRef(null),p=L.useRef(!1),l=L.useRef(null),[h,f]=L.useState(jP),v=yd();if(L.useEffect(()=>{if(v){l.current===null&&(l.current=h,f(!0));return}l.current!==null&&(f(l.current),l.current=null)},[h,v]),s.width<=0||s.height<=0||i.zoom<=0)return null;const m=[...Object.entries(e).map(([H,P])=>({id:H,x:P.x,y:P.y,width:P.width,height:P.height})),...Object.entries(t).map(([H,P])=>({id:H,x:P.geometry.x,y:P.geometry.y,width:P.geometry.width,height:P.geometry.height}))];if(m.length===0)return null;const S=()=>{f(H=>{const P=!H;return v||IP(P),P})};if(h)return u.jsx("button",{type:"button",className:"canvas-minimap-fab","data-canvas-blocker":!0,onClick:S,"aria-label":"Open Map",title:"Open Map",children:u.jsx(PP,{})});const C=lx-Cm*2,T=cx-Cm*2,w={x:-i.x/i.zoom,y:-i.y/i.zoom,width:s.width/i.zoom,height:s.height/i.zoom};let _=Math.min(w.x,...m.map(H=>H.x)),b=Math.min(w.y,...m.map(H=>H.y)),g=Math.max(w.x+w.width,...m.map(H=>H.x+H.width)),y=Math.max(w.y+w.height,...m.map(H=>H.y+H.height));_-=dh,b-=dh,g+=dh,y+=dh;const k=g-_,M=y-b,A=Math.min(C/k,T/M),N=(C-k*A)/2,R=(T-M*A)/2,B=H=>N+(H-_)*A,q=H=>R+(H-b)*A,W=H=>{const P=d.current?.getBoundingClientRect();if(!P)return;const Y=H.clientX-P.left,X=H.clientY-P.top;o({x:_+(Y-N)/A,y:b+(X-R)/A})},G=H=>{H.stopPropagation(),p.current=!0,H.currentTarget.setPointerCapture(H.pointerId),W(H)},I=H=>{p.current&&(H.stopPropagation(),W(H))},K=H=>{p.current=!1;try{H.currentTarget.releasePointerCapture(H.pointerId)}catch{}};return u.jsxs("div",{className:"canvas-minimap","data-canvas-blocker":!0,style:{width:lx,height:cx},children:[u.jsx("span",{className:"canvas-minimap-label","aria-hidden":"true",children:"Map"}),u.jsx("button",{type:"button",className:"canvas-minimap-toggle",onClick:S,"aria-label":"Collapse Map",title:"Collapse Map",children:u.jsx(BP,{})}),u.jsxs("div",{ref:d,className:"canvas-minimap-inner",style:{inset:Cm},onPointerDown:G,onPointerMove:I,onPointerUp:K,onPointerCancel:K,role:"presentation","aria-label":"Canvas minimap — drag to navigate",children:[m.map(H=>u.jsx("div",{className:"canvas-minimap-operation",style:{left:B(H.x),top:q(H.y),width:Math.max(2,H.width*A),height:Math.max(2,H.height*A)}},H.id)),u.jsx("div",{className:"canvas-minimap-view",style:{left:B(w.x),top:q(w.y),width:w.width*A,height:w.height*A}})]})]})}function jP(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(OE)==="true"}catch{return!1}}function IP(e){if(!(typeof window>"u"))try{window.localStorage.setItem(OE,String(e))}catch{}}function BP(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M5.5 4.5 10.5 8l-5 3.5M11 8H5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})})}function PP(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[u.jsx("rect",{x:"2",y:"3",width:"12",height:"10",rx:"2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),u.jsx("rect",{x:"4.2",y:"5",width:"4.2",height:"3.1",rx:"0.6",fill:"none",stroke:"currentColor",strokeWidth:"1"}),u.jsx("circle",{cx:"11",cy:"10.2",r:"0.95",fill:"currentColor"})]})}function zP({viewport:e}){return u.jsxs("div",{className:"operations-canvas-background","aria-hidden":"true",children:[u.jsx("div",{className:"operations-canvas-sea"}),u.jsx("div",{className:"operations-canvas-grid",style:{backgroundPosition:`${e.x}px ${e.y}px`,backgroundSize:`${48*e.zoom}px ${48*e.zoom}px, ${12*e.zoom}px ${12*e.zoom}px`}})]})}const ux=8,HP=120;function $P({anchor:e,accentKey:t,onSelect:i,onClose:s}){const[o,d]=L.useState(void 0);L.useLayoutEffect(()=>{const l=Math.max(8,Math.min(e.left,window.innerWidth-8)),h=e.bottom+ux,f=h+HP>window.innerHeight;d(f?{position:"fixed",left:l,top:"auto",bottom:Math.round(window.innerHeight-e.top+ux)}:{position:"fixed",left:l,top:Math.round(h)})},[e]),L.useEffect(()=>{const l=h=>{h.key==="Escape"&&(h.preventDefault(),s())};return window.addEventListener("keydown",l),window.addEventListener("resize",s),window.addEventListener("scroll",s,!0),()=>{window.removeEventListener("keydown",l),window.removeEventListener("resize",s),window.removeEventListener("scroll",s,!0)}},[s]);const p=l=>{i(l),s()};return Os.createPortal(u.jsx("div",{className:"accent-popover-overlay",role:"presentation",onPointerDown:s,children:o?u.jsxs("div",{className:"accent-popover-card",role:"menu","aria-label":"Accent",style:o,onPointerDown:l=>l.stopPropagation(),children:[u.jsxs("button",{type:"button",className:"accent-popover-swatch accent-popover-swatch--clear",role:"menuitem","aria-label":"No accent","aria-pressed":t===null,onClick:()=>p(null),children:[u.jsx("span",{}),"None"]}),bd.map(l=>u.jsx("button",{type:"button",className:"accent-popover-swatch",role:"menuitem","aria-label":l.label,"aria-pressed":t===l.key,onClick:()=>p(l.key),children:u.jsx("span",{style:{background:l.color}})},l.key))]}):null}),document.body)}const UP=["n","ne","e","se","s","sw","w","nw"],Em=320,km=200,FP=1500;function WP({operation:e,active:t,geometry:i,zoom:s,status:o,minimized:d=!1,maximized:p=!1,interactionDisabled:l=!1,accentKey:h=null,children:f,onActivate:v,onClose:m,onMinimize:S,onMaximize:C,onSetAccent:T,onGeometryChange:w,onGeometryCommit:_}){const b=L.useRef(null),g=L.useRef(null),y=L.useRef(null),k=L.useRef(null),[M,A]=L.useState(null),[N,R]=L.useState(!1),B=e.title,q=h?To(h):null,W=["canvas-operation",t?"is-active":"",d?"is-minimized":"",p?"is-maximized":"",qP(o)].filter(Boolean).join(" ");L.useEffect(()=>()=>{k.current!==null&&window.clearTimeout(k.current)},[]);const G=()=>{k.current!==null&&(window.clearTimeout(k.current),k.current=null)},I=()=>{G(),R(!1)},K=()=>{G(),R(!0),k.current=window.setTimeout(()=>{k.current=null,R(!1)},FP)},H=re=>{I(),!(p||l)&&re.button===0&&(re.preventDefault(),re.stopPropagation(),v(),g.current={pointerId:re.pointerId,startX:re.clientX,startY:re.clientY,geometry:i,latest:i},re.currentTarget.setPointerCapture(re.pointerId))},P=re=>{if(p||l)return;const ge=g.current;if(!ge||ge.pointerId!==re.pointerId)return;re.preventDefault(),re.stopPropagation();const de={...ge.geometry,x:ge.geometry.x+(re.clientX-ge.startX)/s,y:ge.geometry.y+(re.clientY-ge.startY)/s};ge.latest=de,w(de)},Y=re=>{if(p||l){g.current=null;return}const ge=g.current;!ge||ge.pointerId!==re.pointerId||(re.preventDefault(),re.stopPropagation(),g.current=null,re.currentTarget.releasePointerCapture(re.pointerId),_(ge.latest))},X=(re,ge)=>{p||l||(ge.preventDefault(),ge.stopPropagation(),v(),y.current={direction:re,pointerId:ge.pointerId,startX:ge.clientX,startY:ge.clientY,geometry:i,latest:i},ge.currentTarget.setPointerCapture(ge.pointerId))},j=re=>{if(p||l)return;const ge=y.current;if(!ge||ge.pointerId!==re.pointerId)return;re.preventDefault(),re.stopPropagation();const de=GP(ge.geometry,ge.direction,(re.clientX-ge.startX)/s,(re.clientY-ge.startY)/s);ge.latest=de,w(de)},z=re=>{if(p||l){y.current=null;return}const ge=y.current;!ge||ge.pointerId!==re.pointerId||(re.preventDefault(),re.stopPropagation(),y.current=null,re.currentTarget.releasePointerCapture(re.pointerId),_(ge.latest))},D=re=>{re.stopPropagation()},U=re=>{re.stopPropagation(),v()},V=re=>{re.stopPropagation()},J=()=>{I();const re=typeof document<"u"?document.activeElement:null;re instanceof HTMLElement&&b.current?.contains(re)&&re.blur(),S()},le=()=>{I(),C?.()},pe=re=>{I(),v(),A(re)},te=re=>{re.stopPropagation(),I(),v()},F=()=>{if(!N){K();return}I(),m()},ae={left:Math.round(i.x),top:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height),zIndex:i.zIndex,...q?{"--user-accent":q}:{}};return u.jsxs("article",{ref:b,className:W,style:ae,onPointerDown:v,"data-canvas-operation":!0,"aria-label":`Operation ${B}`,inert:d?!0:void 0,children:[!p&&!l?u.jsx("div",{className:"canvas-operation-drag-edge",onPointerDown:H,onPointerMove:P,onPointerUp:Y,onPointerCancel:Y,"data-canvas-blocker":!0,"aria-hidden":"true"}):null,u.jsxs("div",{className:"canvas-operation-titlebar",onPointerDown:H,onPointerMove:P,onPointerUp:Y,onPointerCancel:Y,"data-canvas-blocker":!0,children:[T?u.jsx("button",{type:"button",className:"canvas-operation-beacon-button",onPointerDown:D,onClick:re=>pe(re.currentTarget.getBoundingClientRect()),"aria-label":`Set accent for operation ${B}`,"aria-haspopup":"menu",title:"Set accent",children:u.jsx("span",{className:hx(o),"aria-hidden":"true"})}):u.jsx("span",{className:hx(o),onPointerDown:te,"aria-hidden":"true"}),u.jsx("button",{type:"button",className:"canvas-operation-icon-button",onPointerDown:D,onClick:J,"aria-label":`Minimize operation ${B}`,title:"Minimize operation",children:u.jsx(KP,{})}),C?u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${p?"is-active":""}`,onPointerDown:D,onClick:le,"aria-label":p?`Restore operation ${B}`:`Maximize operation ${B}`,"aria-pressed":p,title:p?"Restore operation":"Maximize operation",children:p?u.jsx(YP,{}):u.jsx(VP,{})}):null,u.jsx("button",{type:"button",className:`canvas-operation-icon-button ${N?"is-armed-close":""}`,onPointerDown:D,onClick:F,"aria-label":N?`Confirm close operation ${B}`:`Close operation ${B}`,title:N?"Confirm close":"Close operation",children:N?"Close?":u.jsx(XP,{})})]}),u.jsx("div",{className:"canvas-operation-terminal",onPointerDown:U,onWheel:V,"data-canvas-blocker":!0,children:f}),!p&&!l&&UP.map(re=>u.jsx("div",{className:`canvas-operation-resize canvas-operation-resize--${re}`,onPointerDown:ge=>X(re,ge),onPointerMove:j,onPointerUp:z,onPointerCancel:z,"data-canvas-blocker":!0,"aria-hidden":"true"},re)),M&&T?u.jsx($P,{anchor:M,accentKey:h,onSelect:T,onClose:()=>A(null)}):null]})}function GP(e,t,i,s){let{x:o,y:d,width:p,height:l}=e;return t.includes("e")&&(p+=i),t.includes("s")&&(l+=s),t.includes("w")&&(o+=i,p-=i),t.includes("n")&&(d+=s,l-=s),p<Em&&(t.includes("w")&&(o-=Em-p),p=Em),l<km&&(t.includes("n")&&(d-=km-l),l=km),{...e,x:o,y:d,width:p,height:l}}function qP(e){const t=Sd(e);return t==="running"?"is-running is-running--turn":t==="awaiting"?"is-running is-running--awaiting":""}function hx(e){const t=Sd(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 KP(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 11.5h9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function VP(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M3.5 6V3.5H6M10 3.5h2.5V6M12.5 10v2.5H10M6 12.5H3.5V10",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function YP(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M6.2 3.5v2.7H3.5M9.8 3.5v2.7h2.7M12.5 9.8H9.8v2.7M3.5 9.8h2.7v2.7",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})})}function XP(){return u.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:u.jsx("path",{d:"M4.6 4.6 11.4 11.4M11.4 4.6 4.6 11.4",fill:"none",stroke:"currentColor",strokeWidth:"1.35",strokeLinecap:"round"})})}function ZP({rect:e,viewport:t}){const i=OP(e,t);return u.jsx("div",{className:"canvas-rubber-band",style:{left:i.x,top:i.y,width:i.width,height:i.height},"aria-hidden":"true"})}const JP=.25,QP=2,ez=200,tz=150,dx=5,nz=.0018;function iz({viewport:e,disabled:t=!1,consumePointerDown:i=!1,onViewportChange:s,onZoom:o,onCreate:d,onConsumePointerDown:p,onClick:l}){const h=L.useRef(null),f=L.useRef(e),[v,m]=L.useState(null),[S,C]=L.useState(!1),[T,w]=L.useState(!1);L.useEffect(()=>{f.current=e},[e]),L.useEffect(()=>{const A=R=>{R.key==="Shift"&&w(!0),!rz(R.target)&&R.code==="Space"&&(R.preventDefault(),C(!0))},N=R=>{R.key==="Shift"&&w(!1),R.code==="Space"&&C(!1)};return window.addEventListener("keydown",A),window.addEventListener("keyup",N),()=>{window.removeEventListener("keydown",A),window.removeEventListener("keyup",N)}},[]);const _=A=>{if(t||fx(A.target)||A.button!==0&&A.button!==1)return;if(A.preventDefault(),i){p?.();return}const N=Am(A),R=A.shiftKey&&A.button===0&&!S?"create":"pan";h.current={pointerId:A.pointerId,mode:R,startScreen:N,currentScreen:N,startViewport:f.current},A.currentTarget.setPointerCapture(A.pointerId),R==="create"&&m(Tm(N,N,f.current))},b=A=>{const N=h.current;if(!N||N.pointerId!==A.pointerId)return;A.preventDefault();const R=Am(A);if(h.current={...N,currentScreen:R},N.mode==="pan"){s({...N.startViewport,x:N.startViewport.x+R.x-N.startScreen.x,y:N.startViewport.y+R.y-N.startScreen.y});return}m(Tm(N.startScreen,R,f.current))},g=A=>{M(A,!0)},y=A=>{M(A,!1)},k=A=>{if(t||fx(A.target))return;A.preventDefault();const N=Am(A),R=f.current,B=sz(R.zoom*Math.exp(-A.deltaY*nz),JP,QP),q=kc(N,R);o({x:N.x-q.x*B,y:N.y-q.y*B,zoom:B})},M=(A,N)=>{const R=h.current;if(!R||R.pointerId!==A.pointerId||(h.current=null,A.currentTarget.releasePointerCapture(A.pointerId),m(null),!N))return;const B=Math.abs(R.currentScreen.x-R.startScreen.x),q=Math.abs(R.currentScreen.y-R.startScreen.y);if(B<dx&&q<dx){l?.();return}if(R.mode!=="create")return;const W=Tm(R.startScreen,R.currentScreen,f.current),G={x:W.x,y:W.y,width:Math.max(W.width,ez),height:Math.max(W.height,tz)};d(G,R.currentScreen)};return{rubberBand:v,spaceActive:S,shiftActive:T,onPointerDown:_,onPointerMove:b,onPointerUp:g,onPointerCancel:y,onWheel:k}}function Tm(e,t,i){const s=kc(e,i),o=kc(t,i),d=Math.min(s.x,o.x),p=Math.min(s.y,o.y);return{x:d,y:p,width:Math.abs(s.x-o.x),height:Math.abs(s.y-o.y)}}function Am(e){const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function fx(e){return e instanceof Element&&!!e.closest("[data-canvas-blocker], [data-canvas-operation]")}function rz(e){return e instanceof HTMLElement&&!!e.closest("input, textarea, select, [contenteditable='true']")}function sz(e,t,i){return Math.min(i,Math.max(t,e))}const az="Shift-drag to create a Shell. Right-click for actions. Drag to pan; scroll to zoom.",oz=560,lz=360;function cz({state:e,catalog:t,canLaunch:i,renderKindIcon:s,onLaunchKind:o,onLaunchAtGeometry:d,onResetView:p,onToggleFormation:l,onClose:h,onFocus:f,onSetAccent:v}){const m=L.useRef(null),S=W2(),C=yd(),T=G2(),w=q2(),_=e.activeOperationId,[b,g]=L.useState(null),y=Io(),[k,M]=L.useState({width:0,height:0}),A=!e.activeTheaterId||e.addingTheater;L.useEffect(()=>{const J=m.current;if(!J||typeof ResizeObserver>"u")return;const le=()=>M({width:J.clientWidth,height:J.clientHeight});le();const pe=new ResizeObserver(le);return pe.observe(J),()=>pe.disconnect()},[]);const N=iz({viewport:S.viewport,disabled:A||C,onViewportChange:Lg,onZoom:K2,onCreate:J=>{if(g(null),e.activeTheaterId&&i){const le=mz(t);if(!le)return;const pe={...dz(J),zIndex:ma()};d(le.pluginId,le.kind,pe)}},consumePointerDown:b!==null,onConsumePointerDown:()=>{g(null)},onClick:hz}),R=(J,le)=>{const pe=b?.canvasPoint;g(null),pe&&o(J,le,pe)},B=()=>{g(null),p()},q=J=>{if(J.target instanceof Element&&J.target.closest("[data-canvas-blocker], [data-canvas-operation]"))return;J.preventDefault();const le=m.current?.getBoundingClientRect();if(!le)return;const pe={x:J.clientX-le.left,y:J.clientY-le.top};g({anchor:pe,canvasPoint:kc(pe,S.viewport)})},W=new Set(w);L.useEffect(()=>{e.activeOperationId&&W.has(e.activeOperationId)&&Mi(null)},[w,e.activeOperationId]);const G=Object.fromEntries(Object.entries(S.operations).filter(([J])=>!W.has(J))),I=(e.operations??[]).filter(J=>J.theaterId===e.activeTheaterId),K=I,H=I.length>0,P=y.operationKinds,X=T!==null&&I.some(J=>J.id===T&&!W.has(J.id))?T:null,j=fw(I,e.groups.filter(J=>J.theaterId===e.activeTheaterId),S.operationOrder,[]).filter(J=>!W.has(J.id)).map(J=>J.id),z=C?KI({x:0,y:0,width:k.width,height:k.height},j.length):[],D=new Map(j.map((J,le)=>[J,z[le]])),U=X||C?1:S.viewport.zoom,V=pz(S.operations)+1;return u.jsxs("main",{className:`operations-canvas ${N.spaceActive?"is-panning":""} ${N.shiftActive?"is-creating":""} ${X?"is-panel-maximized":""} ${C?"is-formation-view":""}`,onPointerDown:N.onPointerDown,onPointerMove:N.onPointerMove,onPointerUp:N.onPointerUp,onPointerCancel:N.onPointerCancel,onWheel:N.onWheel,onContextMenu:q,ref:m,children:[u.jsx(zP,{viewport:S.viewport}),u.jsx("div",{style:{transform:X||C?"none":`translate(${Math.round(S.viewport.x)}px, ${Math.round(S.viewport.y)}px) scale(${S.viewport.zoom})`},className:"operations-canvas-world",children:K.map(J=>{const le=S.operations[J.id]??J.geometry??Rm(J),pe=X===J.id,te=D.get(J.id),F=pe?fz(k,V):te?{...le,...te}:le;return _z(J,{active:_===J.id,geometry:F,operationKindRegistry:P,status:e.operationStatus[J.id],theme:e.activeTheme,viewportZoom:U,minimized:W.has(J.id),maximized:pe,formation:C,accentKey:S.operationAccent[J.id]??gz(J),onActivate:()=>{Mi(J.id),!pe&&!C&&Mg(J.id,S.operations[J.id]??J.geometry??Rm(J))},onClose:()=>{e.activeOperationId===J.id&&Mi(null),X===J.id&&ga(),h(J.id)},onMinimize:()=>{e.activeOperationId===J.id&&Mi(null),VI(J.id)},onMaximize:()=>{pe?ga():(Mi(J.id),cc(J.id))},onSetAccent:ae=>{v(J.id,ae)},onGeometryChange:ae=>{!pe&&!C&&Mg(J.id,ae)},onGeometryCommit:ae=>{!pe&&!C&&bz(J.id,Ao().operations[J.id]??ae)}})})}),H?null:u.jsxs("div",{className:"operations-canvas-empty","data-canvas-blocker":!0,children:[u.jsx("span",{className:"operations-canvas-empty-mark","aria-hidden":"true"}),u.jsx("p",{children:e.activeTheaterId?az:"Add a Theater from the top bar to start operations."})]}),N.rubberBand?u.jsx(ZP,{rect:N.rubberBand,viewport:S.viewport}):null,b?u.jsx($2,{anchor:b.anchor,viewportBounds:uz(m.current),placement:"cursor",catalog:t,canLaunch:i&&!C,renderKindIcon:s,onLaunchKind:R,onResetView:B,formationView:C,onToggleFormation:()=>{l(),g(null)},onClose:()=>g(null)},`${b.anchor.x}:${b.anchor.y}`):null,u.jsx(DP,{operations:G,pluginOperations:Object.fromEntries(I.filter(J=>!W.has(J.id)).map(J=>[J.id,{theaterId:J.theaterId,geometry:S.operations[J.id]??J.geometry??Rm(J)}])),viewport:S.viewport,canvasSize:k,onJump:J=>Lg({x:k.width/2-J.x*S.viewport.zoom,y:k.height/2-J.y*S.viewport.zoom,zoom:S.viewport.zoom})})]})}function uz(e){if(!e)return;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function hz(){if(typeof document<"u"){const e=document.activeElement;e instanceof HTMLElement&&e.blur()}Mi(null)}function dz(e){return{x:e.x,y:e.y,width:e.width,height:e.height,zIndex:0}}function Rm(e){return e.geometry??{x:0,y:0,width:oz,height:lz,zIndex:0}}function fz(e,t){return{x:0,y:0,width:Math.max(320,e.width),height:Math.max(240,e.height),zIndex:t}}function pz(e){return Object.values(e).reduce((t,i)=>Math.max(t,i.zIndex),0)}function mz(e){const t=e.flatMap(i=>i.kinds.filter(s=>s.disabled!==!0).map(s=>({pluginId:i.id,kind:s})));return t.find(({kind:i})=>i.type==="shell")??t[0]??null}function gz(e){return typeof e.accent=="string"?e.accent:null}function _z(e,t){const i=t.operationKindRegistry.find(d=>d.pluginId===e.pluginId&&d.type===e.type),s=t.geometry;if(!i?.render)return null;const o=wd(()=>{gi(null).then(_i).catch(()=>{})});return u.jsx(WP,{operation:e,active:t.active,geometry:s,zoom:t.viewportZoom,status:t.status,minimized:t.minimized,maximized:t.maximized,interactionDisabled:t.formation,accentKey:t.accentKey,onActivate:t.onActivate,onClose:t.onClose,onMinimize:t.onMinimize,onMaximize:t.onMaximize,onSetAccent:t.onSetAccent,onGeometryChange:t.onGeometryChange,onGeometryCommit:t.onGeometryCommit,children:u.jsx(Xg,{fallback:u.jsx("div",{className:"fc-plugin-error",children:"Plugin operation failed to render."}),children:u.jsx(vz,{active:t.active,capabilities:o,descriptor:i,geometry:s,operation:e,theme:t.theme,viewportZoom:t.viewportZoom,onActivate:t.onActivate,onClose:t.onClose,onGeometryChange:t.onGeometryChange})})},e.id)}function vz({active:e,capabilities:t,descriptor:i,geometry:s,operation:o,theme:d,viewportZoom:p,onActivate:l,onClose:h,onGeometryChange:f}){return i.render?i.render({operationId:o.id,theaterId:o.theaterId,pluginId:o.pluginId,type:o.type,operation:o,geometry:s,active:e,zoom:p,theme:d,api:t.api,lifecycle:t.lifecycle,terminal:t.terminal,notifications:t.notifications,operations:t.operations,preferences:t.preferences,settings:t.settings,status:t.status,onActivate:l,onClose:h,onGeometryChange:f}):null}async function bz(e,t){await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({geometry:t})})}function DE(e){if(!e.operationsViewActive||!e.activeOperationId)return new Set;const t=e.operations.find(i=>i.id===e.activeOperationId);return!t||t.theaterId!==e.activeTheaterId?new Set:new Set([t.id])}function jE(e,t){const i=new Set(t.map(s=>s.id));return e.filter(s=>i.has(s.operationId))}function IE(e,t){const i=[],s=[];for(const o of e)t.has(o.operationId)?s.push(o):i.push(o);return{hidden:i,visible:s}}function $g(e){const t=new Map;for(const i of[...e].sort((s,o)=>o.lastRaisedSeq-s.lastRaisedSeq)){const s=i.theaterId??"__unknown__",o=t.get(s)??{theaterId:i.theaterId,theaterLabel:i.theaterLabel,notifications:[]};o.notifications.push(i),t.set(s,o)}return[...t.values()].sort((i,s)=>{const o=i.notifications[0]?.lastRaisedSeq??0;return(s.notifications[0]?.lastRaisedSeq??0)-o})}function BE(e,t){return t.globalMute||t.dnd?[]:e.filter(i=>!i.theaterId||t.mutedTheaterIds[i.theaterId]!==!0)}const yz={ended:"Ended","input-waiting":"Waiting for input"},Sz={id:"alerts",title:"Alerts",icon:()=>u.jsx(wz,{}),render:()=>u.jsx(xz,{})};function xz(){const e=cr(),t=Lc(),[i,s]=L.useState(!1),o=L.useMemo(()=>jE(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),d=DE(e),p=IE(o,d).hidden,l=BE(p,e.notificationPreferences),h=$g(l),f=$g(p),v=Ug(h,"input-waiting"),m=Ug(h,"ended"),S=h.length===0,C=L.useCallback(T=>{mc(T.operationId),t("/operations")},[t]);return u.jsxs("div",{className:"alerts-panel-body","aria-live":"polite","aria-label":"Operation alerts",children:[u.jsxs("div",{className:"alerts-panel-toolbar",children:[u.jsxs("div",{className:"alerts-panel-tallies","aria-hidden":"true",children:[v>0?u.jsx("span",{className:"notification-tally is-input-waiting",children:v}):null,m>0?u.jsx("span",{className:"notification-tally is-ended",children:m}):null,S?u.jsx("span",{className:"alerts-panel-tally-empty",children:"—"}):null]}),u.jsx("button",{type:"button",className:`alerts-panel-settings-btn${i?" is-active":""}`,onClick:()=>s(T=>!T),"aria-expanded":i,"aria-label":"Notification settings",title:"Notification settings",children:u.jsx(Tz,{})})]}),i?u.jsx(Cz,{groups:f}):null,S?u.jsx("p",{className:"notification-dock-empty",children:"No active alerts"}):u.jsx("div",{className:"notification-dock-deck",children:h.map(T=>u.jsxs("section",{className:"notification-cluster-group",children:[u.jsxs("header",{className:"notification-cluster-group-head",children:[u.jsx("span",{className:"notification-cluster-theater",children:T.theaterLabel}),u.jsx("span",{className:"notification-cluster-group-count",children:T.notifications.length})]}),u.jsx("ul",{className:"notification-cluster-roster",children:T.notifications.map(w=>u.jsxs("li",{className:`notification-row is-${w.kind}`,children:[u.jsx("span",{className:"notification-row-beacon","aria-hidden":"true"}),u.jsxs("span",{className:"notification-row-body",children:[u.jsx("span",{className:"notification-row-op",children:w.operationLabel}),u.jsx("span",{className:"notification-row-state",children:yz[w.kind]})]}),u.jsx("button",{type:"button",className:"notification-row-move",onClick:()=>C(w),"aria-label":`Open ${T.theaterLabel} ${w.operationLabel}`,children:"Open"})]},w.operationId))})]},T.theaterId??"__unknown__"))})]})}function wz(){const e=cr();Mw();const t=L.useMemo(()=>jE(Object.values(e.operationNotifications),e.operations),[e.operationNotifications,e.operations]),i=DE(e),s=IE(t,i).hidden,o=BE(s,e.notificationPreferences),d=$g(o),p=d.reduce((f,v)=>f+v.notifications.length,0),l=Ug(d,"input-waiting"),h=p===0?"muted":l>0?"awaiting":"ended";return u.jsxs("span",{className:`alerts-icon is-${h}`,"aria-hidden":"true",children:[u.jsx(kz,{}),p>0?u.jsx("span",{className:"alerts-icon-badge",children:p}):null]})}function Cz({groups:e}){const t=cr(),i=Ez(e,t.notificationPreferences.mutedTheaterIds,t.theaters);return u.jsxs("div",{className:"notification-cluster-settings",role:"dialog","aria-label":"Notification settings",children:[u.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"Display"}),u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:t.notificationPreferences.globalMute,onChange:s=>x3(s.currentTarget.checked)}),u.jsx("span",{children:"Mute all"})]}),u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:t.notificationPreferences.dnd,onChange:s=>w3(s.currentTarget.checked)}),u.jsx("span",{children:"Do not disturb"})]}),i.length>0?u.jsx("p",{className:"notification-cluster-settings-eyebrow",children:"By Theater"}):null,i.map(s=>u.jsxs("label",{className:"notification-cluster-setting",children:[u.jsx("input",{type:"checkbox",checked:s.theaterId?t.notificationPreferences.mutedTheaterIds[s.theaterId]===!0:!1,onChange:()=>{s.theaterId&&C3(s.theaterId)}}),u.jsx("span",{children:s.theaterLabel})]},s.theaterId))]})}function Ez(e,t,i){const s=new Map;for(const o of e)o.theaterId&&s.set(o.theaterId,o);for(const o of Object.keys(t))s.has(o)||s.set(o,{theaterId:o,theaterLabel:i.find(d=>d.id===o)?.label??o,notifications:[]});return[...s.values()]}function Ug(e,t){let i=0;for(const s of e)for(const o of s.notifications)o.kind===t&&(i+=1);return i}function kz(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"16",height:"16",children:[u.jsx("path",{d:"M8 2a4.5 4.5 0 0 0-4.5 4.5v2.25L2 10.5v.75h12v-.75l-1.5-1.75V6.5A4.5 4.5 0 0 0 8 2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M6.5 12a1.5 1.5 0 0 0 3 0",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}function Tz(){return u.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",width:"15",height:"15",children:[u.jsx("path",{d:"M8 5.4a2.6 2.6 0 1 1 0 5.2 2.6 2.6 0 0 1 0-5.2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.25"}),u.jsx("path",{d:"M8 2.2v1.6M8 12.2v1.6M3.9 3.9 5 5M11 11l1.1 1.1M2.2 8h1.6M12.2 8h1.6M3.9 12.1 5 11M11 5l1.1-1.1",fill:"none",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round"})]})}async function Az(e,t){const s=new URLSearchParams().toString();return Bo(va(e,`/search${s?`?${s}`:""}`))}async function Rz(e,t,i){return Bo(va(e,`/entry/${encodeURIComponent(t)}`))}async function PE(e,t="pending"){return Bo(va(e,`/drydock?status=${encodeURIComponent(t)}`))}async function Lz(e,t){return Bo(va(e,`/drydock/${encodeURIComponent(t)}`))}async function Mz(e,t,i,s){const o={action:i};return s!==void 0&&(o.reason=s),Dz(va(e,`/drydock/${encodeURIComponent(t)}/decision`),o)}async function Nz(e){return Bo(va(e,"/conflicts"))}async function Oz(e,t){return Bo(va(e,`/conflicts/${encodeURIComponent(t)}`))}function va(e,t){const i=t.startsWith("/")?t:`/${t}`;return e?`/console/codex/w/${encodeURIComponent(e)}/api${i}`:`/console/codex/api${i}`}async function Bo(e){const t=await fetch(e,{headers:{accept:"application/json"}});if(!t.ok)throw new Error(await zE(e,t));return t.json()}async function Dz(e,t){const i=await fetch(e,{method:"POST",headers:{"content-type":"application/json",accept:"application/json"},body:JSON.stringify(t)});if(!i.ok)throw new Error(await zE(e,i));return i.json()}async function zE(e,t){return(await t.json().catch(()=>null))?.error??`${e} request failed: ${t.status}`}const Fg=new Set,nd={index:[],conflicts:[],pendingPatchCount:0,currentWorkspaceId:null,loading:!1,error:null};function nc(){return nd}function HE(e){return Fg.add(e),()=>Fg.delete(e)}function px(e){Th({currentWorkspaceId:e})}async function id(){Th({loading:!0,error:null});try{const e=nd.currentWorkspaceId,[t,i]=await Promise.all([Az(e),PE(e,"pending").catch(()=>null)]);Th({index:t.entries,pendingPatchCount:i?.pendingCount??0,loading:!1})}catch(e){Th({loading:!1,error:jz(e)})}}function Th(e){Object.assign(nd,e);for(const t of Fg)t(nd)}function jz(e){return e instanceof Error?e.message:String(e)}const Iz=120;function ir(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Bz(e,t){if(!t)return ir(e);const i=e.toLowerCase().indexOf(t.toLowerCase());return i===-1?ir(e):ir(e.slice(0,i))+`<mark>${ir(e.slice(i,i+t.length))}</mark>`+ir(e.slice(i+t.length))}function Pz(e){return`<span class="codex-nav-tag">${ir(e)}</span>`}function zz(e,t,i){const s=t?e.tags.some(l=>l.toLowerCase().includes(t.toLowerCase())):!1,o=e.tags.slice(0,3).map(Pz).join(""),d=ir(e.status??"current"),p=ir(e.updated??"");return`<button
215
+ class="codex-nav-entry${i?" is-current":""}"
216
+ data-entry-id="${ir(e.id)}"
217
+ type="button"
218
+ ${i?'aria-current="page"':""}
219
+ title="${ir(e.title)}"
220
+ >
221
+ <span class="t">${Bz(e.title,s?"":t)}</span>
222
+ ${o?`<span class="tg">${o}</span>`:""}
223
+ <span class="meta">${d} · ${p}</span>
224
+ </button>`}function Hz(e,t){if(!t)return e;const i=t.toLowerCase();return e.filter(s=>s.title.toLowerCase().includes(i)||s.tags.some(o=>o.toLowerCase().includes(i)))}function $z(e,t){let i="",s=null,o=null;e.innerHTML=`
225
+ <div class="codex-navigator">
226
+ <div class="codex-nav-search">
227
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="7"/><path d="M21 21l-4.35-4.35"/></svg>
228
+ <input
229
+ class="codex-nav-search-input"
230
+ type="search"
231
+ placeholder="Search entries"
232
+ autocomplete="off"
233
+ spellcheck="false"
234
+ aria-label="Search Codex entries"
235
+ />
236
+ </div>
237
+ <div class="codex-nav-quick-row">
238
+ <button class="codex-nav-quick" data-action="drydock" type="button">
239
+ Review queue <span class="badge" id="codex-nav-drydock-badge">0</span>
240
+ </button>
241
+ <button class="codex-nav-quick" data-action="conflicts" type="button">Conflicts</button>
242
+ </div>
243
+ <div class="codex-nav-list-eyebrow" id="codex-nav-eyebrow">Entries · 0</div>
244
+ <div class="codex-navigator-scroll">
245
+ <div class="codex-nav-list" id="codex-nav-list"></div>
246
+ </div>
247
+ </div>
248
+ `;const d=e.querySelector(".codex-nav-search-input"),p=e.querySelector("#codex-nav-list"),l=e.querySelector("#codex-nav-eyebrow"),h=e.querySelector("#codex-nav-drydock-badge");function f(C){const T=Hz(C.index,i);if(l.textContent=`Entries · ${T.length}`,h.textContent=String(C.pendingPatchCount),h.hidden=C.pendingPatchCount===0,C.loading&&C.index.length===0){p.innerHTML='<div class="codex-nav-loading" aria-live="polite">Loading…</div>';return}if(C.error){p.innerHTML=`<div class="codex-nav-error" role="alert">${ir(C.error)}</div>`;return}if(T.length===0){p.innerHTML=`<div class="codex-nav-empty">${i?"No entries match.":"No entries."}</div>`;return}p.innerHTML=T.map(w=>zz(w,i,w.id===s)).join("")}function v(C){const T=C.target;if(!(T instanceof Element))return;const w=T.closest("[data-entry-id]");if(w?.dataset.entryId){s=w.dataset.entryId,f(nc()),t.onRequest({kind:"entry",id:s});return}const _=T.closest("[data-action]");if(_?.dataset.action==="drydock"){t.onRequest({kind:"drydock"});return}if(_?.dataset.action==="conflicts"){t.onRequest({kind:"conflicts"});return}}function m(){o!==null&&clearTimeout(o),o=setTimeout(()=>{i=d.value,f(nc())},Iz)}e.addEventListener("click",v),d.addEventListener("input",m);const S=HE(C=>f(C));return f(nc()),{destroy(){S(),e.removeEventListener("click",v),d.removeEventListener("input",m),o!==null&&clearTimeout(o),e.innerHTML=""},setTheater(C){i="",s=null,d&&(d.value=""),f(nc())}}}function Uz(e,t){t.initialTheaterId&&px(t.initialTheaterId);const i=$z(e,{initialTheaterId:t.initialTheaterId,onRequest:t.onRequest}),s=HE(()=>{});id();const o=i.destroy.bind(i);return{destroy(){s(),o()},setTheater(d){px(d),id(),i.setTheater(d)}}}function Nt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Mo(e){return Nt(e).replace(/"/g,"&quot;")}function Fz(e){const t=e.tags.map(s=>`<span class="chip chip-tag">${Nt(s)}</span>`).join(""),i=Gz(e);return`
249
+ <div class="meta-chips">
250
+ ${t}
251
+ ${i}
252
+ <span class="chip">Updated ${Nt(Wz(e.updated))}</span>
253
+ </div>
254
+ `}function $E(e){return e.map(t=>`<span class="chip chip-muted">${Nt(t)}</span>`).join("")}function Wz(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}function Gz(e){const t=qz(e);return t?`<span class="chip ${t.tone==="deprecated"?"chip-coral":t.tone==="stale"?"chip-stale":""}" title="${Mo(t.title)}">${Nt(t.label)}</span>`:""}function qz(e,t=new Date){const i=e.status,s=typeof e.revalidateAfter=="string"&&!Number.isNaN(Date.parse(e.revalidateAfter))&&Date.parse(e.revalidateAfter)<t.getTime();return i==="deprecated"||i==="superseded"?{label:i,tone:"deprecated",title:s?`${i} · stale`:i}:s?{label:"stale",tone:"stale",title:e.revalidateAfter??"stale"}:i==="current"||i==="draft"?{label:i,tone:"neutral",title:i}:null}const Kz="active";function mx(e){return e.length===0?'<p class="toc-empty">No sections</p>':e.map(t=>`<a class="ti toc-level-${t.level}" href="#${Mo(t.id)}" data-toc-id="${Mo(t.id)}">${Nt(t.text)}</a>`).join("")}function gx(e,t,i){if(t.length===0||typeof IntersectionObserver>"u")return()=>{};const s=[...i.querySelectorAll("[data-toc-id]")],o=new Set(t.map(f=>f.id)),d=[...e.querySelectorAll("h2[id], h3[id]")].filter(f=>o.has(f.id));if(s.length===0||d.length===0)return()=>{};const p=e.closest(".codex-reading-sheet-read"),l=new Set,h=new IntersectionObserver(f=>{for(const m of f){const S=m.target instanceof HTMLElement?m.target.id:"";S&&(m.isIntersecting?l.add(S):l.delete(S))}const v=Vz(d,l)??Yz(d,p)??d[0]?.id??null;_x(s,v)},{root:p,rootMargin:"-20% 0px -65% 0px",threshold:[0,.2,.6,1]});for(const f of d)h.observe(f);return _x(s,d[0]?.id??null),()=>h.disconnect()}function Vz(e,t){for(const i of e)if(t.has(i.id))return i.id;return null}function Yz(e,t){const i=t?t.getBoundingClientRect().top:0;let s=null;for(const o of e)if(o.getBoundingClientRect().top-i<=80)s=o.id;else break;return s}function _x(e,t){for(const i of e){const s=!!(t&&i.dataset.tocId===t);i.classList.toggle(Kz,s),s?i.setAttribute("aria-current","location"):i.removeAttribute("aria-current")}}function vx(e){return`/entry/${encodeURIComponent(e)}`}const UE={create_wiki:"+",update_wiki:"↻"},FE={create_wiki:"Create",update_wiki:"Update"};function Xz(e,t){let i=!1,s=null,o=t,d="idle",p=null,l=null,h=null;M_(e);function f(b){const g=b.target;if(!(g instanceof Element))return;const y=g.closest("[data-patch-id]");if(y){b.preventDefault();const A=y.dataset.patchId||void 0;o.onPatchOpen?.(A);return}const k=g.closest("[data-entry-id]");if(k?.dataset.entryId){b.preventDefault(),o.onRelatedClick(k.dataset.entryId);return}const M=g.closest("[data-drydock-action]");if(M){b.preventDefault(),v(M.dataset.drydockAction);return}}function v(b){if(b){if(b==="back"){o.onPatchOpen?.(void 0);return}if(b==="approve"){d="approving",p=null,S();return}if(b==="approve-confirm"){m("approve",void 0);return}if(b==="reject"){d="rejecting",p=null,S();return}if(b==="reject-submit"){const g=e.querySelector("#queue-reject-reason")?.value.trim();if(!g){p="Rejection reason is required.",S();return}m("reject",g);return}if(b==="cancel"){d="idle",p=null,S();return}}}async function m(b,g){if(h){d="submitting",p=null,S();try{await Mz(o.theaterId,h,b,g),o.onDecided?.()}catch(y){d=b==="approve"?"approving":"rejecting",p=y instanceof Error?y.message:String(y),S()}}}function S(){const b=e.querySelector("[data-decision-bar-wrap]");b&&(b.innerHTML=WE(d,p))}e.addEventListener("click",f);function C(){s?.(),s=null}async function T(b){if(!i){Lm(e,t.tocContainer),C();try{const g=await Rz(o.theaterId,b);if(i)return;const{index:y}=nc(),{html:k,toc:M}=xc(g.body,{omitDuplicateTitle:g.frontmatter.title,resolveWikiLink:N=>vx(N)});e.innerHTML=`
255
+ <article class="document">
256
+ <header class="document-header">
257
+ ${Zz(g.frontmatter.title)}
258
+ <h1>${Nt(g.frontmatter.title)}</h1>
259
+ ${Fz(g.frontmatter)}
260
+ </header>
261
+ <div class="markdown-body" id="codex-reader-body">
262
+ ${k}
263
+ </div>
264
+ ${Jz(g.frontmatter.id,g.frontmatter.tags,y)}
265
+ </article>
266
+ `,t.tocContainer.innerHTML=mx(M);const A=e.querySelector("article");A&&M.length>0&&(s=gx(A,M,t.tocContainer))}catch(g){i||Mm(e,t.tocContainer,g)}}}async function w(b){if(!i){Lm(e,t.tocContainer),C(),l=null,h=null,d="idle",p=null;try{if(b){const g=await Lz(o.theaterId,b);if(i)return;l=g.meta,h=b;const{html:y,toc:k}=xc(g.wikiEntry.body,{omitDuplicateTitle:g.wikiEntry.title,resolveWikiLink:A=>vx(A)});e.innerHTML=tH(g,y),t.tocContainer.innerHTML=mx(k);const M=e.querySelector("article");M&&k.length>0&&(s=gx(M,k,t.tocContainer))}else{const g=await PE(o.theaterId,"pending");if(i)return;t.tocContainer.innerHTML="",e.innerHTML=Qz(g.items,"Review queue — Pending patches")}}catch(g){i||Mm(e,t.tocContainer,g)}}}async function _(b){if(!i){Lm(e,t.tocContainer),C();try{if(b){const g=await Oz(o.theaterId,b);if(i)return;t.tocContainer.innerHTML="",e.innerHTML=rH(g)}else{const g=await Nz(o.theaterId);if(i)return;t.tocContainer.innerHTML="",e.innerHTML=sH(g)}}catch(g){i||Mm(e,t.tocContainer,g)}}}return t.kind==="entry"&&t.initialEntryId?T(t.initialEntryId):t.kind==="drydock"?w(t.subId):t.kind==="conflicts"&&_(t.subId),{destroy(){i=!0,e.removeEventListener("click",f),C()},async setEntry(b){await T(b)},async navigateSub(b){t.kind==="drydock"?await w(b):t.kind==="conflicts"&&await _(b)},refreshCallbacks(b){o={...o,...b}}}}function Lm(e,t){e.innerHTML='<div class="codex-reader-loading" aria-live="polite" aria-busy="true">Loading…</div>',t.innerHTML=""}function Mm(e,t,i){const s=i instanceof Error?i.message:String(i);e.innerHTML=`<div class="codex-reader-error" role="alert">${Nt(s)}</div>`,t.innerHTML=""}function Zz(e){return`
267
+ <nav class="breadcrumb" aria-label="Entry location">
268
+ <ol>
269
+ <li><span>Codex</span></li>
270
+ <li><span aria-current="page">${Nt(e)}</span></li>
271
+ </ol>
272
+ </nav>
273
+ `}function Jz(e,t,i){const s=new Set(t),o=i.filter(d=>d.id!==e).map(d=>({entry:d,matchingTags:d.tags.filter(p=>s.has(p))})).filter(d=>d.matchingTags.length>0).sort((d,p)=>p.matchingTags.length-d.matchingTags.length||d.entry.title.localeCompare(p.entry.title,"en-US",{sensitivity:"base",numeric:!0})).slice(0,5);return o.length===0?"":`
274
+ <section class="related-list">
275
+ <h2>Related entries</h2>
276
+ <div class="related-items">
277
+ ${o.map(d=>`<button class="related-card" type="button" data-entry-id="${Mo(d.entry.id)}">
278
+ <strong>${Nt(d.entry.title)}</strong>
279
+ <span>${$E(d.matchingTags)}</span>
280
+ </button>`).join("")}
281
+ </div>
282
+ </section>
283
+ `}function Qz(e,t){return e.length===0?'<div class="codex-reader-empty"><p class="queue-empty">No pending patches.</p></div>':`
284
+ <article class="document">
285
+ <header class="document-header">
286
+ <nav class="breadcrumb" aria-label="Entry location">
287
+ <ol>
288
+ <li><span>Codex</span></li>
289
+ <li><span aria-current="page">Review queue</span></li>
290
+ </ol>
291
+ </nav>
292
+ <h1>${Nt(t)}</h1>
293
+ </header>
294
+ <div class="queue-row-list">
295
+ ${e.map(eH).join("")}
296
+ </div>
297
+ </article>
298
+ `}function eH(e){const t=e.op??"create_wiki",i=UE[t]??"?",s=FE[t]??"Patch",o=e.target??e.id,p=[aH(e.meta.createdAt)].filter(Boolean);return`
299
+ <button class="queue-row" type="button" data-patch-id="${Mo(e.id)}" aria-label="${Mo(s+": "+o)}">
300
+ <span class="queue-row-badge" aria-hidden="true">
301
+ <span class="op-badge">${i}</span>
302
+ </span>
303
+ <span class="queue-row-body">
304
+ <span class="queue-row-target">${Nt(o)}</span>
305
+ ${e.summary?`<span class="queue-row-summary">${Nt(e.summary)}</span>`:""}
306
+ ${p.length>0?`<span class="queue-row-meta">${p.map(Nt).join(" · ")}</span>`:""}
307
+ </span>
308
+ </button>
309
+ `}function tH(e,t){const{patch:i,meta:s,wikiEntry:o,targetExists:d}=e,p=i.frontmatter.op,l=UE[p]??"?",h=FE[p]??"Patch",f=d?"기존 문서 대체":"신규 문서 생성",v=s.status==="pending";return`
310
+ <article class="document">
311
+ <header class="document-header">
312
+ <nav class="breadcrumb" aria-label="Entry location">
313
+ <ol>
314
+ <li><span>Codex</span></li>
315
+ <li><span>Review queue</span></li>
316
+ <li><span aria-current="page">${Nt(h)}</span></li>
317
+ </ol>
318
+ </nav>
319
+ <button type="button" class="queue-back-btn" data-drydock-action="back">‹ Queue</button>
320
+ <h1><span class="op-badge">${l}</span> ${Nt(o.title)}</h1>
321
+ <p class="eyebrow">${Nt(i.frontmatter.target)} · v${o.version} · ${Nt(f)}</p>
322
+ ${nH(i.frontmatter.proposer,o.tags)}
323
+ </header>
324
+ <div class="markdown-body" id="codex-reader-body">
325
+ ${t}
326
+ </div>
327
+ <div class="queue-decision-section" data-decision-bar-wrap>
328
+ ${v?WE("idle",null):iH(s)}
329
+ </div>
330
+ </article>
331
+ `}function nH(e,t){const i=[];return e&&i.push(`<span class="meta-chip">${Nt(e)}</span>`),t.length>0&&i.push($E(t)),i.length===0?"":`<div class="meta-chips">${i.join("")}</div>`}function WE(e,t){return e==="submitting"?'<span class="queue-action-spinner" role="status" aria-label="Processing…"></span>':e==="approving"?`
332
+ <p class="queue-decision-confirm">Apply this patch to the wiki?</p>
333
+ <div class="queue-action-buttons">
334
+ <button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve-confirm">✓ Yes, Approve</button>
335
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
336
+ </div>
337
+ ${t?`<p class="queue-action-error">${Nt(t)}</p>`:""}
338
+ `:e==="rejecting"?`
339
+ <div class="queue-reject-form">
340
+ <textarea class="queue-reject-textarea" id="queue-reject-reason" placeholder="Rejection reason (required)…" rows="3"></textarea>
341
+ <div class="queue-action-buttons">
342
+ <button type="button" class="queue-action-btn queue-action-btn--reject-submit" data-drydock-action="reject-submit">Submit Rejection</button>
343
+ <button type="button" class="queue-action-btn queue-action-btn--cancel" data-drydock-action="cancel">Cancel</button>
344
+ </div>
345
+ ${t?`<p class="queue-action-error">${Nt(t)}</p>`:""}
346
+ </div>
347
+ `:`
348
+ <div class="queue-action-buttons">
349
+ <button type="button" class="queue-action-btn queue-action-btn--approve" data-drydock-action="approve">✓ Approve</button>
350
+ <button type="button" class="queue-action-btn queue-action-btn--reject" data-drydock-action="reject">✕ Reject</button>
351
+ </div>
352
+ `}function iH(e){const t=e.status==="accepted",i=t?"✓ Approved":"✕ Rejected",s=t?"queue-decision-decided--approve":"queue-decision-decided--reject",o=e.reason?` · ${Nt(e.reason)}`:"";return`<p class="queue-decision-decided ${s}">${i}${o}</p>`}function rH(e){return`
353
+ <article class="document">
354
+ <header class="document-header">
355
+ <nav class="breadcrumb" aria-label="Entry location">
356
+ <ol><li><span>Codex</span></li><li><span>Conflicts</span></li></ol>
357
+ </nav>
358
+ <h1>${Nt(e.id)}</h1>
359
+ <p class="eyebrow">Conflict · ${Nt(e.meta?.status??"open")}</p>
360
+ </header>
361
+ <div class="markdown-body">
362
+ ${e.current?`<h2>Current</h2><pre><code>${Nt(e.current)}</code></pre>`:""}
363
+ ${e.proposed?`<h2>Proposed</h2><pre><code>${Nt(e.proposed)}</code></pre>`:""}
364
+ </div>
365
+ </article>
366
+ `}function sH(e){return e.length===0?'<div class="codex-reader-empty"><p>No conflicts found.</p></div>':`
367
+ <article class="document">
368
+ <header class="document-header">
369
+ <h1>Conflicts</h1>
370
+ </header>
371
+ <div class="markdown-body">
372
+ <ul class="queue-list">
373
+ ${e.map(t=>`<li class="queue-item">
374
+ <strong>${Nt(t.title||t.id)}</strong>
375
+ <span class="eyebrow">${Nt(t.status)}</span>
376
+ </li>`).join("")}
377
+ </ul>
378
+ </div>
379
+ </article>
380
+ `}function aH(e){try{const i=(Date.now()-new Date(e).getTime())/(1e3*60*60);if(i<1)return"< 1h ago";if(i<24)return`${Math.floor(i)}h ago`;const s=i/24;return s<7?`${Math.floor(s)}d ago`:s<30?`${Math.floor(s/7)}w ago`:`${Math.floor(s/30)}mo ago`}catch{return""}}let ra=null,Tc=null,GE=null,Rs=null,sa=null,Ts=null,Ah=null,Nm=null,Rh,Wg=0;function bx(e){GE=e}function oH(e,t){const i=uH();i.parentElement!==e&&e.appendChild(i),Tc||(Tc=Uz(i,{initialTheaterId:t,onRequest:s=>GE?.(s)}))}function lH(e){Tc?.setTheater(e)}function qE(e,t,i){const s=hH(),o=dH(),d=s.parentElement,p=i.kind==="entry"&&Ah==="entry"&&i.initialEntryId===Nm;d&&d!==e&&(Wg=d.scrollTop),s.parentElement!==e&&e.appendChild(s),o.parentElement!==t&&t.appendChild(o),!Ts||Ah!==i.kind?(Ts?.destroy(),Ts=Xz(s,{...i,tocContainer:o}),Ah=i.kind,Rh=i.subId):i.kind==="entry"&&i.initialEntryId&&i.initialEntryId!==Nm?Ts.setEntry(i.initialEntryId):(i.kind==="drydock"||i.kind==="conflicts")&&i.subId!==Rh&&(Rh=i.subId,Ts.navigateSub(i.subId)),Nm=i.kind==="entry"?i.initialEntryId??null:null,Ts.refreshCallbacks({onPatchOpen:i.onPatchOpen,onDecided:i.onDecided,onRelatedClick:i.onRelatedClick,onClose:i.onClose,theaterId:i.theaterId});const l=p?Wg:0;requestAnimationFrame(()=>{e.scrollTop=l})}function cH(){const e=Rs?.parentElement;e&&(Wg=e.scrollTop)}function KE(){Ts?.destroy(),Ts=null,Ah=null,Rh=void 0,Rs?.parentElement&&Rs.parentElement.removeChild(Rs),sa?.parentElement&&sa.parentElement.removeChild(sa)}function yx(){KE(),Tc?.destroy(),Tc=null,ra?.parentElement&&ra.parentElement.removeChild(ra)}function uH(){return ra||(ra=document.createElement("div"),ra.className="codex-host"),ra}function hH(){return Rs||(Rs=document.createElement("div"),Rs.className="codex-reader-host"),Rs}function dH(){return sa||(sa=document.createElement("div"),sa.className="codex-toc-host"),sa}const fH={id:"codex",title:"Codex",icon:()=>u.jsx(vH,{}),pathAware:!0,render:e=>u.jsx(pH,{theaterId:e.theaterId,pathContext:e.pathContext})};function pH({theaterId:e,pathContext:t}){const i=cr(),s=L.useRef(null),o=L.useRef(null),d=L.useRef(null),p=L.useRef(""),[l,h]=L.useState(null),f=i.codexReader,v=f!==null,m=i.codexReaderExpanded,S=i.theaters.find(g=>g.id===i.activeTheaterId)??null,C=i.theaters.length>0,T=`${e??""}\0${t.relPath??""}`,w=l?.contextKey===T&&l.hasWiki?l.id:null,_=w!==null,b=f?`${f.kind}:${f.kind==="entry"?f.entryId:f.kind==="drydock"?f.patchId??"":f.id??""}`:null;return L.useEffect(()=>{if(p.current=T,zp(),!e){h({contextKey:T,hasWiki:!1,id:null});return}gH(e,t.relPath).then(g=>{p.current===T&&h({contextKey:T,...g})}).catch(()=>{p.current===T&&h({contextKey:T,hasWiki:!1,id:null})})},[T,t.relPath,e]),L.useEffect(()=>{l?.contextKey===T&&!l.hasWiki&&yx()},[T,l]),L.useEffect(()=>()=>yx(),[]),L.useEffect(()=>{if(!_||!w)return;const g=s.current;if(g)return oH(g,w),bx(y=>{y.kind==="entry"?Wr({kind:"entry",entryId:y.id}):y.kind==="drydock"?Wr({kind:"drydock",patchId:y.patchId}):y.kind==="conflicts"&&Wr({kind:"conflicts",id:y.id})}),()=>{bx(null)}},[_,w,v]),L.useEffect(()=>{_&&w&&lH(w)},[_,w]),L.useEffect(()=>{if(!_||!w||!v||m||!o.current||!d.current||!f)return;const g=f.kind,y=g==="drydock"?f.patchId:g==="conflicts"?f.id:void 0;qE(o.current,d.current,{initialEntryId:g==="entry"?f.entryId:"",kind:g,subId:y,theaterId:w,onRelatedClick:k=>Wr({kind:"entry",entryId:k}),onClose:()=>zp(),onPatchOpen:k=>Wr({kind:"drydock",patchId:k}),onDecided:()=>{id(),Wr({kind:"drydock",patchId:void 0})}})},[_,w,v,m,b]),L.useEffect(()=>{v||KE()},[v]),_?v?u.jsxs("div",{className:"codex-rail-host is-split",children:[u.jsxs("div",{className:"codex-doc-pane",children:[u.jsxs("div",{className:"codex-doc-pane-head",children:[u.jsx("button",{className:"codex-doc-expand",type:"button","aria-label":"Expand reading sheet","data-codex-expand":"true",onClick:_h,children:"⤢ Expand"}),u.jsx("button",{className:"codex-reading-sheet-close",type:"button","aria-label":"Close document pane",onClick:zp,children:"✕"})]}),u.jsx("div",{ref:o,className:"codex-doc-scroll"}),u.jsx("div",{ref:d,className:"codex-doc-toc-inline"})]}),u.jsx("div",{ref:s,className:"codex-nav-pane"})]}):u.jsx("div",{ref:s,className:"codex-rail-host"}):u.jsx(mH,{activeTheater:S,contextLabel:t.label,hasTheaters:C})}function mH({activeTheater:e,contextLabel:t,hasTheaters:i}){return i?u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:"Codex unavailable"}),u.jsx("h1",{children:t||e?.label||"This context"}),u.jsx("p",{children:"This selected context does not have Fleet Wiki data mounted."})]}):u.jsxs("section",{className:"codex-empty-state",children:[u.jsx("p",{className:"codex-empty-eyebrow",children:"Codex"}),u.jsx("h1",{children:"Add a Theater"}),u.jsx("p",{children:"Use the top bar Theater control to choose a project root before opening Codex."})]})}async function gH(e,t){const i=await fetch(`/api/v1/theaters/${encodeURIComponent(e)}/codex-workspace`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({relPath:t})});if(!i.ok)throw new Error("codex_workspace_unavailable");return _H(await i.json())}function _H(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 vH(){return u.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r:"9"}),u.jsx("circle",{cx:"12",cy:"12",r:"3.2",fill:"currentColor",stroke:"none",opacity:"0.16"}),u.jsx("path",{d:"M12 3v3.6M12 17.4V21M3 12h3.6M17.4 12H21"}),u.jsx("path",{d:"M12 8.6 14.2 12 12 15.4 9.8 12Z",fill:"currentColor",stroke:"none"})]})}function VE(e,t=Date.now()){const i=Date.parse(e);if(!Number.isFinite(i))return"Unknown";const s=Math.max(0,Math.floor((t-i)/1e3));if(s<60)return"just now";const o=Math.floor(s/60);if(o<60)return`${o}m ago`;const d=Math.floor(o/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}function bH(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 yH(e,t){return t>0&&e>=t?"complete":e>0?"in-progress":"not-started"}function SH(e){return e.tasksTotal===0||e.tasksDone>=e.tasksTotal}function xH(e,t,i){return i.tasksTotal<=0?"none":i.tasksDone>=i.tasksTotal?"complete":e.slice(0,t).every(SH)?"ready":"blocked"}const wH=360,CH={id:"plans",title:"Plans",icon:LH,pathAware:!0,render:e=>u.jsx(EH,{...e})};function EH(e){const t=JSON.stringify([e.theaterId,e.pathContext.relPath]);return u.jsx(kH,{...e},t)}function kH(e){const{pathContext:t,requestExtraWidth:i,theaterId:s}=e,o=t.relPath,[d,p]=L.useState({kind:"no-theater"}),[l,h]=L.useState({kind:"loading"}),[f,v]=L.useState(null),[m,S]=L.useState(0),[C,T]=L.useState(0),w=f?.theaterId===s&&f.relPath===o?f.name:null;L.useEffect(()=>{let k=!1;return v(null),h({kind:"loading"}),s?(p({kind:"loading"}),ER(s,o).then(M=>{k||p({kind:"ready",plans:M.plans})}).catch(()=>{k||p({kind:"error"})}),()=>{k=!0}):(p({kind:"no-theater"}),()=>{k=!0})},[o,s,m]),L.useEffect(()=>{let k=!1;return!s||!w?()=>{k=!0}:(h({kind:"loading"}),kR(s,o,w).then(M=>{k||h({kind:"ready",plan:M})}).catch(()=>{k||h({kind:"error"})}),()=>{k=!0})},[C,o,w,s]),L.useLayoutEffect(()=>(i?.(w?wH:null),()=>i?.(null)),[i,w]);const _=L.useCallback(k=>{s&&v({theaterId:s,relPath:o,name:k})},[o,s]),b=L.useCallback(()=>v(null),[]),g=L.useCallback(()=>S(k=>k+1),[]),y=L.useCallback(()=>T(k=>k+1),[]);return u.jsx("div",{className:"plans-panel-shell",children:u.jsxs("div",{className:`plans-root${w?" is-reader-open":""}`,children:[w&&u.jsx(AH,{state:l,onClose:b,onRetry:y}),w&&u.jsx("div",{className:"plans-divider","aria-hidden":"true"}),u.jsx(TH,{selectedName:w,state:d,onRetry:g,onSelect:_})]})})}function TH({selectedName:e,state:t,onRetry:i,onSelect:s}){return t.kind==="no-theater"?u.jsx("div",{className:"plans-list-pane",children:u.jsx(Sx,{children:"Select a Theater to browse plans."})}):t.kind==="loading"?u.jsx("div",{className:"plans-list-pane",children:u.jsx("div",{className:"plans-loading",children:"Loading plans…"})}):t.kind==="error"?u.jsx("div",{className:"plans-list-pane",children:u.jsx(YE,{message:"Unable to load plans.",onRetry:i})}):t.plans.length===0?u.jsx("div",{className:"plans-list-pane",children:u.jsx(Sx,{detail:"Execution plans in .fleet/plans/ appear here.",children:"No plans yet."})}):u.jsx("div",{className:"plans-list-pane",children:u.jsx("div",{className:"plans-list","aria-label":"Plans",children:t.plans.map(o=>{const d=bH(o.tasksDone,o.tasksTotal),p=d===100;return u.jsxs("button",{type:"button",className:`plans-row${e===o.name?" is-selected":""}`,onClick:()=>s(o.name),children:[u.jsx("span",{className:"plans-row-name",children:o.name}),u.jsxs("span",{className:"plans-row-meta",children:[o.waveCount," waves · ",o.tasksDone,"/",o.tasksTotal," tasks · ",VE(o.updatedAt),o.executionMode==="parallel"?" · parallel":""]}),d!==null&&u.jsx("span",{className:"plans-progress-track","aria-label":`${d}% complete`,children:u.jsx("span",{className:`plans-progress-fill${p?" is-complete":""}`,style:{width:`${d}%`}})})]},o.name)})})})}function AH({state:e,onClose:t,onRetry:i}){return e.kind==="loading"?u.jsxs("div",{className:"plans-reader-pane",children:[u.jsxs("div",{className:"plans-reader-head",children:[u.jsx("span",{className:"plans-reader-title",children:"Plan"}),u.jsx(Gg,{onClose:t})]}),u.jsx("div",{className:"plans-loading",children:"Loading plan…"})]}):e.kind==="error"?u.jsxs("div",{className:"plans-reader-pane",children:[u.jsxs("div",{className:"plans-reader-head",children:[u.jsx("span",{className:"plans-reader-title",children:"Plan"}),u.jsx(Gg,{onClose:t})]}),u.jsx(YE,{message:"Unable to load plan.",onRetry:i})]}):u.jsx(RH,{plan:e.plan,onClose:t})}function RH({plan:e,onClose:t}){const i=L.useMemo(()=>{const d=new DOMParser().parseFromString(xc(e.content).html,"text/html");return Om(d.body),d.body.innerHTML},[e.content]),s=L.useRef(null),o=L.useCallback(d=>{const p=d.target.closest('[data-action="copy-code"]');if(!p)return;const l=p.closest("pre")?.getAttribute("data-code");if(!l)return;navigator.clipboard?.writeText(l);const h=p.textContent;p.textContent="Copied",window.setTimeout(()=>{p.textContent=h},1200)},[]);return L.useEffect(()=>{const d=s.current;if(!d)return;M_(d),Om(d);const p=new MutationObserver(()=>Om(d));return p.observe(d,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["href","src","srcset"]}),()=>p.disconnect()},[i]),u.jsxs("div",{className:"plans-reader-pane",children:[u.jsxs("div",{className:"plans-reader-head",children:[u.jsxs("div",{className:"plans-reader-heading",children:[u.jsx("h2",{className:"plans-reader-title",children:e.title}),u.jsxs("span",{className:"plans-reader-meta",children:[e.executionMode==="parallel"&&u.jsx("span",{className:"plans-mode-badge",children:"PARALLEL"}),e.waves.length," waves · ",e.tasksDone,"/",e.tasksTotal," tasks · updated ",VE(e.updatedAt)]})]}),u.jsx(Gg,{onClose:t})]}),u.jsxs("div",{className:"plans-reader-body",children:[u.jsx("div",{className:"plans-wave-strip","aria-label":"Wave progress",children:e.waves.map((d,p)=>{const l=yH(d.tasksDone,d.tasksTotal);return u.jsxs("span",{className:`plans-wave is-${l}`,children:[u.jsx("span",{className:"plans-wave-heading",children:d.heading}),d.tasksTotal>0&&u.jsxs("span",{className:"plans-wave-count",children:[d.tasksDone,"/",d.tasksTotal]}),d.lanes.length>0&&u.jsx("span",{className:"plans-lane-list",children:d.lanes.map((h,f)=>{const v=xH(e.waves,p,h);return u.jsxs("span",{className:`plans-lane is-${v}`,children:[u.jsx("span",{className:"plans-lane-id",children:h.id??h.heading}),h.tasksTotal>0&&u.jsxs("span",{className:"plans-lane-count",children:[h.tasksDone,"/",h.tasksTotal]}),v==="ready"&&u.jsx("span",{className:"plans-lane-ready",children:"READY"})]},h.id??`${d.index}-${f}`)})})]},d.index)})}),u.jsx("div",{ref:s,className:"plans-markdown markdown-body",onClick:o,dangerouslySetInnerHTML:{__html:i}})]})]})}function Gg({onClose:e}){return u.jsx("button",{className:"plans-close",type:"button","aria-label":"Close plan",onClick:e,children:"✕"})}function Sx({children:e,detail:t}){return u.jsxs("div",{className:"plans-empty",children:[u.jsx("span",{children:e}),t&&u.jsx("span",{className:"plans-empty-detail",children:t})]})}function YE({message:e,onRetry:t}){return u.jsxs("div",{className:"plans-error-state",children:[u.jsx("span",{children:e}),u.jsx("button",{className:"plans-retry",type:"button",onClick:t,children:"Retry"})]})}function Om(e){for(const t of e.querySelectorAll("a[href]")){const i=t.getAttribute("href")??"";/^(https?:|mailto:|#)/i.test(i)||(t.removeAttribute("href"),t.setAttribute("role","link"),t.setAttribute("aria-disabled","true"))}for(const t of e.querySelectorAll("img, video, audio, embed, object, iframe")){const i=t.getAttribute("alt")?.trim()||t.getAttribute("title")?.trim(),s=t.tagName==="IMG"?"Image":"Media",o=t.ownerDocument.createElement("span");o.className="plans-md-blocked-image",o.textContent=i?`${s} blocked: ${i}`:`${s} blocked`,t.replaceWith(o)}for(const t of e.querySelectorAll("source, track"))t.removeAttribute("src"),t.removeAttribute("srcset");for(const t of e.querySelectorAll("image, feImage"))t.remove();for(const t of e.querySelectorAll("use")){const i=t.getAttribute("href")??t.getAttribute("xlink:href")??"";i!==""&&!i.startsWith("#")&&t.remove()}}function LH(){return u.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[u.jsx("path",{d:"M9 6h10M9 12h10M9 18h10M4 6.5l1.5 1.5L8 4.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),u.jsx("path",{d:"M4 12.5l1.5 1.5L8 10.5M4 18.5l1.5 1.5L8 16.5",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})]})}const MH=[Sz,fH,CH];function NH(e="right"){const{railPanels:t}=Io();return e==="right"?t.filter(i=>(i.side??"right")==="right"):t}const OH=360;function DH(e){const{codexReader:t}=cr();return e==="codex"&&t!==null?OH:0}const XE=240,jH=312,ZE="fleet-console.rail.panelWidth",IH={kind:"root",relPath:null,label:"Theater-wide"};function BH(){try{const e=localStorage.getItem(ZE);if(e!==null){const t=parseInt(e,10);if(!isNaN(t)&&t>=XE)return t}}catch{}return jH}function PH({theaterId:e,api:t}){const i=L.useRef(null),s=Mw(),o=Nw(),d=L.useRef(o),p=NH(),l=MH,f=[...l,...p].find(I=>I.id===s)??null,v=f!==null,{pathContextTheaterId:m,pathContext:S,pathContextHydrated:C,pathContextLoading:T,pathContextMutationInProgress:w,pathContextError:_,isPathContextDeckOpen:b}=Ow(),g=e!==null&&m===e&&C&&S!==null,y=DH(s)+(f?.preferredExtraWidth??0)+kL(),k=L.useRef(y);k.current=y;const[M,A]=L.useState(BH),N=L.useRef(M),[R,B]=L.useState(!1);L.useLayoutEffect(()=>{d.current&&!o&&U2(i.current,".command-band-rail-toggle"),d.current=o},[o]),L.useEffect(()=>{Rw(e),e&&EL(e,I=>fL(e,I))},[e]);const q=L.useCallback(I=>{I.preventDefault();const K=I.clientX,H=N.current;B(!0);const P=X=>{const j=K-X.clientX,z=window.innerWidth-148-k.current,D=Math.max(XE,Math.min(z,H+j));N.current=D,A(D)},Y=()=>{document.removeEventListener("pointermove",P),document.removeEventListener("pointerup",Y),B(!1);try{localStorage.setItem(ZE,String(N.current))}catch{}};document.addEventListener("pointermove",P),document.addEventListener("pointerup",Y)},[]),W=L.useMemo(()=>({theaterId:e,pathContext:S??IH,api:t,requestExtraWidth:I=>{s!==null&&CL(s,I)}}),[e,S,t,s]),G=L.useCallback(I=>{e&&Lw(e,K=>xw(e,I,K))},[e]);return u.jsxs("div",{ref:i,className:`right-rail${v?" is-open":""}${o?" is-expanded":" is-closed"}${R?" is-dragging":""}${b?" is-context-deck-open":""}`,"data-rail-chrome":o?"expanded":"closed",role:"complementary","aria-label":"Activity Rail",inert:!o,style:{"--right-rail-panel-width":`${v?M+y:0}px`},children:[u.jsxs("div",{className:"right-rail-panel-slot",style:v?{width:M+y}:void 0,children:[v&&u.jsx("div",{className:"right-rail-resize-handle",onPointerDown:q,"aria-hidden":"true"}),f&&u.jsx(zH,{activePanel:f,activeId:s,ctx:W,theaterId:e,hasHydratedPathContext:g,isPathContextDeckOpen:b,pathContextLoading:T,pathContextMutationInProgress:w,pathContextError:_,onSelectPathContext:G})]}),u.jsx("nav",{className:"right-rail-icons","aria-label":"Activity tools",children:u.jsxs("div",{className:"right-rail-tabs",role:"tablist","aria-label":"Activity panels",children:[l.map(I=>u.jsx(xx,{panel:I,isActive:s===I.id},I.id)),l.length>0&&p.length>0?u.jsx("div",{className:"right-rail-divider",role:"separator","aria-hidden":"true"}):null,p.map(I=>u.jsx(xx,{panel:I,isActive:s===I.id},I.id))]})})]})}const zH=L.memo(function({activePanel:t,activeId:i,ctx:s,theaterId:o,hasHydratedPathContext:d,isPathContextDeckOpen:p,pathContextLoading:l,pathContextMutationInProgress:h,pathContextError:f,onSelectPathContext:v}){const m=L.useRef(null),S=L.useRef(null),C=L.useRef(!1),T=t.pathAware===!0,w=L.useSyncExternalStore(cw,()=>pc().theaters.find(y=>y.id===o)?.label??"Theater"),_=bL(T,o,d);L.useEffect(()=>{if(C.current&&!p){const y=requestAnimationFrame(()=>m.current?.focus());return C.current=p,()=>cancelAnimationFrame(y)}C.current=p},[p]),L.useEffect(()=>{if(!p)return;const y=k=>{const M=k.target;!(M instanceof Node)||m.current?.contains(M)||S.current?.contains(M)||vh(!1)};return document.addEventListener("pointerdown",y),()=>document.removeEventListener("pointerdown",y)},[p]);const b=L.useCallback(()=>vh(!1),[]),g=L.useCallback(y=>{v(y)},[v]);return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"right-rail-panel-head",children:[T?u.jsxs("button",{ref:m,className:`rail-context-title-trigger${p?" is-open":""}`,type:"button",disabled:!d||l||h,"aria-expanded":p,"aria-haspopup":"dialog",title:f??t.title,onClick:()=>vh(!p),children:[u.jsx("span",{className:"rail-context-title-text",children:t.title}),u.jsx("span",{className:"rail-context-label",title:o===null?"Theater-wide":d?s.pathContext.label:"Loading…",children:o===null?"Theater-wide":d?s.pathContext.label:"Loading…"}),u.jsx("span",{className:"rail-context-title-caret","aria-hidden":"true",children:"⌄"})]}):u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"right-rail-panel-title",children:t.title}),u.jsx("span",{className:"rail-context-label",children:"Theater-wide"})]}),u.jsx("button",{className:"right-rail-close-btn",type:"button","aria-label":`Close ${t.title}`,onClick:SL,children:"✕"}),T&&d&&p&&o?u.jsx(Tw,{ref:S,theaterId:o,theaterLabel:w,context:s.pathContext,isMutating:h,onSelect:g,onClose:b}):null]}),u.jsx("div",{className:"right-rail-panel-body",role:"tabpanel","aria-labelledby":`rail-tab-${i}`,children:_?t.render(s):u.jsx("div",{className:"rail-context-tree-status",children:"Loading path context…"})})]})});function xx({panel:e,isActive:t}){const i=L.useCallback(()=>yL(e.id),[e.id]),s=typeof e.icon=="function"?e.icon():e.icon;return u.jsx("button",{id:`rail-tab-${e.id}`,className:`right-rail-ico${t?" is-active":""}`,type:"button",role:"tab","aria-selected":t,"aria-label":e.title,title:e.title,onClick:i,children:s})}const HH='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function $H(){const{codexReader:e,codexReaderExpanded:t,activeTheaterId:i}=cr(),s=L.useRef(null),o=L.useRef(null),d=L.useRef(null),p=e?`${e.kind}:${e.kind==="entry"?e.entryId:e.kind==="drydock"?e.patchId??"":e.id??""}`:null,l=e!==null&&t,h=L.useCallback(()=>{cH(),y3()},[]);return L.useEffect(()=>{if(!l)return;const f=e;document.body.setAttribute("data-codex-reading","true");const v=document.querySelector(".operations-canvas"),m=document.querySelector(".operations-side-bar");v?.setAttribute("inert",""),m?.setAttribute("inert","");const S=C=>{if(C.key==="Escape"){C.preventDefault(),C.stopPropagation(),h();return}C.key==="Tab"&&UH(s.current,C)};return window.addEventListener("keydown",S,!0),()=>{window.removeEventListener("keydown",S,!0),document.body.removeAttribute("data-codex-reading"),v?.removeAttribute("inert"),m?.removeAttribute("inert");const C=f?.kind==="entry"?f.entryId:null;(document.querySelector('[data-codex-expand="true"]')??(C?document.querySelector(`.codex-nav-entry.is-current[data-entry-id="${C}"]`):null)??document.querySelector(".codex-navigator .codex-nav-search-input"))?.focus()}},[l]),L.useEffect(()=>{if(!l||!o.current||!d.current||!e)return;const f=e.kind,v=f==="drydock"?e.patchId:f==="conflicts"?e.id:void 0;qE(o.current,d.current,{initialEntryId:f==="entry"?e.entryId:"",kind:f,subId:v,theaterId:i,onRelatedClick:m=>{Wr({kind:"entry",entryId:m}),_h()},onClose:h,onPatchOpen:m=>{Wr({kind:"drydock",patchId:m}),_h()},onDecided:()=>{id(),Wr({kind:"drydock",patchId:void 0}),_h()}}),requestAnimationFrame(()=>{s.current?.querySelector("[data-sheet-initial-focus]")?.focus()})},[l,p]),l?Os.createPortal(u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"codex-reading-scrim",onClick:h,"aria-hidden":"true"}),u.jsxs("div",{ref:s,className:"codex-reading-sheet",role:"dialog","aria-modal":"true","aria-label":"Codex reading",children:[u.jsxs("div",{className:"codex-reading-sheet-head",children:[u.jsx("span",{className:"codex-reading-sheet-eyebrow",children:"Codex · Reading"}),u.jsx("button",{"data-sheet-initial-focus":!0,className:"codex-reading-sheet-close",type:"button","aria-label":"Close reading",onClick:h,children:"✕"})]}),u.jsxs("div",{className:"codex-reading-sheet-body",children:[u.jsx("div",{ref:o,className:"codex-reading-sheet-read"}),u.jsx("aside",{ref:d,className:"codex-reading-sheet-toc","aria-label":"On this page"})]})]})]}),document.body):null}function UH(e,t){if(!e)return;const i=[...e.querySelectorAll(HH)].filter(d=>!d.closest("[inert]"));if(i.length===0)return;const s=i[0],o=i[i.length-1];t.shiftKey?document.activeElement===s&&(t.preventDefault(),o.focus()):document.activeElement===o&&(t.preventDefault(),s.focus())}const FH=wd().api,qg=560,Kg=360,Dm=new Set;function WH({state:e}){const t=L.useRef(null),i=G2(),s=yd(),o=q2(),d=Io(),[p,l]=L.useState([]),h=L.useMemo(()=>GH(e).map(I=>I.id),[e.operations,e.activeTheaterId]),f=L.useRef(e);f.current=e;const v=L.useCallback(()=>{Ng()},[]);L.useEffect(()=>{ZI(e.activeTheaterId)},[e.activeTheaterId]),L.useEffect(()=>{if(!e.activeTheaterId){l([]);return}Tx().then(l).catch(()=>{})},[e.activeTheaterId]),L.useEffect(()=>{const I={current:i},K={current:s},H=P=>{if(!P3()||!P.altKey||P.metaKey||P.ctrlKey)return;const Y=document.activeElement;if(Y instanceof HTMLElement&&Y.matches("input, textarea, [contenteditable='true']")&&!Y.closest(".xterm"))return;if(P.code==="KeyF"){P.preventDefault(),P.stopImmediatePropagation(),Ng({restoreMinimized:P.shiftKey});return}if(P.shiftKey||P.key!=="ArrowLeft"&&P.key!=="ArrowRight")return;const X=f.current,j=Ao(),z=fw(X.operations.filter(V=>V.theaterId===X.activeTheaterId),X.groups.filter(V=>V.theaterId===X.activeTheaterId),j.operationOrder,j.collapsedGroups).map(V=>V.id);if(z.length===0)return;P.preventDefault(),P.stopImmediatePropagation();const D=I.current??f.current.activeOperationId,U=v3(z,D,P.key==="ArrowRight"?1:-1);if(U){if(K.current){hh(U),Mi(U);return}if(I.current){Mi(U),cc(U);return}mc(U)}};return window.addEventListener("keydown",H,!0),()=>window.removeEventListener("keydown",H,!0)},[s,v,i]),L.useEffect(()=>{for(const I of h)YI(I);e.operationsHydrated&&XI(h)},[h,e.operationsHydrated]),L.useEffect(()=>{const I=e.pendingOperationFocus;if(I===null)return;if(s){hh(I),Mi(I),Bp();return}if(Ag()!==null){cc(I),Bp();return}ga();const K=wx(t.current);K&&WS(I,K),Bp()},[s,e.pendingOperationFocus]);const m=!!e.activeTheaterId&&!e.addingTheater;(e.operations??[]).filter(I=>I.theaterId===e.activeTheaterId);const S=L.useCallback((I,K)=>d.plugins.find(P=>P.id===I)?.renderLaunchIcon?.(K)??null,[d.plugins]),C=L.useCallback((I,K,H)=>{if(!f.current.activeTheaterId)return;const P={...Cx(H),zIndex:ma()};jm(I,K,P,f.current.activeTheaterId,d.plugins)},[d.plugins]),T=L.useCallback((I,K)=>{if(!f.current.activeTheaterId)return;const H=KH(t.current),P={...Cx(H),zIndex:ma()};jm(I,K,P,f.current.activeTheaterId,d.plugins)},[d.plugins]),w=L.useCallback((I,K,H)=>{f.current.activeTheaterId&&jm(I,K,H,f.current.activeTheaterId,d.plugins)},[d.plugins]),_=L.useCallback(()=>{K2({x:0,y:0,zoom:1})},[]),b=L.useCallback(I=>{const K=f.current.operations.find(j=>j.id===I);if(!K)return;if(K.theaterId!==f.current.activeTheaterId){mc(I);return}if(Rg()){hh(I),Mi(I);return}const H=Ag();if(H!==null&&H!==I){Mi(I),cc(I);return}const P=Ao(),Y=P.operations[I]??K.geometry??qH(K);P.operations[I]||Mg(I,Y),hh(I),Mi(I);const X=wx(t.current);X&&WS(I,X)},[]),g=L.useCallback((I,K)=>{gh(I,{accent:K}).then(()=>gi(null)).then(_i).catch(()=>{})},[]),y=L.useCallback((I,K)=>{Qx(I,K).then(()=>gi(null)).then(_i).catch(()=>{})},[]),k=L.useCallback((I,K)=>{gh(I,{groupId:K}).then(()=>gi(null)).then(_i).catch(()=>{})},[]),M=L.useCallback((I,K,H)=>{AR({theaterId:I,name:K,color:"blue"}).then(P=>H?gh(H,{groupId:P.id}).then(()=>{}):void 0).then(()=>Promise.all([gi(null).then(_i),ta().then(na)])).catch(()=>{})},[]),A=L.useCallback((I,K)=>{K&&Ip(I,{color:K}).then(()=>ta()).then(na).catch(()=>{})},[]),N=L.useCallback((I,K)=>{Ip(I,{name:K}).then(()=>ta()).then(na).catch(()=>{})},[]),R=L.useCallback(I=>{const K=new Map(f.current.groups.map(P=>[P.id,P])),H=I.flatMap((P,Y)=>{const X=K.get(P);return!X||X.order===Y?[]:[Ip(P,{order:Y})]});H.length!==0&&Promise.allSettled(H).then(()=>ta()).then(na).catch(()=>{})},[]),B=L.useCallback(I=>{RR(I).then(()=>Promise.all([gi(null).then(_i),ta().then(na)])).catch(()=>{})},[]),q=L.useCallback(I=>{if(Dm.has(I))return;Dm.add(I);const K=f.current.operations.find(P=>P.id===I)?.pluginId,H=(K?d.plugins.find(P=>P.id===K):null)??null;VH(I,H).finally(()=>Dm.delete(I))},[d.plugins]),W=L.useCallback(async I=>{hw();try{const K=await Jx(I),H=await Zx(K);dw(H)}catch(K){Gm(K instanceof Error?K.message:String(K))}},[]),G=L.useCallback(async I=>{const K=()=>Promise.all([gi(null).then(_i),ta().then(na)]).then(()=>{}).catch(()=>{});try{await TR(I),Yy(I),await K()}catch(H){if(H instanceof ht&&H.status===404){Yy(I),await K();return}Gm(H instanceof Error?H.message:String(H))}},[]);return u.jsxs("div",{className:"console-body is-canvas",children:[u.jsx(HB,{theaters:e.theaters,activeTheaterId:e.activeTheaterId,operations:e.operations,groups:e.groups,minimized:o,activeOperationId:e.activeOperationId,operationNotifications:e.operationNotifications,catalog:p,canLaunch:m,addingTheater:e.addingTheater,theaterError:e.theaterError,renderKindIcon:S,onLaunchKind:T,onResetView:_,onClose:q,onFocus:b,onSetAccent:g,onRename:y,onSetGroupId:k,onCreateGroup:M,onSetGroupColor:A,onRenameGroup:N,onReorderGroups:R,onUngroupAll:B,onSelectTheater:p3,onAddTheater:W,onCancelAddTheater:_3,onForgetTheater:G}),u.jsx("div",{className:"operations-center-stage",ref:t,children:u.jsx(cz,{state:e,catalog:p,canLaunch:m,renderKindIcon:S,onLaunchKind:C,onLaunchAtGeometry:w,onResetView:_,onToggleFormation:v,onClose:q,onFocus:b,onSetAccent:g})}),u.jsx(PH,{theaterId:e.activeTheaterId,api:FH}),u.jsx($H,{})]})}function GH(e){return e.operations.filter(t=>t.theaterId===e.activeTheaterId).sort(qm)}function wx(e){if(!e)return null;const t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function qH(e){return e.geometry??{x:0,y:0,width:qg,height:Kg,zIndex:0}}function KH(e){const t=Ao(),i=e?.clientWidth??800,s=e?.clientHeight??600;return kc({x:i/2,y:s/2},t.viewport)}function Cx(e){return{x:e.x-qg/2,y:e.y-Kg/2,width:qg,height:Kg}}async function jm(e,t,i,s,o){const d=o.find(m=>m.id===e),l=wd(()=>{gi(null).then(_i).catch(()=>{})});let h=null;if(d?.launch?h=(await d.launch({theaterId:s,kind:t,geometry:i,operations:l.operations})).id:h=(await l.operations.create({theaterId:s,type:t.type,pluginId:e,title:t.title,geometry:i})).id,await gi(null).then(_i).catch(()=>{}),!h)return;const f=WI()===s,v=pc().operations.some(m=>m.id===h);f&&v&&Ag()!==null?(Mi(h),cc(h)):mc(h)}async function VH(e,t){try{t?.closeOperation&&await t.closeOperation(e)}catch{}await fetch(`/api/v1/operations/${encodeURIComponent(e)}`,{method:"DELETE"}).catch(()=>{}),await gi(null).then(_i).catch(()=>{})}const YH=3e4;let fh=1e3,ql=null,Im=null,Bm=!1;function JE(){ql!==null&&(clearTimeout(ql),ql=null);const e=new EventSource("/api/v1/operations/events");e.addEventListener("operation:changed",t=>{const i=t;try{const s=JSON.parse(i.data);XH(s.operation)&&f3(s.operation)}catch{}}),e.addEventListener("update:available",()=>{Ac()}),e.onopen=()=>{fh=1e3,Ac()},e.onerror=()=>{e.close(),ql=setTimeout(()=>{ql=null,fh=Math.min(fh*2,YH),gi().then(_i).catch(()=>{}).finally(JE)},fh)}}function Ac(){if(Im){Bm=!0;return}Im=SR(pc().activeTheaterId).then(r3).catch(()=>{}).finally(()=>{Im=null,Bm&&(Bm=!1,Ac())})}function XH(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const ZH=6e3;function JH(){const e=cr(),t=lr(),i=Io(),s=G_(),o=xE(s.state?.language??"auto"),p=t.pathname.startsWith("/operations");return L.useEffect(()=>{const l=wd(()=>{gi().then(_i).catch(()=>{})}),h=i.plugins.map(f=>f.install?.(l)).filter(f=>typeof f=="function");return()=>{for(const f of h)f()}},[i.plugins]),L.useEffect(()=>{i3(p)},[p]),L.useEffect(()=>{const l=new AbortController;yR(l.signal).then(f=>{d3(f),Vy()}).catch(f=>{l.signal.aborted||(it({theaterError:f instanceof Error?f.message:String(f)}),Vy())}),gi(null,l.signal).then(_i).catch(()=>{}),ta(null,l.signal).then(na).catch(()=>{}),Ac();const h=window.setTimeout(Ac,ZH);return()=>{window.clearTimeout(h),l.abort()}},[]),L.useEffect(()=>(SE({locale:o}),g9),[o]),L.useEffect(()=>{const l=h=>{yw()||(h.metaKey||h.ctrlKey)&&h.key.toLowerCase()==="k"&&(h.preventDefault(),h.stopImmediatePropagation(),pw())};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[]),u.jsxs("div",{className:"console-shell",children:[u.jsx(XB,{operationsViewVisible:p}),u.jsx("main",{className:"console-route-content",children:u.jsxs(zA,{children:[u.jsx(ro,{path:"/",element:u.jsx(Uy,{to:"/operations",replace:!0})}),u.jsx(ro,{path:"/operations",element:u.jsx(WH,{state:e})}),u.jsx(ro,{path:"/carrier-settings",element:u.jsx(G9,{})}),u.jsx(ro,{path:"/settings",element:u.jsx(SP,{})}),u.jsx(ro,{path:"*",element:u.jsx(Uy,{to:"/operations",replace:!0})})]})}),u.jsx(i9,{state:e}),u.jsx(b9,{state:e}),u.jsx(e9,{state:e}),u.jsx(c9,{open:e.connectionError!==null,tone:"error",title:"Console link interrupted",message:e.connectionError??void 0})]})}globalThis.__fleetConsoleRuntime__={react:Lh,"react/jsx-runtime":rT,"@fleet-console/sdk/plugin/browser":CT,"@fleet-console/sdk/settings/browser":MT,"@fleet-console/sdk/operations/browser":dT,"@fleet-console/sdk/notifications/browser":OT,"@fleet-console/sdk/react/browser":jT};Ih("instrument");c3();try{const e=await _E();Ih(e.theme),Wm(e.uiFont),f9(e)}catch{}const QH=await cI();JE();const Ex=document.querySelector("#app");Ex&&$T.createRoot(Ex).render(u.jsx(L.StrictMode,{children:u.jsx(cR,{basename:"/console",children:u.jsx(lI,{value:QH,children:u.jsx(JH,{})})})}));export{N8 as _,e$ as a,Vg as g,Mt as k,oc as p};