@tui-sandbox/library 10.6.0 → 10.6.1

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.
@@ -1,9 +0,0 @@
1
- var sr=Object.defineProperty;var nr=(e,t,c)=>t in e?sr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:c}):e[t]=c;var se=(e,t,c)=>nr(e,typeof t!="symbol"?t+"":t,c);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const E of document.querySelectorAll('link[rel="modulepreload"]'))b(E);new MutationObserver(E=>{for(const L of E)if(L.type==="childList")for(const x of L.addedNodes)x.tagName==="LINK"&&x.rel==="modulepreload"&&b(x)}).observe(document,{childList:!0,subtree:!0});function c(E){const L={};return E.integrity&&(L.integrity=E.integrity),E.referrerPolicy&&(L.referrerPolicy=E.referrerPolicy),E.crossOrigin==="use-credentials"?L.credentials="include":E.crossOrigin==="anonymous"?L.credentials="omit":L.credentials="same-origin",L}function b(E){if(E.ep)return;E.ep=!0;const L=c(E);fetch(E.href,L)}})();function ve(e){const t={subscribe(c){let b=null,E=!1,L=!1,x=!1;function n(){if(b===null){x=!0;return}L||(L=!0,typeof b=="function"?b():b&&b.unsubscribe())}return b=e({next(a){var l;E||(l=c.next)==null||l.call(c,a)},error(a){var l;E||(E=!0,(l=c.error)==null||l.call(c,a),n())},complete(){var a;E||(E=!0,(a=c.complete)==null||a.call(c),n())}}),x&&n(),{unsubscribe:n}},pipe(...c){return c.reduce(or,t)}};return t}function or(e,t){return t(e)}function ar(e){const t=new AbortController;return new Promise((b,E)=>{let L=!1;function x(){L||(L=!0,n.unsubscribe())}t.signal.addEventListener("abort",()=>{E(t.signal.reason)});const n=e.subscribe({next(a){L=!0,b(a),x()},error(a){E(a)},complete(){t.abort(),x()}})})}function cr(e){return t=>{let c=0,b=null;const E=[];function L(){b||(b=t.subscribe({next(n){var a;for(const l of E)(a=l.next)==null||a.call(l,n)},error(n){var a;for(const l of E)(a=l.error)==null||a.call(l,n)},complete(){var n;for(const a of E)(n=a.complete)==null||n.call(a)}}))}function x(){if(c===0&&b){const n=b;b=null,n.unsubscribe()}}return ve(n=>(c++,E.push(n),L(),{unsubscribe(){c--,x();const a=E.findIndex(l=>l===n);a>-1&&E.splice(a,1)}}))}}function hr(e){let t=e;const c=[],b=x=>{t!==void 0&&x.next(t),c.push(x)},E=x=>{c.splice(c.indexOf(x),1)},L=ve(x=>(b(x),()=>{E(x)}));return L.next=x=>{if(t!==x){t=x;for(const n of c)n.next(x)}},L.get=()=>t,L}function Dt(e){return ve(t=>{function c(E=0,L=e.op){const x=e.links[E];if(!x)throw new Error("No more links to execute - did you forget to add an ending link?");return x({op:L,next(a){return c(E+1,a)}})}return c().subscribe(t)})}function st(e){return Array.isArray(e)?e:[e]}function Lt(e){return t=>{const c=st(e.true).map(E=>E(t)),b=st(e.false).map(E=>E(t));return E=>ve(L=>{const x=e.condition(E.op)?c:b;return Dt({op:E.op,links:x}).subscribe(L)})}}const Oe={INTERNAL_SERVER_ERROR:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603},lr=[Oe.BAD_GATEWAY,Oe.SERVICE_UNAVAILABLE,Oe.GATEWAY_TIMEOUT,Oe.INTERNAL_SERVER_ERROR];function Ee(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}const At=e=>e(),Bt=()=>{},nt=e=>{Object.freeze&&Object.freeze(e)};function Tt(e,t,c){const b=t.join(".");return c[b]??(c[b]=new Proxy(Bt,{get(E,L){if(!(typeof L!="string"||L==="then"))return Tt(e,[...t,L],c)},apply(E,L,x){const n=t[t.length-1];let a={args:x,path:t};return n==="call"?a={args:x.length>=2?[x[1]]:[],path:t.slice(0,-1)}:n==="apply"&&(a={args:x.length>=2?x[1]:[],path:t.slice(0,-1)}),nt(a.args),nt(a.path),e(a)}})),c[b]}const ur=e=>Tt(e,[],Object.create(null)),dr=e=>new Proxy(Bt,{get(t,c){if(c!=="then")return e(c)}});function fr(e,t){if("error"in e){const b=t.deserialize(e.error);return{ok:!1,error:{...e,error:b}}}return{ok:!0,result:{...e.result,...(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)}}}}var qe=class extends Error{constructor(){super("Unable to transform response from server")}};function _r(e,t){let c;try{c=fr(e,t)}catch{throw new qe}if(!c.ok&&(!Ee(c.error.error)||typeof c.error.error.code!="number"))throw new qe;if(c.ok&&!Ee(c.result))throw new qe;return c}var pr=Object.create,Ot=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,Pt=Object.getOwnPropertyNames,vr=Object.getPrototypeOf,mr=Object.prototype.hasOwnProperty,br=(e,t)=>function(){return t||(0,e[Pt(e)[0]])((t={exports:{}}).exports,t),t.exports},Sr=(e,t,c,b)=>{if(t&&typeof t=="object"||typeof t=="function")for(var E=Pt(t),L=0,x=E.length,n;L<x;L++)n=E[L],!mr.call(e,n)&&n!==c&&Ot(e,n,{get:(a=>t[a]).bind(null,n),enumerable:!(b=gr(t,n))||b.enumerable});return e},Re=(e,t,c)=>(c=e!=null?pr(vr(e)):{},Sr(Ot(c,"default",{value:e,enumerable:!0}),e));const Ke=new WeakMap,Cr=()=>{};var Rt,he,Mt=(Rt=Symbol.toStringTag,he=class{constructor(t){se(this,"promise");se(this,"subscribers",[]);se(this,"settlement",null);se(this,Rt,"Unpromise");typeof t=="function"?this.promise=new Promise(t):this.promise=t;const c=this.promise.then(b=>{const{subscribers:E}=this;this.subscribers=null,this.settlement={status:"fulfilled",value:b},E==null||E.forEach(({resolve:L})=>{L(b)})});"catch"in c&&c.catch(b=>{const{subscribers:E}=this;this.subscribers=null,this.settlement={status:"rejected",reason:b},E==null||E.forEach(({reject:L})=>{L(b)})})}subscribe(){let t,c;const{settlement:b}=this;if(b===null){if(this.subscribers===null)throw new Error("Unpromise settled but still has subscribers");const E=yr();this.subscribers=Er(this.subscribers,E),t=E.promise,c=()=>{this.subscribers!==null&&(this.subscribers=xr(this.subscribers,E))}}else{const{status:E}=b;E==="fulfilled"?t=Promise.resolve(b.value):t=Promise.reject(b.reason),c=Cr}return Object.assign(t,{unsubscribe:c})}then(t,c){const b=this.subscribe(),{unsubscribe:E}=b;return Object.assign(b.then(t,c),{unsubscribe:E})}catch(t){const c=this.subscribe(),{unsubscribe:b}=c;return Object.assign(c.catch(t),{unsubscribe:b})}finally(t){const c=this.subscribe(),{unsubscribe:b}=c;return Object.assign(c.finally(t),{unsubscribe:b})}static proxy(t){const c=he.getSubscribablePromise(t);return typeof c<"u"?c:he.createSubscribablePromise(t)}static createSubscribablePromise(t){const c=new he(t);return Ke.set(t,c),Ke.set(c,c),c}static getSubscribablePromise(t){return Ke.get(t)}static resolve(t){const c=typeof t=="object"&&t!==null&&"then"in t&&typeof t.then=="function"?t:Promise.resolve(t);return he.proxy(c).subscribe()}static async any(t){const b=(Array.isArray(t)?t:[...t]).map(he.resolve);try{return await Promise.any(b)}finally{b.forEach(({unsubscribe:E})=>{E()})}}static async race(t){const b=(Array.isArray(t)?t:[...t]).map(he.resolve);try{return await Promise.race(b)}finally{b.forEach(({unsubscribe:E})=>{E()})}}static async raceReferences(t){const c=t.map(wr);try{return await Promise.race(c)}finally{for(const b of c)b.unsubscribe()}}},he);function wr(e){return Mt.proxy(e).then(()=>[e])}function yr(){let e,t;return{promise:new Promise((b,E)=>{e=b,t=E}),resolve:e,reject:t}}function Er(e,t){return[...e,t]}function kr(e,t){return[...e.slice(0,t),...e.slice(t+1)]}function xr(e,t){const c=e.indexOf(t);return c!==-1?kr(e,c):e}Symbol.dispose??(Symbol.dispose=Symbol());Symbol.asyncDispose??(Symbol.asyncDispose=Symbol());function Rr(e,t){const c=e,b=c[Symbol.dispose];return c[Symbol.dispose]=()=>{t(),b==null||b()},c}function Dr(e,t){const c=e,b=c[Symbol.asyncDispose];return c[Symbol.asyncDispose]=async()=>{await t(),await(b==null?void 0:b())},c}const It=Symbol();function Lr(e){let t=null;return Rr({start(){if(t)throw new Error("Timer already started");return new Promise(b=>{t=setTimeout(()=>b(It),e)})}},()=>{t&&clearTimeout(t)})}var De=br({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){function c(){var b=typeof SuppressedError=="function"?SuppressedError:function(n,a){var l=Error();return l.name="SuppressedError",l.error=n,l.suppressed=a,l},E={},L=[];function x(n,a){if(a!=null){if(Object(a)!==a)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(n)var l=a[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(l===void 0&&(l=a[Symbol.dispose||Symbol.for("Symbol.dispose")],n))var g=l;if(typeof l!="function")throw new TypeError("Object is not disposable.");g&&(l=function(){try{g.call(a)}catch(f){return Promise.reject(f)}}),L.push({v:a,d:l,a:n})}else n&&L.push({d:a,a:n});return a}return{e:E,u:x.bind(null,!1),a:x.bind(null,!0),d:function(){var a,l=this.e,g=0;function h(){for(;a=L.pop();)try{if(!a.a&&g===1)return g=0,L.push(a),Promise.resolve().then(h);if(a.d){var p=a.d.call(a.v);if(a.a)return g|=2,Promise.resolve(p).then(h,f)}else g|=1}catch(S){return f(S)}if(g===1)return l!==E?Promise.reject(l):Promise.resolve();if(l!==E)throw l}function f(p){return l=l!==E?new b(p,l):p,h()}return h()}}}t.exports=c,t.exports.__esModule=!0,t.exports.default=t.exports}});Re(De());Re(De());Re(De());Re(De());var Ht=Re(De());const Ar="ping",Br="serialized-error",Tr="connected",Or="return";async function Pr(e){try{var t=(0,Ht.default)();const c=t.u(Lr(e.timeoutMs)),b=await Mt.race([e.promise,c.start()]);return b===It?await e.onTimeout():b}catch(c){t.e=c}finally{t.d()}}function Mr(e){const{deserialize:t=n=>n}=e;let c={};const b=e.signal;let E=null;const L=()=>new ReadableStream({async start(n){const[a,l]=await Promise.all([e.url(),e.init()]),g=E=new e.EventSource(a,l);n.enqueue({type:"connecting",eventSource:E,event:null}),g.addEventListener(Tr,f=>{const S=JSON.parse(f.data);c=S,n.enqueue({type:"connected",options:S,eventSource:g})}),g.addEventListener(Br,f=>{const p=f;n.enqueue({type:"serialized-error",error:t(JSON.parse(p.data)),eventSource:g})}),g.addEventListener(Ar,()=>{n.enqueue({type:"ping",eventSource:g})}),g.addEventListener(Or,()=>{g.close(),n.close(),E=null}),g.addEventListener("error",f=>{g.readyState===g.CLOSED?n.error(f):n.enqueue({type:"connecting",eventSource:g,event:f})}),g.addEventListener("message",f=>{const p=f,d={data:t(JSON.parse(p.data))};p.lastEventId&&(d.id=p.lastEventId),n.enqueue({type:"data",data:d,eventSource:g})});const h=()=>{try{g.close(),n.close()}catch{}};b.aborted?h():b.addEventListener("abort",h)},cancel(){E==null||E.close()}}),x=()=>{let n=L(),a=n.getReader();async function l(){await a.cancel(),E=null}return Dr({read(){return a.read()},async recreate(){await l(),n=L(),a=n.getReader()}},l)};return At(async function*(){try{var n=(0,Ht.default)();const a=n.a(x());for(;;){let l=a.read();const g=c.reconnectAfterInactivityMs;g&&(l=Pr({promise:l,timeoutMs:g,onTimeout:async()=>{const f={value:{type:"timeout",ms:g,eventSource:E},done:!1};return await a.recreate(),f}}));const h=await l;if(h.done)return h.value;yield h.value}}catch(a){n.e=a}finally{await n.d()}})}function Ir(e){return e instanceof ge}function Hr(e){return Ee(e)&&Ee(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function Fr(e,t){return typeof e=="string"?e:Ee(e)&&typeof e.message=="string"?e.message:t}var ge=class Ie extends Error{constructor(c,b){var L,x;const E=b==null?void 0:b.cause;super(c,{cause:E});se(this,"cause");se(this,"shape");se(this,"data");se(this,"meta");this.meta=b==null?void 0:b.meta,this.cause=E,this.shape=(L=b==null?void 0:b.result)==null?void 0:L.error,this.data=(x=b==null?void 0:b.result)==null?void 0:x.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Ie.prototype)}static from(c,b={}){const E=c;return Ir(E)?(b.meta&&(E.meta={...E.meta,...b.meta}),E):Hr(E)?new Ie(E.error.message,{...b,result:E}):new Ie(Fr(E,"Unknown error"),{...b,cause:E})}};function Ft(e){const t=e;return t?"input"in t?t:{input:t,output:t}:{input:{serialize:c=>c,deserialize:c=>c},output:{serialize:c=>c,deserialize:c=>c}}}const ot=e=>typeof e=="function";function $r(e){if(e)return e;if(typeof window<"u"&&ot(window.fetch))return window.fetch;if(typeof globalThis<"u"&&ot(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function zr(e){return{url:e.url.toString(),fetch:e.fetch,transformer:Ft(e.transformer),methodOverride:e.methodOverride}}function Wr(e){const t={};for(let c=0;c<e.length;c++){const b=e[c];t[c]=b}return t}const Ur={query:"GET",mutation:"POST",subscription:"PATCH"};function $t(e){return"input"in e?e.transformer.input.serialize(e.input):Wr(e.inputs.map(t=>e.transformer.input.serialize(t)))}const Ye=e=>{const t=e.url.split("?");let b=t[0].replace(/\/$/,"")+"/"+e.path;const E=[];if(t[1]&&E.push(t[1]),"inputs"in e&&E.push("batch=1"),e.type==="query"||e.type==="subscription"){const L=$t(e);L!==void 0&&e.methodOverride!=="POST"&&E.push(`input=${encodeURIComponent(JSON.stringify(L))}`)}return E.length&&(b+="?"+E.join("&")),b},Nr=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=$t(e);return t!==void 0?JSON.stringify(t):void 0},jr=e=>Vr({...e,contentTypeHeader:"application/json",getUrl:Ye,getBody:Nr});var Zr=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const qr=e=>{var t;if(e!=null&&e.aborted)throw(t=e.throwIfAborted)==null||t.call(e),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new Zr};async function Kr(e){qr(e.signal);const t=e.getUrl(e),c=e.getBody(e),{type:b}=e,E=await(async()=>{const x=await e.headers();return Symbol.iterator in x?Object.fromEntries(x):x})(),L={...e.contentTypeHeader?{"content-type":e.contentTypeHeader}:{},...e.trpcAcceptHeader?{"trpc-accept":e.trpcAcceptHeader}:void 0,...E};return $r(e.fetch)(t,{method:e.methodOverride??Ur[b],signal:e.signal,body:c,headers:L})}async function Vr(e){const t={},c=await Kr(e);t.response=c;const b=await c.json();return t.responseJSON=b,{json:b,meta:t}}const at=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function ct(e){let t=null,c=null;const b=()=>{clearTimeout(c),c=null,t=null};function E(n){var g,h;const a=[[]];let l=0;for(;;){const f=n[l];if(!f)break;const p=a[a.length-1];if(f.aborted){(g=f.reject)==null||g.call(f,new Error("Aborted")),l++;continue}if(e.validate(p.concat(f).map(d=>d.key))){p.push(f),l++;continue}if(p.length===0){(h=f.reject)==null||h.call(f,new Error("Input is too big for a single dispatch")),l++;continue}a.push([])}return a}function L(){const n=E(t);b();for(const a of n){if(!a.length)continue;const l={items:a};for(const h of a)h.batch=l;e.fetch(l.items.map(h=>h.key)).then(async h=>{var f;await Promise.all(h.map(async(p,S)=>{var s,o;const d=l.items[S];try{const r=await Promise.resolve(p);(s=d.resolve)==null||s.call(d,r)}catch(r){(o=d.reject)==null||o.call(d,r)}d.batch=null,d.reject=null,d.resolve=null}));for(const p of l.items)(f=p.reject)==null||f.call(p,new Error("Missing result")),p.batch=null}).catch(h=>{var f;for(const p of l.items)(f=p.reject)==null||f.call(p,h),p.batch=null})}}function x(n){const a={aborted:!1,key:n,batch:null,resolve:at,reject:at},l=new Promise((g,h)=>{a.reject=h,a.resolve=g,t??(t=[]),t.push(a)});return c??(c=setTimeout(L)),l}return{load:x}}function Gr(...e){const t=new AbortController,c=e.length;let b=0;const E=()=>{++b===c&&t.abort()};for(const L of e)L!=null&&L.aborted?E():L==null||L.addEventListener("abort",E,{once:!0});return t.signal}function Jr(...e){const t=new AbortController;for(const c of e)c!=null&&c.aborted?t.abort():c==null||c.addEventListener("abort",()=>t.abort(),{once:!0});return t.signal}function zt(e){const t=zr(e),c=e.maxURLLength??1/0,b=e.maxItems??1/0;return()=>{const E=a=>({validate(l){if(c===1/0&&b===1/0)return!0;if(l.length>b)return!1;const g=l.map(p=>p.path).join(","),h=l.map(p=>p.input);return Ye({...t,type:a,path:g,inputs:h,signal:null}).length<=c},async fetch(l){const g=l.map(s=>s.path).join(","),h=l.map(s=>s.input),f=Gr(...l.map(s=>s.signal)),p=await jr({...t,path:g,inputs:h,type:a,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:l}):e.headers:{}},signal:f});return(Array.isArray(p.json)?p.json:l.map(()=>p.json)).map(s=>({meta:p.meta,json:s}))}}),L=ct(E("query")),x=ct(E("mutation")),n={query:L,mutation:x};return({op:a})=>ve(l=>{/* istanbul ignore if -- @preserve */if(a.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const h=n[a.type].load(a);let f;return h.then(p=>{f=p;const S=_r(p.json,t.transformer.output);if(!S.ok){l.error(ge.from(S.error,{meta:p.meta}));return}l.next({context:p.meta,result:S.result}),l.complete()}).catch(p=>{l.error(ge.from(p,{meta:f==null?void 0:f.meta}))}),()=>{}})}}const Je=(e,...t)=>typeof e=="function"?e(...t):e;var Xr=Object.create,Wt=Object.defineProperty,Yr=Object.getOwnPropertyDescriptor,Ut=Object.getOwnPropertyNames,Qr=Object.getPrototypeOf,ei=Object.prototype.hasOwnProperty,ti=(e,t)=>function(){return t||(0,e[Ut(e)[0]])((t={exports:{}}).exports,t),t.exports},ri=(e,t,c,b)=>{if(t&&typeof t=="object"||typeof t=="function")for(var E=Ut(t),L=0,x=E.length,n;L<x;L++)n=E[L],!ei.call(e,n)&&n!==c&&Wt(e,n,{get:(a=>t[a]).bind(null,n),enumerable:!(b=Yr(t,n))||b.enumerable});return e},ii=(e,t,c)=>(c=e!=null?Xr(Qr(e)):{},ri(Wt(c,"default",{value:e,enumerable:!0}),e)),si=class{constructor(e){se(this,"links");se(this,"runtime");se(this,"requestId");this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){return Dt({links:this.links,op:{...e,context:e.context??{},id:++this.requestId}}).pipe(cr())}async requestAsPromise(e){try{const t=this.$request(e);return(await ar(t)).result.data}catch(t){throw ge.from(t)}}query(e,t,c){return this.requestAsPromise({type:"query",path:e,input:t,context:c==null?void 0:c.context,signal:c==null?void 0:c.signal})}mutation(e,t,c){return this.requestAsPromise({type:"mutation",path:e,input:t,context:c==null?void 0:c.context,signal:c==null?void 0:c.signal})}subscription(e,t,c){return this.$request({type:"subscription",path:e,input:t,context:c.context,signal:c.signal}).subscribe({next(E){var L,x,n,a;switch(E.result.type){case"state":{(L=c.onConnectionStateChange)==null||L.call(c,E.result);break}case"started":{(x=c.onStarted)==null||x.call(c,{context:E.context});break}case"stopped":{(n=c.onStopped)==null||n.call(c);break}case"data":case void 0:{(a=c.onData)==null||a.call(c,E.result.data);break}}},error(E){var L;(L=c.onError)==null||L.call(c,E)},complete(){var E;(E=c.onComplete)==null||E.call(c)}})}};const ni=Symbol.for("trpc_untypedClient"),oi={query:"query",mutate:"mutation",subscribe:"subscription"},ai=e=>oi[e];function ci(e){const t=ur(({path:c,args:b})=>{const E=[...c],L=ai(E.pop()),x=E.join(".");return e[L](x,...b)});return dr(c=>c===ni?e:t[c])}function Nt(e){const t=new si(e);return ci(t)}function hi(e,t){return!t||e!=null&&typeof e!="object"?e:{...e??{},lastEventId:t}}async function li(e){let t=await Je(e.url);if(e.connectionParams){const c=await Je(e.connectionParams),b=t.includes("?")?"&":"?";t+=b+"connectionParams="+encodeURIComponent(JSON.stringify(c))}return t}function jt(e){const t=Ft(e.transformer);return()=>({op:c})=>ve(b=>{const{type:E,path:L,input:x}=c;/* istanbul ignore if -- @preserve */if(E!=="subscription")throw new Error("httpSubscriptionLink only supports subscriptions");let n;const a=new AbortController,l=Jr(c.signal,a.signal),g=Mr({url:async()=>Ye({transformer:t,url:await li(e),input:hi(x,n),path:L,type:E,signal:null}),init:()=>Je(e.eventSourceOptions,{op:c}),signal:l,deserialize:t.output.deserialize,EventSource:e.EventSource??globalThis.EventSource}),h=hr({type:"state",state:"connecting",error:null}),f=h.subscribe({next(p){b.next({result:p})}});return At(async()=>{for await(const p of g)switch(p.type){case"ping":break;case"data":const S=p.data;let d;S.id?(n=S.id,d={id:S.id,data:S}):d={data:S.data},b.next({result:d,context:{eventSource:p.eventSource}});break;case"connected":{b.next({result:{type:"started"},context:{eventSource:p.eventSource}}),h.next({type:"state",state:"pending",error:null});break}case"serialized-error":{const s=ge.from({error:p.error});if(lr.includes(p.error.code)){h.next({type:"state",state:"connecting",error:s});break}throw s}case"connecting":{const s=h.get(),o=p.event&&ge.from(p.event);if(!o&&s.state==="connecting")break;h.next({type:"state",state:"connecting",error:o});break}case"timeout":h.next({type:"state",state:"connecting",error:new ge(`Timeout of ${p.ms}ms reached while waiting for a response`)})}b.next({result:{type:"stopped"}}),h.next({type:"state",state:"idle",error:null}),b.complete()}).catch(p=>{b.error(ge.from(p))}),()=>{b.complete(),a.abort(),f.unsubscribe()}})}var ui=ti({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(e,t){function c(){var b=typeof SuppressedError=="function"?SuppressedError:function(n,a){var l=Error();return l.name="SuppressedError",l.error=n,l.suppressed=a,l},E={},L=[];function x(n,a){if(a!=null){if(Object(a)!==a)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(n)var l=a[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(l===void 0&&(l=a[Symbol.dispose||Symbol.for("Symbol.dispose")],n))var g=l;if(typeof l!="function")throw new TypeError("Object is not disposable.");g&&(l=function(){try{g.call(a)}catch(f){return Promise.reject(f)}}),L.push({v:a,d:l,a:n})}else n&&L.push({d:a,a:n});return a}return{e:E,u:x.bind(null,!1),a:x.bind(null,!0),d:function(){var a,l=this.e,g=0;function h(){for(;a=L.pop();)try{if(!a.a&&g===1)return g=0,L.push(a),Promise.resolve().then(h);if(a.d){var p=a.d.call(a.v);if(a.a)return g|=2,Promise.resolve(p).then(h,f)}else g|=1}catch(S){return f(S)}if(g===1)return l!==E?Promise.reject(l):Promise.resolve();if(l!==E)throw l}function f(p){return l=l!==E?new b(p,l):p,h()}return h()}}}t.exports=c,t.exports.__esModule=!0,t.exports.default=t.exports}});ii(ui());const di={version:"1.7.1",latte:{name:"Latte",emoji:"🌻",order:0,dark:!1,colors:{rosewater:{name:"Rosewater",order:0,hex:"#dc8a78",rgb:{r:220,g:138,b:120},hsl:{h:10.799999999999995,s:.5882352941176472,l:.6666666666666667},accent:!0},flamingo:{name:"Flamingo",order:1,hex:"#dd7878",rgb:{r:221,g:120,b:120},hsl:{h:0,s:.5976331360946746,l:.6686274509803922},accent:!0},pink:{name:"Pink",order:2,hex:"#ea76cb",rgb:{r:234,g:118,b:203},hsl:{h:316.0344827586207,s:.7341772151898731,l:.6901960784313725},accent:!0},mauve:{name:"Mauve",order:3,hex:"#8839ef",rgb:{r:136,g:57,b:239},hsl:{h:266.0439560439561,s:.8504672897196262,l:.5803921568627451},accent:!0},red:{name:"Red",order:4,hex:"#d20f39",rgb:{r:210,g:15,b:57},hsl:{h:347.0769230769231,s:.8666666666666666,l:.4411764705882353},accent:!0},maroon:{name:"Maroon",order:5,hex:"#e64553",rgb:{r:230,g:69,b:83},hsl:{h:354.78260869565213,s:.76303317535545,l:.5862745098039216},accent:!0},peach:{name:"Peach",order:6,hex:"#fe640b",rgb:{r:254,g:100,b:11},hsl:{h:21.975308641975307,s:.9918367346938776,l:.5196078431372549},accent:!0},yellow:{name:"Yellow",order:7,hex:"#df8e1d",rgb:{r:223,g:142,b:29},hsl:{h:34.948453608247426,s:.7698412698412698,l:.49411764705882355},accent:!0},green:{name:"Green",order:8,hex:"#40a02b",rgb:{r:64,g:160,b:43},hsl:{h:109.23076923076923,s:.5763546798029556,l:.39803921568627454},accent:!0},teal:{name:"Teal",order:9,hex:"#179299",rgb:{r:23,g:146,b:153},hsl:{h:183.23076923076923,s:.7386363636363636,l:.34509803921568627},accent:!0},sky:{name:"Sky",order:10,hex:"#04a5e5",rgb:{r:4,g:165,b:229},hsl:{h:197.0666666666667,s:.965665236051502,l:.45686274509803926},accent:!0},sapphire:{name:"Sapphire",order:11,hex:"#209fb5",rgb:{r:32,g:159,b:181},hsl:{h:188.85906040268458,s:.6995305164319249,l:.4176470588235294},accent:!0},blue:{name:"Blue",order:12,hex:"#1e66f5",rgb:{r:30,g:102,b:245},hsl:{h:219.90697674418607,s:.9148936170212768,l:.5392156862745098},accent:!0},lavender:{name:"Lavender",order:13,hex:"#7287fd",rgb:{r:114,g:135,b:253},hsl:{h:230.93525179856115,s:.9720279720279721,l:.7196078431372549},accent:!0},text:{name:"Text",order:14,hex:"#4c4f69",rgb:{r:76,g:79,b:105},hsl:{h:233.79310344827587,s:.16022099447513813,l:.3549019607843137},accent:!1},subtext1:{name:"Subtext 1",order:15,hex:"#5c5f77",rgb:{r:92,g:95,b:119},hsl:{h:233.33333333333334,s:.1279620853080569,l:.4137254901960784},accent:!1},subtext0:{name:"Subtext 0",order:16,hex:"#6c6f85",rgb:{r:108,g:111,b:133},hsl:{h:232.79999999999998,s:.10373443983402494,l:.4725490196078431},accent:!1},overlay2:{name:"Overlay 2",order:17,hex:"#7c7f93",rgb:{r:124,g:127,b:147},hsl:{h:232.17391304347825,s:.09623430962343092,l:.5313725490196078},accent:!1},overlay1:{name:"Overlay 1",order:18,hex:"#8c8fa1",rgb:{r:140,g:143,b:161},hsl:{h:231.42857142857144,s:.10047846889952144,l:.5901960784313726},accent:!1},overlay0:{name:"Overlay 0",order:19,hex:"#9ca0b0",rgb:{r:156,g:160,b:176},hsl:{h:228.00000000000003,s:.11235955056179768,l:.6509803921568628},accent:!1},surface2:{name:"Surface 2",order:20,hex:"#acb0be",rgb:{r:172,g:176,b:190},hsl:{h:226.6666666666667,s:.12162162162162159,l:.7098039215686275},accent:!1},surface1:{name:"Surface 1",order:21,hex:"#bcc0cc",rgb:{r:188,g:192,b:204},hsl:{h:225.00000000000003,s:.13559322033898308,l:.7686274509803922},accent:!1},surface0:{name:"Surface 0",order:22,hex:"#ccd0da",rgb:{r:204,g:208,b:218},hsl:{h:222.85714285714292,s:.1590909090909089,l:.8274509803921568},accent:!1},base:{name:"Base",order:23,hex:"#eff1f5",rgb:{r:239,g:241,b:245},hsl:{h:220.00000000000009,s:.23076923076923136,l:.9490196078431372},accent:!1},mantle:{name:"Mantle",order:24,hex:"#e6e9ef",rgb:{r:230,g:233,b:239},hsl:{h:220.00000000000006,s:.21951219512195116,l:.919607843137255},accent:!1},crust:{name:"Crust",order:25,hex:"#dce0e8",rgb:{r:220,g:224,b:232},hsl:{h:220.00000000000006,s:.20689655172413762,l:.8862745098039215},accent:!1}},ansiColors:{black:{name:"Black",order:0,normal:{name:"Black",hex:"#5c5f77",rgb:{r:92,g:95,b:119},hsl:{h:233.33333333333334,s:.1279620853080569,l:.4137254901960784},code:0},bright:{name:"Bright Black",hex:"#6c6f85",rgb:{r:108,g:111,b:133},hsl:{h:232.79999999999998,s:.10373443983402494,l:.4725490196078431},code:8}},red:{name:"Red",order:1,normal:{name:"Red",hex:"#d20f39",rgb:{r:210,g:15,b:57},hsl:{h:347.0769230769231,s:.8666666666666666,l:.4411764705882353},code:1},bright:{name:"Bright Red",hex:"#de293e",rgb:{r:222,g:41,b:62},hsl:{h:353.0386740331492,s:.7327935222672065,l:.515686274509804},code:9}},green:{name:"Green",order:2,normal:{name:"Green",hex:"#40a02b",rgb:{r:64,g:160,b:43},hsl:{h:109.23076923076923,s:.5763546798029556,l:.39803921568627454},code:2},bright:{name:"Bright Green",hex:"#49af3d",rgb:{r:73,g:175,b:61},hsl:{h:113.68421052631581,s:.48305084745762705,l:.4627450980392157},code:10}},yellow:{name:"Yellow",order:3,normal:{name:"Yellow",hex:"#df8e1d",rgb:{r:223,g:142,b:29},hsl:{h:34.948453608247426,s:.7698412698412698,l:.49411764705882355},code:3},bright:{name:"Bright Yellow",hex:"#eea02d",rgb:{r:238,g:160,b:45},hsl:{h:35.751295336787564,s:.8502202643171807,l:.5549019607843138},code:11}},blue:{name:"Blue",order:4,normal:{name:"Blue",hex:"#1e66f5",rgb:{r:30,g:102,b:245},hsl:{h:219.90697674418607,s:.9148936170212768,l:.5392156862745098},code:4},bright:{name:"Bright Blue",hex:"#456eff",rgb:{r:69,g:110,b:255},hsl:{h:226.77419354838707,s:1,l:.6352941176470588},code:12}},magenta:{name:"Magenta",order:5,normal:{name:"Magenta",hex:"#ea76cb",rgb:{r:234,g:118,b:203},hsl:{h:316.0344827586207,s:.7341772151898731,l:.6901960784313725},code:5},bright:{name:"Bright Magenta",hex:"#fe85d8",rgb:{r:254,g:133,b:216},hsl:{h:318.8429752066116,s:.983739837398374,l:.7588235294117647},code:13}},cyan:{name:"Cyan",order:6,normal:{name:"Cyan",hex:"#179299",rgb:{r:23,g:146,b:153},hsl:{h:183.23076923076923,s:.7386363636363636,l:.34509803921568627},code:6},bright:{name:"Bright Cyan",hex:"#2d9fa8",rgb:{r:45,g:159,b:168},hsl:{h:184.39024390243904,s:.5774647887323943,l:.4176470588235294},code:14}},white:{name:"White",order:7,normal:{name:"White",hex:"#acb0be",rgb:{r:172,g:176,b:190},hsl:{h:226.6666666666667,s:.12162162162162159,l:.7098039215686275},code:7},bright:{name:"Bright White",hex:"#bcc0cc",rgb:{r:188,g:192,b:204},hsl:{h:225.00000000000003,s:.13559322033898308,l:.7686274509803922},code:15}}}},frappe:{name:"Frappé",emoji:"🪴",order:1,dark:!0,colors:{rosewater:{name:"Rosewater",order:0,hex:"#f2d5cf",rgb:{r:242,g:213,b:207},hsl:{h:10.2857142857143,s:.5737704918032784,l:.8803921568627451},accent:!0},flamingo:{name:"Flamingo",order:1,hex:"#eebebe",rgb:{r:238,g:190,b:190},hsl:{h:0,s:.5853658536585367,l:.8392156862745098},accent:!0},pink:{name:"Pink",order:2,hex:"#f4b8e4",rgb:{r:244,g:184,b:228},hsl:{h:316,s:.7317073170731713,l:.8392156862745098},accent:!0},mauve:{name:"Mauve",order:3,hex:"#ca9ee6",rgb:{r:202,g:158,b:230},hsl:{h:276.66666666666663,s:.5901639344262294,l:.7607843137254902},accent:!0},red:{name:"Red",order:4,hex:"#e78284",rgb:{r:231,g:130,b:132},hsl:{h:358.8118811881188,s:.6778523489932885,l:.7078431372549019},accent:!0},maroon:{name:"Maroon",order:5,hex:"#ea999c",rgb:{r:234,g:153,b:156},hsl:{h:357.77777777777777,s:.6585365853658534,l:.7588235294117647},accent:!0},peach:{name:"Peach",order:6,hex:"#ef9f76",rgb:{r:239,g:159,b:118},hsl:{h:20.33057851239669,s:.7908496732026143,l:.7},accent:!0},yellow:{name:"Yellow",order:7,hex:"#e5c890",rgb:{r:229,g:200,b:144},hsl:{h:39.52941176470588,s:.6204379562043796,l:.7313725490196079},accent:!0},green:{name:"Green",order:8,hex:"#a6d189",rgb:{r:166,g:209,b:137},hsl:{h:95.83333333333331,s:.4390243902439024,l:.6784313725490196},accent:!0},teal:{name:"Teal",order:9,hex:"#81c8be",rgb:{r:129,g:200,b:190},hsl:{h:171.5492957746479,s:.3922651933701657,l:.6450980392156862},accent:!0},sky:{name:"Sky",order:10,hex:"#99d1db",rgb:{r:153,g:209,b:219},hsl:{h:189.09090909090907,s:.47826086956521735,l:.7294117647058823},accent:!0},sapphire:{name:"Sapphire",order:11,hex:"#85c1dc",rgb:{r:133,g:193,b:220},hsl:{h:198.62068965517244,s:.5541401273885351,l:.692156862745098},accent:!0},blue:{name:"Blue",order:12,hex:"#8caaee",rgb:{r:140,g:170,b:238},hsl:{h:221.6326530612245,s:.7424242424242424,l:.7411764705882353},accent:!0},lavender:{name:"Lavender",order:13,hex:"#babbf1",rgb:{r:186,g:187,b:241},hsl:{h:238.90909090909093,s:.6626506024096385,l:.8372549019607842},accent:!0},text:{name:"Text",order:14,hex:"#c6d0f5",rgb:{r:198,g:208,b:245},hsl:{h:227.2340425531915,s:.7014925373134333,l:.8686274509803922},accent:!1},subtext1:{name:"Subtext 1",order:15,hex:"#b5bfe2",rgb:{r:181,g:191,b:226},hsl:{h:226.66666666666669,s:.43689320388349495,l:.7980392156862746},accent:!1},subtext0:{name:"Subtext 0",order:16,hex:"#a5adce",rgb:{r:165,g:173,b:206},hsl:{h:228.29268292682926,s:.2949640287769784,l:.7274509803921569},accent:!1},overlay2:{name:"Overlay 2",order:17,hex:"#949cbb",rgb:{r:148,g:156,b:187},hsl:{h:227.69230769230768,s:.22285714285714275,l:.6568627450980392},accent:!1},overlay1:{name:"Overlay 1",order:18,hex:"#838ba7",rgb:{r:131,g:139,b:167},hsl:{h:226.66666666666669,s:.16981132075471703,l:.584313725490196},accent:!1},overlay0:{name:"Overlay 0",order:19,hex:"#737994",rgb:{r:115,g:121,b:148},hsl:{h:229.0909090909091,s:.13360323886639683,l:.515686274509804},accent:!1},surface2:{name:"Surface 2",order:20,hex:"#626880",rgb:{r:98,g:104,b:128},hsl:{h:228.00000000000003,s:.1327433628318584,l:.44313725490196076},accent:!1},surface1:{name:"Surface 1",order:21,hex:"#51576d",rgb:{r:81,g:87,b:109},hsl:{h:227.14285714285714,s:.14736842105263157,l:.37254901960784315},accent:!1},surface0:{name:"Surface 0",order:22,hex:"#414559",rgb:{r:65,g:69,b:89},hsl:{h:230.00000000000003,s:.15584415584415584,l:.30196078431372547},accent:!1},base:{name:"Base",order:23,hex:"#303446",rgb:{r:48,g:52,b:70},hsl:{h:229.0909090909091,s:.18644067796610175,l:.23137254901960785},accent:!1},mantle:{name:"Mantle",order:24,hex:"#292c3c",rgb:{r:41,g:44,b:60},hsl:{h:230.52631578947367,s:.18811881188118806,l:.19803921568627453},accent:!1},crust:{name:"Crust",order:25,hex:"#232634",rgb:{r:35,g:38,b:52},hsl:{h:229.41176470588238,s:.19540229885057467,l:.17058823529411765},accent:!1}},ansiColors:{black:{name:"Black",order:0,normal:{name:"Black",hex:"#51576d",rgb:{r:81,g:87,b:109},hsl:{h:227.14285714285714,s:.14736842105263157,l:.37254901960784315},code:0},bright:{name:"Bright Black",hex:"#626880",rgb:{r:98,g:104,b:128},hsl:{h:228.00000000000003,s:.1327433628318584,l:.44313725490196076},code:8}},red:{name:"Red",order:1,normal:{name:"Red",hex:"#e78284",rgb:{r:231,g:130,b:132},hsl:{h:358.8118811881188,s:.6778523489932885,l:.7078431372549019},code:1},bright:{name:"Bright Red",hex:"#e67172",rgb:{r:230,g:113,b:114},hsl:{h:359.4871794871795,s:.7005988023952096,l:.6725490196078432},code:9}},green:{name:"Green",order:2,normal:{name:"Green",hex:"#a6d189",rgb:{r:166,g:209,b:137},hsl:{h:95.83333333333331,s:.4390243902439024,l:.6784313725490196},code:2},bright:{name:"Bright Green",hex:"#8ec772",rgb:{r:142,g:199,b:114},hsl:{h:100.23529411764706,s:.431472081218274,l:.6137254901960785},code:10}},yellow:{name:"Yellow",order:3,normal:{name:"Yellow",hex:"#e5c890",rgb:{r:229,g:200,b:144},hsl:{h:39.52941176470588,s:.6204379562043796,l:.7313725490196079},code:3},bright:{name:"Bright Yellow",hex:"#d9ba73",rgb:{r:217,g:186,b:115},hsl:{h:41.764705882352935,s:.5730337078651685,l:.6509803921568628},code:11}},blue:{name:"Blue",order:4,normal:{name:"Blue",hex:"#8caaee",rgb:{r:140,g:170,b:238},hsl:{h:221.6326530612245,s:.7424242424242424,l:.7411764705882353},code:4},bright:{name:"Bright Blue",hex:"#7b9ef0",rgb:{r:123,g:158,b:240},hsl:{h:222.05128205128207,s:.7959183673469388,l:.711764705882353},code:12}},magenta:{name:"Magenta",order:5,normal:{name:"Magenta",hex:"#f4b8e4",rgb:{r:244,g:184,b:228},hsl:{h:316,s:.7317073170731713,l:.8392156862745098},code:5},bright:{name:"Bright Magenta",hex:"#f2a4db",rgb:{r:242,g:164,b:219},hsl:{h:317.6923076923077,s:.7499999999999998,l:.7960784313725491},code:13}},cyan:{name:"Cyan",order:6,normal:{name:"Cyan",hex:"#81c8be",rgb:{r:129,g:200,b:190},hsl:{h:171.5492957746479,s:.3922651933701657,l:.6450980392156862},code:6},bright:{name:"Bright Cyan",hex:"#5abfb5",rgb:{r:90,g:191,b:181},hsl:{h:174.05940594059405,s:.44104803493449785,l:.5509803921568628},code:14}},white:{name:"White",order:7,normal:{name:"White",hex:"#a5adce",rgb:{r:165,g:173,b:206},hsl:{h:228.29268292682926,s:.2949640287769784,l:.7274509803921569},code:7},bright:{name:"Bright White",hex:"#b5bfe2",rgb:{r:181,g:191,b:226},hsl:{h:226.66666666666669,s:.43689320388349495,l:.7980392156862746},code:15}}}},macchiato:{name:"Macchiato",emoji:"🌺",order:2,dark:!0,colors:{rosewater:{name:"Rosewater",order:0,hex:"#f4dbd6",rgb:{r:244,g:219,b:214},hsl:{h:9.999999999999963,s:.5769230769230775,l:.8980392156862745},accent:!0},flamingo:{name:"Flamingo",order:1,hex:"#f0c6c6",rgb:{r:240,g:198,b:198},hsl:{h:0,s:.5833333333333333,l:.8588235294117648},accent:!0},pink:{name:"Pink",order:2,hex:"#f5bde6",rgb:{r:245,g:189,b:230},hsl:{h:316.0714285714286,s:.7368421052631583,l:.8509803921568628},accent:!0},mauve:{name:"Mauve",order:3,hex:"#c6a0f6",rgb:{r:198,g:160,b:246},hsl:{h:266.51162790697674,s:.8269230769230772,l:.7960784313725491},accent:!0},red:{name:"Red",order:4,hex:"#ed8796",rgb:{r:237,g:135,b:150},hsl:{h:351.1764705882353,s:.7391304347826088,l:.7294117647058824},accent:!0},maroon:{name:"Maroon",order:5,hex:"#ee99a0",rgb:{r:238,g:153,b:160},hsl:{h:355.05882352941177,s:.7142857142857143,l:.7666666666666666},accent:!0},peach:{name:"Peach",order:6,hex:"#f5a97f",rgb:{r:245,g:169,b:127},hsl:{h:21.355932203389827,s:.8550724637681162,l:.7294117647058824},accent:!0},yellow:{name:"Yellow",order:7,hex:"#eed49f",rgb:{r:238,g:212,b:159},hsl:{h:40.253164556962034,s:.6991150442477877,l:.7784313725490196},accent:!0},green:{name:"Green",order:8,hex:"#a6da95",rgb:{r:166,g:218,b:149},hsl:{h:105.21739130434783,s:.4825174825174825,l:.7196078431372549},accent:!0},teal:{name:"Teal",order:9,hex:"#8bd5ca",rgb:{r:139,g:213,b:202},hsl:{h:171.08108108108107,s:.46835443037974706,l:.6901960784313725},accent:!0},sky:{name:"Sky",order:10,hex:"#91d7e3",rgb:{r:145,g:215,b:227},hsl:{h:188.78048780487802,s:.5942028985507245,l:.7294117647058823},accent:!0},sapphire:{name:"Sapphire",order:11,hex:"#7dc4e4",rgb:{r:125,g:196,b:228},hsl:{h:198.64077669902912,s:.6560509554140128,l:.692156862745098},accent:!0},blue:{name:"Blue",order:12,hex:"#8aadf4",rgb:{r:138,g:173,b:244},hsl:{h:220.188679245283,s:.8281250000000003,l:.7490196078431373},accent:!0},lavender:{name:"Lavender",order:13,hex:"#b7bdf8",rgb:{r:183,g:189,b:248},hsl:{h:234.46153846153848,s:.8227848101265824,l:.8450980392156863},accent:!0},text:{name:"Text",order:14,hex:"#cad3f5",rgb:{r:202,g:211,b:245},hsl:{h:227.4418604651163,s:.6825396825396831,l:.8764705882352941},accent:!1},subtext1:{name:"Subtext 1",order:15,hex:"#b8c0e0",rgb:{r:184,g:192,b:224},hsl:{h:228,s:.39215686274509803,l:.8},accent:!1},subtext0:{name:"Subtext 0",order:16,hex:"#a5adcb",rgb:{r:165,g:173,b:203},hsl:{h:227.36842105263156,s:.2676056338028167,l:.7215686274509804},accent:!1},overlay2:{name:"Overlay 2",order:17,hex:"#939ab7",rgb:{r:147,g:154,b:183},hsl:{h:228.33333333333331,s:.2000000000000001,l:.6470588235294117},accent:!1},overlay1:{name:"Overlay 1",order:18,hex:"#8087a2",rgb:{r:128,g:135,b:162},hsl:{h:227.6470588235294,s:.1545454545454545,l:.5686274509803921},accent:!1},overlay0:{name:"Overlay 0",order:19,hex:"#6e738d",rgb:{r:110,g:115,b:141},hsl:{h:230.32258064516128,s:.12350597609561753,l:.49215686274509807},accent:!1},surface2:{name:"Surface 2",order:20,hex:"#5b6078",rgb:{r:91,g:96,b:120},hsl:{h:229.65517241379308,s:.13744075829383887,l:.4137254901960784},accent:!1},surface1:{name:"Surface 1",order:21,hex:"#494d64",rgb:{r:73,g:77,b:100},hsl:{h:231.11111111111114,s:.15606936416184972,l:.3392156862745098},accent:!1},surface0:{name:"Surface 0",order:22,hex:"#363a4f",rgb:{r:54,g:58,b:79},hsl:{h:230.4,s:.1879699248120301,l:.2607843137254902},accent:!1},base:{name:"Base",order:23,hex:"#24273a",rgb:{r:36,g:39,b:58},hsl:{h:231.8181818181818,s:.23404255319148934,l:.1843137254901961},accent:!1},mantle:{name:"Mantle",order:24,hex:"#1e2030",rgb:{r:30,g:32,b:48},hsl:{h:233.33333333333334,s:.23076923076923075,l:.15294117647058825},accent:!1},crust:{name:"Crust",order:25,hex:"#181926",rgb:{r:24,g:25,b:38},hsl:{h:235.71428571428572,s:.22580645161290322,l:.12156862745098039},accent:!1}},ansiColors:{black:{name:"Black",order:0,normal:{name:"Black",hex:"#494d64",rgb:{r:73,g:77,b:100},hsl:{h:231.11111111111114,s:.15606936416184972,l:.3392156862745098},code:0},bright:{name:"Bright Black",hex:"#5b6078",rgb:{r:91,g:96,b:120},hsl:{h:229.65517241379308,s:.13744075829383887,l:.4137254901960784},code:8}},red:{name:"Red",order:1,normal:{name:"Red",hex:"#ed8796",rgb:{r:237,g:135,b:150},hsl:{h:351.1764705882353,s:.7391304347826088,l:.7294117647058824},code:1},bright:{name:"Bright Red",hex:"#ec7486",rgb:{r:236,g:116,b:134},hsl:{h:351,s:.759493670886076,l:.6901960784313725},code:9}},green:{name:"Green",order:2,normal:{name:"Green",hex:"#a6da95",rgb:{r:166,g:218,b:149},hsl:{h:105.21739130434783,s:.4825174825174825,l:.7196078431372549},code:2},bright:{name:"Bright Green",hex:"#8ccf7f",rgb:{r:140,g:207,b:127},hsl:{h:110.24999999999999,s:.45454545454545453,l:.6549019607843137},code:10}},yellow:{name:"Yellow",order:3,normal:{name:"Yellow",hex:"#eed49f",rgb:{r:238,g:212,b:159},hsl:{h:40.253164556962034,s:.6991150442477877,l:.7784313725490196},code:3},bright:{name:"Bright Yellow",hex:"#e1c682",rgb:{r:225,g:198,b:130},hsl:{h:42.94736842105264,s:.6129032258064515,l:.696078431372549},code:11}},blue:{name:"Blue",order:4,normal:{name:"Blue",hex:"#8aadf4",rgb:{r:138,g:173,b:244},hsl:{h:220.188679245283,s:.8281250000000003,l:.7490196078431373},code:4},bright:{name:"Bright Blue",hex:"#78a1f6",rgb:{r:120,g:161,b:246},hsl:{h:220.47619047619048,s:.8750000000000002,l:.7176470588235294},code:12}},magenta:{name:"Magenta",order:5,normal:{name:"Magenta",hex:"#f5bde6",rgb:{r:245,g:189,b:230},hsl:{h:316.0714285714286,s:.7368421052631583,l:.8509803921568628},code:5},bright:{name:"Bright Magenta",hex:"#f2a9dd",rgb:{r:242,g:169,b:221},hsl:{h:317.26027397260276,s:.7373737373737372,l:.8058823529411765},code:13}},cyan:{name:"Cyan",order:6,normal:{name:"Cyan",hex:"#8bd5ca",rgb:{r:139,g:213,b:202},hsl:{h:171.08108108108107,s:.46835443037974706,l:.6901960784313725},code:6},bright:{name:"Bright Cyan",hex:"#63cbc0",rgb:{r:99,g:203,b:192},hsl:{h:173.65384615384616,s:.4999999999999998,l:.592156862745098},code:14}},white:{name:"White",order:7,normal:{name:"White",hex:"#a5adcb",rgb:{r:165,g:173,b:203},hsl:{h:227.36842105263156,s:.2676056338028167,l:.7215686274509804},code:7},bright:{name:"Bright White",hex:"#b8c0e0",rgb:{r:184,g:192,b:224},hsl:{h:228,s:.39215686274509803,l:.8},code:15}}}},mocha:{name:"Mocha",emoji:"🌿",order:3,dark:!0,colors:{rosewater:{name:"Rosewater",order:0,hex:"#f5e0dc",rgb:{r:245,g:224,b:220},hsl:{h:9.599999999999968,s:.555555555555556,l:.911764705882353},accent:!0},flamingo:{name:"Flamingo",order:1,hex:"#f2cdcd",rgb:{r:242,g:205,b:205},hsl:{h:0,s:.587301587301587,l:.8764705882352941},accent:!0},pink:{name:"Pink",order:2,hex:"#f5c2e7",rgb:{r:245,g:194,b:231},hsl:{h:316.4705882352941,s:.7183098591549301,l:.8607843137254902},accent:!0},mauve:{name:"Mauve",order:3,hex:"#cba6f7",rgb:{r:203,g:166,b:247},hsl:{h:267.4074074074074,s:.8350515463917528,l:.8098039215686275},accent:!0},red:{name:"Red",order:4,hex:"#f38ba8",rgb:{r:243,g:139,b:168},hsl:{h:343.2692307692308,s:.8124999999999998,l:.7490196078431373},accent:!0},maroon:{name:"Maroon",order:5,hex:"#eba0ac",rgb:{r:235,g:160,b:172},hsl:{h:350.4,s:.6521739130434779,l:.7745098039215685},accent:!0},peach:{name:"Peach",order:6,hex:"#fab387",rgb:{r:250,g:179,b:135},hsl:{h:22.95652173913043,s:.92,l:.7549019607843137},accent:!0},yellow:{name:"Yellow",order:7,hex:"#f9e2af",rgb:{r:249,g:226,b:175},hsl:{h:41.35135135135135,s:.8604651162790699,l:.8313725490196078},accent:!0},green:{name:"Green",order:8,hex:"#a6e3a1",rgb:{r:166,g:227,b:161},hsl:{h:115.45454545454544,s:.5409836065573769,l:.7607843137254902},accent:!0},teal:{name:"Teal",order:9,hex:"#94e2d5",rgb:{r:148,g:226,b:213},hsl:{h:170.00000000000003,s:.5735294117647057,l:.7333333333333334},accent:!0},sky:{name:"Sky",order:10,hex:"#89dceb",rgb:{r:137,g:220,b:235},hsl:{h:189.18367346938774,s:.7101449275362316,l:.7294117647058823},accent:!0},sapphire:{name:"Sapphire",order:11,hex:"#74c7ec",rgb:{r:116,g:199,b:236},hsl:{h:198.5,s:.759493670886076,l:.6901960784313725},accent:!0},blue:{name:"Blue",order:12,hex:"#89b4fa",rgb:{r:137,g:180,b:250},hsl:{h:217.1681415929203,s:.9186991869918699,l:.7588235294117647},accent:!0},lavender:{name:"Lavender",order:13,hex:"#b4befe",rgb:{r:180,g:190,b:254},hsl:{h:231.89189189189187,s:.9736842105263159,l:.8509803921568628},accent:!0},text:{name:"Text",order:14,hex:"#cdd6f4",rgb:{r:205,g:214,b:244},hsl:{h:226.15384615384616,s:.6393442622950825,l:.8803921568627451},accent:!1},subtext1:{name:"Subtext 1",order:15,hex:"#bac2de",rgb:{r:186,g:194,b:222},hsl:{h:226.66666666666669,s:.35294117647058837,l:.8},accent:!1},subtext0:{name:"Subtext 0",order:16,hex:"#a6adc8",rgb:{r:166,g:173,b:200},hsl:{h:227.6470588235294,s:.23611111111111102,l:.7176470588235294},accent:!1},overlay2:{name:"Overlay 2",order:17,hex:"#9399b2",rgb:{r:147,g:153,b:178},hsl:{h:228.38709677419354,s:.16756756756756758,l:.6372549019607843},accent:!1},overlay1:{name:"Overlay 1",order:18,hex:"#7f849c",rgb:{r:127,g:132,b:156},hsl:{h:229.65517241379308,s:.12775330396475776,l:.5549019607843138},accent:!1},overlay0:{name:"Overlay 0",order:19,hex:"#6c7086",rgb:{r:108,g:112,b:134},hsl:{h:230.7692307692308,s:.10743801652892565,l:.4745098039215686},accent:!1},surface2:{name:"Surface 2",order:20,hex:"#585b70",rgb:{r:88,g:91,b:112},hsl:{h:232.5,s:.12,l:.39215686274509803},accent:!1},surface1:{name:"Surface 1",order:21,hex:"#45475a",rgb:{r:69,g:71,b:90},hsl:{h:234.2857142857143,s:.13207547169811326,l:.31176470588235294},accent:!1},surface0:{name:"Surface 0",order:22,hex:"#313244",rgb:{r:49,g:50,b:68},hsl:{h:236.84210526315792,s:.16239316239316234,l:.22941176470588237},accent:!1},base:{name:"Base",order:23,hex:"#1e1e2e",rgb:{r:30,g:30,b:46},hsl:{h:240,s:.21052631578947367,l:.14901960784313725},accent:!1},mantle:{name:"Mantle",order:24,hex:"#181825",rgb:{r:24,g:24,b:37},hsl:{h:240,s:.2131147540983607,l:.11960784313725491},accent:!1},crust:{name:"Crust",order:25,hex:"#11111b",rgb:{r:17,g:17,b:27},hsl:{h:240,s:.22727272727272727,l:.08627450980392157},accent:!1}},ansiColors:{black:{name:"Black",order:0,normal:{name:"Black",hex:"#45475a",rgb:{r:69,g:71,b:90},hsl:{h:234.2857142857143,s:.13207547169811326,l:.31176470588235294},code:0},bright:{name:"Bright Black",hex:"#585b70",rgb:{r:88,g:91,b:112},hsl:{h:232.5,s:.12,l:.39215686274509803},code:8}},red:{name:"Red",order:1,normal:{name:"Red",hex:"#f38ba8",rgb:{r:243,g:139,b:168},hsl:{h:343.2692307692308,s:.8124999999999998,l:.7490196078431373},code:1},bright:{name:"Bright Red",hex:"#f37799",rgb:{r:243,g:119,b:153},hsl:{h:343.54838709677415,s:.8378378378378376,l:.7098039215686274},code:9}},green:{name:"Green",order:2,normal:{name:"Green",hex:"#a6e3a1",rgb:{r:166,g:227,b:161},hsl:{h:115.45454545454544,s:.5409836065573769,l:.7607843137254902},code:2},bright:{name:"Bright Green",hex:"#89d88b",rgb:{r:137,g:216,b:139},hsl:{h:121.51898734177213,s:.5031847133757963,l:.692156862745098},code:10}},yellow:{name:"Yellow",order:3,normal:{name:"Yellow",hex:"#f9e2af",rgb:{r:249,g:226,b:175},hsl:{h:41.35135135135135,s:.8604651162790699,l:.8313725490196078},code:3},bright:{name:"Bright Yellow",hex:"#ebd391",rgb:{r:235,g:211,b:145},hsl:{h:44,s:.692307692307692,l:.7450980392156863},code:11}},blue:{name:"Blue",order:4,normal:{name:"Blue",hex:"#89b4fa",rgb:{r:137,g:180,b:250},hsl:{h:217.1681415929203,s:.9186991869918699,l:.7588235294117647},code:4},bright:{name:"Bright Blue",hex:"#74a8fc",rgb:{r:116,g:168,b:252},hsl:{h:217.05882352941174,s:.9577464788732396,l:.7215686274509804},code:12}},magenta:{name:"Magenta",order:5,normal:{name:"Magenta",hex:"#f5c2e7",rgb:{r:245,g:194,b:231},hsl:{h:316.4705882352941,s:.7183098591549301,l:.8607843137254902},code:5},bright:{name:"Bright Magenta",hex:"#f2aede",rgb:{r:242,g:174,b:222},hsl:{h:317.6470588235294,s:.7234042553191488,l:.8156862745098039},code:13}},cyan:{name:"Cyan",order:6,normal:{name:"Cyan",hex:"#94e2d5",rgb:{r:148,g:226,b:213},hsl:{h:170.00000000000003,s:.5735294117647057,l:.7333333333333334},code:6},bright:{name:"Bright Cyan",hex:"#6bd7ca",rgb:{r:107,g:215,b:202},hsl:{h:172.77777777777777,s:.5744680851063831,l:.6313725490196078},code:14}},white:{name:"White",order:7,normal:{name:"White",hex:"#a6adc8",rgb:{r:166,g:173,b:200},hsl:{h:227.6470588235294,s:.23611111111111102,l:.7176470588235294},code:7},bright:{name:"Bright White",hex:"#bac2de",rgb:{r:186,g:194,b:222},hsl:{h:226.66666666666669,s:.35294117647058837,l:.8},code:15}}}}},He=e=>Object.entries(e),{version:Wo,...fi}=di,Zt=He(fi).reduce((e,[t,c])=>(e[t]={...c,colorEntries:He(c.colors),ansiColorEntries:He(c.ansiColors)},e),{});He(Zt);var Ve={exports:{}},ht;function _i(){return ht||(ht=1,function(e,t){(function(c,b){e.exports=b()})(self,()=>(()=>{var c={};return(()=>{var b=c;Object.defineProperty(b,"__esModule",{value:!0}),b.FitAddon=void 0,b.FitAddon=class{activate(E){this._terminal=E}dispose(){}fit(){const E=this.proposeDimensions();if(!E||!this._terminal||isNaN(E.cols)||isNaN(E.rows))return;const L=this._terminal._core;this._terminal.rows===E.rows&&this._terminal.cols===E.cols||(L._renderService.clear(),this._terminal.resize(E.cols,E.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const E=this._terminal._core,L=E._renderService.dimensions;if(L.css.cell.width===0||L.css.cell.height===0)return;const x=this._terminal.options.scrollback===0?0:E.viewport.scrollBarWidth,n=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(n.getPropertyValue("height")),l=Math.max(0,parseInt(n.getPropertyValue("width"))),g=window.getComputedStyle(this._terminal.element),h=a-(parseInt(g.getPropertyValue("padding-top"))+parseInt(g.getPropertyValue("padding-bottom"))),f=l-(parseInt(g.getPropertyValue("padding-right"))+parseInt(g.getPropertyValue("padding-left")))-x;return{cols:Math.max(2,Math.floor(f/L.css.cell.width)),rows:Math.max(1,Math.floor(h/L.css.cell.height))}}}})(),c})())}(Ve)),Ve.exports}var pi=_i(),Ge={exports:{}},lt;function gi(){return lt||(lt=1,function(e,t){(function(c,b){e.exports=b()})(globalThis,()=>(()=>{var c={4567:function(x,n,a){var l=this&&this.__decorate||function(r,i,u,m){var v,C=arguments.length,_=C<3?i:m===null?m=Object.getOwnPropertyDescriptor(i,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(r,i,u,m);else for(var w=r.length-1;w>=0;w--)(v=r[w])&&(_=(C<3?v(_):C>3?v(i,u,_):v(i,u))||_);return C>3&&_&&Object.defineProperty(i,u,_),_},g=this&&this.__param||function(r,i){return function(u,m){i(u,m,r)}};Object.defineProperty(n,"__esModule",{value:!0}),n.AccessibilityManager=void 0;const h=a(9042),f=a(9924),p=a(844),S=a(4725),d=a(2585),s=a(3656);let o=n.AccessibilityManager=class extends p.Disposable{constructor(r,i,u,m){super(),this._terminal=r,this._coreBrowserService=u,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 v=0;v<this._terminal.rows;v++)this._rowElements[v]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[v]);if(this._topBoundaryFocusListener=v=>this._handleBoundaryFocus(v,0),this._bottomBoundaryFocusListener=v=>this._handleBoundaryFocus(v,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 f.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(v=>this._handleResize(v.rows))),this.register(this._terminal.onRender(v=>this._refreshRows(v.start,v.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(v=>this._handleChar(v))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
2
- `))),this.register(this._terminal.onA11yTab(v=>this._handleTab(v))),this.register(this._terminal.onKey(v=>this._handleKey(v.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,s.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,p.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(r){for(let i=0;i<r;i++)this._handleChar(" ")}_handleChar(r){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==r&&(this._charsToAnnounce+=r):this._charsToAnnounce+=r,r===`
3
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=h.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(r){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(r)||this._charsToConsume.push(r)}_refreshRows(r,i){this._liveRegionDebouncer.refresh(r,i,this._terminal.rows)}_renderRows(r,i){const u=this._terminal.buffer,m=u.lines.length.toString();for(let v=r;v<=i;v++){const C=u.lines.get(u.ydisp+v),_=[],w=(C==null?void 0:C.translateToString(!0,void 0,void 0,_))||"",A=(u.ydisp+v+1).toString(),T=this._rowElements[v];T&&(w.length===0?(T.innerText=" ",this._rowColumns.set(T,[0,1])):(T.textContent=w,this._rowColumns.set(T,_)),T.setAttribute("aria-posinset",A),T.setAttribute("aria-setsize",m))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(r,i){const u=r.target,m=this._rowElements[i===0?1:this._rowElements.length-2];if(u.getAttribute("aria-posinset")===(i===0?"1":`${this._terminal.buffer.lines.length}`)||r.relatedTarget!==m)return;let v,C;if(i===0?(v=u,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(v=this._rowElements.shift(),C=u,this._rowContainer.removeChild(v)),v.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),i===0){const _=this._createAccessibilityTreeNode();this._rowElements.unshift(_),this._rowContainer.insertAdjacentElement("afterbegin",_)}else{const _=this._createAccessibilityTreeNode();this._rowElements.push(_),this._rowContainer.appendChild(_)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(i===0?-1:1),this._rowElements[i===0?1:this._rowElements.length-2].focus(),r.preventDefault(),r.stopImmediatePropagation()}_handleSelectionChange(){var w;if(this._rowElements.length===0)return;const r=document.getSelection();if(!r)return;if(r.isCollapsed)return void(this._rowContainer.contains(r.anchorNode)&&this._terminal.clearSelection());if(!r.anchorNode||!r.focusNode)return void console.error("anchorNode and/or focusNode are null");let i={node:r.anchorNode,offset:r.anchorOffset},u={node:r.focusNode,offset:r.focusOffset};if((i.node.compareDocumentPosition(u.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===u.node&&i.offset>u.offset)&&([i,u]=[u,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;const m=this._rowElements.slice(-1)[0];if(u.node.compareDocumentPosition(m)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(u={node:m,offset:((w=m.textContent)==null?void 0:w.length)??0}),!this._rowContainer.contains(u.node))return;const v=({node:A,offset:T})=>{const O=A instanceof Text?A.parentNode:A;let D=parseInt(O==null?void 0:O.getAttribute("aria-posinset"),10)-1;if(isNaN(D))return console.warn("row is invalid. Race condition?"),null;const I=this._rowColumns.get(O);if(!I)return console.warn("columns is null. Race condition?"),null;let F=T<I.length?I[T]:I.slice(-1)[0]+1;return F>=this._terminal.cols&&(++D,F=0),{row:D,column:F}},C=v(i),_=v(u);if(C&&_){if(C.row>_.row||C.row===_.row&&C.column>=_.column)throw new Error("invalid range");this._terminal.select(C.column,C.row,(_.row-C.row)*this._terminal.cols-C.column+_.column)}}_handleResize(r){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let i=this._rowContainer.children.length;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);for(;this._rowElements.length>r;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const r=this._coreBrowserService.mainDocument.createElement("div");return r.setAttribute("role","listitem"),r.tabIndex=-1,this._refreshRowDimensions(r),r}_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 r=0;r<this._terminal.rows;r++)this._refreshRowDimensions(this._rowElements[r])}}_refreshRowDimensions(r){r.style.height=`${this._renderService.dimensions.css.cell.height}px`}};n.AccessibilityManager=o=l([g(1,d.IInstantiationService),g(2,S.ICoreBrowserService),g(3,S.IRenderService)],o)},3614:(x,n)=>{function a(f){return f.replace(/\r?\n/g,"\r")}function l(f,p){return p?"\x1B[200~"+f+"\x1B[201~":f}function g(f,p,S,d){f=l(f=a(f),S.decPrivateModes.bracketedPasteMode&&d.rawOptions.ignoreBracketedPasteMode!==!0),S.triggerDataEvent(f,!0),p.value=""}function h(f,p,S){const d=S.getBoundingClientRect(),s=f.clientX-d.left-10,o=f.clientY-d.top-10;p.style.width="20px",p.style.height="20px",p.style.left=`${s}px`,p.style.top=`${o}px`,p.style.zIndex="1000",p.focus()}Object.defineProperty(n,"__esModule",{value:!0}),n.rightClickHandler=n.moveTextAreaUnderMouseCursor=n.paste=n.handlePasteEvent=n.copyHandler=n.bracketTextForPaste=n.prepareTextForTerminal=void 0,n.prepareTextForTerminal=a,n.bracketTextForPaste=l,n.copyHandler=function(f,p){f.clipboardData&&f.clipboardData.setData("text/plain",p.selectionText),f.preventDefault()},n.handlePasteEvent=function(f,p,S,d){f.stopPropagation(),f.clipboardData&&g(f.clipboardData.getData("text/plain"),p,S,d)},n.paste=g,n.moveTextAreaUnderMouseCursor=h,n.rightClickHandler=function(f,p,S,d,s){h(f,p,S),s&&d.rightClickSelect(f),p.value=d.selectionText,p.select()}},7239:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ColorContrastCache=void 0;const l=a(1505);n.ColorContrastCache=class{constructor(){this._color=new l.TwoKeyMap,this._css=new l.TwoKeyMap}setCss(g,h,f){this._css.set(g,h,f)}getCss(g,h){return this._css.get(g,h)}setColor(g,h,f){this._color.set(g,h,f)}getColor(g,h){return this._color.get(g,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.addDisposableDomListener=void 0,n.addDisposableDomListener=function(a,l,g,h){a.addEventListener(l,g,h);let f=!1;return{dispose:()=>{f||(f=!0,a.removeEventListener(l,g,h))}}}},3551:function(x,n,a){var l=this&&this.__decorate||function(o,r,i,u){var m,v=arguments.length,C=v<3?r:u===null?u=Object.getOwnPropertyDescriptor(r,i):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(o,r,i,u);else for(var _=o.length-1;_>=0;_--)(m=o[_])&&(C=(v<3?m(C):v>3?m(r,i,C):m(r,i))||C);return v>3&&C&&Object.defineProperty(r,i,C),C},g=this&&this.__param||function(o,r){return function(i,u){r(i,u,o)}};Object.defineProperty(n,"__esModule",{value:!0}),n.Linkifier=void 0;const h=a(3656),f=a(8460),p=a(844),S=a(2585),d=a(4725);let s=n.Linkifier=class extends p.Disposable{get currentLink(){return this._currentLink}constructor(o,r,i,u,m){super(),this._element=o,this._mouseService=r,this._renderService=i,this._bufferService=u,this._linkProviderService=m,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new f.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new f.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,p.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,p.toDisposable)(()=>{var v;this._lastMouseEvent=void 0,(v=this._activeProviderReplies)==null||v.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,h.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,h.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,h.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(o){this._lastMouseEvent=o;const r=this._positionFromMouseEvent(o,this._element,this._mouseService);if(!r)return;this._isMouseOut=!1;const i=o.composedPath();for(let u=0;u<i.length;u++){const m=i[u];if(m.classList.contains("xterm"))break;if(m.classList.contains("xterm-hover"))return}this._lastBufferCell&&r.x===this._lastBufferCell.x&&r.y===this._lastBufferCell.y||(this._handleHover(r),this._lastBufferCell=r)}_handleHover(o){if(this._activeLine!==o.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(o,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,o)||(this._clearCurrentLink(),this._askForLink(o,!0))}_askForLink(o,r){var u,m;this._activeProviderReplies&&r||((u=this._activeProviderReplies)==null||u.forEach(v=>{v==null||v.forEach(C=>{C.link.dispose&&C.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=o.y);let i=!1;for(const[v,C]of this._linkProviderService.linkProviders.entries())r?(m=this._activeProviderReplies)!=null&&m.get(v)&&(i=this._checkLinkProviderResult(v,o,i)):C.provideLinks(o.y,_=>{var A,T;if(this._isMouseOut)return;const w=_==null?void 0:_.map(O=>({link:O}));(A=this._activeProviderReplies)==null||A.set(v,w),i=this._checkLinkProviderResult(v,o,i),((T=this._activeProviderReplies)==null?void 0:T.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(o.y,this._activeProviderReplies)})}_removeIntersectingLinks(o,r){const i=new Set;for(let u=0;u<r.size;u++){const m=r.get(u);if(m)for(let v=0;v<m.length;v++){const C=m[v],_=C.link.range.start.y<o?0:C.link.range.start.x,w=C.link.range.end.y>o?this._bufferService.cols:C.link.range.end.x;for(let A=_;A<=w;A++){if(i.has(A)){m.splice(v--,1);break}i.add(A)}}}}_checkLinkProviderResult(o,r,i){var v;if(!this._activeProviderReplies)return i;const u=this._activeProviderReplies.get(o);let m=!1;for(let C=0;C<o;C++)this._activeProviderReplies.has(C)&&!this._activeProviderReplies.get(C)||(m=!0);if(!m&&u){const C=u.find(_=>this._linkAtPosition(_.link,r));C&&(i=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let C=0;C<this._activeProviderReplies.size;C++){const _=(v=this._activeProviderReplies.get(C))==null?void 0:v.find(w=>this._linkAtPosition(w.link,r));if(_){i=!0,this._handleNewLink(_);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(o){if(!this._currentLink)return;const r=this._positionFromMouseEvent(o,this._element,this._mouseService);r&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,r)&&this._currentLink.link.activate(o,this._currentLink.link.text)}_clearCurrentLink(o,r){this._currentLink&&this._lastMouseEvent&&(!o||!r||this._currentLink.link.range.start.y>=o&&this._currentLink.link.range.end.y<=r)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,p.disposeArray)(this._linkCacheDisposables))}_handleNewLink(o){if(!this._lastMouseEvent)return;const r=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);r&&this._linkAtPosition(o.link,r)&&(this._currentLink=o,this._currentLink.state={decorations:{underline:o.link.decorations===void 0||o.link.decorations.underline,pointerCursor:o.link.decorations===void 0||o.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,o.link,this._lastMouseEvent),o.link.decorations={},Object.defineProperties(o.link.decorations,{pointerCursor:{get:()=>{var i,u;return(u=(i=this._currentLink)==null?void 0:i.state)==null?void 0:u.decorations.pointerCursor},set:i=>{var u;(u=this._currentLink)!=null&&u.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>{var i,u;return(u=(i=this._currentLink)==null?void 0:i.state)==null?void 0:u.decorations.underline},set:i=>{var u,m,v;(u=this._currentLink)!=null&&u.state&&((v=(m=this._currentLink)==null?void 0:m.state)==null?void 0:v.decorations.underline)!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(o.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;const u=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,m=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=u&&this._currentLink.link.range.end.y<=m&&(this._clearCurrentLink(u,m),this._lastMouseEvent)){const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._askForLink(v,!1)}})))}_linkHover(o,r,i){var u;(u=this._currentLink)!=null&&u.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!0),this._currentLink.state.decorations.pointerCursor&&o.classList.add("xterm-cursor-pointer")),r.hover&&r.hover(i,r.text)}_fireUnderlineEvent(o,r){const i=o.range,u=this._bufferService.buffer.ydisp,m=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-u-1,i.end.x,i.end.y-u-1,void 0);(r?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(m)}_linkLeave(o,r,i){var u;(u=this._currentLink)!=null&&u.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!1),this._currentLink.state.decorations.pointerCursor&&o.classList.remove("xterm-cursor-pointer")),r.leave&&r.leave(i,r.text)}_linkAtPosition(o,r){const i=o.range.start.y*this._bufferService.cols+o.range.start.x,u=o.range.end.y*this._bufferService.cols+o.range.end.x,m=r.y*this._bufferService.cols+r.x;return i<=m&&m<=u}_positionFromMouseEvent(o,r,i){const u=i.getCoords(o,r,this._bufferService.cols,this._bufferService.rows);if(u)return{x:u[0],y:u[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(o,r,i,u,m){return{x1:o,y1:r,x2:i,y2:u,cols:this._bufferService.cols,fg:m}}};n.Linkifier=s=l([g(1,d.IMouseService),g(2,d.IRenderService),g(3,S.IBufferService),g(4,d.ILinkProviderService)],s)},9042:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.tooMuchOutput=n.promptLabel=void 0,n.promptLabel="Terminal input",n.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(x,n,a){var l=this&&this.__decorate||function(d,s,o,r){var i,u=arguments.length,m=u<3?s:r===null?r=Object.getOwnPropertyDescriptor(s,o):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(d,s,o,r);else for(var v=d.length-1;v>=0;v--)(i=d[v])&&(m=(u<3?i(m):u>3?i(s,o,m):i(s,o))||m);return u>3&&m&&Object.defineProperty(s,o,m),m},g=this&&this.__param||function(d,s){return function(o,r){s(o,r,d)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkProvider=void 0;const h=a(511),f=a(2585);let p=n.OscLinkProvider=class{constructor(d,s,o){this._bufferService=d,this._optionsService=s,this._oscLinkService=o}provideLinks(d,s){var w;const o=this._bufferService.buffer.lines.get(d-1);if(!o)return void s(void 0);const r=[],i=this._optionsService.rawOptions.linkHandler,u=new h.CellData,m=o.getTrimmedLength();let v=-1,C=-1,_=!1;for(let A=0;A<m;A++)if(C!==-1||o.hasContent(A)){if(o.loadCell(A,u),u.hasExtendedAttrs()&&u.extended.urlId){if(C===-1){C=A,v=u.extended.urlId;continue}_=u.extended.urlId!==v}else C!==-1&&(_=!0);if(_||C!==-1&&A===m-1){const T=(w=this._oscLinkService.getLinkData(v))==null?void 0:w.uri;if(T){const O={start:{x:C+1,y:d},end:{x:A+(_||A!==m-1?0:1),y:d}};let D=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{const I=new URL(T);["http:","https:"].includes(I.protocol)||(D=!0)}catch{D=!0}D||r.push({text:T,range:O,activate:(I,F)=>i?i.activate(I,F,O):S(0,F),hover:(I,F)=>{var U;return(U=i==null?void 0:i.hover)==null?void 0:U.call(i,I,F,O)},leave:(I,F)=>{var U;return(U=i==null?void 0:i.leave)==null?void 0:U.call(i,I,F,O)}})}_=!1,u.hasExtendedAttrs()&&u.extended.urlId?(C=A,v=u.extended.urlId):(C=-1,v=-1)}}s(r)}};function S(d,s){if(confirm(`Do you want to navigate to ${s}?
4
-
5
- WARNING: This link could potentially be dangerous`)){const o=window.open();if(o){try{o.opener=null}catch{}o.location.href=s}else console.warn("Opening link blocked as opener could not be cleared")}}n.OscLinkProvider=p=l([g(0,f.IBufferService),g(1,f.IOptionsService),g(2,f.IOscLinkService)],p)},6193:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RenderDebouncer=void 0,n.RenderDebouncer=class{constructor(a,l){this._renderCallback=a,this._coreBrowserService=l,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(a,l,g){this._rowCount=g,a=a!==void 0?a:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,l):l,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 a=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,l),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Terminal=void 0;const l=a(3614),g=a(3656),h=a(3551),f=a(9042),p=a(3730),S=a(1680),d=a(3107),s=a(5744),o=a(2950),r=a(1296),i=a(428),u=a(4269),m=a(5114),v=a(8934),C=a(3230),_=a(9312),w=a(4725),A=a(6731),T=a(8055),O=a(8969),D=a(8460),I=a(844),F=a(6114),U=a(8437),K=a(2584),N=a(7399),y=a(5941),R=a(9074),B=a(2585),P=a(5435),$=a(4567),j=a(779);class V extends O.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(M={}){super(M),this.browser=F,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new I.MutableDisposable),this._onCursorMove=this.register(new D.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new D.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new D.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new D.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new D.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new D.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new D.EventEmitter),this._onBlur=this.register(new D.EventEmitter),this._onA11yCharEmitter=this.register(new D.EventEmitter),this._onA11yTabEmitter=this.register(new D.EventEmitter),this._onWillOpen=this.register(new D.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(R.DecorationService),this._instantiationService.setService(B.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(j.LinkProviderService),this._instantiationService.setService(w.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(p.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((k,z)=>this.refresh(k,z))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(k=>this._reportWindowsOptions(k))),this.register(this._inputHandler.onColor(k=>this._handleColorEvent(k))),this.register((0,D.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,D.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(k=>this._afterResize(k.cols,k.rows))),this.register((0,I.toDisposable)(()=>{var k,z;this._customKeyEventHandler=void 0,(z=(k=this.element)==null?void 0:k.parentNode)==null||z.removeChild(this.element)}))}_handleColorEvent(M){if(this._themeService)for(const k of M){let z,H="";switch(k.index){case 256:z="foreground",H="10";break;case 257:z="background",H="11";break;case 258:z="cursor",H="12";break;default:z="ansi",H="4;"+k.index}switch(k.type){case 0:const q=T.color.toColorRGB(z==="ansi"?this._themeService.colors.ansi[k.index]:this._themeService.colors[z]);this.coreService.triggerDataEvent(`${K.C0.ESC}]${H};${(0,y.toRgbString)(q)}${K.C1_ESCAPED.ST}`);break;case 1:if(z==="ansi")this._themeService.modifyColors(Z=>Z.ansi[k.index]=T.channels.toColor(...k.color));else{const Z=z;this._themeService.modifyColors(Y=>Y[Z]=T.channels.toColor(...k.color))}break;case 2:this._themeService.restoreColor(k.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(M){M?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(M){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var M;return(M=this.textarea)==null?void 0:M.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(K.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const M=this.buffer.ybase+this.buffer.y,k=this.buffer.lines.get(M);if(!k)return;const z=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,q=k.getWidth(z),Z=this._renderService.dimensions.css.cell.width*q,Y=this.buffer.y*this._renderService.dimensions.css.cell.height,re=z*this._renderService.dimensions.css.cell.width;this.textarea.style.left=re+"px",this.textarea.style.top=Y+"px",this.textarea.style.width=Z+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,g.addDisposableDomListener)(this.element,"copy",k=>{this.hasSelection()&&(0,l.copyHandler)(k,this._selectionService)}));const M=k=>(0,l.handlePasteEvent)(k,this.textarea,this.coreService,this.optionsService);this.register((0,g.addDisposableDomListener)(this.textarea,"paste",M)),this.register((0,g.addDisposableDomListener)(this.element,"paste",M)),F.isFirefox?this.register((0,g.addDisposableDomListener)(this.element,"mousedown",k=>{k.button===2&&(0,l.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,g.addDisposableDomListener)(this.element,"contextmenu",k=>{(0,l.rightClickHandler)(k,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),F.isLinux&&this.register((0,g.addDisposableDomListener)(this.element,"auxclick",k=>{k.button===1&&(0,l.moveTextAreaUnderMouseCursor)(k,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,g.addDisposableDomListener)(this.textarea,"keyup",M=>this._keyUp(M),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keydown",M=>this._keyDown(M),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"keypress",M=>this._keyPress(M),!0)),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionupdate",M=>this._compositionHelper.compositionupdate(M))),this.register((0,g.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,g.addDisposableDomListener)(this.textarea,"input",M=>this._inputEvent(M),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(M){var z;if(!M)throw new Error("Terminal requires a parent element.");if(M.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((z=this.element)==null?void 0:z.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=M.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"),M.appendChild(this.element);const k=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),k.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,g.addDisposableDomListener)(this.screenElement,"mousemove",H=>this.updateCursorStyle(H))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),k.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",f.promptLabel),F.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,M.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(w.ICoreBrowserService,this._coreBrowserService),this.register((0,g.addDisposableDomListener)(this.textarea,"focus",H=>this._handleTextAreaFocus(H))),this.register((0,g.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(i.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(w.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(A.ThemeService),this._instantiationService.setService(w.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(u.CharacterJoinerService),this._instantiationService.setService(w.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(C.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(w.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(H=>this._onRender.fire(H))),this.onResize(H=>this._renderService.resize(H.cols,H.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(o.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(v.MouseService),this._instantiationService.setService(w.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(k);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(S.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(H=>this.scrollLines(H.amount,H.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(_.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(w.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(H=>this.scrollLines(H.amount,H.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(H=>this._renderService.handleSelectionChanged(H.start,H.end,H.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(H=>{this.textarea.value=H,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(H=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,g.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(d.BufferDecorationRenderer,this.screenElement)),this.register((0,g.addDisposableDomListener)(this.element,"mousedown",H=>this._selectionService.handleMouseDown(H))),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($.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",H=>this._handleScreenReaderModeOptionChange(H))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(s.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",H=>{!this._overviewRulerRenderer&&H&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(s.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(r.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const M=this,k=this.element;function z(Z){const Y=M._mouseService.getMouseReportCoords(Z,M.screenElement);if(!Y)return!1;let re,ie;switch(Z.overrideType||Z.type){case"mousemove":ie=32,Z.buttons===void 0?(re=3,Z.button!==void 0&&(re=Z.button<3?Z.button:3)):re=1&Z.buttons?0:4&Z.buttons?1:2&Z.buttons?2:3;break;case"mouseup":ie=0,re=Z.button<3?Z.button:3;break;case"mousedown":ie=1,re=Z.button<3?Z.button:3;break;case"wheel":if(M._customWheelEventHandler&&M._customWheelEventHandler(Z)===!1||M.viewport.getLinesScrolled(Z)===0)return!1;ie=Z.deltaY<0?0:1,re=4;break;default:return!1}return!(ie===void 0||re===void 0||re>4)&&M.coreMouseService.triggerMouseEvent({col:Y.col,row:Y.row,x:Y.x,y:Y.y,button:re,action:ie,ctrl:Z.ctrlKey,alt:Z.altKey,shift:Z.shiftKey})}const H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},q={mouseup:Z=>(z(Z),Z.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(Z)),wheel:Z=>(z(Z),this.cancel(Z,!0)),mousedrag:Z=>{Z.buttons&&z(Z)},mousemove:Z=>{Z.buttons||z(Z)}};this.register(this.coreMouseService.onProtocolChange(Z=>{Z?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Z)),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&Z?H.mousemove||(k.addEventListener("mousemove",q.mousemove),H.mousemove=q.mousemove):(k.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&Z?H.wheel||(k.addEventListener("wheel",q.wheel,{passive:!1}),H.wheel=q.wheel):(k.removeEventListener("wheel",H.wheel),H.wheel=null),2&Z?H.mouseup||(H.mouseup=q.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&Z?H.mousedrag||(H.mousedrag=q.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,g.addDisposableDomListener)(k,"mousedown",Z=>{if(Z.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Z))return z(Z),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(Z)})),this.register((0,g.addDisposableDomListener)(k,"wheel",Z=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(Z)===!1)return!1;if(!this.buffer.hasScrollback){const Y=this.viewport.getLinesScrolled(Z);if(Y===0)return;const re=K.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Z.deltaY<0?"A":"B");let ie="";for(let ne=0;ne<Math.abs(Y);ne++)ie+=re;return this.coreService.triggerDataEvent(ie,!0),this.cancel(Z,!0)}return this.viewport.handleWheel(Z)?this.cancel(Z):void 0}},{passive:!1})),this.register((0,g.addDisposableDomListener)(k,"touchstart",Z=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Z),this.cancel(Z)},{passive:!0})),this.register((0,g.addDisposableDomListener)(k,"touchmove",Z=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Z)?void 0:this.cancel(Z)},{passive:!1}))}refresh(M,k){var z;(z=this._renderService)==null||z.refreshRows(M,k)}updateCursorStyle(M){var k;(k=this._selectionService)!=null&&k.shouldColumnSelect(M)?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(M,k,z=0){var H;z===1?(super.scrollLines(M,k,z),this.refresh(0,this.rows-1)):(H=this.viewport)==null||H.scrollLines(M)}paste(M){(0,l.paste)(M,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(M){this._customKeyEventHandler=M}attachCustomWheelEventHandler(M){this._customWheelEventHandler=M}registerLinkProvider(M){return this._linkProviderService.registerLinkProvider(M)}registerCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const k=this._characterJoinerService.register(M);return this.refresh(0,this.rows-1),k}deregisterCharacterJoiner(M){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(M)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(M){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+M)}registerDecoration(M){return this._decorationService.registerDecoration(M)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(M,k,z){this._selectionService.setSelection(M,k,z)}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(){var M;(M=this._selectionService)==null||M.clearSelection()}selectAll(){var M;(M=this._selectionService)==null||M.selectAll()}selectLines(M,k){var z;(z=this._selectionService)==null||z.selectLines(M,k)}_keyDown(M){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;const k=this.browser.isMac&&this.options.macOptionIsMeta&&M.altKey;if(!k&&!this._compositionHelper.keydown(M))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;k||M.key!=="Dead"&&M.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const z=(0,N.evaluateKeyboardEvent)(M,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(M),z.type===3||z.type===2){const H=this.rows-1;return this.scrollLines(z.type===2?-H:H),this.cancel(M,!0)}return z.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,M)||(z.cancel&&this.cancel(M,!0),!z.key||!!(M.key&&!M.ctrlKey&&!M.altKey&&!M.metaKey&&M.key.length===1&&M.key.charCodeAt(0)>=65&&M.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(z.key!==K.C0.ETX&&z.key!==K.C0.CR||(this.textarea.value=""),this._onKey.fire({key:z.key,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(z.key,!0),!this.optionsService.rawOptions.screenReaderMode||M.altKey||M.ctrlKey?this.cancel(M,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(M,k){const z=M.isMac&&!this.options.macOptionIsMeta&&k.altKey&&!k.ctrlKey&&!k.metaKey||M.isWindows&&k.altKey&&k.ctrlKey&&!k.metaKey||M.isWindows&&k.getModifierState("AltGraph");return k.type==="keypress"?z:z&&(!k.keyCode||k.keyCode>47)}_keyUp(M){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1||(function(k){return k.keyCode===16||k.keyCode===17||k.keyCode===18}(M)||this.focus(),this.updateCursorStyle(M),this._keyPressHandled=!1)}_keyPress(M){let k;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(M)===!1)return!1;if(this.cancel(M),M.charCode)k=M.charCode;else if(M.which===null||M.which===void 0)k=M.keyCode;else{if(M.which===0||M.charCode===0)return!1;k=M.which}return!(!k||(M.altKey||M.ctrlKey||M.metaKey)&&!this._isThirdLevelShift(this.browser,M)||(k=String.fromCharCode(k),this._onKey.fire({key:k,domEvent:M}),this._showCursor(),this.coreService.triggerDataEvent(k,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(M){if(M.data&&M.inputType==="insertText"&&(!M.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const k=M.data;return this.coreService.triggerDataEvent(k,!0),this.cancel(M),!0}return!1}resize(M,k){M!==this.cols||k!==this.rows?super.resize(M,k):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(M,k){var z,H;(z=this._charSizeService)==null||z.measure(),(H=this.viewport)==null||H.syncScrollArea(!0)}clear(){var M;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 k=1;k<this.rows;k++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(M=this.viewport)==null||M.reset(),this.refresh(0,this.rows-1)}}reset(){var k,z;this.options.rows=this.rows,this.options.cols=this.cols;const M=this._customKeyEventHandler;this._setup(),super.reset(),(k=this._selectionService)==null||k.reset(),this._decorationService.reset(),(z=this.viewport)==null||z.reset(),this._customKeyEventHandler=M,this.refresh(0,this.rows-1)}clearTextureAtlas(){var M;(M=this._renderService)==null||M.clearTextureAtlas()}_reportFocus(){var M;(M=this.element)!=null&&M.classList.contains("focus")?this.coreService.triggerDataEvent(K.C0.ESC+"[I"):this.coreService.triggerDataEvent(K.C0.ESC+"[O")}_reportWindowsOptions(M){if(this._renderService)switch(M){case P.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const k=this._renderService.dimensions.css.canvas.width.toFixed(0),z=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[4;${z};${k}t`);break;case P.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const H=this._renderService.dimensions.css.cell.width.toFixed(0),q=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${K.C0.ESC}[6;${q};${H}t`)}}cancel(M,k){if(this.options.cancelEvents||k)return M.preventDefault(),M.stopPropagation(),!1}}n.Terminal=V},9924:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TimeBasedDebouncer=void 0,n.TimeBasedDebouncer=class{constructor(a,l=1e3){this._renderCallback=a,this._debounceThresholdMS=l,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,l,g){this._rowCount=g,a=a!==void 0?a:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,l):l;const h=Date.now();if(h-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=h,this._innerRefresh();else if(!this._additionalRefreshRequested){const f=h-this._lastRefreshMs,p=this._debounceThresholdMS-f;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},p)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const a=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,l)}}},1680:function(x,n,a){var l=this&&this.__decorate||function(o,r,i,u){var m,v=arguments.length,C=v<3?r:u===null?u=Object.getOwnPropertyDescriptor(r,i):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(o,r,i,u);else for(var _=o.length-1;_>=0;_--)(m=o[_])&&(C=(v<3?m(C):v>3?m(r,i,C):m(r,i))||C);return v>3&&C&&Object.defineProperty(r,i,C),C},g=this&&this.__param||function(o,r){return function(i,u){r(i,u,o)}};Object.defineProperty(n,"__esModule",{value:!0}),n.Viewport=void 0;const h=a(3656),f=a(4725),p=a(8460),S=a(844),d=a(2585);let s=n.Viewport=class extends S.Disposable{constructor(o,r,i,u,m,v,C,_){super(),this._viewportElement=o,this._scrollArea=r,this._bufferService=i,this._optionsService=u,this._charSizeService=m,this._renderService=v,this._coreBrowserService=C,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 p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,h.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(w=>this._activeBuffer=w.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(w=>this._renderDimensions=w)),this._handleThemeChange(_.colors),this.register(_.onChangeColors(w=>this._handleThemeChange(w))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(o){this._viewportElement.style.backgroundColor=o.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(o){if(o)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 r=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==r&&(this._lastRecordedBufferHeight=r,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const o=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==o&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=o),this._refreshAnimationFrame=null}syncScrollArea(o=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(o);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(o)}_handleScroll(o){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 r=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:r,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const o=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(o*(this._smoothScrollState.target-this._smoothScrollState.origin)),o<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(o,r){const i=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(r<0&&this._viewportElement.scrollTop!==0||r>0&&i<this._lastRecordedBufferHeight)||(o.cancelable&&o.preventDefault(),!1)}handleWheel(o){const r=this._getPixelsScrolled(o);return r!==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+r:this._smoothScrollState.target+=r,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=r,this._bubbleScroll(o,r))}scrollLines(o){if(o!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const r=o*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+r,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:o,suppressScrollEvent:!1})}_getPixelsScrolled(o){if(o.deltaY===0||o.shiftKey)return 0;let r=this._applyScrollModifier(o.deltaY,o);return o.deltaMode===WheelEvent.DOM_DELTA_LINE?r*=this._currentRowHeight:o.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._currentRowHeight*this._bufferService.rows),r}getBufferElements(o,r){var _;let i,u="";const m=[],v=r??this._bufferService.buffer.lines.length,C=this._bufferService.buffer.lines;for(let w=o;w<v;w++){const A=C.get(w);if(!A)continue;const T=(_=C.get(w+1))==null?void 0:_.isWrapped;if(u+=A.translateToString(!T),!T||w===C.length-1){const O=document.createElement("div");O.textContent=u,m.push(O),u.length>0&&(i=O),u=""}}return{bufferElements:m,cursorElement:i}}getLinesScrolled(o){if(o.deltaY===0||o.shiftKey)return 0;let r=this._applyScrollModifier(o.deltaY,o);return o.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=this._currentRowHeight+0,this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):o.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(o,r){const i=this._optionsService.rawOptions.fastScrollModifier;return i==="alt"&&r.altKey||i==="ctrl"&&r.ctrlKey||i==="shift"&&r.shiftKey?o*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:o*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(o){this._lastTouchY=o.touches[0].pageY}handleTouchMove(o){const r=this._lastTouchY-o.touches[0].pageY;return this._lastTouchY=o.touches[0].pageY,r!==0&&(this._viewportElement.scrollTop+=r,this._bubbleScroll(o,r))}};n.Viewport=s=l([g(2,d.IBufferService),g(3,d.IOptionsService),g(4,f.ICharSizeService),g(5,f.IRenderService),g(6,f.ICoreBrowserService),g(7,f.IThemeService)],s)},3107:function(x,n,a){var l=this&&this.__decorate||function(d,s,o,r){var i,u=arguments.length,m=u<3?s:r===null?r=Object.getOwnPropertyDescriptor(s,o):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(d,s,o,r);else for(var v=d.length-1;v>=0;v--)(i=d[v])&&(m=(u<3?i(m):u>3?i(s,o,m):i(s,o))||m);return u>3&&m&&Object.defineProperty(s,o,m),m},g=this&&this.__param||function(d,s){return function(o,r){s(o,r,d)}};Object.defineProperty(n,"__esModule",{value:!0}),n.BufferDecorationRenderer=void 0;const h=a(4725),f=a(844),p=a(2585);let S=n.BufferDecorationRenderer=class extends f.Disposable{constructor(d,s,o,r,i){super(),this._screenElement=d,this._bufferService=s,this._coreBrowserService=o,this._decorationService=r,this._renderService=i,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(u=>this._removeDecoration(u))),this.register((0,f.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 d of this._decorationService.decorations)this._renderDecoration(d);this._dimensionsChanged=!1}_renderDecoration(d){this._refreshStyle(d),this._dimensionsChanged&&this._refreshXPosition(d)}_createElement(d){var r;const s=this._coreBrowserService.mainDocument.createElement("div");s.classList.add("xterm-decoration"),s.classList.toggle("xterm-decoration-top-layer",((r=d==null?void 0:d.options)==null?void 0:r.layer)==="top"),s.style.width=`${Math.round((d.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=(d.options.height||1)*this._renderService.dimensions.css.cell.height+"px",s.style.top=(d.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const o=d.options.x??0;return o&&o>this._bufferService.cols&&(s.style.display="none"),this._refreshXPosition(d,s),s}_refreshStyle(d){const s=d.marker.line-this._bufferService.buffers.active.ydisp;if(s<0||s>=this._bufferService.rows)d.element&&(d.element.style.display="none",d.onRenderEmitter.fire(d.element));else{let o=this._decorationElements.get(d);o||(o=this._createElement(d),d.element=o,this._decorationElements.set(d,o),this._container.appendChild(o),d.onDispose(()=>{this._decorationElements.delete(d),o.remove()})),o.style.top=s*this._renderService.dimensions.css.cell.height+"px",o.style.display=this._altBufferIsActive?"none":"block",d.onRenderEmitter.fire(o)}}_refreshXPosition(d,s=d.element){if(!s)return;const o=d.options.x??0;(d.options.anchor||"left")==="right"?s.style.right=o?o*this._renderService.dimensions.css.cell.width+"px":"":s.style.left=o?o*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(d){var s;(s=this._decorationElements.get(d))==null||s.remove(),this._decorationElements.delete(d),d.dispose()}};n.BufferDecorationRenderer=S=l([g(1,p.IBufferService),g(2,h.ICoreBrowserService),g(3,p.IDecorationService),g(4,h.IRenderService)],S)},5871:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ColorZoneStore=void 0,n.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(a){if(a.options.overviewRulerOptions){for(const l of this._zones)if(l.color===a.options.overviewRulerOptions.color&&l.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(l,a.marker.line))return;if(this._lineAdjacentToZone(l,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(l,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,l){return l>=a.startBufferLine&&l<=a.endBufferLine}_lineAdjacentToZone(a,l,g){return l>=a.startBufferLine-this._linePadding[g||"full"]&&l<=a.endBufferLine+this._linePadding[g||"full"]}_addLineToZone(a,l){a.startBufferLine=Math.min(a.startBufferLine,l),a.endBufferLine=Math.max(a.endBufferLine,l)}}},5744:function(x,n,a){var l=this&&this.__decorate||function(i,u,m,v){var C,_=arguments.length,w=_<3?u:v===null?v=Object.getOwnPropertyDescriptor(u,m):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(i,u,m,v);else for(var A=i.length-1;A>=0;A--)(C=i[A])&&(w=(_<3?C(w):_>3?C(u,m,w):C(u,m))||w);return _>3&&w&&Object.defineProperty(u,m,w),w},g=this&&this.__param||function(i,u){return function(m,v){u(m,v,i)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OverviewRulerRenderer=void 0;const h=a(5871),f=a(4725),p=a(844),S=a(2585),d={full:0,left:0,center:0,right:0},s={full:0,left:0,center:0,right:0},o={full:0,left:0,center:0,right:0};let r=n.OverviewRulerRenderer=class extends p.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(i,u,m,v,C,_,w){var T;super(),this._viewportElement=i,this._screenElement=u,this._bufferService=m,this._decorationService=v,this._renderService=C,this._optionsService=_,this._coreBrowserService=w,this._colorZoneStore=new h.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(),(T=this._viewportElement.parentElement)==null||T.insertBefore(this._canvas,this._viewportElement);const A=this._canvas.getContext("2d");if(!A)throw new Error("Ctx cannot be null");this._ctx=A,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,p.toDisposable)(()=>{var O;(O=this._canvas)==null||O.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 i=Math.floor(this._canvas.width/3),u=Math.ceil(this._canvas.width/3);s.full=this._canvas.width,s.left=i,s.center=u,s.right=i,this._refreshDrawHeightConstants(),o.full=0,o.left=0,o.center=s.left,o.right=s.left+s.center}_refreshDrawHeightConstants(){d.full=Math.round(2*this._coreBrowserService.dpr);const i=this._canvas.height/this._bufferService.buffer.lines.length,u=Math.round(Math.max(Math.min(i,12),6)*this._coreBrowserService.dpr);d.left=u,d.center=u,d.right=u}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*d.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*d.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*d.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*d.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 u of this._decorationService.decorations)this._colorZoneStore.addDecoration(u);this._ctx.lineWidth=1;const i=this._colorZoneStore.zones;for(const u of i)u.position!=="full"&&this._renderColorZone(u);for(const u of i)u.position==="full"&&this._renderColorZone(u);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(i){this._ctx.fillStyle=i.color,this._ctx.fillRect(o[i.position||"full"],Math.round((this._canvas.height-1)*(i.startBufferLine/this._bufferService.buffers.active.lines.length)-d[i.position||"full"]/2),s[i.position||"full"],Math.round((this._canvas.height-1)*((i.endBufferLine-i.startBufferLine)/this._bufferService.buffers.active.lines.length)+d[i.position||"full"]))}_queueRefresh(i,u){this._shouldUpdateDimensions=i||this._shouldUpdateDimensions,this._shouldUpdateAnchor=u||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};n.OverviewRulerRenderer=r=l([g(2,S.IBufferService),g(3,S.IDecorationService),g(4,f.IRenderService),g(5,S.IOptionsService),g(6,f.ICoreBrowserService)],r)},2950:function(x,n,a){var l=this&&this.__decorate||function(d,s,o,r){var i,u=arguments.length,m=u<3?s:r===null?r=Object.getOwnPropertyDescriptor(s,o):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(d,s,o,r);else for(var v=d.length-1;v>=0;v--)(i=d[v])&&(m=(u<3?i(m):u>3?i(s,o,m):i(s,o))||m);return u>3&&m&&Object.defineProperty(s,o,m),m},g=this&&this.__param||function(d,s){return function(o,r){s(o,r,d)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CompositionHelper=void 0;const h=a(4725),f=a(2585),p=a(2584);let S=n.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(d,s,o,r,i,u){this._textarea=d,this._compositionView=s,this._bufferService=o,this._optionsService=r,this._coreService=i,this._renderService=u,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(d){this._compositionView.textContent=d.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(d){if(this._isComposing||this._isSendingComposition){if(d.keyCode===229||d.keyCode===16||d.keyCode===17||d.keyCode===18)return!1;this._finalizeComposition(!1)}return d.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(d){if(this._compositionView.classList.remove("active"),this._isComposing=!1,d){const s={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let o;this._isSendingComposition=!1,s.start+=this._dataAlreadySent.length,o=this._isComposing?this._textarea.value.substring(s.start,s.end):this._textarea.value.substring(s.start),o.length>0&&this._coreService.triggerDataEvent(o,!0)}},0)}else{this._isSendingComposition=!1;const s=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(s,!0)}}_handleAnyTextareaChanges(){const d=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const s=this._textarea.value,o=s.replace(d,"");this._dataAlreadySent=o,s.length>d.length?this._coreService.triggerDataEvent(o,!0):s.length<d.length?this._coreService.triggerDataEvent(`${p.C0.DEL}`,!0):s.length===d.length&&s!==d&&this._coreService.triggerDataEvent(s,!0)}},0)}updateCompositionElements(d){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const s=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),o=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=s*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=o+"px",this._compositionView.style.lineHeight=o+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const u=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(u.width,1)+"px",this._textarea.style.height=Math.max(u.height,1)+"px",this._textarea.style.lineHeight=u.height+"px"}d||setTimeout(()=>this.updateCompositionElements(!0),0)}}};n.CompositionHelper=S=l([g(2,f.IBufferService),g(3,f.IOptionsService),g(4,f.ICoreService),g(5,h.IRenderService)],S)},9806:(x,n)=>{function a(l,g,h){const f=h.getBoundingClientRect(),p=l.getComputedStyle(h),S=parseInt(p.getPropertyValue("padding-left")),d=parseInt(p.getPropertyValue("padding-top"));return[g.clientX-f.left-S,g.clientY-f.top-d]}Object.defineProperty(n,"__esModule",{value:!0}),n.getCoords=n.getCoordsRelativeToElement=void 0,n.getCoordsRelativeToElement=a,n.getCoords=function(l,g,h,f,p,S,d,s,o){if(!S)return;const r=a(l,g,h);return r?(r[0]=Math.ceil((r[0]+(o?d/2:0))/d),r[1]=Math.ceil(r[1]/s),r[0]=Math.min(Math.max(r[0],1),f+(o?1:0)),r[1]=Math.min(Math.max(r[1],1),p),r):void 0}},9504:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.moveToCellSequence=void 0;const l=a(2584);function g(s,o,r,i){const u=s-h(s,r),m=o-h(o,r),v=Math.abs(u-m)-function(C,_,w){let A=0;const T=C-h(C,w),O=_-h(_,w);for(let D=0;D<Math.abs(T-O);D++){const I=f(C,_)==="A"?-1:1,F=w.buffer.lines.get(T+I*D);F!=null&&F.isWrapped&&A++}return A}(s,o,r);return d(v,S(f(s,o),i))}function h(s,o){let r=0,i=o.buffer.lines.get(s),u=i==null?void 0:i.isWrapped;for(;u&&s>=0&&s<o.rows;)r++,i=o.buffer.lines.get(--s),u=i==null?void 0:i.isWrapped;return r}function f(s,o){return s>o?"A":"B"}function p(s,o,r,i,u,m){let v=s,C=o,_="";for(;v!==r||C!==i;)v+=u?1:-1,u&&v>m.cols-1?(_+=m.buffer.translateBufferLineToString(C,!1,s,v),v=0,s=0,C++):!u&&v<0&&(_+=m.buffer.translateBufferLineToString(C,!1,0,s+1),v=m.cols-1,s=v,C--);return _+m.buffer.translateBufferLineToString(C,!1,s,v)}function S(s,o){const r=o?"O":"[";return l.C0.ESC+r+s}function d(s,o){s=Math.floor(s);let r="";for(let i=0;i<s;i++)r+=o;return r}n.moveToCellSequence=function(s,o,r,i){const u=r.buffer.x,m=r.buffer.y;if(!r.buffer.hasScrollback)return function(_,w,A,T,O,D){return g(w,T,O,D).length===0?"":d(p(_,w,_,w-h(w,O),!1,O).length,S("D",D))}(u,m,0,o,r,i)+g(m,o,r,i)+function(_,w,A,T,O,D){let I;I=g(w,T,O,D).length>0?T-h(T,O):w;const F=T,U=function(K,N,y,R,B,P){let $;return $=g(y,R,B,P).length>0?R-h(R,B):N,K<y&&$<=R||K>=y&&$<R?"C":"D"}(_,w,A,T,O,D);return d(p(_,I,A,F,U==="C",O).length,S(U,D))}(u,m,s,o,r,i);let v;if(m===o)return v=u>s?"D":"C",d(Math.abs(u-s),S(v,i));v=m>o?"D":"C";const C=Math.abs(m-o);return d(function(_,w){return w.cols-_}(m>o?s:u,r)+(C-1)*r.cols+1+((m>o?u:s)-1),S(v,i))}},1296:function(x,n,a){var l=this&&this.__decorate||function(D,I,F,U){var K,N=arguments.length,y=N<3?I:U===null?U=Object.getOwnPropertyDescriptor(I,F):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(D,I,F,U);else for(var R=D.length-1;R>=0;R--)(K=D[R])&&(y=(N<3?K(y):N>3?K(I,F,y):K(I,F))||y);return N>3&&y&&Object.defineProperty(I,F,y),y},g=this&&this.__param||function(D,I){return function(F,U){I(F,U,D)}};Object.defineProperty(n,"__esModule",{value:!0}),n.DomRenderer=void 0;const h=a(3787),f=a(2550),p=a(2223),S=a(6171),d=a(6052),s=a(4725),o=a(8055),r=a(8460),i=a(844),u=a(2585),m="xterm-dom-renderer-owner-",v="xterm-rows",C="xterm-fg-",_="xterm-bg-",w="xterm-focus",A="xterm-selection";let T=1,O=n.DomRenderer=class extends i.Disposable{constructor(D,I,F,U,K,N,y,R,B,P,$,j,V){super(),this._terminal=D,this._document=I,this._element=F,this._screenElement=U,this._viewportElement=K,this._helperContainer=N,this._linkifier2=y,this._charSizeService=B,this._optionsService=P,this._bufferService=$,this._coreBrowserService=j,this._themeService=V,this._terminalClass=T++,this._rowElements=[],this._selectionRenderModel=(0,d.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new r.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(v),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(A),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,S.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(J=>this._injectCss(J))),this._injectCss(this._themeService.colors),this._rowFactory=R.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(m+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(J=>this._handleLinkHover(J))),this.register(this._linkifier2.onHideLinkUnderline(J=>this._handleLinkLeave(J))),this.register((0,i.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 f.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 D=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*D,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*D),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/D),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/D),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 F of this._rowElements)F.style.width=`${this.dimensions.css.canvas.width}px`,F.style.height=`${this.dimensions.css.cell.height}px`,F.style.lineHeight=`${this.dimensions.css.cell.height}px`,F.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const I=`${this._terminalSelector} .${v} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=I,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(D){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let I=`${this._terminalSelector} .${v} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;I+=`${this._terminalSelector} .${v} .xterm-dim { color: ${o.color.multiplyOpacity(D.foreground,.5).css};}`,I+=`${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 F=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,K=`blink_block_${this._terminalClass}`;I+=`@keyframes ${F} { 50% { border-bottom-style: hidden; }}`,I+=`@keyframes ${U} { 50% { box-shadow: none; }}`,I+=`@keyframes ${K} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,I+=`${this._terminalSelector} .${v}.${w} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${v}.${w} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${v}.${w} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${v} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,I+=`${this._terminalSelector} .${A} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${A} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${A} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(const[N,y]of D.ansi.entries())I+=`${this._terminalSelector} .${C}${N} { color: ${y.css}; }${this._terminalSelector} .${C}${N}.xterm-dim { color: ${o.color.multiplyOpacity(y,.5).css}; }${this._terminalSelector} .${_}${N} { background-color: ${y.css}; }`;I+=`${this._terminalSelector} .${C}${p.INVERTED_DEFAULT_COLOR} { color: ${o.color.opaque(D.background).css}; }${this._terminalSelector} .${C}${p.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${o.color.multiplyOpacity(o.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${_}${p.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=I}_setDefaultSpacing(){const D=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${D}px`,this._rowFactory.defaultSpacing=D}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(D,I){for(let F=this._rowElements.length;F<=I;F++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>I;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,I){this._refreshRowElements(D,I),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(w),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(w),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(D,I,F){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,I,F),this.renderRows(0,this._bufferService.rows-1),!D||!I)return;this._selectionRenderModel.update(this._terminal,D,I,F);const U=this._selectionRenderModel.viewportStartRow,K=this._selectionRenderModel.viewportEndRow,N=this._selectionRenderModel.viewportCappedStartRow,y=this._selectionRenderModel.viewportCappedEndRow;if(N>=this._bufferService.rows||y<0)return;const R=this._document.createDocumentFragment();if(F){const B=D[0]>I[0];R.appendChild(this._createSelectionElement(N,B?I[0]:D[0],B?D[0]:I[0],y-N+1))}else{const B=U===N?D[0]:0,P=N===K?I[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(N,B,P));const $=y-N-1;if(R.appendChild(this._createSelectionElement(N+1,0,this._bufferService.cols,$)),N!==y){const j=K===y?I[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(y,0,j))}}this._selectionContainer.appendChild(R)}_createSelectionElement(D,I,F,U=1){const K=this._document.createElement("div"),N=I*this.dimensions.css.cell.width;let y=this.dimensions.css.cell.width*(F-I);return N+y>this.dimensions.css.canvas.width&&(y=this.dimensions.css.canvas.width-N),K.style.height=U*this.dimensions.css.cell.height+"px",K.style.top=D*this.dimensions.css.cell.height+"px",K.style.left=`${N}px`,K.style.width=`${y}px`,K}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const D of this._rowElements)D.replaceChildren()}renderRows(D,I){const F=this._bufferService.buffer,U=F.ybase+F.y,K=Math.min(F.x,this._bufferService.cols-1),N=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,R=this._optionsService.rawOptions.cursorInactiveStyle;for(let B=D;B<=I;B++){const P=B+F.ydisp,$=this._rowElements[B],j=F.lines.get(P);if(!$||!j)break;$.replaceChildren(...this._rowFactory.createRow(j,P,P===U,y,R,K,N,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${m}${this._terminalClass}`}_handleLinkHover(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!0)}_handleLinkLeave(D){this._setCellUnderline(D.x1,D.x2,D.y1,D.y2,D.cols,!1)}_setCellUnderline(D,I,F,U,K,N){F<0&&(D=0),U<0&&(I=0);const y=this._bufferService.rows-1;F=Math.max(Math.min(F,y),0),U=Math.max(Math.min(U,y),0),K=Math.min(K,this._bufferService.cols);const R=this._bufferService.buffer,B=R.ybase+R.y,P=Math.min(R.x,K-1),$=this._optionsService.rawOptions.cursorBlink,j=this._optionsService.rawOptions.cursorStyle,V=this._optionsService.rawOptions.cursorInactiveStyle;for(let J=F;J<=U;++J){const M=J+R.ydisp,k=this._rowElements[J],z=R.lines.get(M);if(!k||!z)break;k.replaceChildren(...this._rowFactory.createRow(z,M,M===B,j,V,P,$,this.dimensions.css.cell.width,this._widthCache,N?J===F?D:0:-1,N?(J===U?I:K)-1:-1))}}};n.DomRenderer=O=l([g(7,u.IInstantiationService),g(8,s.ICharSizeService),g(9,u.IOptionsService),g(10,u.IBufferService),g(11,s.ICoreBrowserService),g(12,s.IThemeService)],O)},3787:function(x,n,a){var l=this&&this.__decorate||function(v,C,_,w){var A,T=arguments.length,O=T<3?C:w===null?w=Object.getOwnPropertyDescriptor(C,_):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(v,C,_,w);else for(var D=v.length-1;D>=0;D--)(A=v[D])&&(O=(T<3?A(O):T>3?A(C,_,O):A(C,_))||O);return T>3&&O&&Object.defineProperty(C,_,O),O},g=this&&this.__param||function(v,C){return function(_,w){C(_,w,v)}};Object.defineProperty(n,"__esModule",{value:!0}),n.DomRendererRowFactory=void 0;const h=a(2223),f=a(643),p=a(511),S=a(2585),d=a(8055),s=a(4725),o=a(4269),r=a(6171),i=a(3734);let u=n.DomRendererRowFactory=class{constructor(v,C,_,w,A,T,O){this._document=v,this._characterJoinerService=C,this._optionsService=_,this._coreBrowserService=w,this._coreService=A,this._decorationService=T,this._themeService=O,this._workCell=new p.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(v,C,_){this._selectionStart=v,this._selectionEnd=C,this._columnSelectMode=_}createRow(v,C,_,w,A,T,O,D,I,F,U){const K=[],N=this._characterJoinerService.getJoinedCharacters(C),y=this._themeService.colors;let R,B=v.getNoBgTrimmedLength();_&&B<T+1&&(B=T+1);let P=0,$="",j=0,V=0,J=0,M=!1,k=0,z=!1,H=0;const q=[],Z=F!==-1&&U!==-1;for(let Y=0;Y<B;Y++){v.loadCell(Y,this._workCell);let re=this._workCell.getWidth();if(re===0)continue;let ie=!1,ne=Y,X=this._workCell;if(N.length>0&&Y===N[0][0]){ie=!0;const ee=N.shift();X=new o.JoinedCellData(this._workCell,v.translateToString(!0,ee[0],ee[1]),ee[1]-ee[0]),ne=ee[1]-1,re=X.getWidth()}const me=this._isCellInSelection(Y,C),Ue=_&&Y===T,Ne=Z&&Y>=F&&Y<=U;let je=!1;this._decorationService.forEachDecorationAtCell(Y,C,void 0,ee=>{je=!0});let Be=X.getChars()||f.WHITESPACE_CELL_CHAR;if(Be===" "&&(X.isUnderline()||X.isOverline())&&(Be=" "),H=re*D-I.get(Be,X.isBold(),X.isItalic()),R){if(P&&(me&&z||!me&&!z&&X.bg===j)&&(me&&z&&y.selectionForeground||X.fg===V)&&X.extended.ext===J&&Ne===M&&H===k&&!Ue&&!ie&&!je){X.isInvisible()?$+=f.WHITESPACE_CELL_CHAR:$+=Be,P++;continue}P&&(R.textContent=$),R=this._document.createElement("span"),P=0,$=""}else R=this._document.createElement("span");if(j=X.bg,V=X.fg,J=X.extended.ext,M=Ne,k=H,z=me,ie&&T>=Y&&T<=ne&&(T=Y),!this._coreService.isCursorHidden&&Ue&&this._coreService.isCursorInitialized){if(q.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&q.push("xterm-cursor-blink"),q.push(w==="bar"?"xterm-cursor-bar":w==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(A)switch(A){case"outline":q.push("xterm-cursor-outline");break;case"block":q.push("xterm-cursor-block");break;case"bar":q.push("xterm-cursor-bar");break;case"underline":q.push("xterm-cursor-underline")}}if(X.isBold()&&q.push("xterm-bold"),X.isItalic()&&q.push("xterm-italic"),X.isDim()&&q.push("xterm-dim"),$=X.isInvisible()?f.WHITESPACE_CELL_CHAR:X.getChars()||f.WHITESPACE_CELL_CHAR,X.isUnderline()&&(q.push(`xterm-underline-${X.extended.underlineStyle}`),$===" "&&($=" "),!X.isUnderlineColorDefault()))if(X.isUnderlineColorRGB())R.style.textDecorationColor=`rgb(${i.AttributeData.toColorRGB(X.getUnderlineColor()).join(",")})`;else{let ee=X.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&X.isBold()&&ee<8&&(ee+=8),R.style.textDecorationColor=y.ansi[ee].css}X.isOverline()&&(q.push("xterm-overline"),$===" "&&($=" ")),X.isStrikethrough()&&q.push("xterm-strikethrough"),Ne&&(R.style.textDecoration="underline");let ce=X.getFgColor(),be=X.getFgColorMode(),le=X.getBgColor(),Se=X.getBgColorMode();const Ze=!!X.isInverse();if(Ze){const ee=ce;ce=le,le=ee;const ir=be;be=Se,Se=ir}let _e,Te,pe,Ce=!1;switch(this._decorationService.forEachDecorationAtCell(Y,C,void 0,ee=>{ee.options.layer!=="top"&&Ce||(ee.backgroundColorRGB&&(Se=50331648,le=ee.backgroundColorRGB.rgba>>8&16777215,_e=ee.backgroundColorRGB),ee.foregroundColorRGB&&(be=50331648,ce=ee.foregroundColorRGB.rgba>>8&16777215,Te=ee.foregroundColorRGB),Ce=ee.options.layer==="top")}),!Ce&&me&&(_e=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,le=_e.rgba>>8&16777215,Se=50331648,Ce=!0,y.selectionForeground&&(be=50331648,ce=y.selectionForeground.rgba>>8&16777215,Te=y.selectionForeground)),Ce&&q.push("xterm-decoration-top"),Se){case 16777216:case 33554432:pe=y.ansi[le],q.push(`xterm-bg-${le}`);break;case 50331648:pe=d.channels.toColor(le>>16,le>>8&255,255&le),this._addStyle(R,`background-color:#${m((le>>>0).toString(16),"0",6)}`);break;default:Ze?(pe=y.foreground,q.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):pe=y.background}switch(_e||X.isDim()&&(_e=d.color.multiplyOpacity(pe,.5)),be){case 16777216:case 33554432:X.isBold()&&ce<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ce+=8),this._applyMinimumContrast(R,pe,y.ansi[ce],X,_e,void 0)||q.push(`xterm-fg-${ce}`);break;case 50331648:const ee=d.channels.toColor(ce>>16&255,ce>>8&255,255&ce);this._applyMinimumContrast(R,pe,ee,X,_e,Te)||this._addStyle(R,`color:#${m(ce.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(R,pe,y.foreground,X,_e,Te)||Ze&&q.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}q.length&&(R.className=q.join(" "),q.length=0),Ue||ie||je?R.textContent=$:P++,H!==this.defaultSpacing&&(R.style.letterSpacing=`${H}px`),K.push(R),Y=ne}return R&&P&&(R.textContent=$),K}_applyMinimumContrast(v,C,_,w,A,T){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,r.treatGlyphAsBackgroundColor)(w.getCode()))return!1;const O=this._getContrastCache(w);let D;if(A||T||(D=O.getColor(C.rgba,_.rgba)),D===void 0){const I=this._optionsService.rawOptions.minimumContrastRatio/(w.isDim()?2:1);D=d.color.ensureContrastRatio(A||C,T||_,I),O.setColor((A||C).rgba,(T||_).rgba,D??null)}return!!D&&(this._addStyle(v,`color:${D.css}`),!0)}_getContrastCache(v){return v.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(v,C){v.setAttribute("style",`${v.getAttribute("style")||""}${C};`)}_isCellInSelection(v,C){const _=this._selectionStart,w=this._selectionEnd;return!(!_||!w)&&(this._columnSelectMode?_[0]<=w[0]?v>=_[0]&&C>=_[1]&&v<w[0]&&C<=w[1]:v<_[0]&&C>=_[1]&&v>=w[0]&&C<=w[1]:C>_[1]&&C<w[1]||_[1]===w[1]&&C===_[1]&&v>=_[0]&&v<w[0]||_[1]<w[1]&&C===w[1]&&v<w[0]||_[1]<w[1]&&C===_[1]&&v>=_[0])}};function m(v,C,_){for(;v.length<_;)v=C+v;return v}n.DomRendererRowFactory=u=l([g(1,s.ICharacterJoinerService),g(2,S.IOptionsService),g(3,s.ICoreBrowserService),g(4,S.ICoreService),g(5,S.IDecorationService),g(6,s.IThemeService)],u)},2550:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WidthCache=void 0,n.WidthCache=class{constructor(a,l){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const g=a.createElement("span");g.classList.add("xterm-char-measure-element");const h=a.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const f=a.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontStyle="italic";const p=a.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontWeight="bold",p.style.fontStyle="italic",this._measureElements=[g,h,f,p],this._container.appendChild(g),this._container.appendChild(h),this._container.appendChild(f),this._container.appendChild(p),l.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(a,l,g,h){a===this._font&&l===this._fontSize&&g===this._weight&&h===this._weightBold||(this._font=a,this._fontSize=l,this._weight=g,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${g}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${g}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(a,l,g){let h=0;if(!l&&!g&&a.length===1&&(h=a.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const S=this._measure(a,0);return S>0&&(this._flat[h]=S),S}let f=a;l&&(f+="B"),g&&(f+="I");let p=this._holey.get(f);if(p===void 0){let S=0;l&&(S|=1),g&&(S|=2),p=this._measure(a,S),p>0&&this._holey.set(f,p)}return p}_measure(a,l){const g=this._measureElements[l];return g.textContent=a.repeat(32),g.offsetWidth/32}}},2223:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TEXT_BASELINE=n.DIM_OPACITY=n.INVERTED_DEFAULT_COLOR=void 0;const l=a(6114);n.INVERTED_DEFAULT_COLOR=257,n.DIM_OPACITY=.5,n.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},6171:(x,n)=>{function a(g){return 57508<=g&&g<=57558}function l(g){return g>=128512&&g<=128591||g>=127744&&g<=128511||g>=128640&&g<=128767||g>=9728&&g<=9983||g>=9984&&g<=10175||g>=65024&&g<=65039||g>=129280&&g<=129535||g>=127462&&g<=127487}Object.defineProperty(n,"__esModule",{value:!0}),n.computeNextVariantOffset=n.createRenderDimensions=n.treatGlyphAsBackgroundColor=n.allowRescaling=n.isEmoji=n.isRestrictedPowerlineGlyph=n.isPowerlineGlyph=n.throwIfFalsy=void 0,n.throwIfFalsy=function(g){if(!g)throw new Error("value must not be falsy");return g},n.isPowerlineGlyph=a,n.isRestrictedPowerlineGlyph=function(g){return 57520<=g&&g<=57527},n.isEmoji=l,n.allowRescaling=function(g,h,f,p){return h===1&&f>Math.ceil(1.5*p)&&g!==void 0&&g>255&&!l(g)&&!a(g)&&!function(S){return 57344<=S&&S<=63743}(g)},n.treatGlyphAsBackgroundColor=function(g){return a(g)||function(h){return 9472<=h&&h<=9631}(g)},n.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}}}},n.computeNextVariantOffset=function(g,h,f=0){return(g-(2*Math.round(h)-f))%(2*Math.round(h))}},6052:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(g,h,f,p=!1){if(this.selectionStart=h,this.selectionEnd=f,!h||!f||h[0]===f[0]&&h[1]===f[1])return void this.clear();const S=g.buffers.active.ydisp,d=h[1]-S,s=f[1]-S,o=Math.max(d,0),r=Math.min(s,g.rows-1);o>=g.rows||r<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=p,this.viewportStartRow=d,this.viewportEndRow=s,this.viewportCappedStartRow=o,this.viewportCappedEndRow=r,this.startCol=h[0],this.endCol=f[0])}isCellSelected(g,h,f){return!!this.hasSelection&&(f-=g.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&f>=this.viewportCappedStartRow&&h<this.endCol&&f<=this.viewportCappedEndRow:h<this.startCol&&f>=this.viewportCappedStartRow&&h>=this.endCol&&f<=this.viewportCappedEndRow:f>this.viewportStartRow&&f<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&f===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&f===this.viewportStartRow&&h>=this.startCol)}}n.createSelectionRenderModel=function(){return new a}},456:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SelectionModel=void 0,n.SelectionModel=class{constructor(a){this._bufferService=a,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 a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,l=this.selectionEnd;return!(!a||!l)&&(a[1]>l[1]||a[1]===l[1]&&a[0]>l[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(x,n,a){var l=this&&this.__decorate||function(r,i,u,m){var v,C=arguments.length,_=C<3?i:m===null?m=Object.getOwnPropertyDescriptor(i,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(r,i,u,m);else for(var w=r.length-1;w>=0;w--)(v=r[w])&&(_=(C<3?v(_):C>3?v(i,u,_):v(i,u))||_);return C>3&&_&&Object.defineProperty(i,u,_),_},g=this&&this.__param||function(r,i){return function(u,m){i(u,m,r)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CharSizeService=void 0;const h=a(2585),f=a(8460),p=a(844);let S=n.CharSizeService=class extends p.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(r,i,u){super(),this._optionsService=u,this.width=0,this.height=0,this._onCharSizeChange=this.register(new f.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new o(this._optionsService))}catch{this._measureStrategy=this.register(new s(r,i,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const r=this._measureStrategy.measure();r.width===this.width&&r.height===this.height||(this.width=r.width,this.height=r.height,this._onCharSizeChange.fire())}};n.CharSizeService=S=l([g(2,h.IOptionsService)],S);class d extends p.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(i,u){i!==void 0&&i>0&&u!==void 0&&u>0&&(this._result.width=i,this._result.height=u)}}class s extends d{constructor(i,u,m){super(),this._document=i,this._parentElement=u,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 o extends d{constructor(i){super(),this._optionsService=i,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const u=this._ctx.measureText("W");if(!("width"in u&&"fontBoundingBoxAscent"in u&&"fontBoundingBoxDescent"in u))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const i=this._ctx.measureText("W");return this._validateAndSet(i.width,i.fontBoundingBoxAscent+i.fontBoundingBoxDescent),this._result}}},4269:function(x,n,a){var l=this&&this.__decorate||function(o,r,i,u){var m,v=arguments.length,C=v<3?r:u===null?u=Object.getOwnPropertyDescriptor(r,i):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(o,r,i,u);else for(var _=o.length-1;_>=0;_--)(m=o[_])&&(C=(v<3?m(C):v>3?m(r,i,C):m(r,i))||C);return v>3&&C&&Object.defineProperty(r,i,C),C},g=this&&this.__param||function(o,r){return function(i,u){r(i,u,o)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CharacterJoinerService=n.JoinedCellData=void 0;const h=a(3734),f=a(643),p=a(511),S=a(2585);class d extends h.AttributeData{constructor(r,i,u){super(),this.content=0,this.combinedData="",this.fg=r.fg,this.bg=r.bg,this.combinedData=i,this._width=u}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(r){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}n.JoinedCellData=d;let s=n.CharacterJoinerService=class qt{constructor(r){this._bufferService=r,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new p.CellData}register(r){const i={id:this._nextCharacterJoinerId++,handler:r};return this._characterJoiners.push(i),i.id}deregister(r){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===r)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(r){if(this._characterJoiners.length===0)return[];const i=this._bufferService.buffer.lines.get(r);if(!i||i.length===0)return[];const u=[],m=i.translateToString(!0);let v=0,C=0,_=0,w=i.getFg(0),A=i.getBg(0);for(let T=0;T<i.getTrimmedLength();T++)if(i.loadCell(T,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==w||this._workCell.bg!==A){if(T-v>1){const O=this._getJoinedRanges(m,_,C,i,v);for(let D=0;D<O.length;D++)u.push(O[D])}v=T,_=C,w=this._workCell.fg,A=this._workCell.bg}C+=this._workCell.getChars().length||f.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-v>1){const T=this._getJoinedRanges(m,_,C,i,v);for(let O=0;O<T.length;O++)u.push(T[O])}return u}_getJoinedRanges(r,i,u,m,v){const C=r.substring(i,u);let _=[];try{_=this._characterJoiners[0].handler(C)}catch(w){console.error(w)}for(let w=1;w<this._characterJoiners.length;w++)try{const A=this._characterJoiners[w].handler(C);for(let T=0;T<A.length;T++)qt._mergeRanges(_,A[T])}catch(A){console.error(A)}return this._stringRangesToCellRanges(_,m,v),_}_stringRangesToCellRanges(r,i,u){let m=0,v=!1,C=0,_=r[m];if(_){for(let w=u;w<this._bufferService.cols;w++){const A=i.getWidth(w),T=i.getString(w).length||f.WHITESPACE_CELL_CHAR.length;if(A!==0){if(!v&&_[0]<=C&&(_[0]=w,v=!0),_[1]<=C){if(_[1]=w,_=r[++m],!_)break;_[0]<=C?(_[0]=w,v=!0):v=!1}C+=T}}_&&(_[1]=this._bufferService.cols)}}static _mergeRanges(r,i){let u=!1;for(let m=0;m<r.length;m++){const v=r[m];if(u){if(i[1]<=v[0])return r[m-1][1]=i[1],r;if(i[1]<=v[1])return r[m-1][1]=Math.max(i[1],v[1]),r.splice(m,1),r;r.splice(m,1),m--}else{if(i[1]<=v[0])return r.splice(m,0,i),r;if(i[1]<=v[1])return v[0]=Math.min(i[0],v[0]),r;i[0]<v[1]&&(v[0]=Math.min(i[0],v[0]),u=!0)}}return u?r[r.length-1][1]=i[1]:r.push(i),r}};n.CharacterJoinerService=s=l([g(0,S.IBufferService)],s)},5114:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoreBrowserService=void 0;const l=a(844),g=a(8460),h=a(3656);class f extends l.Disposable{constructor(d,s,o){super(),this._textarea=d,this._window=s,this.mainDocument=o,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new p(this._window),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new g.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this.register((0,g.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get window(){return this._window}set window(d){this._window!==d&&(this._window=d,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}}n.CoreBrowserService=f;class p extends l.Disposable{constructor(d){super(),this._parentWindow=d,this._windowResizeListener=this.register(new l.MutableDisposable),this._onDprChange=this.register(new g.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,l.toDisposable)(()=>this.clearListener()))}setWindow(d){this._parentWindow=d,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,h.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var d;this._outerListener&&((d=this._resolutionMediaMatchList)==null||d.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:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.LinkProviderService=void 0;const l=a(844);class g extends l.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,l.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(f){return this.linkProviders.push(f),{dispose:()=>{const p=this.linkProviders.indexOf(f);p!==-1&&this.linkProviders.splice(p,1)}}}}n.LinkProviderService=g},8934:function(x,n,a){var l=this&&this.__decorate||function(S,d,s,o){var r,i=arguments.length,u=i<3?d:o===null?o=Object.getOwnPropertyDescriptor(d,s):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(S,d,s,o);else for(var m=S.length-1;m>=0;m--)(r=S[m])&&(u=(i<3?r(u):i>3?r(d,s,u):r(d,s))||u);return i>3&&u&&Object.defineProperty(d,s,u),u},g=this&&this.__param||function(S,d){return function(s,o){d(s,o,S)}};Object.defineProperty(n,"__esModule",{value:!0}),n.MouseService=void 0;const h=a(4725),f=a(9806);let p=n.MouseService=class{constructor(S,d){this._renderService=S,this._charSizeService=d}getCoords(S,d,s,o,r){return(0,f.getCoords)(window,S,d,s,o,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(S,d){const s=(0,f.getCoordsRelativeToElement)(window,S,d);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};n.MouseService=p=l([g(0,h.IRenderService),g(1,h.ICharSizeService)],p)},3230:function(x,n,a){var l=this&&this.__decorate||function(r,i,u,m){var v,C=arguments.length,_=C<3?i:m===null?m=Object.getOwnPropertyDescriptor(i,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(r,i,u,m);else for(var w=r.length-1;w>=0;w--)(v=r[w])&&(_=(C<3?v(_):C>3?v(i,u,_):v(i,u))||_);return C>3&&_&&Object.defineProperty(i,u,_),_},g=this&&this.__param||function(r,i){return function(u,m){i(u,m,r)}};Object.defineProperty(n,"__esModule",{value:!0}),n.RenderService=void 0;const h=a(6193),f=a(4725),p=a(8460),S=a(844),d=a(7226),s=a(2585);let o=n.RenderService=class extends S.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(r,i,u,m,v,C,_,w){super(),this._rowCount=r,this._charSizeService=m,this._renderer=this.register(new S.MutableDisposable),this._pausedResizeTask=new d.DebouncedIdleTask,this._observerDisposable=this.register(new S.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 p.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new p.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new p.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new p.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer((A,T)=>this._renderRows(A,T),_),this.register(this._renderDebouncer),this.register(_.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(C.onResize(()=>this._fullRefresh())),this.register(C.buffers.onBufferActivate(()=>{var A;return(A=this._renderer.value)==null?void 0:A.clear()})),this.register(u.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(v.onDecorationRegistered(()=>this._fullRefresh())),this.register(v.onDecorationRemoved(()=>this._fullRefresh())),this.register(u.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(C.cols,C.rows),this._fullRefresh()})),this.register(u.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(C.buffer.y,C.buffer.y,!0))),this.register(w.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(_.window,i),this.register(_.onWindowChange(A=>this._registerIntersectionObserver(A,i)))}_registerIntersectionObserver(r,i){if("IntersectionObserver"in r){const u=new r.IntersectionObserver(m=>this._handleIntersectionChange(m[m.length-1]),{threshold:0});u.observe(i),this._observerDisposable.value=(0,S.toDisposable)(()=>u.disconnect())}}_handleIntersectionChange(r){this._isPaused=r.isIntersecting===void 0?r.intersectionRatio===0:!r.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(r,i,u=!1){this._isPaused?this._needsFullRefresh=!0:(u||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(r,i,this._rowCount))}_renderRows(r,i){this._renderer.value&&(r=Math.min(r,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(r,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:r,end:i}),this._onRender.fire({start:r,end:i}),this._isNextRenderRedrawOnly=!0)}resize(r,i){this._rowCount=i,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(r){this._renderer.value=r,this._renderer.value&&(this._renderer.value.onRequestRedraw(i=>this.refreshRows(i.start,i.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(r){return this._renderDebouncer.addRefreshCallback(r)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var r,i;this._renderer.value&&((i=(r=this._renderer.value).clearTextureAtlas)==null||i.call(r),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(r,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var u;return(u=this._renderer.value)==null?void 0:u.handleResize(r,i)}):this._renderer.value.handleResize(r,i),this._fullRefresh())}handleCharSizeChanged(){var r;(r=this._renderer.value)==null||r.handleCharSizeChanged()}handleBlur(){var r;(r=this._renderer.value)==null||r.handleBlur()}handleFocus(){var r;(r=this._renderer.value)==null||r.handleFocus()}handleSelectionChanged(r,i,u){var m;this._selectionState.start=r,this._selectionState.end=i,this._selectionState.columnSelectMode=u,(m=this._renderer.value)==null||m.handleSelectionChanged(r,i,u)}handleCursorMove(){var r;(r=this._renderer.value)==null||r.handleCursorMove()}clear(){var r;(r=this._renderer.value)==null||r.clear()}};n.RenderService=o=l([g(2,s.IOptionsService),g(3,f.ICharSizeService),g(4,s.IDecorationService),g(5,s.IBufferService),g(6,f.ICoreBrowserService),g(7,f.IThemeService)],o)},9312:function(x,n,a){var l=this&&this.__decorate||function(_,w,A,T){var O,D=arguments.length,I=D<3?w:T===null?T=Object.getOwnPropertyDescriptor(w,A):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(_,w,A,T);else for(var F=_.length-1;F>=0;F--)(O=_[F])&&(I=(D<3?O(I):D>3?O(w,A,I):O(w,A))||I);return D>3&&I&&Object.defineProperty(w,A,I),I},g=this&&this.__param||function(_,w){return function(A,T){w(A,T,_)}};Object.defineProperty(n,"__esModule",{value:!0}),n.SelectionService=void 0;const h=a(9806),f=a(9504),p=a(456),S=a(4725),d=a(8460),s=a(844),o=a(6114),r=a(4841),i=a(511),u=a(2585),m=" ",v=new RegExp(m,"g");let C=n.SelectionService=class extends s.Disposable{constructor(_,w,A,T,O,D,I,F,U){super(),this._element=_,this._screenElement=w,this._linkifier=A,this._bufferService=T,this._coreService=O,this._mouseService=D,this._optionsService=I,this._renderService=F,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new i.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new d.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new d.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new d.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new d.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=K=>this._handleMouseMove(K),this._mouseUpListener=K=>this._handleMouseUp(K),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(K=>this._handleTrim(K)),this.register(this._bufferService.buffers.onBufferActivate(K=>this._handleBufferActivate(K))),this.enable(),this._model=new p.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,s.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 _=this._model.finalSelectionStart,w=this._model.finalSelectionEnd;return!(!_||!w||_[0]===w[0]&&_[1]===w[1])}get selectionText(){const _=this._model.finalSelectionStart,w=this._model.finalSelectionEnd;if(!_||!w)return"";const A=this._bufferService.buffer,T=[];if(this._activeSelectionMode===3){if(_[0]===w[0])return"";const O=_[0]<w[0]?_[0]:w[0],D=_[0]<w[0]?w[0]:_[0];for(let I=_[1];I<=w[1];I++){const F=A.translateBufferLineToString(I,!0,O,D);T.push(F)}}else{const O=_[1]===w[1]?w[0]:void 0;T.push(A.translateBufferLineToString(_[1],!0,_[0],O));for(let D=_[1]+1;D<=w[1]-1;D++){const I=A.lines.get(D),F=A.translateBufferLineToString(D,!0);I!=null&&I.isWrapped?T[T.length-1]+=F:T.push(F)}if(_[1]!==w[1]){const D=A.lines.get(w[1]),I=A.translateBufferLineToString(w[1],!0,0,w[0]);D&&D.isWrapped?T[T.length-1]+=I:T.push(I)}}return T.map(O=>O.replace(v," ")).join(o.isWindows?`\r
6
- `:`
7
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(_){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),o.isLinux&&_&&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(_){const w=this._getMouseBufferCoords(_),A=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!!(A&&T&&w)&&this._areCoordsInSelection(w,A,T)}isCellInSelection(_,w){const A=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!A||!T)&&this._areCoordsInSelection([_,w],A,T)}_areCoordsInSelection(_,w,A){return _[1]>w[1]&&_[1]<A[1]||w[1]===A[1]&&_[1]===w[1]&&_[0]>=w[0]&&_[0]<A[0]||w[1]<A[1]&&_[1]===A[1]&&_[0]<A[0]||w[1]<A[1]&&_[1]===w[1]&&_[0]>=w[0]}_selectWordAtCursor(_,w){var O,D;const A=(D=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:D.range;if(A)return this._model.selectionStart=[A.start.x-1,A.start.y-1],this._model.selectionStartLength=(0,r.getRangeLength)(A,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const T=this._getMouseBufferCoords(_);return!!T&&(this._selectWordAt(T,w),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(_,w){this._model.clearSelection(),_=Math.max(_,0),w=Math.min(w,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,_],this._model.selectionEnd=[this._bufferService.cols,w],this.refresh(),this._onSelectionChange.fire()}_handleTrim(_){this._model.handleTrim(_)&&this.refresh()}_getMouseBufferCoords(_){const w=this._mouseService.getCoords(_,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(w)return w[0]--,w[1]--,w[1]+=this._bufferService.buffer.ydisp,w}_getMouseEventScrollAmount(_){let w=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,_,this._screenElement)[1];const A=this._renderService.dimensions.css.canvas.height;return w>=0&&w<=A?0:(w>A&&(w-=A),w=Math.min(Math.max(w,-50),50),w/=50,w/Math.abs(w)+Math.round(14*w))}shouldForceSelection(_){return o.isMac?_.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:_.shiftKey}handleMouseDown(_){if(this._mouseDownTimeStamp=_.timeStamp,(_.button!==2||!this.hasSelection)&&_.button===0){if(!this._enabled){if(!this.shouldForceSelection(_))return;_.stopPropagation()}_.preventDefault(),this._dragScrollAmount=0,this._enabled&&_.shiftKey?this._handleIncrementalClick(_):_.detail===1?this._handleSingleClick(_):_.detail===2?this._handleDoubleClick(_):_.detail===3&&this._handleTripleClick(_),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(_){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(_))}_handleSingleClick(_){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(_)?3:0,this._model.selectionStart=this._getMouseBufferCoords(_),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const w=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);w&&w.length!==this._model.selectionStart[0]&&w.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(_){this._selectWordAtCursor(_,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(_){const w=this._getMouseBufferCoords(_);w&&(this._activeSelectionMode=2,this._selectLineAt(w[1]))}shouldColumnSelect(_){return _.altKey&&!(o.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(_){if(_.stopImmediatePropagation(),!this._model.selectionStart)return;const w=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(_),!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(_),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const A=this._bufferService.buffer;if(this._model.selectionEnd[1]<A.lines.length){const T=A.lines.get(this._model.selectionEnd[1]);T&&T.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}w&&w[0]===this._model.selectionEnd[0]&&w[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 _=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(_.ydisp+this._bufferService.rows,_.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=_.ydisp),this.refresh()}}_handleMouseUp(_){const w=_.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&w<500&&_.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const A=this._mouseService.getCoords(_,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(A&&A[0]!==void 0&&A[1]!==void 0){const T=(0,f.moveToCellSequence)(A[0]-1,A[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(T,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const _=this._model.finalSelectionStart,w=this._model.finalSelectionEnd,A=!(!_||!w||_[0]===w[0]&&_[1]===w[1]);A?_&&w&&(this._oldSelectionStart&&this._oldSelectionEnd&&_[0]===this._oldSelectionStart[0]&&_[1]===this._oldSelectionStart[1]&&w[0]===this._oldSelectionEnd[0]&&w[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(_,w,A)):this._oldHasSelection&&this._fireOnSelectionChange(_,w,A)}_fireOnSelectionChange(_,w,A){this._oldSelectionStart=_,this._oldSelectionEnd=w,this._oldHasSelection=A,this._onSelectionChange.fire()}_handleBufferActivate(_){this.clearSelection(),this._trimListener.dispose(),this._trimListener=_.activeBuffer.lines.onTrim(w=>this._handleTrim(w))}_convertViewportColToCharacterIndex(_,w){let A=w;for(let T=0;w>=T;T++){const O=_.loadCell(T,this._workCell).getChars().length;this._workCell.getWidth()===0?A--:O>1&&w!==T&&(A+=O-1)}return A}setSelection(_,w,A){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[_,w],this._model.selectionStartLength=A,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(_){this._isClickInSelection(_)||(this._selectWordAtCursor(_,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(_,w,A=!0,T=!0){if(_[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,D=O.lines.get(_[1]);if(!D)return;const I=O.translateBufferLineToString(_[1],!1);let F=this._convertViewportColToCharacterIndex(D,_[0]),U=F;const K=_[0]-F;let N=0,y=0,R=0,B=0;if(I.charAt(F)===" "){for(;F>0&&I.charAt(F-1)===" ";)F--;for(;U<I.length&&I.charAt(U+1)===" ";)U++}else{let j=_[0],V=_[0];D.getWidth(j)===0&&(N++,j--),D.getWidth(V)===2&&(y++,V++);const J=D.getString(V).length;for(J>1&&(B+=J-1,U+=J-1);j>0&&F>0&&!this._isCharWordSeparator(D.loadCell(j-1,this._workCell));){D.loadCell(j-1,this._workCell);const M=this._workCell.getChars().length;this._workCell.getWidth()===0?(N++,j--):M>1&&(R+=M-1,F-=M-1),F--,j--}for(;V<D.length&&U+1<I.length&&!this._isCharWordSeparator(D.loadCell(V+1,this._workCell));){D.loadCell(V+1,this._workCell);const M=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,V++):M>1&&(B+=M-1,U+=M-1),U++,V++}}U++;let P=F+K-N+R,$=Math.min(this._bufferService.cols,U-F+N+y-R-B);if(w||I.slice(F,U).trim()!==""){if(A&&P===0&&D.getCodePoint(0)!==32){const j=O.lines.get(_[1]-1);if(j&&D.isWrapped&&j.getCodePoint(this._bufferService.cols-1)!==32){const V=this._getWordAt([this._bufferService.cols-1,_[1]-1],!1,!0,!1);if(V){const J=this._bufferService.cols-V.start;P-=J,$+=J}}}if(T&&P+$===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){const j=O.lines.get(_[1]+1);if(j!=null&&j.isWrapped&&j.getCodePoint(0)!==32){const V=this._getWordAt([0,_[1]+1],!1,!1,!0);V&&($+=V.length)}}return{start:P,length:$}}}_selectWordAt(_,w){const A=this._getWordAt(_,w);if(A){for(;A.start<0;)A.start+=this._bufferService.cols,_[1]--;this._model.selectionStart=[A.start,_[1]],this._model.selectionStartLength=A.length}}_selectToWordAt(_){const w=this._getWordAt(_,!0);if(w){let A=_[1];for(;w.start<0;)w.start+=this._bufferService.cols,A--;if(!this._model.areSelectionValuesReversed())for(;w.start+w.length>this._bufferService.cols;)w.length-=this._bufferService.cols,A++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?w.start:w.start+w.length,A]}}_isCharWordSeparator(_){return _.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(_.getChars())>=0}_selectLineAt(_){const w=this._bufferService.buffer.getWrappedRangeForLine(_),A={start:{x:0,y:w.first},end:{x:this._bufferService.cols-1,y:w.last}};this._model.selectionStart=[0,w.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,r.getRangeLength)(A,this._bufferService.cols)}};n.SelectionService=C=l([g(3,u.IBufferService),g(4,u.ICoreService),g(5,S.IMouseService),g(6,u.IOptionsService),g(7,S.IRenderService),g(8,S.ICoreBrowserService)],C)},4725:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ILinkProviderService=n.IThemeService=n.ICharacterJoinerService=n.ISelectionService=n.IRenderService=n.IMouseService=n.ICoreBrowserService=n.ICharSizeService=void 0;const l=a(8343);n.ICharSizeService=(0,l.createDecorator)("CharSizeService"),n.ICoreBrowserService=(0,l.createDecorator)("CoreBrowserService"),n.IMouseService=(0,l.createDecorator)("MouseService"),n.IRenderService=(0,l.createDecorator)("RenderService"),n.ISelectionService=(0,l.createDecorator)("SelectionService"),n.ICharacterJoinerService=(0,l.createDecorator)("CharacterJoinerService"),n.IThemeService=(0,l.createDecorator)("ThemeService"),n.ILinkProviderService=(0,l.createDecorator)("LinkProviderService")},6731:function(x,n,a){var l=this&&this.__decorate||function(C,_,w,A){var T,O=arguments.length,D=O<3?_:A===null?A=Object.getOwnPropertyDescriptor(_,w):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(C,_,w,A);else for(var I=C.length-1;I>=0;I--)(T=C[I])&&(D=(O<3?T(D):O>3?T(_,w,D):T(_,w))||D);return O>3&&D&&Object.defineProperty(_,w,D),D},g=this&&this.__param||function(C,_){return function(w,A){_(w,A,C)}};Object.defineProperty(n,"__esModule",{value:!0}),n.ThemeService=n.DEFAULT_ANSI_COLORS=void 0;const h=a(7239),f=a(8055),p=a(8460),S=a(844),d=a(2585),s=f.css.toColor("#ffffff"),o=f.css.toColor("#000000"),r=f.css.toColor("#ffffff"),i=f.css.toColor("#000000"),u={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};n.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const C=[f.css.toColor("#2e3436"),f.css.toColor("#cc0000"),f.css.toColor("#4e9a06"),f.css.toColor("#c4a000"),f.css.toColor("#3465a4"),f.css.toColor("#75507b"),f.css.toColor("#06989a"),f.css.toColor("#d3d7cf"),f.css.toColor("#555753"),f.css.toColor("#ef2929"),f.css.toColor("#8ae234"),f.css.toColor("#fce94f"),f.css.toColor("#729fcf"),f.css.toColor("#ad7fa8"),f.css.toColor("#34e2e2"),f.css.toColor("#eeeeec")],_=[0,95,135,175,215,255];for(let w=0;w<216;w++){const A=_[w/36%6|0],T=_[w/6%6|0],O=_[w%6];C.push({css:f.channels.toCss(A,T,O),rgba:f.channels.toRgba(A,T,O)})}for(let w=0;w<24;w++){const A=8+10*w;C.push({css:f.channels.toCss(A,A,A),rgba:f.channels.toRgba(A,A,A)})}return C})());let m=n.ThemeService=class extends S.Disposable{get colors(){return this._colors}constructor(C){super(),this._optionsService=C,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new p.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:s,background:o,cursor:r,cursorAccent:i,selectionForeground:void 0,selectionBackgroundTransparent:u,selectionBackgroundOpaque:f.color.blend(o,u),selectionInactiveBackgroundTransparent:u,selectionInactiveBackgroundOpaque:f.color.blend(o,u),ansi:n.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(C={}){const _=this._colors;if(_.foreground=v(C.foreground,s),_.background=v(C.background,o),_.cursor=v(C.cursor,r),_.cursorAccent=v(C.cursorAccent,i),_.selectionBackgroundTransparent=v(C.selectionBackground,u),_.selectionBackgroundOpaque=f.color.blend(_.background,_.selectionBackgroundTransparent),_.selectionInactiveBackgroundTransparent=v(C.selectionInactiveBackground,_.selectionBackgroundTransparent),_.selectionInactiveBackgroundOpaque=f.color.blend(_.background,_.selectionInactiveBackgroundTransparent),_.selectionForeground=C.selectionForeground?v(C.selectionForeground,f.NULL_COLOR):void 0,_.selectionForeground===f.NULL_COLOR&&(_.selectionForeground=void 0),f.color.isOpaque(_.selectionBackgroundTransparent)&&(_.selectionBackgroundTransparent=f.color.opacity(_.selectionBackgroundTransparent,.3)),f.color.isOpaque(_.selectionInactiveBackgroundTransparent)&&(_.selectionInactiveBackgroundTransparent=f.color.opacity(_.selectionInactiveBackgroundTransparent,.3)),_.ansi=n.DEFAULT_ANSI_COLORS.slice(),_.ansi[0]=v(C.black,n.DEFAULT_ANSI_COLORS[0]),_.ansi[1]=v(C.red,n.DEFAULT_ANSI_COLORS[1]),_.ansi[2]=v(C.green,n.DEFAULT_ANSI_COLORS[2]),_.ansi[3]=v(C.yellow,n.DEFAULT_ANSI_COLORS[3]),_.ansi[4]=v(C.blue,n.DEFAULT_ANSI_COLORS[4]),_.ansi[5]=v(C.magenta,n.DEFAULT_ANSI_COLORS[5]),_.ansi[6]=v(C.cyan,n.DEFAULT_ANSI_COLORS[6]),_.ansi[7]=v(C.white,n.DEFAULT_ANSI_COLORS[7]),_.ansi[8]=v(C.brightBlack,n.DEFAULT_ANSI_COLORS[8]),_.ansi[9]=v(C.brightRed,n.DEFAULT_ANSI_COLORS[9]),_.ansi[10]=v(C.brightGreen,n.DEFAULT_ANSI_COLORS[10]),_.ansi[11]=v(C.brightYellow,n.DEFAULT_ANSI_COLORS[11]),_.ansi[12]=v(C.brightBlue,n.DEFAULT_ANSI_COLORS[12]),_.ansi[13]=v(C.brightMagenta,n.DEFAULT_ANSI_COLORS[13]),_.ansi[14]=v(C.brightCyan,n.DEFAULT_ANSI_COLORS[14]),_.ansi[15]=v(C.brightWhite,n.DEFAULT_ANSI_COLORS[15]),C.extendedAnsi){const w=Math.min(_.ansi.length-16,C.extendedAnsi.length);for(let A=0;A<w;A++)_.ansi[A+16]=v(C.extendedAnsi[A],n.DEFAULT_ANSI_COLORS[A+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(C){this._restoreColor(C),this._onChangeColors.fire(this.colors)}_restoreColor(C){if(C!==void 0)switch(C){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[C]=this._restoreColors.ansi[C]}else for(let _=0;_<this._restoreColors.ansi.length;++_)this._colors.ansi[_]=this._restoreColors.ansi[_]}modifyColors(C){C(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 v(C,_){if(C!==void 0)try{return f.css.toColor(C)}catch{}return _}n.ThemeService=m=l([g(0,d.IOptionsService)],m)},6349:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CircularList=void 0;const l=a(8460),g=a(844);class h extends g.Disposable{constructor(p){super(),this._maxLength=p,this.onDeleteEmitter=this.register(new l.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new l.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new l.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(p){if(this._maxLength===p)return;const S=new Array(p);for(let d=0;d<Math.min(p,this.length);d++)S[d]=this._array[this._getCyclicIndex(d)];this._array=S,this._maxLength=p,this._startIndex=0}get length(){return this._length}set length(p){if(p>this._length)for(let S=this._length;S<p;S++)this._array[S]=void 0;this._length=p}get(p){return this._array[this._getCyclicIndex(p)]}set(p,S){this._array[this._getCyclicIndex(p)]=S}push(p){this._array[this._getCyclicIndex(this._length)]=p,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(p,S,...d){if(S){for(let s=p;s<this._length-S;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+S)];this._length-=S,this.onDeleteEmitter.fire({index:p,amount:S})}for(let s=this._length-1;s>=p;s--)this._array[this._getCyclicIndex(s+d.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<d.length;s++)this._array[this._getCyclicIndex(p+s)]=d[s];if(d.length&&this.onInsertEmitter.fire({index:p,amount:d.length}),this._length+d.length>this._maxLength){const s=this._length+d.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=d.length}trimStart(p){p>this._length&&(p=this._length),this._startIndex+=p,this._length-=p,this.onTrimEmitter.fire(p)}shiftElements(p,S,d){if(!(S<=0)){if(p<0||p>=this._length)throw new Error("start argument out of range");if(p+d<0)throw new Error("Cannot shift elements in list beyond index 0");if(d>0){for(let o=S-1;o>=0;o--)this.set(p+o+d,this.get(p+o));const s=p+S+d-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<S;s++)this.set(p+s+d,this.get(p+s))}}_getCyclicIndex(p){return(this._startIndex+p)%this._maxLength}}n.CircularList=h},1439:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clone=void 0,n.clone=function a(l,g=5){if(typeof l!="object")return l;const h=Array.isArray(l)?[]:{};for(const f in l)h[f]=g<=1?l[f]:l[f]&&a(l[f],g-1);return h}},8055:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.contrastRatio=n.toPaddedHex=n.rgba=n.rgb=n.css=n.color=n.channels=n.NULL_COLOR=void 0;let a=0,l=0,g=0,h=0;var f,p,S,d,s;function o(i){const u=i.toString(16);return u.length<2?"0"+u:u}function r(i,u){return i<u?(u+.05)/(i+.05):(i+.05)/(u+.05)}n.NULL_COLOR={css:"#00000000",rgba:0},function(i){i.toCss=function(u,m,v,C){return C!==void 0?`#${o(u)}${o(m)}${o(v)}${o(C)}`:`#${o(u)}${o(m)}${o(v)}`},i.toRgba=function(u,m,v,C=255){return(u<<24|m<<16|v<<8|C)>>>0},i.toColor=function(u,m,v,C){return{css:i.toCss(u,m,v,C),rgba:i.toRgba(u,m,v,C)}}}(f||(n.channels=f={})),function(i){function u(m,v){return h=Math.round(255*v),[a,l,g]=s.toChannels(m.rgba),{css:f.toCss(a,l,g,h),rgba:f.toRgba(a,l,g,h)}}i.blend=function(m,v){if(h=(255&v.rgba)/255,h===1)return{css:v.css,rgba:v.rgba};const C=v.rgba>>24&255,_=v.rgba>>16&255,w=v.rgba>>8&255,A=m.rgba>>24&255,T=m.rgba>>16&255,O=m.rgba>>8&255;return a=A+Math.round((C-A)*h),l=T+Math.round((_-T)*h),g=O+Math.round((w-O)*h),{css:f.toCss(a,l,g),rgba:f.toRgba(a,l,g)}},i.isOpaque=function(m){return(255&m.rgba)==255},i.ensureContrastRatio=function(m,v,C){const _=s.ensureContrastRatio(m.rgba,v.rgba,C);if(_)return f.toColor(_>>24&255,_>>16&255,_>>8&255)},i.opaque=function(m){const v=(255|m.rgba)>>>0;return[a,l,g]=s.toChannels(v),{css:f.toCss(a,l,g),rgba:v}},i.opacity=u,i.multiplyOpacity=function(m,v){return h=255&m.rgba,u(m,h*v/255)},i.toColorRGB=function(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}}(p||(n.color=p={})),function(i){let u,m;try{const v=document.createElement("canvas");v.width=1,v.height=1;const C=v.getContext("2d",{willReadFrequently:!0});C&&(u=C,u.globalCompositeOperation="copy",m=u.createLinearGradient(0,0,1,1))}catch{}i.toColor=function(v){if(v.match(/#[\da-f]{3,8}/i))switch(v.length){case 4:return a=parseInt(v.slice(1,2).repeat(2),16),l=parseInt(v.slice(2,3).repeat(2),16),g=parseInt(v.slice(3,4).repeat(2),16),f.toColor(a,l,g);case 5:return a=parseInt(v.slice(1,2).repeat(2),16),l=parseInt(v.slice(2,3).repeat(2),16),g=parseInt(v.slice(3,4).repeat(2),16),h=parseInt(v.slice(4,5).repeat(2),16),f.toColor(a,l,g,h);case 7:return{css:v,rgba:(parseInt(v.slice(1),16)<<8|255)>>>0};case 9:return{css:v,rgba:parseInt(v.slice(1),16)>>>0}}const C=v.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(C)return a=parseInt(C[1]),l=parseInt(C[2]),g=parseInt(C[3]),h=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),f.toColor(a,l,g,h);if(!u||!m)throw new Error("css.toColor: Unsupported css format");if(u.fillStyle=m,u.fillStyle=v,typeof u.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(u.fillRect(0,0,1,1),[a,l,g,h]=u.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:f.toRgba(a,l,g,h),css:v}}}(S||(n.css=S={})),function(i){function u(m,v,C){const _=m/255,w=v/255,A=C/255;return .2126*(_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4))+.7152*(w<=.03928?w/12.92:Math.pow((w+.055)/1.055,2.4))+.0722*(A<=.03928?A/12.92:Math.pow((A+.055)/1.055,2.4))}i.relativeLuminance=function(m){return u(m>>16&255,m>>8&255,255&m)},i.relativeLuminance2=u}(d||(n.rgb=d={})),function(i){function u(v,C,_){const w=v>>24&255,A=v>>16&255,T=v>>8&255;let O=C>>24&255,D=C>>16&255,I=C>>8&255,F=r(d.relativeLuminance2(O,D,I),d.relativeLuminance2(w,A,T));for(;F<_&&(O>0||D>0||I>0);)O-=Math.max(0,Math.ceil(.1*O)),D-=Math.max(0,Math.ceil(.1*D)),I-=Math.max(0,Math.ceil(.1*I)),F=r(d.relativeLuminance2(O,D,I),d.relativeLuminance2(w,A,T));return(O<<24|D<<16|I<<8|255)>>>0}function m(v,C,_){const w=v>>24&255,A=v>>16&255,T=v>>8&255;let O=C>>24&255,D=C>>16&255,I=C>>8&255,F=r(d.relativeLuminance2(O,D,I),d.relativeLuminance2(w,A,T));for(;F<_&&(O<255||D<255||I<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),D=Math.min(255,D+Math.ceil(.1*(255-D))),I=Math.min(255,I+Math.ceil(.1*(255-I))),F=r(d.relativeLuminance2(O,D,I),d.relativeLuminance2(w,A,T));return(O<<24|D<<16|I<<8|255)>>>0}i.blend=function(v,C){if(h=(255&C)/255,h===1)return C;const _=C>>24&255,w=C>>16&255,A=C>>8&255,T=v>>24&255,O=v>>16&255,D=v>>8&255;return a=T+Math.round((_-T)*h),l=O+Math.round((w-O)*h),g=D+Math.round((A-D)*h),f.toRgba(a,l,g)},i.ensureContrastRatio=function(v,C,_){const w=d.relativeLuminance(v>>8),A=d.relativeLuminance(C>>8);if(r(w,A)<_){if(A<w){const D=u(v,C,_),I=r(w,d.relativeLuminance(D>>8));if(I<_){const F=m(v,C,_);return I>r(w,d.relativeLuminance(F>>8))?D:F}return D}const T=m(v,C,_),O=r(w,d.relativeLuminance(T>>8));if(O<_){const D=u(v,C,_);return O>r(w,d.relativeLuminance(D>>8))?T:D}return T}},i.reduceLuminance=u,i.increaseLuminance=m,i.toChannels=function(v){return[v>>24&255,v>>16&255,v>>8&255,255&v]}}(s||(n.rgba=s={})),n.toPaddedHex=o,n.contrastRatio=r},8969:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoreTerminal=void 0;const l=a(844),g=a(2585),h=a(4348),f=a(7866),p=a(744),S=a(7302),d=a(6975),s=a(8460),o=a(1753),r=a(1480),i=a(7994),u=a(9282),m=a(5435),v=a(5981),C=a(2660);let _=!1;class w extends l.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new s.EventEmitter),this._onScroll.event(T=>{var O;(O=this._onScrollApi)==null||O.fire(T.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(T){for(const O in T)this.optionsService.options[O]=T[O]}constructor(T){super(),this._windowsWrappingHeuristics=this.register(new l.MutableDisposable),this._onBinary=this.register(new s.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new s.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new s.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new s.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new s.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new s.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new S.OptionsService(T)),this._instantiationService.setService(g.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(p.BufferService)),this._instantiationService.setService(g.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(f.LogService)),this._instantiationService.setService(g.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(d.CoreService)),this._instantiationService.setService(g.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(o.CoreMouseService)),this._instantiationService.setService(g.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(r.UnicodeService)),this._instantiationService.setService(g.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(i.CharsetService),this._instantiationService.setService(g.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(C.OscLinkService),this._instantiationService.setService(g.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new m.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,s.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,s.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,s.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,s.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(O=>{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(O=>{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 v.WriteBuffer((O,D)=>this._inputHandler.parse(O,D))),this.register((0,s.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(T,O){this._writeBuffer.write(T,O)}writeSync(T,O){this._logService.logLevel<=g.LogLevelEnum.WARN&&!_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),_=!0),this._writeBuffer.writeSync(T,O)}input(T,O=!0){this.coreService.triggerDataEvent(T,O)}resize(T,O){isNaN(T)||isNaN(O)||(T=Math.max(T,p.MINIMUM_COLS),O=Math.max(O,p.MINIMUM_ROWS),this._bufferService.resize(T,O))}scroll(T,O=!1){this._bufferService.scroll(T,O)}scrollLines(T,O,D){this._bufferService.scrollLines(T,O,D)}scrollPages(T){this.scrollLines(T*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(T){const O=T-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(T,O){return this._inputHandler.registerEscHandler(T,O)}registerDcsHandler(T,O){return this._inputHandler.registerDcsHandler(T,O)}registerCsiHandler(T,O){return this._inputHandler.registerCsiHandler(T,O)}registerOscHandler(T,O){return this._inputHandler.registerOscHandler(T,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let T=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?T=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(T=!0),T?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const T=[];T.push(this.onLineFeed(u.updateWindowsModeWrappedState.bind(null,this._bufferService))),T.push(this.registerCsiHandler({final:"H"},()=>((0,u.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,l.toDisposable)(()=>{for(const O of T)O.dispose()})}}}n.CoreTerminal=w},8460:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.runAndSubscribe=n.forwardEvent=n.EventEmitter=void 0,n.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let l=0;l<this._listeners.length;l++)if(this._listeners[l]===a)return void this._listeners.splice(l,1)}}})),this._event}fire(a,l){const g=[];for(let h=0;h<this._listeners.length;h++)g.push(this._listeners[h]);for(let h=0;h<g.length;h++)g[h].call(void 0,a,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},n.forwardEvent=function(a,l){return a(g=>l.fire(g))},n.runAndSubscribe=function(a,l){return l(void 0),a(g=>l(g))}},5435:function(x,n,a){var l=this&&this.__decorate||function(N,y,R,B){var P,$=arguments.length,j=$<3?y:B===null?B=Object.getOwnPropertyDescriptor(y,R):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")j=Reflect.decorate(N,y,R,B);else for(var V=N.length-1;V>=0;V--)(P=N[V])&&(j=($<3?P(j):$>3?P(y,R,j):P(y,R))||j);return $>3&&j&&Object.defineProperty(y,R,j),j},g=this&&this.__param||function(N,y){return function(R,B){y(R,B,N)}};Object.defineProperty(n,"__esModule",{value:!0}),n.InputHandler=n.WindowsOptionsReportType=void 0;const h=a(2584),f=a(7116),p=a(2015),S=a(844),d=a(482),s=a(8437),o=a(8460),r=a(643),i=a(511),u=a(3734),m=a(2585),v=a(1480),C=a(6242),_=a(6351),w=a(5941),A={"(":0,")":1,"*":2,"+":3,"-":1,".":2},T=131072;function O(N,y){if(N>24)return y.setWinLines||!1;switch(N){case 1:return!!y.restoreWin;case 2:return!!y.minimizeWin;case 3:return!!y.setWinPosition;case 4:return!!y.setWinSizePixels;case 5:return!!y.raiseWin;case 6:return!!y.lowerWin;case 7:return!!y.refreshWin;case 8:return!!y.setWinSizeChars;case 9:return!!y.maximizeWin;case 10:return!!y.fullscreenWin;case 11:return!!y.getWinState;case 13:return!!y.getWinPosition;case 14:return!!y.getWinSizePixels;case 15:return!!y.getScreenSizePixels;case 16:return!!y.getCellSizePixels;case 18:return!!y.getWinSizeChars;case 19:return!!y.getScreenSizeChars;case 20:return!!y.getIconTitle;case 21:return!!y.getWinTitle;case 22:return!!y.pushTitle;case 23:return!!y.popTitle;case 24:return!!y.setWinLines}return!1}var D;(function(N){N[N.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",N[N.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(n.WindowsOptionsReportType=D={}));let I=0;class F extends S.Disposable{getAttrData(){return this._curAttrData}constructor(y,R,B,P,$,j,V,J,M=new p.EscapeSequenceParser){super(),this._bufferService=y,this._charsetService=R,this._coreService=B,this._logService=P,this._optionsService=$,this._oscLinkService=j,this._coreMouseService=V,this._unicodeService=J,this._parser=M,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new d.StringToUtf32,this._utf8Decoder=new d.Utf8ToUtf32,this._workCell=new i.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=s.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=s.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new o.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new o.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new o.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new o.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new o.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new o.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new o.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new o.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new o.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new o.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new o.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new o.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 U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(k=>this._activeBuffer=k.activeBuffer)),this._parser.setCsiHandlerFallback((k,z)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(k),params:z.toArray()})}),this._parser.setEscHandlerFallback(k=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(k)})}),this._parser.setExecuteHandlerFallback(k=>{this._logService.debug("Unknown EXECUTE code: ",{code:k})}),this._parser.setOscHandlerFallback((k,z,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:k,action:z,data:H})}),this._parser.setDcsHandlerFallback((k,z,H)=>{z==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(k),action:z,payload:H})}),this._parser.setPrintHandler((k,z,H)=>this.print(k,z,H)),this._parser.registerCsiHandler({final:"@"},k=>this.insertChars(k)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},k=>this.scrollLeft(k)),this._parser.registerCsiHandler({final:"A"},k=>this.cursorUp(k)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},k=>this.scrollRight(k)),this._parser.registerCsiHandler({final:"B"},k=>this.cursorDown(k)),this._parser.registerCsiHandler({final:"C"},k=>this.cursorForward(k)),this._parser.registerCsiHandler({final:"D"},k=>this.cursorBackward(k)),this._parser.registerCsiHandler({final:"E"},k=>this.cursorNextLine(k)),this._parser.registerCsiHandler({final:"F"},k=>this.cursorPrecedingLine(k)),this._parser.registerCsiHandler({final:"G"},k=>this.cursorCharAbsolute(k)),this._parser.registerCsiHandler({final:"H"},k=>this.cursorPosition(k)),this._parser.registerCsiHandler({final:"I"},k=>this.cursorForwardTab(k)),this._parser.registerCsiHandler({final:"J"},k=>this.eraseInDisplay(k,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},k=>this.eraseInDisplay(k,!0)),this._parser.registerCsiHandler({final:"K"},k=>this.eraseInLine(k,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},k=>this.eraseInLine(k,!0)),this._parser.registerCsiHandler({final:"L"},k=>this.insertLines(k)),this._parser.registerCsiHandler({final:"M"},k=>this.deleteLines(k)),this._parser.registerCsiHandler({final:"P"},k=>this.deleteChars(k)),this._parser.registerCsiHandler({final:"S"},k=>this.scrollUp(k)),this._parser.registerCsiHandler({final:"T"},k=>this.scrollDown(k)),this._parser.registerCsiHandler({final:"X"},k=>this.eraseChars(k)),this._parser.registerCsiHandler({final:"Z"},k=>this.cursorBackwardTab(k)),this._parser.registerCsiHandler({final:"`"},k=>this.charPosAbsolute(k)),this._parser.registerCsiHandler({final:"a"},k=>this.hPositionRelative(k)),this._parser.registerCsiHandler({final:"b"},k=>this.repeatPrecedingCharacter(k)),this._parser.registerCsiHandler({final:"c"},k=>this.sendDeviceAttributesPrimary(k)),this._parser.registerCsiHandler({prefix:">",final:"c"},k=>this.sendDeviceAttributesSecondary(k)),this._parser.registerCsiHandler({final:"d"},k=>this.linePosAbsolute(k)),this._parser.registerCsiHandler({final:"e"},k=>this.vPositionRelative(k)),this._parser.registerCsiHandler({final:"f"},k=>this.hVPosition(k)),this._parser.registerCsiHandler({final:"g"},k=>this.tabClear(k)),this._parser.registerCsiHandler({final:"h"},k=>this.setMode(k)),this._parser.registerCsiHandler({prefix:"?",final:"h"},k=>this.setModePrivate(k)),this._parser.registerCsiHandler({final:"l"},k=>this.resetMode(k)),this._parser.registerCsiHandler({prefix:"?",final:"l"},k=>this.resetModePrivate(k)),this._parser.registerCsiHandler({final:"m"},k=>this.charAttributes(k)),this._parser.registerCsiHandler({final:"n"},k=>this.deviceStatus(k)),this._parser.registerCsiHandler({prefix:"?",final:"n"},k=>this.deviceStatusPrivate(k)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},k=>this.softReset(k)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},k=>this.setCursorStyle(k)),this._parser.registerCsiHandler({final:"r"},k=>this.setScrollRegion(k)),this._parser.registerCsiHandler({final:"s"},k=>this.saveCursor(k)),this._parser.registerCsiHandler({final:"t"},k=>this.windowOptions(k)),this._parser.registerCsiHandler({final:"u"},k=>this.restoreCursor(k)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},k=>this.insertColumns(k)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},k=>this.deleteColumns(k)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},k=>this.selectProtected(k)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},k=>this.requestMode(k,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},k=>this.requestMode(k,!1)),this._parser.setExecuteHandler(h.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(h.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(h.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(h.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(h.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(h.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(h.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(h.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(h.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(h.C1.IND,()=>this.index()),this._parser.setExecuteHandler(h.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(h.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new C.OscHandler(k=>(this.setTitle(k),this.setIconName(k),!0))),this._parser.registerOscHandler(1,new C.OscHandler(k=>this.setIconName(k))),this._parser.registerOscHandler(2,new C.OscHandler(k=>this.setTitle(k))),this._parser.registerOscHandler(4,new C.OscHandler(k=>this.setOrReportIndexedColor(k))),this._parser.registerOscHandler(8,new C.OscHandler(k=>this.setHyperlink(k))),this._parser.registerOscHandler(10,new C.OscHandler(k=>this.setOrReportFgColor(k))),this._parser.registerOscHandler(11,new C.OscHandler(k=>this.setOrReportBgColor(k))),this._parser.registerOscHandler(12,new C.OscHandler(k=>this.setOrReportCursorColor(k))),this._parser.registerOscHandler(104,new C.OscHandler(k=>this.restoreIndexedColor(k))),this._parser.registerOscHandler(110,new C.OscHandler(k=>this.restoreFgColor(k))),this._parser.registerOscHandler(111,new C.OscHandler(k=>this.restoreBgColor(k))),this._parser.registerOscHandler(112,new C.OscHandler(k=>this.restoreCursorColor(k))),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 k in f.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:k},()=>this.selectCharset("("+k)),this._parser.registerEscHandler({intermediates:")",final:k},()=>this.selectCharset(")"+k)),this._parser.registerEscHandler({intermediates:"*",final:k},()=>this.selectCharset("*"+k)),this._parser.registerEscHandler({intermediates:"+",final:k},()=>this.selectCharset("+"+k)),this._parser.registerEscHandler({intermediates:"-",final:k},()=>this.selectCharset("-"+k)),this._parser.registerEscHandler({intermediates:".",final:k},()=>this.selectCharset("."+k)),this._parser.registerEscHandler({intermediates:"/",final:k},()=>this.selectCharset("/"+k));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(k=>(this._logService.error("Parsing error: ",k),k)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new _.DcsHandler((k,z)=>this.requestStatusString(k,z)))}_preserveStack(y,R,B,P){this._parseStack.paused=!0,this._parseStack.cursorStartX=y,this._parseStack.cursorStartY=R,this._parseStack.decodedLength=B,this._parseStack.position=P}_logSlowResolvingAsync(y){this._logService.logLevel<=m.LogLevelEnum.WARN&&Promise.race([y,new Promise((R,B)=>setTimeout(()=>B("#SLOW_TIMEOUT"),5e3))]).catch(R=>{if(R!=="#SLOW_TIMEOUT")throw R;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(y,R){let B,P=this._activeBuffer.x,$=this._activeBuffer.y,j=0;const V=this._parseStack.paused;if(V){if(B=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,R))return this._logSlowResolvingAsync(B),B;P=this._parseStack.cursorStartX,$=this._parseStack.cursorStartY,this._parseStack.paused=!1,y.length>T&&(j=this._parseStack.position+T)}if(this._logService.logLevel<=m.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof y=="string"?` "${y}"`:` "${Array.prototype.map.call(y,k=>String.fromCharCode(k)).join("")}"`),typeof y=="string"?y.split("").map(k=>k.charCodeAt(0)):y),this._parseBuffer.length<y.length&&this._parseBuffer.length<T&&(this._parseBuffer=new Uint32Array(Math.min(y.length,T))),V||this._dirtyRowTracker.clearRange(),y.length>T)for(let k=j;k<y.length;k+=T){const z=k+T<y.length?k+T:y.length,H=typeof y=="string"?this._stringDecoder.decode(y.substring(k,z),this._parseBuffer):this._utf8Decoder.decode(y.subarray(k,z),this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,H))return this._preserveStack(P,$,H,k),this._logSlowResolvingAsync(B),B}else if(!V){const k=typeof y=="string"?this._stringDecoder.decode(y,this._parseBuffer):this._utf8Decoder.decode(y,this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,k))return this._preserveStack(P,$,k,0),this._logSlowResolvingAsync(B),B}this._activeBuffer.x===P&&this._activeBuffer.y===$||this._onCursorMove.fire();const J=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),M=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);M<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(M,this._bufferService.rows-1),Math.min(J,this._bufferService.rows-1))}print(y,R,B){let P,$;const j=this._charsetService.charset,V=this._optionsService.rawOptions.screenReaderMode,J=this._bufferService.cols,M=this._coreService.decPrivateModes.wraparound,k=this._coreService.modes.insertMode,z=this._curAttrData;let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&B-R>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,z);let q=this._parser.precedingJoinState;for(let Z=R;Z<B;++Z){if(P=y[Z],P<127&&j){const ne=j[String.fromCharCode(P)];ne&&(P=ne.charCodeAt(0))}const Y=this._unicodeService.charProperties(P,q);$=v.UnicodeService.extractWidth(Y);const re=v.UnicodeService.extractShouldJoin(Y),ie=re?v.UnicodeService.extractWidth(q):0;if(q=Y,V&&this._onA11yChar.fire((0,d.stringFromCodePoint)(P)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+$-ie>J){if(M){const ne=H;let X=this._activeBuffer.x-ie;for(this._activeBuffer.x=ie,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),H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ie>0&&H instanceof s.BufferLine&&H.copyCellsFrom(ne,X,0,ie,!1);X<J;)ne.setCellFromCodepoint(X++,0,1,z)}else if(this._activeBuffer.x=J-1,$===2)continue}if(re&&this._activeBuffer.x){const ne=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-ne,P,$);for(let X=$-ie;--X>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}else if(k&&(H.insertCells(this._activeBuffer.x,$-ie,this._activeBuffer.getNullCell(z)),H.getWidth(J-1)===2&&H.setCellFromCodepoint(J-1,r.NULL_CELL_CODE,r.NULL_CELL_WIDTH,z)),H.setCellFromCodepoint(this._activeBuffer.x++,P,$,z),$>0)for(;--$;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}this._parser.precedingJoinState=q,this._activeBuffer.x<J&&B-R>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,z),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(y,R){return y.final!=="t"||y.prefix||y.intermediates?this._parser.registerCsiHandler(y,R):this._parser.registerCsiHandler(y,B=>!O(B.params[0],this._optionsService.rawOptions.windowOptions)||R(B))}registerDcsHandler(y,R){return this._parser.registerDcsHandler(y,new _.DcsHandler(R))}registerEscHandler(y,R){return this._parser.registerEscHandler(y,R)}registerOscHandler(y,R){return this._parser.registerOscHandler(y,new C.OscHandler(R))}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(){var y;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&&((y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&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 R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);R.hasWidth(this._activeBuffer.x)&&!R.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const y=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-y),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(y=this._bufferService.cols-1){this._activeBuffer.x=Math.min(y,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(y,R){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=y,this._activeBuffer.y=this._activeBuffer.scrollTop+R):(this._activeBuffer.x=y,this._activeBuffer.y=R),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(y,R){this._restrictCursor(),this._setCursor(this._activeBuffer.x+y,this._activeBuffer.y+R)}cursorUp(y){const R=this._activeBuffer.y-this._activeBuffer.scrollTop;return R>=0?this._moveCursor(0,-Math.min(R,y.params[0]||1)):this._moveCursor(0,-(y.params[0]||1)),!0}cursorDown(y){const R=this._activeBuffer.scrollBottom-this._activeBuffer.y;return R>=0?this._moveCursor(0,Math.min(R,y.params[0]||1)):this._moveCursor(0,y.params[0]||1),!0}cursorForward(y){return this._moveCursor(y.params[0]||1,0),!0}cursorBackward(y){return this._moveCursor(-(y.params[0]||1),0),!0}cursorNextLine(y){return this.cursorDown(y),this._activeBuffer.x=0,!0}cursorPrecedingLine(y){return this.cursorUp(y),this._activeBuffer.x=0,!0}cursorCharAbsolute(y){return this._setCursor((y.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(y){return this._setCursor(y.length>=2?(y.params[1]||1)-1:0,(y.params[0]||1)-1),!0}charPosAbsolute(y){return this._setCursor((y.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(y){return this._moveCursor(y.params[0]||1,0),!0}linePosAbsolute(y){return this._setCursor(this._activeBuffer.x,(y.params[0]||1)-1),!0}vPositionRelative(y){return this._moveCursor(0,y.params[0]||1),!0}hVPosition(y){return this.cursorPosition(y),!0}tabClear(y){const R=y.params[0];return R===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:R===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(y){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=y.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(y){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=y.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(y){const R=y.params[0];return R===1&&(this._curAttrData.bg|=536870912),R!==2&&R!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(y,R,B,P=!1,$=!1){const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);j.replaceCells(R,B,this._activeBuffer.getNullCell(this._eraseAttrData()),$),P&&(j.isWrapped=!1)}_resetBufferLine(y,R=!1){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);B&&(B.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),R),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+y),B.isWrapped=!1)}eraseInDisplay(y,R=!1){let B;switch(this._restrictCursor(this._bufferService.cols),y.params[0]){case 0:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);B<this._bufferService.rows;B++)this._resetBufferLine(B,R);this._dirtyRowTracker.markDirty(B);break;case 1:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B,0,this._activeBuffer.x+1,!0,R),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(B+1).isWrapped=!1);B--;)this._resetBufferLine(B,R);this._dirtyRowTracker.markDirty(0);break;case 2:for(B=this._bufferService.rows,this._dirtyRowTracker.markDirty(B-1);B--;)this._resetBufferLine(B,R);this._dirtyRowTracker.markDirty(0);break;case 3:const P=this._activeBuffer.lines.length-this._bufferService.rows;P>0&&(this._activeBuffer.lines.trimStart(P),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-P,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-P,0),this._onScroll.fire(0))}return!0}eraseInLine(y,R=!1){switch(this._restrictCursor(this._bufferService.cols),y.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,R);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,R)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(y){this._restrictCursor();let R=y.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y,P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,$=this._bufferService.rows-1+this._activeBuffer.ybase-P+1;for(;R--;)this._activeBuffer.lines.splice($-1,1),this._activeBuffer.lines.splice(B,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(y){this._restrictCursor();let R=y.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y;let P;for(P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-P;R--;)this._activeBuffer.lines.splice(B,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(y){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.insertCells(this._activeBuffer.x,y.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(y){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.deleteCells(this._activeBuffer.x,y.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(y){let R=y.params[0]||1;for(;R--;)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(y){let R=y.params[0]||1;for(;R--;)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(s.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.deleteCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.insertCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.insertCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.deleteCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(y){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(y.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(y){const R=this._parser.precedingJoinState;if(!R)return!0;const B=y.params[0]||1,P=v.UnicodeService.extractWidth(R),$=this._activeBuffer.x-P,j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString($),V=new Uint32Array(j.length*B);let J=0;for(let k=0;k<j.length;){const z=j.codePointAt(k)||0;V[J++]=z,k+=z>65535?2:1}let M=J;for(let k=1;k<B;++k)V.copyWithin(M,0,J),M+=J;return this.print(V,0,M),!0}sendDeviceAttributesPrimary(y){return y.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(y){return y.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(y.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(y){return(this._optionsService.rawOptions.termName+"").indexOf(y)===0}setMode(y){for(let R=0;R<y.length;R++)switch(y.params[R]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(y){for(let R=0;R<y.length;R++)switch(y.params[R]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,f.DEFAULT_CHARSET),this._charsetService.setgCharset(1,f.DEFAULT_CHARSET),this._charsetService.setgCharset(2,f.DEFAULT_CHARSET),this._charsetService.setgCharset(3,f.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(y){for(let R=0;R<y.length;R++)switch(y.params[R]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(y){for(let R=0;R<y.length;R++)switch(y.params[R]){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(),y.params[R]===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(y,R){const B=this._coreService.decPrivateModes,{activeProtocol:P,activeEncoding:$}=this._coreMouseService,j=this._coreService,{buffers:V,cols:J}=this._bufferService,{active:M,alt:k}=V,z=this._optionsService.rawOptions,H=re=>re?1:2,q=y.params[0];return Z=q,Y=R?q===2?4:q===4?H(j.modes.insertMode):q===12?3:q===20?H(z.convertEol):0:q===1?H(B.applicationCursorKeys):q===3?z.windowOptions.setWinLines?J===80?2:J===132?1:0:0:q===6?H(B.origin):q===7?H(B.wraparound):q===8?3:q===9?H(P==="X10"):q===12?H(z.cursorBlink):q===25?H(!j.isCursorHidden):q===45?H(B.reverseWraparound):q===66?H(B.applicationKeypad):q===67?4:q===1e3?H(P==="VT200"):q===1002?H(P==="DRAG"):q===1003?H(P==="ANY"):q===1004?H(B.sendFocus):q===1005?4:q===1006?H($==="SGR"):q===1015?4:q===1016?H($==="SGR_PIXELS"):q===1048?1:q===47||q===1047||q===1049?H(M===k):q===2004?H(B.bracketedPasteMode):0,j.triggerDataEvent(`${h.C0.ESC}[${R?"":"?"}${Z};${Y}$y`),!0;var Z,Y}_updateAttrColor(y,R,B,P,$){return R===2?(y|=50331648,y&=-16777216,y|=u.AttributeData.fromColorRGB([B,P,$])):R===5&&(y&=-50331904,y|=33554432|255&B),y}_extractColor(y,R,B){const P=[0,0,-1,0,0,0];let $=0,j=0;do{if(P[j+$]=y.params[R+j],y.hasSubParams(R+j)){const V=y.getSubParams(R+j);let J=0;do P[1]===5&&($=1),P[j+J+1+$]=V[J];while(++J<V.length&&J+j+1+$<P.length);break}if(P[1]===5&&j+$>=2||P[1]===2&&j+$>=5)break;P[1]&&($=1)}while(++j+R<y.length&&j+$<P.length);for(let V=2;V<P.length;++V)P[V]===-1&&(P[V]=0);switch(P[0]){case 38:B.fg=this._updateAttrColor(B.fg,P[1],P[3],P[4],P[5]);break;case 48:B.bg=this._updateAttrColor(B.bg,P[1],P[3],P[4],P[5]);break;case 58:B.extended=B.extended.clone(),B.extended.underlineColor=this._updateAttrColor(B.extended.underlineColor,P[1],P[3],P[4],P[5])}return j}_processUnderline(y,R){R.extended=R.extended.clone(),(!~y||y>5)&&(y=1),R.extended.underlineStyle=y,R.fg|=268435456,y===0&&(R.fg&=-268435457),R.updateExtended()}_processSGR0(y){y.fg=s.DEFAULT_ATTR_DATA.fg,y.bg=s.DEFAULT_ATTR_DATA.bg,y.extended=y.extended.clone(),y.extended.underlineStyle=0,y.extended.underlineColor&=-67108864,y.updateExtended()}charAttributes(y){if(y.length===1&&y.params[0]===0)return this._processSGR0(this._curAttrData),!0;const R=y.length;let B;const P=this._curAttrData;for(let $=0;$<R;$++)B=y.params[$],B>=30&&B<=37?(P.fg&=-50331904,P.fg|=16777216|B-30):B>=40&&B<=47?(P.bg&=-50331904,P.bg|=16777216|B-40):B>=90&&B<=97?(P.fg&=-50331904,P.fg|=16777224|B-90):B>=100&&B<=107?(P.bg&=-50331904,P.bg|=16777224|B-100):B===0?this._processSGR0(P):B===1?P.fg|=134217728:B===3?P.bg|=67108864:B===4?(P.fg|=268435456,this._processUnderline(y.hasSubParams($)?y.getSubParams($)[0]:1,P)):B===5?P.fg|=536870912:B===7?P.fg|=67108864:B===8?P.fg|=1073741824:B===9?P.fg|=2147483648:B===2?P.bg|=134217728:B===21?this._processUnderline(2,P):B===22?(P.fg&=-134217729,P.bg&=-134217729):B===23?P.bg&=-67108865:B===24?(P.fg&=-268435457,this._processUnderline(0,P)):B===25?P.fg&=-536870913:B===27?P.fg&=-67108865:B===28?P.fg&=-1073741825:B===29?P.fg&=2147483647:B===39?(P.fg&=-67108864,P.fg|=16777215&s.DEFAULT_ATTR_DATA.fg):B===49?(P.bg&=-67108864,P.bg|=16777215&s.DEFAULT_ATTR_DATA.bg):B===38||B===48||B===58?$+=this._extractColor(y,$,P):B===53?P.bg|=1073741824:B===55?P.bg&=-1073741825:B===59?(P.extended=P.extended.clone(),P.extended.underlineColor=-1,P.updateExtended()):B===100?(P.fg&=-67108864,P.fg|=16777215&s.DEFAULT_ATTR_DATA.fg,P.bg&=-67108864,P.bg|=16777215&s.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",B);return!0}deviceStatus(y){switch(y.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const R=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${R};${B}R`)}return!0}deviceStatusPrivate(y){if(y.params[0]===6){const R=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${R};${B}R`)}return!0}softReset(y){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=s.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(y){const R=y.params[0]||1;switch(R){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 B=R%2==1;return this._optionsService.options.cursorBlink=B,!0}setScrollRegion(y){const R=y.params[0]||1;let B;return(y.length<2||(B=y.params[1])>this._bufferService.rows||B===0)&&(B=this._bufferService.rows),B>R&&(this._activeBuffer.scrollTop=R-1,this._activeBuffer.scrollBottom=B-1,this._setCursor(0,0)),!0}windowOptions(y){if(!O(y.params[0],this._optionsService.rawOptions.windowOptions))return!0;const R=y.length>1?y.params[1]:0;switch(y.params[0]){case 14:R!==2&&this._onRequestWindowsOptionsReport.fire(D.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(D.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${h.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:R!==0&&R!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),R!==0&&R!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:R!==0&&R!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),R!==0&&R!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(y){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(y){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(y){return this._windowTitle=y,this._onTitleChange.fire(y),!0}setIconName(y){return this._iconName=y,!0}setOrReportIndexedColor(y){const R=[],B=y.split(";");for(;B.length>1;){const P=B.shift(),$=B.shift();if(/^\d+$/.exec(P)){const j=parseInt(P);if(K(j))if($==="?")R.push({type:0,index:j});else{const V=(0,w.parseColor)($);V&&R.push({type:1,index:j,color:V})}}}return R.length&&this._onColor.fire(R),!0}setHyperlink(y){const R=y.split(";");return!(R.length<2)&&(R[1]?this._createHyperlink(R[0],R[1]):!R[0]&&this._finishHyperlink())}_createHyperlink(y,R){this._getCurrentLinkId()&&this._finishHyperlink();const B=y.split(":");let P;const $=B.findIndex(j=>j.startsWith("id="));return $!==-1&&(P=B[$].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:P,uri:R}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(y,R){const B=y.split(";");for(let P=0;P<B.length&&!(R>=this._specialColors.length);++P,++R)if(B[P]==="?")this._onColor.fire([{type:0,index:this._specialColors[R]}]);else{const $=(0,w.parseColor)(B[P]);$&&this._onColor.fire([{type:1,index:this._specialColors[R],color:$}])}return!0}setOrReportFgColor(y){return this._setOrReportSpecialColor(y,0)}setOrReportBgColor(y){return this._setOrReportSpecialColor(y,1)}setOrReportCursorColor(y){return this._setOrReportSpecialColor(y,2)}restoreIndexedColor(y){if(!y)return this._onColor.fire([{type:2}]),!0;const R=[],B=y.split(";");for(let P=0;P<B.length;++P)if(/^\d+$/.exec(B[P])){const $=parseInt(B[P]);K($)&&R.push({type:2,index:$})}return R.length&&this._onColor.fire(R),!0}restoreFgColor(y){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(y){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(y){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,f.DEFAULT_CHARSET),!0}selectCharset(y){return y.length!==2?(this.selectDefaultCharset(),!0):(y[0]==="/"||this._charsetService.setgCharset(A[y[0]],f.CHARSETS[y[1]]||f.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 y=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,y,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=s.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=s.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(y){return this._charsetService.setgLevel(y),!0}screenAlignmentPattern(){const y=new i.CellData;y.content=4194373,y.fg=this._curAttrData.fg,y.bg=this._curAttrData.bg,this._setCursor(0,0);for(let R=0;R<this._bufferService.rows;++R){const B=this._activeBuffer.ybase+this._activeBuffer.y+R,P=this._activeBuffer.lines.get(B);P&&(P.fill(y),P.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(y,R){const B=this._bufferService.buffer,P=this._optionsService.rawOptions;return($=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${$}${h.C0.ESC}\\`),!0))(y==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:y==='"p'?'P1$r61;1"p':y==="r"?`P1$r${B.scrollTop+1};${B.scrollBottom+1}r`:y==="m"?"P1$r0m":y===" q"?`P1$r${{block:2,underline:4,bar:6}[P.cursorStyle]-(P.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(y,R){this._dirtyRowTracker.markRangeDirty(y,R)}}n.InputHandler=F;let U=class{constructor(N){this._bufferService=N,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(N){N<this.start?this.start=N:N>this.end&&(this.end=N)}markRangeDirty(N,y){N>y&&(I=N,N=y,y=I),N<this.start&&(this.start=N),y>this.end&&(this.end=y)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function K(N){return 0<=N&&N<256}U=l([g(0,m.IBufferService)],U)},844:(x,n)=>{function a(l){for(const g of l)g.dispose();l.length=0}Object.defineProperty(n,"__esModule",{value:!0}),n.getDisposeArrayDisposable=n.disposeArray=n.toDisposable=n.MutableDisposable=n.Disposable=void 0,n.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const l of this._disposables)l.dispose();this._disposables.length=0}register(l){return this._disposables.push(l),l}unregister(l){const g=this._disposables.indexOf(l);g!==-1&&this._disposables.splice(g,1)}},n.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){var g;this._isDisposed||l===this._value||((g=this._value)==null||g.dispose(),this._value=l)}clear(){this.value=void 0}dispose(){var l;this._isDisposed=!0,(l=this._value)==null||l.dispose(),this._value=void 0}},n.toDisposable=function(l){return{dispose:l}},n.disposeArray=a,n.getDisposeArrayDisposable=function(l){return{dispose:()=>a(l)}}},1505:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.FourKeyMap=n.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(g,h,f){this._data[g]||(this._data[g]={}),this._data[g][h]=f}get(g,h){return this._data[g]?this._data[g][h]:void 0}clear(){this._data={}}}n.TwoKeyMap=a,n.FourKeyMap=class{constructor(){this._data=new a}set(l,g,h,f,p){this._data.get(l,g)||this._data.set(l,g,new a),this._data.get(l,g).set(h,f,p)}get(l,g,h,f){var p;return(p=this._data.get(l,g))==null?void 0:p.get(h,f)}clear(){this._data.clear()}}},6114:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.isChromeOS=n.isLinux=n.isWindows=n.isIphone=n.isIpad=n.isMac=n.getSafariVersion=n.isSafari=n.isLegacyEdge=n.isFirefox=n.isNode=void 0,n.isNode=typeof process<"u"&&"title"in process;const a=n.isNode?"node":navigator.userAgent,l=n.isNode?"node":navigator.platform;n.isFirefox=a.includes("Firefox"),n.isLegacyEdge=a.includes("Edge"),n.isSafari=/^((?!chrome|android).)*safari/i.test(a),n.getSafariVersion=function(){if(!n.isSafari)return 0;const g=a.match(/Version\/(\d+)/);return g===null||g.length<2?0:parseInt(g[1])},n.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),n.isIpad=l==="iPad",n.isIphone=l==="iPhone",n.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),n.isLinux=l.indexOf("Linux")>=0,n.isChromeOS=/\bCrOS\b/.test(a)},6106:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SortedList=void 0;let a=0;n.SortedList=class{constructor(l){this._getKey=l,this._array=[]}clear(){this._array.length=0}insert(l){this._array.length!==0?(a=this._search(this._getKey(l)),this._array.splice(a,0,l)):this._array.push(l)}delete(l){if(this._array.length===0)return!1;const g=this._getKey(l);if(g===void 0||(a=this._search(g),a===-1)||this._getKey(this._array[a])!==g)return!1;do if(this._array[a]===l)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===g);return!1}*getKeyIterator(l){if(this._array.length!==0&&(a=this._search(l),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===l))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===l)}forEachByKey(l,g){if(this._array.length!==0&&(a=this._search(l),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===l))do g(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===l)}values(){return[...this._array].values()}_search(l){let g=0,h=this._array.length-1;for(;h>=g;){let f=g+h>>1;const p=this._getKey(this._array[f]);if(p>l)h=f-1;else{if(!(p<l)){for(;f>0&&this._getKey(this._array[f-1])===l;)f--;return f}g=f+1}}return g}}},7226:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DebouncedIdleTask=n.IdleTaskQueue=n.PriorityTaskQueue=void 0;const l=a(6114);class g{constructor(){this._tasks=[],this._i=0}enqueue(p){this._tasks.push(p),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(p){this._idleCallback=void 0;let S=0,d=0,s=p.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(S=Date.now(),this._tasks[this._i]()||this._i++,S=Math.max(1,Date.now()-S),d=Math.max(S,d),o=p.timeRemaining(),1.5*d>o)return s-S<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-S))}ms`),void this._start();s=o}this.clear()}}class h extends g{_requestCallback(p){return setTimeout(()=>p(this._createDeadline(16)))}_cancelCallback(p){clearTimeout(p)}_createDeadline(p){const S=Date.now()+p;return{timeRemaining:()=>Math.max(0,S-Date.now())}}}n.PriorityTaskQueue=h,n.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends g{_requestCallback(f){return requestIdleCallback(f)}_cancelCallback(f){cancelIdleCallback(f)}}:h,n.DebouncedIdleTask=class{constructor(){this._queue=new n.IdleTaskQueue}set(f){this._queue.clear(),this._queue.enqueue(f)}flush(){this._queue.flush()}}},9282:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.updateWindowsModeWrappedState=void 0;const l=a(643);n.updateWindowsModeWrappedState=function(g){const h=g.buffer.lines.get(g.buffer.ybase+g.buffer.y-1),f=h==null?void 0:h.get(g.cols-1),p=g.buffer.lines.get(g.buffer.ybase+g.buffer.y);p&&f&&(p.isWrapped=f[l.CHAR_DATA_CODE_INDEX]!==l.NULL_CELL_CODE&&f[l.CHAR_DATA_CODE_INDEX]!==l.WHITESPACE_CELL_CODE)}},3734:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ExtendedAttrs=n.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new l}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new a;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}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}}n.AttributeData=a;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,f=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=f}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}n.ExtendedAttrs=l},9092:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Buffer=n.MAX_BUFFER_SIZE=void 0;const l=a(6349),g=a(7226),h=a(3734),f=a(8437),p=a(4634),S=a(511),d=a(643),s=a(4863),o=a(7116);n.MAX_BUFFER_SIZE=4294967295,n.Buffer=class{constructor(r,i,u){this._hasScrollback=r,this._optionsService=i,this._bufferService=u,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=f.DEFAULT_ATTR_DATA.clone(),this.savedCharset=o.DEFAULT_CHARSET,this.markers=[],this._nullCell=S.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]),this._whitespaceCell=S.CellData.fromCharData([0,d.WHITESPACE_CELL_CHAR,d.WHITESPACE_CELL_WIDTH,d.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new g.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(r){return r?(this._nullCell.fg=r.fg,this._nullCell.bg=r.bg,this._nullCell.extended=r.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(r){return r?(this._whitespaceCell.fg=r.fg,this._whitespaceCell.bg=r.bg,this._whitespaceCell.extended=r.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(r,i){return new f.BufferLine(this._bufferService.cols,this.getNullCell(r),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const r=this.ybase+this.y-this.ydisp;return r>=0&&r<this._rows}_getCorrectBufferLength(r){if(!this._hasScrollback)return r;const i=r+this._optionsService.rawOptions.scrollback;return i>n.MAX_BUFFER_SIZE?n.MAX_BUFFER_SIZE:i}fillViewportRows(r){if(this.lines.length===0){r===void 0&&(r=f.DEFAULT_ATTR_DATA);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(r))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(r,i){const u=this.getNullCell(f.DEFAULT_ATTR_DATA);let m=0;const v=this._getCorrectBufferLength(i);if(v>this.lines.maxLength&&(this.lines.maxLength=v),this.lines.length>0){if(this._cols<r)for(let _=0;_<this.lines.length;_++)m+=+this.lines.get(_).resize(r,u);let C=0;if(this._rows<i)for(let _=this._rows;_<i;_++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new f.BufferLine(r,u)):this.ybase>0&&this.lines.length<=this.ybase+this.y+C+1?(this.ybase--,C++,this.ydisp>0&&this.ydisp--):this.lines.push(new f.BufferLine(r,u)));else for(let _=this._rows;_>i;_--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(v<this.lines.maxLength){const _=this.lines.length-v;_>0&&(this.lines.trimStart(_),this.ybase=Math.max(this.ybase-_,0),this.ydisp=Math.max(this.ydisp-_,0),this.savedY=Math.max(this.savedY-_,0)),this.lines.maxLength=v}this.x=Math.min(this.x,r-1),this.y=Math.min(this.y,i-1),C&&(this.y+=C),this.savedX=Math.min(this.savedX,r-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(r,i),this._cols>r))for(let C=0;C<this.lines.length;C++)m+=+this.lines.get(C).resize(r,u);this._cols=r,this._rows=i,this._memoryCleanupQueue.clear(),m>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let r=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,r=!1);let i=0;for(;this._memoryCleanupPosition<this.lines.length;)if(i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),i>100)return!0;return r}get _isReflowEnabled(){const r=this._optionsService.rawOptions.windowsPty;return r&&r.buildNumber?this._hasScrollback&&r.backend==="conpty"&&r.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(r,i){this._cols!==r&&(r>this._cols?this._reflowLarger(r,i):this._reflowSmaller(r,i))}_reflowLarger(r,i){const u=(0,p.reflowLargerGetLinesToRemove)(this.lines,this._cols,r,this.ybase+this.y,this.getNullCell(f.DEFAULT_ATTR_DATA));if(u.length>0){const m=(0,p.reflowLargerCreateNewLayout)(this.lines,u);(0,p.reflowLargerApplyNewLayout)(this.lines,m.layout),this._reflowLargerAdjustViewport(r,i,m.countRemoved)}}_reflowLargerAdjustViewport(r,i,u){const m=this.getNullCell(f.DEFAULT_ATTR_DATA);let v=u;for(;v-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new f.BufferLine(r,m))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-u,0)}_reflowSmaller(r,i){const u=this.getNullCell(f.DEFAULT_ATTR_DATA),m=[];let v=0;for(let C=this.lines.length-1;C>=0;C--){let _=this.lines.get(C);if(!_||!_.isWrapped&&_.getTrimmedLength()<=r)continue;const w=[_];for(;_.isWrapped&&C>0;)_=this.lines.get(--C),w.unshift(_);const A=this.ybase+this.y;if(A>=C&&A<C+w.length)continue;const T=w[w.length-1].getTrimmedLength(),O=(0,p.reflowSmallerGetNewLineLengths)(w,this._cols,r),D=O.length-w.length;let I;I=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+D):Math.max(0,this.lines.length-this.lines.maxLength+D);const F=[];for(let B=0;B<D;B++){const P=this.getBlankLine(f.DEFAULT_ATTR_DATA,!0);F.push(P)}F.length>0&&(m.push({start:C+w.length+v,newLines:F}),v+=F.length),w.push(...F);let U=O.length-1,K=O[U];K===0&&(U--,K=O[U]);let N=w.length-D-1,y=T;for(;N>=0;){const B=Math.min(y,K);if(w[U]===void 0)break;if(w[U].copyCellsFrom(w[N],y-B,K-B,B,!0),K-=B,K===0&&(U--,K=O[U]),y-=B,y===0){N--;const P=Math.max(N,0);y=(0,p.getWrappedLineTrimmedLength)(w,P,this._cols)}}for(let B=0;B<w.length;B++)O[B]<r&&w[B].setCell(O[B],u);let R=D-I;for(;R-- >0;)this.ybase===0?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+v)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+i-1)}if(m.length>0){const C=[],_=[];for(let U=0;U<this.lines.length;U++)_.push(this.lines.get(U));const w=this.lines.length;let A=w-1,T=0,O=m[T];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+v);let D=0;for(let U=Math.min(this.lines.maxLength-1,w+v-1);U>=0;U--)if(O&&O.start>A+D){for(let K=O.newLines.length-1;K>=0;K--)this.lines.set(U--,O.newLines[K]);U++,C.push({index:A+1,amount:O.newLines.length}),D+=O.newLines.length,O=m[++T]}else this.lines.set(U,_[A--]);let I=0;for(let U=C.length-1;U>=0;U--)C[U].index+=I,this.lines.onInsertEmitter.fire(C[U]),I+=C[U].amount;const F=Math.max(0,w+v-this.lines.maxLength);F>0&&this.lines.onTrimEmitter.fire(F)}}translateBufferLineToString(r,i,u=0,m){const v=this.lines.get(r);return v?v.translateToString(i,u,m):""}getWrappedRangeForLine(r){let i=r,u=r;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;u+1<this.lines.length&&this.lines.get(u+1).isWrapped;)u++;return{first:i,last:u}}setupTabStops(r){for(r!=null?this.tabs[r]||(r=this.prevStop(r)):(this.tabs={},r=0);r<this._cols;r+=this._optionsService.rawOptions.tabStopWidth)this.tabs[r]=!0}prevStop(r){for(r==null&&(r=this.x);!this.tabs[--r]&&r>0;);return r>=this._cols?this._cols-1:r<0?0:r}nextStop(r){for(r==null&&(r=this.x);!this.tabs[++r]&&r<this._cols;);return r>=this._cols?this._cols-1:r<0?0:r}clearMarkers(r){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].line===r&&(this.markers[i].dispose(),this.markers.splice(i--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].dispose(),this.markers.splice(r--,1);this._isClearing=!1}addMarker(r){const i=new s.Marker(r);return this.markers.push(i),i.register(this.lines.onTrim(u=>{i.line-=u,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(u=>{i.line>=u.index&&(i.line+=u.amount)})),i.register(this.lines.onDelete(u=>{i.line>=u.index&&i.line<u.index+u.amount&&i.dispose(),i.line>u.index&&(i.line-=u.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(r){this._isClearing||this.markers.splice(this.markers.indexOf(r),1)}}},8437:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLine=n.DEFAULT_ATTR_DATA=void 0;const l=a(3734),g=a(511),h=a(643),f=a(482);n.DEFAULT_ATTR_DATA=Object.freeze(new l.AttributeData);let p=0;class S{constructor(s,o,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*s);const i=o||g.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let u=0;u<s;++u)this.setCell(u,i);this.length=s}get(s){const o=this._data[3*s+0],r=2097151&o;return[this._data[3*s+1],2097152&o?this._combined[s]:r?(0,f.stringFromCodePoint)(r):"",o>>22,2097152&o?this._combined[s].charCodeAt(this._combined[s].length-1):r]}set(s,o){this._data[3*s+1]=o[h.CHAR_DATA_ATTR_INDEX],o[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[s]=o[1],this._data[3*s+0]=2097152|s|o[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*s+0]=o[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|o[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(s){return this._data[3*s+0]>>22}hasWidth(s){return 12582912&this._data[3*s+0]}getFg(s){return this._data[3*s+1]}getBg(s){return this._data[3*s+2]}hasContent(s){return 4194303&this._data[3*s+0]}getCodePoint(s){const o=this._data[3*s+0];return 2097152&o?this._combined[s].charCodeAt(this._combined[s].length-1):2097151&o}isCombined(s){return 2097152&this._data[3*s+0]}getString(s){const o=this._data[3*s+0];return 2097152&o?this._combined[s]:2097151&o?(0,f.stringFromCodePoint)(2097151&o):""}isProtected(s){return 536870912&this._data[3*s+2]}loadCell(s,o){return p=3*s,o.content=this._data[p+0],o.fg=this._data[p+1],o.bg=this._data[p+2],2097152&o.content&&(o.combinedData=this._combined[s]),268435456&o.bg&&(o.extended=this._extendedAttrs[s]),o}setCell(s,o){2097152&o.content&&(this._combined[s]=o.combinedData),268435456&o.bg&&(this._extendedAttrs[s]=o.extended),this._data[3*s+0]=o.content,this._data[3*s+1]=o.fg,this._data[3*s+2]=o.bg}setCellFromCodepoint(s,o,r,i){268435456&i.bg&&(this._extendedAttrs[s]=i.extended),this._data[3*s+0]=o|r<<22,this._data[3*s+1]=i.fg,this._data[3*s+2]=i.bg}addCodepointToCell(s,o,r){let i=this._data[3*s+0];2097152&i?this._combined[s]+=(0,f.stringFromCodePoint)(o):2097151&i?(this._combined[s]=(0,f.stringFromCodePoint)(2097151&i)+(0,f.stringFromCodePoint)(o),i&=-2097152,i|=2097152):i=o|4194304,r&&(i&=-12582913,i|=r<<22),this._data[3*s+0]=i}insertCells(s,o,r){if((s%=this.length)&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s-1,0,1,r),o<this.length-s){const i=new g.CellData;for(let u=this.length-s-o-1;u>=0;--u)this.setCell(s+o+u,this.loadCell(s+u,i));for(let u=0;u<o;++u)this.setCell(s+u,r)}else for(let i=s;i<this.length;++i)this.setCell(i,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(s,o,r){if(s%=this.length,o<this.length-s){const i=new g.CellData;for(let u=0;u<this.length-s-o;++u)this.setCell(s+u,this.loadCell(s+o+u,i));for(let u=this.length-o;u<this.length;++u)this.setCell(u,r)}else for(let i=s;i<this.length;++i)this.setCell(i,r);s&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s-1,0,1,r),this.getWidth(s)!==0||this.hasContent(s)||this.setCellFromCodepoint(s,0,1,r)}replaceCells(s,o,r,i=!1){if(i)for(s&&this.getWidth(s-1)===2&&!this.isProtected(s-1)&&this.setCellFromCodepoint(s-1,0,1,r),o<this.length&&this.getWidth(o-1)===2&&!this.isProtected(o)&&this.setCellFromCodepoint(o,0,1,r);s<o&&s<this.length;)this.isProtected(s)||this.setCell(s,r),s++;else for(s&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s-1,0,1,r),o<this.length&&this.getWidth(o-1)===2&&this.setCellFromCodepoint(o,0,1,r);s<o&&s<this.length;)this.setCell(s++,r)}resize(s,o){if(s===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const r=3*s;if(s>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{const i=new Uint32Array(r);i.set(this._data),this._data=i}for(let i=this.length;i<s;++i)this.setCell(i,o)}else{this._data=this._data.subarray(0,r);const i=Object.keys(this._combined);for(let m=0;m<i.length;m++){const v=parseInt(i[m],10);v>=s&&delete this._combined[v]}const u=Object.keys(this._extendedAttrs);for(let m=0;m<u.length;m++){const v=parseInt(u[m],10);v>=s&&delete this._extendedAttrs[v]}}return this.length=s,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const s=new Uint32Array(this._data.length);return s.set(this._data),this._data=s,1}return 0}fill(s,o=!1){if(o)for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,s);else{this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,s)}}copyFrom(s){this.length!==s.length?this._data=new Uint32Array(s._data):this._data.set(s._data),this.length=s.length,this._combined={};for(const o in s._combined)this._combined[o]=s._combined[o];this._extendedAttrs={};for(const o in s._extendedAttrs)this._extendedAttrs[o]=s._extendedAttrs[o];this.isWrapped=s.isWrapped}clone(){const s=new S(0);s._data=new Uint32Array(this._data),s.length=this.length;for(const o in this._combined)s._combined[o]=this._combined[o];for(const o in this._extendedAttrs)s._extendedAttrs[o]=this._extendedAttrs[o];return s.isWrapped=this.isWrapped,s}getTrimmedLength(){for(let s=this.length-1;s>=0;--s)if(4194303&this._data[3*s+0])return s+(this._data[3*s+0]>>22);return 0}getNoBgTrimmedLength(){for(let s=this.length-1;s>=0;--s)if(4194303&this._data[3*s+0]||50331648&this._data[3*s+2])return s+(this._data[3*s+0]>>22);return 0}copyCellsFrom(s,o,r,i,u){const m=s._data;if(u)for(let C=i-1;C>=0;C--){for(let _=0;_<3;_++)this._data[3*(r+C)+_]=m[3*(o+C)+_];268435456&m[3*(o+C)+2]&&(this._extendedAttrs[r+C]=s._extendedAttrs[o+C])}else for(let C=0;C<i;C++){for(let _=0;_<3;_++)this._data[3*(r+C)+_]=m[3*(o+C)+_];268435456&m[3*(o+C)+2]&&(this._extendedAttrs[r+C]=s._extendedAttrs[o+C])}const v=Object.keys(s._combined);for(let C=0;C<v.length;C++){const _=parseInt(v[C],10);_>=o&&(this._combined[_-o+r]=s._combined[_])}}translateToString(s,o,r,i){o=o??0,r=r??this.length,s&&(r=Math.min(r,this.getTrimmedLength())),i&&(i.length=0);let u="";for(;o<r;){const m=this._data[3*o+0],v=2097151&m,C=2097152&m?this._combined[o]:v?(0,f.stringFromCodePoint)(v):h.WHITESPACE_CELL_CHAR;if(u+=C,i)for(let _=0;_<C.length;++_)i.push(o);o+=m>>22||1}return i&&i.push(o),u}}n.BufferLine=S},4841:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getRangeLength=void 0,n.getRangeLength=function(a,l){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return l*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(x,n)=>{function a(l,g,h){if(g===l.length-1)return l[g].getTrimmedLength();const f=!l[g].hasContent(h-1)&&l[g].getWidth(h-1)===1,p=l[g+1].getWidth(0)===2;return f&&p?h-1:h}Object.defineProperty(n,"__esModule",{value:!0}),n.getWrappedLineTrimmedLength=n.reflowSmallerGetNewLineLengths=n.reflowLargerApplyNewLayout=n.reflowLargerCreateNewLayout=n.reflowLargerGetLinesToRemove=void 0,n.reflowLargerGetLinesToRemove=function(l,g,h,f,p){const S=[];for(let d=0;d<l.length-1;d++){let s=d,o=l.get(++s);if(!o.isWrapped)continue;const r=[l.get(d)];for(;s<l.length&&o.isWrapped;)r.push(o),o=l.get(++s);if(f>=d&&f<s){d+=r.length-1;continue}let i=0,u=a(r,i,g),m=1,v=0;for(;m<r.length;){const _=a(r,m,g),w=_-v,A=h-u,T=Math.min(w,A);r[i].copyCellsFrom(r[m],v,u,T,!1),u+=T,u===h&&(i++,u=0),v+=T,v===_&&(m++,v=0),u===0&&i!==0&&r[i-1].getWidth(h-1)===2&&(r[i].copyCellsFrom(r[i-1],h-1,u++,1,!1),r[i-1].setCell(h-1,p))}r[i].replaceCells(u,h,p);let C=0;for(let _=r.length-1;_>0&&(_>i||r[_].getTrimmedLength()===0);_--)C++;C>0&&(S.push(d+r.length-C),S.push(C)),d+=r.length-1}return S},n.reflowLargerCreateNewLayout=function(l,g){const h=[];let f=0,p=g[f],S=0;for(let d=0;d<l.length;d++)if(p===d){const s=g[++f];l.onDeleteEmitter.fire({index:d-S,amount:s}),d+=s-1,S+=s,p=g[++f]}else h.push(d);return{layout:h,countRemoved:S}},n.reflowLargerApplyNewLayout=function(l,g){const h=[];for(let f=0;f<g.length;f++)h.push(l.get(g[f]));for(let f=0;f<h.length;f++)l.set(f,h[f]);l.length=g.length},n.reflowSmallerGetNewLineLengths=function(l,g,h){const f=[],p=l.map((o,r)=>a(l,r,g)).reduce((o,r)=>o+r);let S=0,d=0,s=0;for(;s<p;){if(p-s<h){f.push(p-s);break}S+=h;const o=a(l,d,g);S>o&&(S-=o,d++);const r=l[d].getWidth(S-1)===2;r&&S--;const i=r?h-1:h;f.push(i),s+=i}return f},n.getWrappedLineTrimmedLength=a},5295:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferSet=void 0;const l=a(8460),g=a(844),h=a(9092);class f extends g.Disposable{constructor(S,d){super(),this._optionsService=S,this._bufferService=d,this._onBufferActivate=this.register(new l.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 h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.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(S){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(S),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(S,d){this._normal.resize(S,d),this._alt.resize(S,d),this.setupTabStops(S)}setupTabStops(S){this._normal.setupTabStops(S),this._alt.setupTabStops(S)}}n.BufferSet=f},511:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CellData=void 0;const l=a(482),g=a(643),h=a(3734);class f extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(S){const d=new f;return d.setFromCharData(S),d}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,l.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(S){this.fg=S[g.CHAR_DATA_ATTR_INDEX],this.bg=0;let d=!1;if(S[g.CHAR_DATA_CHAR_INDEX].length>2)d=!0;else if(S[g.CHAR_DATA_CHAR_INDEX].length===2){const s=S[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=s&&s<=56319){const o=S[g.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=o&&o<=57343?this.content=1024*(s-55296)+o-56320+65536|S[g.CHAR_DATA_WIDTH_INDEX]<<22:d=!0}else d=!0}else this.content=S[g.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|S[g.CHAR_DATA_WIDTH_INDEX]<<22;d&&(this.combinedData=S[g.CHAR_DATA_CHAR_INDEX],this.content=2097152|S[g.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}n.CellData=f},643:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WHITESPACE_CELL_CODE=n.WHITESPACE_CELL_WIDTH=n.WHITESPACE_CELL_CHAR=n.NULL_CELL_CODE=n.NULL_CELL_WIDTH=n.NULL_CELL_CHAR=n.CHAR_DATA_CODE_INDEX=n.CHAR_DATA_WIDTH_INDEX=n.CHAR_DATA_CHAR_INDEX=n.CHAR_DATA_ATTR_INDEX=n.DEFAULT_EXT=n.DEFAULT_ATTR=n.DEFAULT_COLOR=void 0,n.DEFAULT_COLOR=0,n.DEFAULT_ATTR=256|n.DEFAULT_COLOR<<9,n.DEFAULT_EXT=0,n.CHAR_DATA_ATTR_INDEX=0,n.CHAR_DATA_CHAR_INDEX=1,n.CHAR_DATA_WIDTH_INDEX=2,n.CHAR_DATA_CODE_INDEX=3,n.NULL_CELL_CHAR="",n.NULL_CELL_WIDTH=1,n.NULL_CELL_CODE=0,n.WHITESPACE_CELL_CHAR=" ",n.WHITESPACE_CELL_WIDTH=1,n.WHITESPACE_CELL_CODE=32},4863:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Marker=void 0;const l=a(8460),g=a(844);class h{get id(){return this._id}constructor(p){this.line=p,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,g.disposeArray)(this._disposables),this._disposables.length=0)}register(p){return this._disposables.push(p),p}}n.Marker=h,h._nextId=1},7116:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DEFAULT_CHARSET=n.CHARSETS=void 0,n.CHARSETS={},n.DEFAULT_CHARSET=n.CHARSETS.B,n.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:"≥","{":"π","|":"≠","}":"£","~":"·"},n.CHARSETS.A={"#":"£"},n.CHARSETS.B=void 0,n.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},n.CHARSETS.C=n.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},n.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},n.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},n.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},n.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},n.CHARSETS.E=n.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},n.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},n.CHARSETS.H=n.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},n.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(x,n)=>{var a,l,g;Object.defineProperty(n,"__esModule",{value:!0}),n.C1_ESCAPED=n.C1=n.C0=void 0,function(h){h.NUL="\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\x07",h.BS="\b",h.HT=" ",h.LF=`
8
- `,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL=""}(a||(n.C0=a={})),function(h){h.PAD="€",h.HOP="",h.BPH="‚",h.NBH="ƒ",h.IND="„",h.NEL="…",h.SSA="†",h.ESA="‡",h.HTS="ˆ",h.HTJ="‰",h.VTS="Š",h.PLD="‹",h.PLU="Œ",h.RI="",h.SS2="Ž",h.SS3="",h.DCS="",h.PU1="‘",h.PU2="’",h.STS="“",h.CCH="”",h.MW="•",h.SPA="–",h.EPA="—",h.SOS="˜",h.SGCI="™",h.SCI="š",h.CSI="›",h.ST="œ",h.OSC="",h.PM="ž",h.APC="Ÿ"}(l||(n.C1=l={})),function(h){h.ST=`${a.ESC}\\`}(g||(n.C1_ESCAPED=g={}))},7399:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.evaluateKeyboardEvent=void 0;const l=a(2584),g={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};n.evaluateKeyboardEvent=function(h,f,p,S){const d={type:0,cancel:!1,key:void 0},s=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?d.key=f?l.C0.ESC+"OA":l.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?d.key=f?l.C0.ESC+"OD":l.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?d.key=f?l.C0.ESC+"OC":l.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(d.key=f?l.C0.ESC+"OB":l.C0.ESC+"[B");break;case 8:d.key=h.ctrlKey?"\b":l.C0.DEL,h.altKey&&(d.key=l.C0.ESC+d.key);break;case 9:if(h.shiftKey){d.key=l.C0.ESC+"[Z";break}d.key=l.C0.HT,d.cancel=!0;break;case 13:d.key=h.altKey?l.C0.ESC+l.C0.CR:l.C0.CR,d.cancel=!0;break;case 27:d.key=l.C0.ESC,h.altKey&&(d.key=l.C0.ESC+l.C0.ESC),d.cancel=!0;break;case 37:if(h.metaKey)break;s?(d.key=l.C0.ESC+"[1;"+(s+1)+"D",d.key===l.C0.ESC+"[1;3D"&&(d.key=l.C0.ESC+(p?"b":"[1;5D"))):d.key=f?l.C0.ESC+"OD":l.C0.ESC+"[D";break;case 39:if(h.metaKey)break;s?(d.key=l.C0.ESC+"[1;"+(s+1)+"C",d.key===l.C0.ESC+"[1;3C"&&(d.key=l.C0.ESC+(p?"f":"[1;5C"))):d.key=f?l.C0.ESC+"OC":l.C0.ESC+"[C";break;case 38:if(h.metaKey)break;s?(d.key=l.C0.ESC+"[1;"+(s+1)+"A",p||d.key!==l.C0.ESC+"[1;3A"||(d.key=l.C0.ESC+"[1;5A")):d.key=f?l.C0.ESC+"OA":l.C0.ESC+"[A";break;case 40:if(h.metaKey)break;s?(d.key=l.C0.ESC+"[1;"+(s+1)+"B",p||d.key!==l.C0.ESC+"[1;3B"||(d.key=l.C0.ESC+"[1;5B")):d.key=f?l.C0.ESC+"OB":l.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(d.key=l.C0.ESC+"[2~");break;case 46:d.key=s?l.C0.ESC+"[3;"+(s+1)+"~":l.C0.ESC+"[3~";break;case 36:d.key=s?l.C0.ESC+"[1;"+(s+1)+"H":f?l.C0.ESC+"OH":l.C0.ESC+"[H";break;case 35:d.key=s?l.C0.ESC+"[1;"+(s+1)+"F":f?l.C0.ESC+"OF":l.C0.ESC+"[F";break;case 33:h.shiftKey?d.type=2:h.ctrlKey?d.key=l.C0.ESC+"[5;"+(s+1)+"~":d.key=l.C0.ESC+"[5~";break;case 34:h.shiftKey?d.type=3:h.ctrlKey?d.key=l.C0.ESC+"[6;"+(s+1)+"~":d.key=l.C0.ESC+"[6~";break;case 112:d.key=s?l.C0.ESC+"[1;"+(s+1)+"P":l.C0.ESC+"OP";break;case 113:d.key=s?l.C0.ESC+"[1;"+(s+1)+"Q":l.C0.ESC+"OQ";break;case 114:d.key=s?l.C0.ESC+"[1;"+(s+1)+"R":l.C0.ESC+"OR";break;case 115:d.key=s?l.C0.ESC+"[1;"+(s+1)+"S":l.C0.ESC+"OS";break;case 116:d.key=s?l.C0.ESC+"[15;"+(s+1)+"~":l.C0.ESC+"[15~";break;case 117:d.key=s?l.C0.ESC+"[17;"+(s+1)+"~":l.C0.ESC+"[17~";break;case 118:d.key=s?l.C0.ESC+"[18;"+(s+1)+"~":l.C0.ESC+"[18~";break;case 119:d.key=s?l.C0.ESC+"[19;"+(s+1)+"~":l.C0.ESC+"[19~";break;case 120:d.key=s?l.C0.ESC+"[20;"+(s+1)+"~":l.C0.ESC+"[20~";break;case 121:d.key=s?l.C0.ESC+"[21;"+(s+1)+"~":l.C0.ESC+"[21~";break;case 122:d.key=s?l.C0.ESC+"[23;"+(s+1)+"~":l.C0.ESC+"[23~";break;case 123:d.key=s?l.C0.ESC+"[24;"+(s+1)+"~":l.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(p&&!S||!h.altKey||h.metaKey)!p||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?d.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(d.key=l.C0.US),h.key==="@"&&(d.key=l.C0.NUL)):h.keyCode===65&&(d.type=1);else{const o=g[h.keyCode],r=o==null?void 0:o[h.shiftKey?1:0];if(r)d.key=l.C0.ESC+r;else if(h.keyCode>=65&&h.keyCode<=90){const i=h.ctrlKey?h.keyCode-64:h.keyCode+32;let u=String.fromCharCode(i);h.shiftKey&&(u=u.toUpperCase()),d.key=l.C0.ESC+u}else if(h.keyCode===32)d.key=l.C0.ESC+(h.ctrlKey?l.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let i=h.code.slice(3,4);h.shiftKey||(i=i.toLowerCase()),d.key=l.C0.ESC+i,d.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?d.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?d.key=l.C0.NUL:h.keyCode>=51&&h.keyCode<=55?d.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?d.key=l.C0.DEL:h.keyCode===219?d.key=l.C0.ESC:h.keyCode===220?d.key=l.C0.FS:h.keyCode===221&&(d.key=l.C0.GS)}return d}},482:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Utf8ToUtf32=n.StringToUtf32=n.utf32ToString=n.stringFromCodePoint=void 0,n.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},n.utf32ToString=function(a,l=0,g=a.length){let h="";for(let f=l;f<g;++f){let p=a[f];p>65535?(p-=65536,h+=String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):h+=String.fromCharCode(p)}return h},n.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,l){const g=a.length;if(!g)return 0;let h=0,f=0;if(this._interim){const p=a.charCodeAt(f++);56320<=p&&p<=57343?l[h++]=1024*(this._interim-55296)+p-56320+65536:(l[h++]=this._interim,l[h++]=p),this._interim=0}for(let p=f;p<g;++p){const S=a.charCodeAt(p);if(55296<=S&&S<=56319){if(++p>=g)return this._interim=S,h;const d=a.charCodeAt(p);56320<=d&&d<=57343?l[h++]=1024*(S-55296)+d-56320+65536:(l[h++]=S,l[h++]=d)}else S!==65279&&(l[h++]=S)}return h}},n.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,l){const g=a.length;if(!g)return 0;let h,f,p,S,d=0,s=0,o=0;if(this.interim[0]){let u=!1,m=this.interim[0];m&=(224&m)==192?31:(240&m)==224?15:7;let v,C=0;for(;(v=63&this.interim[++C])&&C<4;)m<<=6,m|=v;const _=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,w=_-C;for(;o<w;){if(o>=g)return 0;if(v=a[o++],(192&v)!=128){o--,u=!0;break}this.interim[C++]=v,m<<=6,m|=63&v}u||(_===2?m<128?o--:l[d++]=m:_===3?m<2048||m>=55296&&m<=57343||m===65279||(l[d++]=m):m<65536||m>1114111||(l[d++]=m)),this.interim.fill(0)}const r=g-4;let i=o;for(;i<g;){for(;!(!(i<r)||128&(h=a[i])||128&(f=a[i+1])||128&(p=a[i+2])||128&(S=a[i+3]));)l[d++]=h,l[d++]=f,l[d++]=p,l[d++]=S,i+=4;if(h=a[i++],h<128)l[d++]=h;else if((224&h)==192){if(i>=g)return this.interim[0]=h,d;if(f=a[i++],(192&f)!=128){i--;continue}if(s=(31&h)<<6|63&f,s<128){i--;continue}l[d++]=s}else if((240&h)==224){if(i>=g)return this.interim[0]=h,d;if(f=a[i++],(192&f)!=128){i--;continue}if(i>=g)return this.interim[0]=h,this.interim[1]=f,d;if(p=a[i++],(192&p)!=128){i--;continue}if(s=(15&h)<<12|(63&f)<<6|63&p,s<2048||s>=55296&&s<=57343||s===65279)continue;l[d++]=s}else if((248&h)==240){if(i>=g)return this.interim[0]=h,d;if(f=a[i++],(192&f)!=128){i--;continue}if(i>=g)return this.interim[0]=h,this.interim[1]=f,d;if(p=a[i++],(192&p)!=128){i--;continue}if(i>=g)return this.interim[0]=h,this.interim[1]=f,this.interim[2]=p,d;if(S=a[i++],(192&S)!=128){i--;continue}if(s=(7&h)<<18|(63&f)<<12|(63&p)<<6|63&S,s<65536||s>1114111)continue;l[d++]=s}}return d}}},225:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeV6=void 0;const l=a(1480),g=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],h=[[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 f;n.UnicodeV6=class{constructor(){if(this.version="6",!f){f=new Uint8Array(65536),f.fill(1),f[0]=0,f.fill(0,1,32),f.fill(0,127,160),f.fill(2,4352,4448),f[9001]=2,f[9002]=2,f.fill(2,11904,42192),f[12351]=1,f.fill(2,44032,55204),f.fill(2,63744,64256),f.fill(2,65040,65050),f.fill(2,65072,65136),f.fill(2,65280,65377),f.fill(2,65504,65511);for(let p=0;p<g.length;++p)f.fill(0,g[p][0],g[p][1]+1)}}wcwidth(p){return p<32?0:p<127?1:p<65536?f[p]:function(S,d){let s,o=0,r=d.length-1;if(S<d[0][0]||S>d[r][1])return!1;for(;r>=o;)if(s=o+r>>1,S>d[s][1])o=s+1;else{if(!(S<d[s][0]))return!0;r=s-1}return!1}(p,h)?0:p>=131072&&p<=196605||p>=196608&&p<=262141?2:1}charProperties(p,S){let d=this.wcwidth(p),s=d===0&&S!==0;if(s){const o=l.UnicodeService.extractWidth(S);o===0?s=!1:o>d&&(d=o)}return l.UnicodeService.createPropertyValue(0,d,s)}}},5981:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WriteBuffer=void 0;const l=a(8460),g=a(844);class h extends g.Disposable{constructor(p){super(),this._action=p,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new l.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(p,S){if(S!==void 0&&this._syncCalls>S)return void(this._syncCalls=0);if(this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let d;for(this._isSyncWriting=!0;d=this._writeBuffer.shift();){this._action(d);const s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(p,S){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+=p.length,this._writeBuffer.push(p),this._callbacks.push(S),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(S)}_innerWrite(p=0,S=!0){const d=p||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const s=this._writeBuffer[this._bufferOffset],o=this._action(s,S);if(o){const i=u=>Date.now()-d>=12?setTimeout(()=>this._innerWrite(0,u)):this._innerWrite(d,u);return void o.catch(u=>(queueMicrotask(()=>{throw u}),Promise.resolve(!1))).then(i)}const r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=s.length,Date.now()-d>=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()}}n.WriteBuffer=h},5941:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.toRgbString=n.parseColor=void 0;const a=/^([\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})$/,l=/^[\da-f]+$/;function g(h,f){const p=h.toString(16),S=p.length<2?"0"+p:p;switch(f){case 4:return p[0];case 8:return S;case 12:return(S+S).slice(0,3);default:return S+S}}n.parseColor=function(h){if(!h)return;let f=h.toLowerCase();if(f.indexOf("rgb:")===0){f=f.slice(4);const p=a.exec(f);if(p){const S=p[1]?15:p[4]?255:p[7]?4095:65535;return[Math.round(parseInt(p[1]||p[4]||p[7]||p[10],16)/S*255),Math.round(parseInt(p[2]||p[5]||p[8]||p[11],16)/S*255),Math.round(parseInt(p[3]||p[6]||p[9]||p[12],16)/S*255)]}}else if(f.indexOf("#")===0&&(f=f.slice(1),l.exec(f)&&[3,6,9,12].includes(f.length))){const p=f.length/3,S=[0,0,0];for(let d=0;d<3;++d){const s=parseInt(f.slice(p*d,p*d+p),16);S[d]=p===1?s<<4:p===2?s:p===3?s>>4:s>>8}return S}},n.toRgbString=function(h,f=16){const[p,S,d]=h;return`rgb:${g(p,f)}/${g(S,f)}/${g(d,f)}`}},5770:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.PAYLOAD_LIMIT=void 0,n.PAYLOAD_LIMIT=1e7},6351:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DcsHandler=n.DcsParser=void 0;const l=a(482),g=a(8742),h=a(5770),f=[];n.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=f,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}registerHandler(S,d){this._handlers[S]===void 0&&(this._handlers[S]=[]);const s=this._handlers[S];return s.push(d),{dispose:()=>{const o=s.indexOf(d);o!==-1&&s.splice(o,1)}}}clearHandler(S){this._handlers[S]&&delete this._handlers[S]}setHandlerFallback(S){this._handlerFb=S}reset(){if(this._active.length)for(let S=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;S>=0;--S)this._active[S].unhook(!1);this._stack.paused=!1,this._active=f,this._ident=0}hook(S,d){if(this.reset(),this._ident=S,this._active=this._handlers[S]||f,this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(d);else this._handlerFb(this._ident,"HOOK",d)}put(S,d,s){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(S,d,s);else this._handlerFb(this._ident,"PUT",(0,l.utf32ToString)(S,d,s))}unhook(S,d=!0){if(this._active.length){let s=!1,o=this._active.length-1,r=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,s=d,r=this._stack.fallThrough,this._stack.paused=!1),!r&&s===!1){for(;o>=0&&(s=this._active[o].unhook(S),s!==!0);o--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,s;o--}for(;o>=0;o--)if(s=this._active[o].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,s}else this._handlerFb(this._ident,"UNHOOK",S);this._active=f,this._ident=0}};const p=new g.Params;p.addParam(0),n.DcsHandler=class{constructor(S){this._handler=S,this._data="",this._params=p,this._hitLimit=!1}hook(S){this._params=S.length>1||S.params[0]?S.clone():p,this._data="",this._hitLimit=!1}put(S,d,s){this._hitLimit||(this._data+=(0,l.utf32ToString)(S,d,s),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(S){let d=!1;if(this._hitLimit)d=!1;else if(S&&(d=this._handler(this._data,this._params),d instanceof Promise))return d.then(s=>(this._params=p,this._data="",this._hitLimit=!1,s));return this._params=p,this._data="",this._hitLimit=!1,d}}},2015:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.EscapeSequenceParser=n.VT500_TRANSITION_TABLE=n.TransitionTable=void 0;const l=a(844),g=a(8742),h=a(6242),f=a(6351);class p{constructor(o){this.table=new Uint8Array(o)}setDefault(o,r){this.table.fill(o<<4|r)}add(o,r,i,u){this.table[r<<8|o]=i<<4|u}addMany(o,r,i,u){for(let m=0;m<o.length;m++)this.table[r<<8|o[m]]=i<<4|u}}n.TransitionTable=p;const S=160;n.VT500_TRANSITION_TABLE=function(){const s=new p(4095),o=Array.apply(null,Array(256)).map((C,_)=>_),r=(C,_)=>o.slice(C,_),i=r(32,127),u=r(0,24);u.push(25),u.push.apply(u,r(28,32));const m=r(0,14);let v;for(v in s.setDefault(1,0),s.addMany(i,0,2,0),m)s.addMany([24,26,153,154],v,3,0),s.addMany(r(128,144),v,3,0),s.addMany(r(144,152),v,3,0),s.add(156,v,0,0),s.add(27,v,11,1),s.add(157,v,4,8),s.addMany([152,158,159],v,0,7),s.add(155,v,11,3),s.add(144,v,11,9);return s.addMany(u,0,3,0),s.addMany(u,1,3,1),s.add(127,1,0,1),s.addMany(u,8,0,8),s.addMany(u,3,3,3),s.add(127,3,0,3),s.addMany(u,4,3,4),s.add(127,4,0,4),s.addMany(u,6,3,6),s.addMany(u,5,3,5),s.add(127,5,0,5),s.addMany(u,2,3,2),s.add(127,2,0,2),s.add(93,1,4,8),s.addMany(i,8,5,8),s.add(127,8,5,8),s.addMany([156,27,24,26,7],8,6,0),s.addMany(r(28,32),8,0,8),s.addMany([88,94,95],1,0,7),s.addMany(i,7,0,7),s.addMany(u,7,0,7),s.add(156,7,0,0),s.add(127,7,0,7),s.add(91,1,11,3),s.addMany(r(64,127),3,7,0),s.addMany(r(48,60),3,8,4),s.addMany([60,61,62,63],3,9,4),s.addMany(r(48,60),4,8,4),s.addMany(r(64,127),4,7,0),s.addMany([60,61,62,63],4,0,6),s.addMany(r(32,64),6,0,6),s.add(127,6,0,6),s.addMany(r(64,127),6,0,0),s.addMany(r(32,48),3,9,5),s.addMany(r(32,48),5,9,5),s.addMany(r(48,64),5,0,6),s.addMany(r(64,127),5,7,0),s.addMany(r(32,48),4,9,5),s.addMany(r(32,48),1,9,2),s.addMany(r(32,48),2,9,2),s.addMany(r(48,127),2,10,0),s.addMany(r(48,80),1,10,0),s.addMany(r(81,88),1,10,0),s.addMany([89,90,92],1,10,0),s.addMany(r(96,127),1,10,0),s.add(80,1,11,9),s.addMany(u,9,0,9),s.add(127,9,0,9),s.addMany(r(28,32),9,0,9),s.addMany(r(32,48),9,9,12),s.addMany(r(48,60),9,8,10),s.addMany([60,61,62,63],9,9,10),s.addMany(u,11,0,11),s.addMany(r(32,128),11,0,11),s.addMany(r(28,32),11,0,11),s.addMany(u,10,0,10),s.add(127,10,0,10),s.addMany(r(28,32),10,0,10),s.addMany(r(48,60),10,8,10),s.addMany([60,61,62,63],10,0,11),s.addMany(r(32,48),10,9,12),s.addMany(u,12,0,12),s.add(127,12,0,12),s.addMany(r(28,32),12,0,12),s.addMany(r(32,48),12,9,12),s.addMany(r(48,64),12,0,11),s.addMany(r(64,127),12,12,13),s.addMany(r(64,127),10,12,13),s.addMany(r(64,127),9,12,13),s.addMany(u,13,13,13),s.addMany(i,13,13,13),s.add(127,13,0,13),s.addMany([27,156,24,26],13,14,0),s.add(S,0,2,0),s.add(S,8,5,8),s.add(S,6,0,6),s.add(S,11,0,11),s.add(S,13,13,13),s}();class d extends l.Disposable{constructor(o=n.VT500_TRANSITION_TABLE){super(),this._transitions=o,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new g.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(r,i,u)=>{},this._executeHandlerFb=r=>{},this._csiHandlerFb=(r,i)=>{},this._escHandlerFb=r=>{},this._errorHandlerFb=r=>r,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,l.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new f.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(o,r=[64,126]){let i=0;if(o.prefix){if(o.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=o.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(o.intermediates){if(o.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let m=0;m<o.intermediates.length;++m){const v=o.intermediates.charCodeAt(m);if(32>v||v>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=v}}if(o.final.length!==1)throw new Error("final must be a single byte");const u=o.final.charCodeAt(0);if(r[0]>u||u>r[1])throw new Error(`final must be in range ${r[0]} .. ${r[1]}`);return i<<=8,i|=u,i}identToString(o){const r=[];for(;o;)r.push(String.fromCharCode(255&o)),o>>=8;return r.reverse().join("")}setPrintHandler(o){this._printHandler=o}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(o,r){const i=this._identifier(o,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);const u=this._escHandlers[i];return u.push(r),{dispose:()=>{const m=u.indexOf(r);m!==-1&&u.splice(m,1)}}}clearEscHandler(o){this._escHandlers[this._identifier(o,[48,126])]&&delete this._escHandlers[this._identifier(o,[48,126])]}setEscHandlerFallback(o){this._escHandlerFb=o}setExecuteHandler(o,r){this._executeHandlers[o.charCodeAt(0)]=r}clearExecuteHandler(o){this._executeHandlers[o.charCodeAt(0)]&&delete this._executeHandlers[o.charCodeAt(0)]}setExecuteHandlerFallback(o){this._executeHandlerFb=o}registerCsiHandler(o,r){const i=this._identifier(o);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);const u=this._csiHandlers[i];return u.push(r),{dispose:()=>{const m=u.indexOf(r);m!==-1&&u.splice(m,1)}}}clearCsiHandler(o){this._csiHandlers[this._identifier(o)]&&delete this._csiHandlers[this._identifier(o)]}setCsiHandlerFallback(o){this._csiHandlerFb=o}registerDcsHandler(o,r){return this._dcsParser.registerHandler(this._identifier(o),r)}clearDcsHandler(o){this._dcsParser.clearHandler(this._identifier(o))}setDcsHandlerFallback(o){this._dcsParser.setHandlerFallback(o)}registerOscHandler(o,r){return this._oscParser.registerHandler(o,r)}clearOscHandler(o){this._oscParser.clearHandler(o)}setOscHandlerFallback(o){this._oscParser.setHandlerFallback(o)}setErrorHandler(o){this._errorHandler=o}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(o,r,i,u,m){this._parseStack.state=o,this._parseStack.handlers=r,this._parseStack.handlerPos=i,this._parseStack.transition=u,this._parseStack.chunkPos=m}parse(o,r,i){let u,m=0,v=0,C=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,C=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const _=this._parseStack.handlers;let w=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&w>-1){for(;w>=0&&(u=_[w](this._params),u!==!0);w--)if(u instanceof Promise)return this._parseStack.handlerPos=w,u}this._parseStack.handlers=[];break;case 4:if(i===!1&&w>-1){for(;w>=0&&(u=_[w](),u!==!0);w--)if(u instanceof Promise)return this._parseStack.handlerPos=w,u}this._parseStack.handlers=[];break;case 6:if(m=o[this._parseStack.chunkPos],u=this._dcsParser.unhook(m!==24&&m!==26,i),u)return u;m===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(m=o[this._parseStack.chunkPos],u=this._oscParser.end(m!==24&&m!==26,i),u)return u;m===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,C=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let _=C;_<r;++_){switch(m=o[_],v=this._transitions.table[this.currentState<<8|(m<160?m:S)],v>>4){case 2:for(let D=_+1;;++D){if(D>=r||(m=o[D])<32||m>126&&m<S){this._printHandler(o,_,D),_=D-1;break}if(++D>=r||(m=o[D])<32||m>126&&m<S){this._printHandler(o,_,D),_=D-1;break}if(++D>=r||(m=o[D])<32||m>126&&m<S){this._printHandler(o,_,D),_=D-1;break}if(++D>=r||(m=o[D])<32||m>126&&m<S){this._printHandler(o,_,D),_=D-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:_,code:m,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const w=this._csiHandlers[this._collect<<8|m];let A=w?w.length-1:-1;for(;A>=0&&(u=w[A](this._params),u!==!0);A--)if(u instanceof Promise)return this._preserveStack(3,w,A,v,_),u;A<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&&(m=o[_])>47&&m<60);_--;break;case 9:this._collect<<=8,this._collect|=m;break;case 10:const T=this._escHandlers[this._collect<<8|m];let O=T?T.length-1:-1;for(;O>=0&&(u=T[O](),u!==!0);O--)if(u instanceof Promise)return this._preserveStack(4,T,O,v,_),u;O<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 D=_+1;;++D)if(D>=r||(m=o[D])===24||m===26||m===27||m>127&&m<S){this._dcsParser.put(o,_,D),_=D-1;break}break;case 14:if(u=this._dcsParser.unhook(m!==24&&m!==26),u)return this._preserveStack(6,[],0,v,_),u;m===27&&(v|=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 D=_+1;;D++)if(D>=r||(m=o[D])<32||m>127&&m<S){this._oscParser.put(o,_,D),_=D-1;break}break;case 6:if(u=this._oscParser.end(m!==24&&m!==26),u)return this._preserveStack(5,[],0,v,_),u;m===27&&(v|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&v}}}n.EscapeSequenceParser=d},6242:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OscHandler=n.OscParser=void 0;const l=a(5770),g=a(482),h=[];n.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(f,p){this._handlers[f]===void 0&&(this._handlers[f]=[]);const S=this._handlers[f];return S.push(p),{dispose:()=>{const d=S.indexOf(p);d!==-1&&S.splice(d,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].start();else this._handlerFb(this._id,"START")}_put(f,p,S){if(this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].put(f,p,S);else this._handlerFb(this._id,"PUT",(0,g.utf32ToString)(f,p,S))}start(){this.reset(),this._state=1}put(f,p,S){if(this._state!==3){if(this._state===1)for(;p<S;){const d=f[p++];if(d===59){this._state=2,this._start();break}if(d<48||57<d)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+d-48}this._state===2&&S-p>0&&this._put(f,p,S)}}end(f,p=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let S=!1,d=this._active.length-1,s=!1;if(this._stack.paused&&(d=this._stack.loopPosition-1,S=p,s=this._stack.fallThrough,this._stack.paused=!1),!s&&S===!1){for(;d>=0&&(S=this._active[d].end(f),S!==!0);d--)if(S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!1,S;d--}for(;d>=0;d--)if(S=this._active[d].end(!1),S instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=d,this._stack.fallThrough=!0,S}else this._handlerFb(this._id,"END",f);this._active=h,this._id=-1,this._state=0}}},n.OscHandler=class{constructor(f){this._handler=f,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(f,p,S){this._hitLimit||(this._data+=(0,g.utf32ToString)(f,p,S),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(f){let p=!1;if(this._hitLimit)p=!1;else if(f&&(p=this._handler(this._data),p instanceof Promise))return p.then(S=>(this._data="",this._hitLimit=!1,S));return this._data="",this._hitLimit=!1,p}}},8742:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Params=void 0;const a=2147483647;class l{static fromArray(h){const f=new l;if(!h.length)return f;for(let p=Array.isArray(h[0])?1:0;p<h.length;++p){const S=h[p];if(Array.isArray(S))for(let d=0;d<S.length;++d)f.addSubParam(S[d]);else f.addParam(S)}return f}constructor(h=32,f=32){if(this.maxLength=h,this.maxSubParamsLength=f,f>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(f),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new l(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){const h=[];for(let f=0;f<this.length;++f){h.push(this.params[f]);const p=this._subParamsIdx[f]>>8,S=255&this._subParamsIdx[f];S-p>0&&h.push(Array.prototype.slice.call(this._subParams,p,S))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>a?a:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>a?a:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const f=this._subParamsIdx[h]>>8,p=255&this._subParamsIdx[h];return p-f>0?this._subParams.subarray(f,p):null}getSubParamsAll(){const h={};for(let f=0;f<this.length;++f){const p=this._subParamsIdx[f]>>8,S=255&this._subParamsIdx[f];S-p>0&&(h[f]=this._subParams.slice(p,S))}return h}addDigit(h){let f;if(this._rejectDigits||!(f=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const p=this._digitIsSub?this._subParams:this.params,S=p[f-1];p[f-1]=~S?Math.min(10*S+h,a):h}}n.Params=l},5741:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.AddonManager=void 0,n.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,l){const g={instance:l,dispose:l.dispose,isDisposed:!1};this._addons.push(g),l.dispose=()=>this._wrappedAddonDispose(g),l.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let l=-1;for(let g=0;g<this._addons.length;g++)if(this._addons[g]===a){l=g;break}if(l===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(l,1)}}},8771:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferApiView=void 0;const l=a(3785),g=a(511);n.BufferApiView=class{constructor(h,f){this._buffer=h,this.type=f}init(h){return this._buffer=h,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(h){const f=this._buffer.lines.get(h);if(f)return new l.BufferLineApiView(f)}getNullCell(){return new g.CellData}}},3785:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLineApiView=void 0;const l=a(511);n.BufferLineApiView=class{constructor(g){this._line=g}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(g,h){if(!(g<0||g>=this._line.length))return h?(this._line.loadCell(g,h),h):this._line.loadCell(g,new l.CellData)}translateToString(g,h,f){return this._line.translateToString(g,h,f)}}},8285:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferNamespaceApi=void 0;const l=a(8771),g=a(8460),h=a(844);class f extends h.Disposable{constructor(S){super(),this._core=S,this._onBufferChange=this.register(new g.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new l.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new l.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)}}n.BufferNamespaceApi=f},7975:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ParserApi=void 0,n.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,l){return this._core.registerCsiHandler(a,g=>l(g.toArray()))}addCsiHandler(a,l){return this.registerCsiHandler(a,l)}registerDcsHandler(a,l){return this._core.registerDcsHandler(a,(g,h)=>l(g,h.toArray()))}addDcsHandler(a,l){return this.registerDcsHandler(a,l)}registerEscHandler(a,l){return this._core.registerEscHandler(a,l)}addEscHandler(a,l){return this.registerEscHandler(a,l)}registerOscHandler(a,l){return this._core.registerOscHandler(a,l)}addOscHandler(a,l){return this.registerOscHandler(a,l)}}},7090:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeApi=void 0,n.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(x,n,a){var l=this&&this.__decorate||function(s,o,r,i){var u,m=arguments.length,v=m<3?o:i===null?i=Object.getOwnPropertyDescriptor(o,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,o,r,i);else for(var C=s.length-1;C>=0;C--)(u=s[C])&&(v=(m<3?u(v):m>3?u(o,r,v):u(o,r))||v);return m>3&&v&&Object.defineProperty(o,r,v),v},g=this&&this.__param||function(s,o){return function(r,i){o(r,i,s)}};Object.defineProperty(n,"__esModule",{value:!0}),n.BufferService=n.MINIMUM_ROWS=n.MINIMUM_COLS=void 0;const h=a(8460),f=a(844),p=a(5295),S=a(2585);n.MINIMUM_COLS=2,n.MINIMUM_ROWS=1;let d=n.BufferService=class extends f.Disposable{get buffer(){return this.buffers.active}constructor(s){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(s.rawOptions.cols||0,n.MINIMUM_COLS),this.rows=Math.max(s.rawOptions.rows||0,n.MINIMUM_ROWS),this.buffers=this.register(new p.BufferSet(s,this))}resize(s,o){this.cols=s,this.rows=o,this.buffers.resize(s,o),this._onResize.fire({cols:s,rows:o})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(s,o=!1){const r=this.buffer;let i;i=this._cachedBlankLine,i&&i.length===this.cols&&i.getFg(0)===s.fg&&i.getBg(0)===s.bg||(i=r.getBlankLine(s,o),this._cachedBlankLine=i),i.isWrapped=o;const u=r.ybase+r.scrollTop,m=r.ybase+r.scrollBottom;if(r.scrollTop===0){const v=r.lines.isFull;m===r.lines.length-1?v?r.lines.recycle().copyFrom(i):r.lines.push(i.clone()):r.lines.splice(m+1,0,i.clone()),v?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{const v=m-u+1;r.lines.shiftElements(u+1,v-1,-1),r.lines.set(m,i.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(s,o,r){const i=this.buffer;if(s<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else s+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);const u=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+s,i.ybase),0),u!==i.ydisp&&(o||this._onScroll.fire(i.ydisp))}};n.BufferService=d=l([g(0,S.IOptionsService)],d)},7994:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CharsetService=void 0,n.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,l){this._charsets[a]=l,this.glevel===a&&(this.charset=l)}}},1753:function(x,n,a){var l=this&&this.__decorate||function(i,u,m,v){var C,_=arguments.length,w=_<3?u:v===null?v=Object.getOwnPropertyDescriptor(u,m):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(i,u,m,v);else for(var A=i.length-1;A>=0;A--)(C=i[A])&&(w=(_<3?C(w):_>3?C(u,m,w):C(u,m))||w);return _>3&&w&&Object.defineProperty(u,m,w),w},g=this&&this.__param||function(i,u){return function(m,v){u(m,v,i)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreMouseService=void 0;const h=a(2585),f=a(8460),p=a(844),S={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:i=>i.button!==4&&i.action===1&&(i.ctrl=!1,i.alt=!1,i.shift=!1,!0)},VT200:{events:19,restrict:i=>i.action!==32},DRAG:{events:23,restrict:i=>i.action!==32||i.button!==3},ANY:{events:31,restrict:i=>!0}};function d(i,u){let m=(i.ctrl?16:0)|(i.shift?4:0)|(i.alt?8:0);return i.button===4?(m|=64,m|=i.action):(m|=3&i.button,4&i.button&&(m|=64),8&i.button&&(m|=128),i.action===32?m|=32:i.action!==0||u||(m|=3)),m}const s=String.fromCharCode,o={DEFAULT:i=>{const u=[d(i,!1)+32,i.col+32,i.row+32];return u[0]>255||u[1]>255||u[2]>255?"":`\x1B[M${s(u[0])}${s(u[1])}${s(u[2])}`},SGR:i=>{const u=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${d(i,!0)};${i.col};${i.row}${u}`},SGR_PIXELS:i=>{const u=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${d(i,!0)};${i.x};${i.y}${u}`}};let r=n.CoreMouseService=class extends p.Disposable{constructor(i,u){super(),this._bufferService=i,this._coreService=u,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new f.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const m of Object.keys(S))this.addProtocol(m,S[m]);for(const m of Object.keys(o))this.addEncoding(m,o[m]);this.reset()}addProtocol(i,u){this._protocols[i]=u}addEncoding(i,u){this._encodings[i]=u}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(i){if(!this._protocols[i])throw new Error(`unknown protocol "${i}"`);this._activeProtocol=i,this._onProtocolChange.fire(this._protocols[i].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(i){if(!this._encodings[i])throw new Error(`unknown encoding "${i}"`);this._activeEncoding=i}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(i){if(i.col<0||i.col>=this._bufferService.cols||i.row<0||i.row>=this._bufferService.rows||i.button===4&&i.action===32||i.button===3&&i.action!==32||i.button!==4&&(i.action===2||i.action===3)||(i.col++,i.row++,i.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,i,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(i))return!1;const u=this._encodings[this._activeEncoding](i);return u&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(u):this._coreService.triggerDataEvent(u,!0)),this._lastEvent=i,!0}explainEvents(i){return{down:!!(1&i),up:!!(2&i),drag:!!(4&i),move:!!(8&i),wheel:!!(16&i)}}_equalEvents(i,u,m){if(m){if(i.x!==u.x||i.y!==u.y)return!1}else if(i.col!==u.col||i.row!==u.row)return!1;return i.button===u.button&&i.action===u.action&&i.ctrl===u.ctrl&&i.alt===u.alt&&i.shift===u.shift}};n.CoreMouseService=r=l([g(0,h.IBufferService),g(1,h.ICoreService)],r)},6975:function(x,n,a){var l=this&&this.__decorate||function(r,i,u,m){var v,C=arguments.length,_=C<3?i:m===null?m=Object.getOwnPropertyDescriptor(i,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(r,i,u,m);else for(var w=r.length-1;w>=0;w--)(v=r[w])&&(_=(C<3?v(_):C>3?v(i,u,_):v(i,u))||_);return C>3&&_&&Object.defineProperty(i,u,_),_},g=this&&this.__param||function(r,i){return function(u,m){i(u,m,r)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreService=void 0;const h=a(1439),f=a(8460),p=a(844),S=a(2585),d=Object.freeze({insertMode:!1}),s=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let o=n.CoreService=class extends p.Disposable{constructor(r,i,u){super(),this._bufferService=r,this._logService=i,this._optionsService=u,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new f.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new f.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new f.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new f.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(d),this.decPrivateModes=(0,h.clone)(s)}reset(){this.modes=(0,h.clone)(d),this.decPrivateModes=(0,h.clone)(s)}triggerDataEvent(r,i=!1){if(this._optionsService.rawOptions.disableStdin)return;const u=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&u.ybase!==u.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${r}"`,()=>r.split("").map(m=>m.charCodeAt(0))),this._onData.fire(r)}triggerBinaryEvent(r){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${r}"`,()=>r.split("").map(i=>i.charCodeAt(0))),this._onBinary.fire(r))}};n.CoreService=o=l([g(0,S.IBufferService),g(1,S.ILogService),g(2,S.IOptionsService)],o)},9074:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DecorationService=void 0;const l=a(8055),g=a(8460),h=a(844),f=a(6106);let p=0,S=0;class d extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new f.SortedList(r=>r==null?void 0:r.marker.line),this._onDecorationRegistered=this.register(new g.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new g.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)(()=>this.reset()))}registerDecoration(r){if(r.marker.isDisposed)return;const i=new s(r);if(i){const u=i.marker.onDispose(()=>i.dispose());i.onDispose(()=>{i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),u.dispose())}),this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(const r of this._decorations.values())r.dispose();this._decorations.clear()}*getDecorationsAtCell(r,i,u){let m=0,v=0;for(const C of this._decorations.getKeyIterator(i))m=C.options.x??0,v=m+(C.options.width??1),r>=m&&r<v&&(!u||(C.options.layer??"bottom")===u)&&(yield C)}forEachDecorationAtCell(r,i,u,m){this._decorations.forEachByKey(i,v=>{p=v.options.x??0,S=p+(v.options.width??1),r>=p&&r<S&&(!u||(v.options.layer??"bottom")===u)&&m(v)})}}n.DecorationService=d;class s extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=l.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=l.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(r){super(),this.options=r,this.onRenderEmitter=this.register(new g.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new g.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=r.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.InstantiationService=n.ServiceCollection=void 0;const l=a(2585),g=a(8343);class h{constructor(...p){this._entries=new Map;for(const[S,d]of p)this.set(S,d)}set(p,S){const d=this._entries.get(p);return this._entries.set(p,S),d}forEach(p){for(const[S,d]of this._entries.entries())p(S,d)}has(p){return this._entries.has(p)}get(p){return this._entries.get(p)}}n.ServiceCollection=h,n.InstantiationService=class{constructor(){this._services=new h,this._services.set(l.IInstantiationService,this)}setService(f,p){this._services.set(f,p)}getService(f){return this._services.get(f)}createInstance(f,...p){const S=(0,g.getServiceDependencies)(f).sort((o,r)=>o.index-r.index),d=[];for(const o of S){const r=this._services.get(o.id);if(!r)throw new Error(`[createInstance] ${f.name} depends on UNKNOWN service ${o.id}.`);d.push(r)}const s=S.length>0?S[0].index:p.length;if(p.length!==s)throw new Error(`[createInstance] First service dependency of ${f.name} at position ${s+1} conflicts with ${p.length} static arguments`);return new f(...p,...d)}}},7866:function(x,n,a){var l=this&&this.__decorate||function(s,o,r,i){var u,m=arguments.length,v=m<3?o:i===null?i=Object.getOwnPropertyDescriptor(o,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(s,o,r,i);else for(var C=s.length-1;C>=0;C--)(u=s[C])&&(v=(m<3?u(v):m>3?u(o,r,v):u(o,r))||v);return m>3&&v&&Object.defineProperty(o,r,v),v},g=this&&this.__param||function(s,o){return function(r,i){o(r,i,s)}};Object.defineProperty(n,"__esModule",{value:!0}),n.traceCall=n.setTraceLogger=n.LogService=void 0;const h=a(844),f=a(2585),p={trace:f.LogLevelEnum.TRACE,debug:f.LogLevelEnum.DEBUG,info:f.LogLevelEnum.INFO,warn:f.LogLevelEnum.WARN,error:f.LogLevelEnum.ERROR,off:f.LogLevelEnum.OFF};let S,d=n.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(s){super(),this._optionsService=s,this._logLevel=f.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),S=this}_updateLogLevel(){this._logLevel=p[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(s){for(let o=0;o<s.length;o++)typeof s[o]=="function"&&(s[o]=s[o]())}_log(s,o,r){this._evalLazyOptionalParams(r),s.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+o,...r)}trace(s,...o){var r;this._logLevel<=f.LogLevelEnum.TRACE&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,s,o)}debug(s,...o){var r;this._logLevel<=f.LogLevelEnum.DEBUG&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,s,o)}info(s,...o){var r;this._logLevel<=f.LogLevelEnum.INFO&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,s,o)}warn(s,...o){var r;this._logLevel<=f.LogLevelEnum.WARN&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,s,o)}error(s,...o){var r;this._logLevel<=f.LogLevelEnum.ERROR&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,s,o)}};n.LogService=d=l([g(0,f.IOptionsService)],d),n.setTraceLogger=function(s){S=s},n.traceCall=function(s,o,r){if(typeof r.value!="function")throw new Error("not supported");const i=r.value;r.value=function(...u){if(S.logLevel!==f.LogLevelEnum.TRACE)return i.apply(this,u);S.trace(`GlyphRenderer#${i.name}(${u.map(v=>JSON.stringify(v)).join(", ")})`);const m=i.apply(this,u);return S.trace(`GlyphRenderer#${i.name} return`,m),m}}},7302:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OptionsService=n.DEFAULT_OPTIONS=void 0;const l=a(8460),g=a(844),h=a(6114);n.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:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const f=["normal","bold","100","200","300","400","500","600","700","800","900"];class p extends g.Disposable{constructor(d){super(),this._onOptionChange=this.register(new l.EventEmitter),this.onOptionChange=this._onOptionChange.event;const s={...n.DEFAULT_OPTIONS};for(const o in d)if(o in s)try{const r=d[o];s[o]=this._sanitizeAndValidateOption(o,r)}catch(r){console.error(r)}this.rawOptions=s,this.options={...s},this._setupOptions(),this.register((0,g.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(d,s){return this.onOptionChange(o=>{o===d&&s(this.rawOptions[d])})}onMultipleOptionChange(d,s){return this.onOptionChange(o=>{d.indexOf(o)!==-1&&s()})}_setupOptions(){const d=o=>{if(!(o in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${o}"`);return this.rawOptions[o]},s=(o,r)=>{if(!(o in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${o}"`);r=this._sanitizeAndValidateOption(o,r),this.rawOptions[o]!==r&&(this.rawOptions[o]=r,this._onOptionChange.fire(o))};for(const o in this.rawOptions){const r={get:d.bind(this,o),set:s.bind(this,o)};Object.defineProperty(this.options,o,r)}}_sanitizeAndValidateOption(d,s){switch(d){case"cursorStyle":if(s||(s=n.DEFAULT_OPTIONS[d]),!function(o){return o==="block"||o==="underline"||o==="bar"}(s))throw new Error(`"${s}" is not a valid value for ${d}`);break;case"wordSeparator":s||(s=n.DEFAULT_OPTIONS[d]);break;case"fontWeight":case"fontWeightBold":if(typeof s=="number"&&1<=s&&s<=1e3)break;s=f.includes(s)?s:n.DEFAULT_OPTIONS[d];break;case"cursorWidth":s=Math.floor(s);case"lineHeight":case"tabStopWidth":if(s<1)throw new Error(`${d} cannot be less than 1, value: ${s}`);break;case"minimumContrastRatio":s=Math.max(1,Math.min(21,Math.round(10*s)/10));break;case"scrollback":if((s=Math.min(s,4294967295))<0)throw new Error(`${d} cannot be less than 0, value: ${s}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(s<=0)throw new Error(`${d} cannot be less than or equal to 0, value: ${s}`);break;case"rows":case"cols":if(!s&&s!==0)throw new Error(`${d} must be numeric, value: ${s}`);break;case"windowsPty":s=s??{}}return s}}n.OptionsService=p},2660:function(x,n,a){var l=this&&this.__decorate||function(p,S,d,s){var o,r=arguments.length,i=r<3?S:s===null?s=Object.getOwnPropertyDescriptor(S,d):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(p,S,d,s);else for(var u=p.length-1;u>=0;u--)(o=p[u])&&(i=(r<3?o(i):r>3?o(S,d,i):o(S,d))||i);return r>3&&i&&Object.defineProperty(S,d,i),i},g=this&&this.__param||function(p,S){return function(d,s){S(d,s,p)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkService=void 0;const h=a(2585);let f=n.OscLinkService=class{constructor(p){this._bufferService=p,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(p){const S=this._bufferService.buffer;if(p.id===void 0){const u=S.addMarker(S.ybase+S.y),m={data:p,id:this._nextId++,lines:[u]};return u.onDispose(()=>this._removeMarkerFromLink(m,u)),this._dataByLinkId.set(m.id,m),m.id}const d=p,s=this._getEntryIdKey(d),o=this._entriesWithId.get(s);if(o)return this.addLineToLink(o.id,S.ybase+S.y),o.id;const r=S.addMarker(S.ybase+S.y),i={id:this._nextId++,key:this._getEntryIdKey(d),data:d,lines:[r]};return r.onDispose(()=>this._removeMarkerFromLink(i,r)),this._entriesWithId.set(i.key,i),this._dataByLinkId.set(i.id,i),i.id}addLineToLink(p,S){const d=this._dataByLinkId.get(p);if(d&&d.lines.every(s=>s.line!==S)){const s=this._bufferService.buffer.addMarker(S);d.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(d,s))}}getLinkData(p){var S;return(S=this._dataByLinkId.get(p))==null?void 0:S.data}_getEntryIdKey(p){return`${p.id};;${p.uri}`}_removeMarkerFromLink(p,S){const d=p.lines.indexOf(S);d!==-1&&(p.lines.splice(d,1),p.lines.length===0&&(p.data.id!==void 0&&this._entriesWithId.delete(p.key),this._dataByLinkId.delete(p.id)))}};n.OscLinkService=f=l([g(0,h.IBufferService)],f)},8343:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createDecorator=n.getServiceDependencies=n.serviceRegistry=void 0;const a="di$target",l="di$dependencies";n.serviceRegistry=new Map,n.getServiceDependencies=function(g){return g[l]||[]},n.createDecorator=function(g){if(n.serviceRegistry.has(g))return n.serviceRegistry.get(g);const h=function(f,p,S){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(d,s,o){s[a]===s?s[l].push({id:d,index:o}):(s[l]=[{id:d,index:o}],s[a]=s)})(h,f,S)};return h.toString=()=>g,n.serviceRegistry.set(g,h),h}},2585:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.IDecorationService=n.IUnicodeService=n.IOscLinkService=n.IOptionsService=n.ILogService=n.LogLevelEnum=n.IInstantiationService=n.ICharsetService=n.ICoreService=n.ICoreMouseService=n.IBufferService=void 0;const l=a(8343);var g;n.IBufferService=(0,l.createDecorator)("BufferService"),n.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),n.ICoreService=(0,l.createDecorator)("CoreService"),n.ICharsetService=(0,l.createDecorator)("CharsetService"),n.IInstantiationService=(0,l.createDecorator)("InstantiationService"),function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"}(g||(n.LogLevelEnum=g={})),n.ILogService=(0,l.createDecorator)("LogService"),n.IOptionsService=(0,l.createDecorator)("OptionsService"),n.IOscLinkService=(0,l.createDecorator)("OscLinkService"),n.IUnicodeService=(0,l.createDecorator)("UnicodeService"),n.IDecorationService=(0,l.createDecorator)("DecorationService")},1480:(x,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeService=void 0;const l=a(8460),g=a(225);class h{static extractShouldJoin(p){return(1&p)!=0}static extractWidth(p){return p>>1&3}static extractCharKind(p){return p>>3}static createPropertyValue(p,S,d=!1){return(16777215&p)<<3|(3&S)<<1|(d?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new l.EventEmitter,this.onChange=this._onChange.event;const p=new g.UnicodeV6;this.register(p),this._active=p.version,this._activeProvider=p}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(p){if(!this._providers[p])throw new Error(`unknown Unicode version "${p}"`);this._active=p,this._activeProvider=this._providers[p],this._onChange.fire(p)}register(p){this._providers[p.version]=p}wcwidth(p){return this._activeProvider.wcwidth(p)}getStringCellWidth(p){let S=0,d=0;const s=p.length;for(let o=0;o<s;++o){let r=p.charCodeAt(o);if(55296<=r&&r<=56319){if(++o>=s)return S+this.wcwidth(r);const m=p.charCodeAt(o);56320<=m&&m<=57343?r=1024*(r-55296)+m-56320+65536:S+=this.wcwidth(m)}const i=this.charProperties(r,d);let u=h.extractWidth(i);h.extractShouldJoin(i)&&(u-=h.extractWidth(d)),S+=u,d=i}return S}charProperties(p,S){return this._activeProvider.charProperties(p,S)}}n.UnicodeService=h}},b={};function E(x){var n=b[x];if(n!==void 0)return n.exports;var a=b[x]={exports:{}};return c[x].call(a.exports,a,a.exports,E),a.exports}var L={};return(()=>{var x=L;Object.defineProperty(x,"__esModule",{value:!0}),x.Terminal=void 0;const n=E(9042),a=E(3236),l=E(844),g=E(5741),h=E(8285),f=E(7975),p=E(7090),S=["cols","rows"];class d extends l.Disposable{constructor(o){super(),this._core=this.register(new a.Terminal(o)),this._addonManager=this.register(new g.AddonManager),this._publicOptions={...this._core.options};const r=u=>this._core.options[u],i=(u,m)=>{this._checkReadonlyOptions(u),this._core.options[u]=m};for(const u in this._core.options){const m={get:r.bind(this,u),set:i.bind(this,u)};Object.defineProperty(this._publicOptions,u,m)}}_checkReadonlyOptions(o){if(S.includes(o))throw new Error(`Option "${o}" 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 f.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new p.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 h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const o=this._core.coreService.decPrivateModes;let r="none";switch(this._core.coreMouseService.activeProtocol){case"X10":r="x10";break;case"VT200":r="vt200";break;case"DRAG":r="drag";break;case"ANY":r="any"}return{applicationCursorKeysMode:o.applicationCursorKeys,applicationKeypadMode:o.applicationKeypad,bracketedPasteMode:o.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:r,originMode:o.origin,reverseWraparoundMode:o.reverseWraparound,sendFocusMode:o.sendFocus,wraparoundMode:o.wraparound}}get options(){return this._publicOptions}set options(o){for(const r in o)this._publicOptions[r]=o[r]}blur(){this._core.blur()}focus(){this._core.focus()}input(o,r=!0){this._core.input(o,r)}resize(o,r){this._verifyIntegers(o,r),this._core.resize(o,r)}open(o){this._core.open(o)}attachCustomKeyEventHandler(o){this._core.attachCustomKeyEventHandler(o)}attachCustomWheelEventHandler(o){this._core.attachCustomWheelEventHandler(o)}registerLinkProvider(o){return this._core.registerLinkProvider(o)}registerCharacterJoiner(o){return this._checkProposedApi(),this._core.registerCharacterJoiner(o)}deregisterCharacterJoiner(o){this._checkProposedApi(),this._core.deregisterCharacterJoiner(o)}registerMarker(o=0){return this._verifyIntegers(o),this._core.registerMarker(o)}registerDecoration(o){return this._checkProposedApi(),this._verifyPositiveIntegers(o.x??0,o.width??0,o.height??0),this._core.registerDecoration(o)}hasSelection(){return this._core.hasSelection()}select(o,r,i){this._verifyIntegers(o,r,i),this._core.select(o,r,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(o,r){this._verifyIntegers(o,r),this._core.selectLines(o,r)}dispose(){super.dispose()}scrollLines(o){this._verifyIntegers(o),this._core.scrollLines(o)}scrollPages(o){this._verifyIntegers(o),this._core.scrollPages(o)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(o){this._verifyIntegers(o),this._core.scrollToLine(o)}clear(){this._core.clear()}write(o,r){this._core.write(o,r)}writeln(o,r){this._core.write(o),this._core.write(`\r
9
- `,r)}paste(o){this._core.paste(o)}refresh(o,r){this._verifyIntegers(o,r),this._core.refresh(o,r)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(o){this._addonManager.loadAddon(this,o)}static get strings(){return n}_verifyIntegers(...o){for(const r of o)if(r===1/0||isNaN(r)||r%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...o){for(const r of o)if(r&&(r===1/0||isNaN(r)||r%1!=0||r<0))throw new Error("This API only accepts positive integers")}}x.Terminal=d})(),L})())}(Ge)),Ge.exports}var vi=gi();function W(e,t){class c{constructor(E){var L;const x=this;c.init(x,E),(L=x._zod).deferred??(L.deferred=[]);for(const n of x._zod.deferred)n()}static init(E,L){var x;E._zod??(E._zod={}),(x=E._zod).traits??(x.traits=new Set),E._zod.traits.add(e),t(E,L);for(const n in c.prototype)Object.defineProperty(E,n,{value:c.prototype[n].bind(E)});E._zod.constr=c,E._zod.def=L}static[Symbol.hasInstance](E){var L,x;return(x=(L=E==null?void 0:E._zod)==null?void 0:L.traits)==null?void 0:x.has(e)}}return Object.defineProperty(c,"name",{value:e}),c}class ke extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const mi={};function de(e){return mi}function bi(e,t){return typeof t=="bigint"?t.toString():t}function Qe(e){return e==null}function et(e){const t=e.startsWith("^")?1:0,c=e.endsWith("$")?e.length-1:e.length;return e.slice(t,c)}function Si(e,t,c){Object.defineProperty(e,t,{get(){{const b=c();return e[t]=b,b}},set(b){Object.defineProperty(e,t,{value:b})},configurable:!0})}function Ci(e=10){const t="abcdefghijklmnopqrstuvwxyz";let c="";for(let b=0;b<e;b++)c+=t[Math.floor(Math.random()*t.length)];return c}function ut(e){return typeof e=="object"&&e!==null&&Object.getPrototypeOf(e)===Object.prototype}function Fe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function wi(e,t){const c=new e._zod.constr(t??e._zod.def);return t||(c._zod.parent=e),c}function G(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ye(e,t=0){for(let c=t;c<e.issues.length;c++)if(e.issues[c].continue!==!0)return!0;return!1}function yi(e,t){return t.map(c=>{var b;return(b=c).path??(b.path=[]),c.path.unshift(e),c})}function Pe(e){return typeof e=="string"?e:e==null?void 0:e.message}function fe(e,t,c){var E,L,x,n,a,l;const b={...e,path:e.path??[]};if(!e.message){const g=Pe((x=(L=(E=e.inst)==null?void 0:E._zod.def)==null?void 0:L.error)==null?void 0:x.call(L,e))??Pe((n=t==null?void 0:t.error)==null?void 0:n.call(t,e))??Pe((a=c.customError)==null?void 0:a.call(c,e))??Pe((l=c.localeError)==null?void 0:l.call(c,e))??"Invalid input";b.message=g}return delete b.inst,delete b.continue,t!=null&&t.reportInput||delete b.input,b}function tt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function xe(...e){const[t,c,b]=e;return typeof t=="string"?{message:t,code:"custom",input:c,inst:b}:{...t}}const dt=Symbol.for("{{zod.error}}");class Le{get message(){return JSON.stringify(this.issues,bi,2)}constructor(t){Object.defineProperty(this,"_tag",{value:dt,enumerable:!1}),Object.defineProperty(this,"name",{value:"$ZodError",enumerable:!1}),this.issues=t}static[Symbol.hasInstance](t){return(t==null?void 0:t._tag)===dt}}function Ei(e,t=c=>c.message){const c={},b=[];for(const E of e.issues)E.path.length>0?(c[E.path[0]]=c[E.path[0]]||[],c[E.path[0]].push(t(E))):b.push(t(E));return{formErrors:b,fieldErrors:c}}function ki(e,t){const c=t||function(L){return L.message},b={_errors:[]},E=L=>{for(const x of L.issues)if(x.code==="invalid_union")x.errors.map(n=>E({issues:n}));else if(x.code==="invalid_key")E({issues:x.issues});else if(x.code==="invalid_element")E({issues:x.issues});else if(x.path.length===0)b._errors.push(c(x));else{let n=b,a=0;for(;a<x.path.length;){const l=x.path[a];a===x.path.length-1?(n[l]=n[l]||{_errors:[]},n[l]._errors.push(c(x))):n[l]=n[l]||{_errors:[]},n=n[l],a++}}};return E(e),b}function Kt(e,t,c){const b=c?{...c,async:!1}:{async:!1},E=e._zod.run({value:t,issues:[]},b);if(E instanceof Promise)throw new ke;if(E.issues.length){const L=new((this==null?void 0:this.Error)??Le)(E.issues.map(x=>fe(x,b,de())));throw Error.captureStackTrace(L,Kt),L}return E.value}function xi(e,t,c){const b=c?{...c,async:!1}:{async:!1},E=e._zod.run({value:t,issues:[]},b);if(E instanceof Promise)throw new ke;return E.issues.length?{success:!1,error:new((this==null?void 0:this.Error)??Le)(E.issues.map(L=>fe(L,b,de())))}:{success:!0,data:E.value}}async function Vt(e,t,c){const b=c?{...c,async:!0}:{async:!0};let E=e._zod.run({value:t,issues:[]},b);if(E instanceof Promise&&(E=await E),E.issues.length){const L=new((this==null?void 0:this.Error)??Le)(E.issues.map(x=>fe(x,b,de())));throw Error.captureStackTrace(L,Vt),L}return E.value}async function Ri(e,t,c){const b=c?{...c,async:!0}:{async:!0};let E=e._zod.run({value:t,issues:[]},b);return E instanceof Promise&&(E=await E),E.issues.length?{success:!1,error:new((this==null?void 0:this.Error)??Le)(E.issues.map(L=>fe(L,b,de())))}:{success:!0,data:E.value}}const Di=/^[cC][^\s-]{8,}$/,Li=/^[0-9a-z]+$/,Ai=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Bi=/^[0-9a-vA-V]{20}$/,Ti=/^[A-Za-z0-9]{27}$/,Oi=/^[a-zA-Z0-9_-]{21}$/,Pi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Mi=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ft=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,Ii=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Hi="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Fi(){return new RegExp(Hi,"u")}const $i=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Wi=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ui=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ni=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ji=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_t=/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)+([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/,Zi=/^\+(?:[0-9]){6,14}[0-9]$/,Gt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",qi=new RegExp(`^${Gt}$`);function Jt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function Ki(e){return new RegExp(`^${Jt(e)}$`)}function Vi(e){let t=`${Gt}T${Jt(e)}`;const c=[];return c.push(e.local?"Z?":"Z"),e.offset&&c.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${c.join("|")})`,new RegExp(`^${t}$`)}const Gi=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ji=/^[^A-Z]*$/,Xi=/^[^a-z]*$/,ue=W("$ZodCheck",(e,t)=>{var c;e._zod??(e._zod={}),e._zod.def=t,(c=e._zod).onattach??(c.onattach=[])}),Yi=W("$ZodCheckMaxLength",(e,t)=>{ue.init(e,t),e._zod.when=c=>{const b=c.value;return!Qe(b)&&b.length!==void 0},e._zod.onattach.push(c=>{const b=c._zod.computed.maximum??Number.POSITIVE_INFINITY;t.maximum<b&&(c._zod.computed.maximum=t.maximum)}),e._zod.check=c=>{const b=c.value;if(b.length<=t.maximum)return;const L=tt(b);c.issues.push({origin:L,code:"too_big",maximum:t.maximum,input:b,inst:e,continue:!t.abort})}}),Qi=W("$ZodCheckMinLength",(e,t)=>{ue.init(e,t),e._zod.when=c=>{const b=c.value;return!Qe(b)&&b.length!==void 0},e._zod.onattach.push(c=>{const b=c._zod.computed.minimum??Number.NEGATIVE_INFINITY;t.minimum>b&&(c._zod.computed.minimum=t.minimum)}),e._zod.check=c=>{const b=c.value;if(b.length>=t.minimum)return;const L=tt(b);c.issues.push({origin:L,code:"too_small",minimum:t.minimum,input:b,inst:e,continue:!t.abort})}}),es=W("$ZodCheckLengthEquals",(e,t)=>{ue.init(e,t),e._zod.when=c=>{const b=c.value;return!Qe(b)&&b.length!==void 0},e._zod.onattach.push(c=>{c._zod.computed.minimum=t.length,c._zod.computed.maximum=t.length,c._zod.computed.length=t.length}),e._zod.check=c=>{const b=c.value,E=b.length;if(E===t.length)return;const L=tt(b),x=E>t.length;c.issues.push({origin:L,...x?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},input:c.value,inst:e,continue:!t.abort})}}),ze=W("$ZodCheckStringFormat",(e,t)=>{var c;ue.init(e,t),e._zod.onattach.push(b=>{b._zod.computed.format=t.format,t.pattern&&(b._zod.computed.pattern=t.pattern)}),(c=e._zod).check??(c.check=b=>{if(!t.pattern)throw new Error("Not implemented.");t.pattern.lastIndex=0,!t.pattern.test(b.value)&&b.issues.push({origin:"string",code:"invalid_format",format:t.format,input:b.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})})}),ts=W("$ZodCheckRegex",(e,t)=>{ze.init(e,t),e._zod.check=c=>{t.pattern.lastIndex=0,!t.pattern.test(c.value)&&c.issues.push({origin:"string",code:"invalid_format",format:"regex",input:c.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),rs=W("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ji),ze.init(e,t)}),is=W("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Xi),ze.init(e,t)}),ss=W("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);const c=new RegExp(Fe(t.includes));t.pattern=c,e._zod.onattach.push(b=>{b._zod.computed.pattern=c}),e._zod.check=b=>{b.value.includes(t.includes,t.position)||b.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:b.value,inst:e,continue:!t.abort})}}),ns=W("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);const c=new RegExp(`^${Fe(t.prefix)}.*`);t.pattern??(t.pattern=c),e._zod.onattach.push(b=>{b._zod.computed.pattern=c}),e._zod.check=b=>{b.value.startsWith(t.prefix)||b.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:b.value,inst:e,continue:!t.abort})}}),os=W("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);const c=new RegExp(`.*${Fe(t.suffix)}$`);t.pattern??(t.pattern=c),e._zod.onattach.push(b=>{b._zod.computed.pattern=new RegExp(`.*${Fe(t.suffix)}$`)}),e._zod.check=b=>{b.value.endsWith(t.suffix)||b.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:b.value,inst:e,continue:!t.abort})}}),as=W("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=c=>{c.value=t.tx(c.value)}}),cs={major:0,minor:11,patch:6},oe=W("$ZodType",(e,t)=>{var E;var c;e??(e={}),e._zod.id=t.type+"_"+Ci(10),e._zod.def=t,e._zod.computed=e._zod.computed||{},e._zod.version=cs;const b=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&b.unshift(e);for(const L of b)for(const x of L._zod.onattach)x(e);if(b.length===0)(c=e._zod).deferred??(c.deferred=[]),(E=e._zod.deferred)==null||E.push(()=>{e._zod.run=e._zod.parse});else{const L=(x,n,a)=>{let l=ye(x),g;for(const h of n){if(h._zod.when){if(!h._zod.when(x))continue}else if(l)continue;const f=x.issues.length,p=h._zod.check(x);if(p instanceof Promise&&(a==null?void 0:a.async)===!1)throw new ke;if(g||p instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await p,x.issues.length!==f&&(l||(l=ye(x,f)))});else{if(x.issues.length===f)continue;l||(l=ye(x,f))}}return g?g.then(()=>x):x};e._zod.run=(x,n)=>{const a=e._zod.parse(x,n);if(a instanceof Promise){if(n.async===!1)throw new ke;return a.then(l=>L(l,b,n))}return L(a,b,n)}}e["~standard"]={validate:L=>{const x=e._zod.run({value:L,issues:[]},{});return x instanceof Promise?x.then(({issues:n,value:a})=>n.length===0?{value:a}:{issues:n.map(l=>fe(l,{},de()))}):x.issues.length===0?{value:x.value}:{issues:x.issues.map(n=>fe(n,{},de()))}},vendor:"zod",version:1}}),rt=W("$ZodString",(e,t)=>{var c;oe.init(e,t),e._zod.pattern=((c=e==null?void 0:e._zod.computed)==null?void 0:c.pattern)??Gi(e._zod.computed),e._zod.parse=(b,E)=>{if(t.coerce)try{b.value=String(b.value)}catch{}return typeof b.value=="string"||b.issues.push({expected:"string",code:"invalid_type",input:b.value,inst:e}),b}}),Q=W("$ZodStringFormat",(e,t)=>{ze.init(e,t),rt.init(e,t)}),hs=W("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Mi),Q.init(e,t)}),ls=W("$ZodUUID",(e,t)=>{if(t.version){const b={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(b===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ft(b))}else t.pattern??(t.pattern=ft());Q.init(e,t)}),us=W("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ii),Q.init(e,t)}),ds=W("$ZodURL",(e,t)=>{Q.init(e,t),e._zod.check=c=>{try{const b=new URL(c.value);if(_t.lastIndex=0,!_t.test(b.hostname))throw new Error;return}catch{c.issues.push({code:"invalid_format",format:"url",input:c.value,inst:e})}}}),fs=W("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Fi()),Q.init(e,t)}),_s=W("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Oi),Q.init(e,t)}),ps=W("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Di),Q.init(e,t)}),gs=W("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Li),Q.init(e,t)}),vs=W("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ai),Q.init(e,t)}),ms=W("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Bi),Q.init(e,t)}),bs=W("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ti),Q.init(e,t)}),Ss=W("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Vi(t)),Q.init(e,t)}),Cs=W("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=qi),Q.init(e,t)}),ws=W("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ki(t)),Q.init(e,t)}),ys=W("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Pi),Q.init(e,t)}),Es=W("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$i),Q.init(e,t),e._zod.onattach.push(c=>{c._zod.computed.format="ipv4"})}),ks=W("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=zi),Q.init(e,t),e._zod.onattach.push(c=>{c._zod.computed.format="ipv6"}),e._zod.check=c=>{try{new URL(`http://[${c.value}]`)}catch{c.issues.push({code:"invalid_format",format:"ipv6",input:c.value,inst:e})}}}),xs=W("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Wi),Q.init(e,t)}),Rs=W("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ui),Q.init(e,t),e._zod.check=c=>{const[b,E]=c.value.split("/");try{if(!E)throw new Error;const L=Number(E);if(`${L}`!==E)throw new Error;if(L<0||L>128)throw new Error;new URL(`http://[${b}]`)}catch{c.issues.push({code:"invalid_format",format:"cidrv6",input:c.value,inst:e})}}}),Ds=W("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ni),Q.init(e,t),e._zod.onattach.push(c=>{c._zod.computed.contentEncoding="base64"})}),Ls=W("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ji),Q.init(e,t),e._zod.onattach.push(c=>{c._zod.computed.contentEncoding="base64url"})}),As=W("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Zi),Q.init(e,t)});function Bs(e,t=null){try{const c=e.split(".");if(c.length!==3)return!1;const[b]=c,E=JSON.parse(atob(b));return!("typ"in E&&(E==null?void 0:E.typ)!=="JWT"||t&&(!("alg"in E)||E.alg!==t))}catch{return!1}}const Ts=W("$ZodJWT",(e,t)=>{Q.init(e,t),e._zod.check=c=>{Bs(c.value,t.alg)||c.issues.push({code:"invalid_format",format:"jwt",input:c.value,inst:e})}});function pt(e,t,c){e.issues.length&&t.issues.push(...yi(c,e.issues)),t.value[c]=e.value}const Os=W("$ZodArray",(e,t)=>{oe.init(e,t),e._zod.parse=(c,b)=>{const E=c.value;if(!Array.isArray(E))return c.issues.push({expected:"array",code:"invalid_type",input:E,inst:e}),c;c.value=Array(E.length);const L=[];for(let x=0;x<E.length;x++){const n=E[x],a=t.element._zod.run({value:n,issues:[]},b);a instanceof Promise?L.push(a.then(l=>pt(l,c,x))):pt(a,c,x)}return L.length?Promise.all(L).then(()=>c):c}});function Ps(e,t,c,b){for(const E of e)if(E.issues.length===0)return t.value=E.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:c,errors:e.map(E=>E.issues.map(L=>fe(L,b,de())))}),t}const Ms=W("$ZodUnion",(e,t)=>{oe.init(e,t);const c=new Set;if(t.options.every(b=>b._zod.values)){for(const b of t.options)for(const E of b._zod.values)c.add(E);e._zod.values=c}if(t.options.every(b=>b._zod.pattern)){const b=t.options.map(E=>E._zod.pattern);e._zod.pattern=new RegExp(`^(${b.map(E=>et(E.source)).join("|")})$`)}e._zod.parse=(b,E)=>{const L=[];for(const x of t.options){const n=x._zod.run({value:b.value,issues:[]},E);if(n instanceof Promise)L.push(n);else{if(n.issues.length===0)return n;L.push(n)}}return Ps(L,b,e,E)}}),Is=W("$ZodIntersection",(e,t)=>{oe.init(e,t),e._zod.parse=(c,b)=>{const{value:E}=c,L=t.left._zod.run({value:E,issues:[]},b),x=t.right._zod.run({value:E,issues:[]},b);return L instanceof Promise||x instanceof Promise?Promise.all([L,x]).then(([a,l])=>gt(c,a,l)):gt(c,L,x)}});function Xe(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ut(e)&&ut(t)){const c=Object.keys(t),b=Object.keys(e).filter(L=>c.indexOf(L)!==-1),E={...e,...t};for(const L of b){const x=Xe(e[L],t[L]);if(!x.valid)return{valid:!1,mergeErrorPath:[L,...x.mergeErrorPath]};E[L]=x.data}return{valid:!0,data:E}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const c=[];for(let b=0;b<e.length;b++){const E=e[b],L=t[b],x=Xe(E,L);if(!x.valid)return{valid:!1,mergeErrorPath:[b,...x.mergeErrorPath]};c.push(x.data)}return{valid:!0,data:c}}return{valid:!1,mergeErrorPath:[]}}function gt(e,t,c){if(t.issues.length&&e.issues.push(...t.issues),c.issues.length&&e.issues.push(...c.issues),ye(e))return e;const b=Xe(t.value,c.value);if(!b.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(b.mergeErrorPath)}`);return e.value=b.data,e}const Hs=W("$ZodTransform",(e,t)=>{oe.init(e,t),e._zod.parse=(c,b)=>{const E=t.transform(c.value,c);if(b.async)return(E instanceof Promise?E:Promise.resolve(E)).then(x=>(c.value=x,c));if(E instanceof Promise)throw new ke;return c.value=E,c}}),Fs=W("$ZodOptional",(e,t)=>{oe.init(e,t),e._zod.optionality="optional",t.innerType._zod.values&&(e._zod.values=new Set([...t.innerType._zod.values,void 0]));const c=t.innerType._zod.pattern;c&&(e._zod.pattern=new RegExp(`^(${et(c.source)})?$`)),e._zod.parse=(b,E)=>b.value===void 0?b:t.innerType._zod.run(b,E)}),$s=W("$ZodNullable",(e,t)=>{oe.init(e,t),e._zod.optionality=t.innerType._zod.optionality;const c=t.innerType._zod.pattern;c&&(e._zod.pattern=new RegExp(`^(${et(c.source)}|null)$`)),t.innerType._zod.values&&(e._zod.values=new Set([...t.innerType._zod.values,null])),e._zod.parse=(b,E)=>b.value===null?b:t.innerType._zod.run(b,E)}),zs=W("$ZodDefault",(e,t)=>{oe.init(e,t),e._zod.optionality="defaulted",e._zod.values=t.innerType._zod.values,e._zod.parse=(c,b)=>{if(c.value===void 0)return c.value=t.defaultValue(),c;const E=t.innerType._zod.run(c,b);return E instanceof Promise?E.then(L=>vt(L,t)):vt(E,t)}});function vt(e,t){return e.value===void 0&&(e.value=t.defaultValue()),e}const Ws=W("$ZodNonOptional",(e,t)=>{oe.init(e,t),t.innerType._zod.values&&(e._zod.values=new Set([...t.innerType._zod.values].filter(c=>c!==void 0))),e._zod.parse=(c,b)=>{const E=t.innerType._zod.run(c,b);return E instanceof Promise?E.then(L=>mt(L,e)):mt(E,e)}});function mt(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Us=W("$ZodCatch",(e,t)=>{oe.init(e,t),e._zod.optionality=t.innerType._zod.optionality,e._zod.values=t.innerType._zod.values,e._zod.parse=(c,b)=>{const E=t.innerType._zod.run(c,b);return E instanceof Promise?E.then(L=>(L.issues.length?(c.value=t.catchValue({...c,error:{issues:L.issues.map(x=>fe(x,b,de()))},input:c.value}),c.issues=[]):c.value=L.value,c)):(E.issues.length?(c.value=t.catchValue({...c,error:{issues:E.issues.map(L=>fe(L,b,de()))},input:c.value}),c.issues=[]):c.value=E.value,c)}}),Ns=W("$ZodPipe",(e,t)=>{oe.init(e,t),e._zod.values=t.in._zod.values,e._zod.parse=(c,b)=>{const E=t.in._zod.run(c,b);return E instanceof Promise?E.then(L=>bt(L,t,b)):bt(E,t,b)}});function bt(e,t,c){return ye(e)?e:t.out._zod.run({value:e.value,issues:e.issues},c)}const js=W("$ZodReadonly",(e,t)=>{oe.init(e,t),Si(e._zod,"disc",()=>t.innerType._zod.disc),e._zod.optionality=t.innerType._zod.optionality,e._zod.parse=(c,b)=>{const E=t.innerType._zod.run(c,b);return E instanceof Promise?E.then(St):St(E)}});function St(e){return e.value=Object.freeze(e.value),e}const Zs=W("$ZodCustom",(e,t)=>{ue.init(e,t),oe.init(e,t),e._zod.parse=(c,b)=>c,e._zod.check=c=>{const b=c.value,E=t.fn(b);if(E instanceof Promise)return E.then(L=>Ct(L,c,b,e));Ct(E,c,b,e)}});function Ct(e,t,c,b){if(!e){const E={code:"custom",input:c,inst:b,path:b._zod.def.path,continue:!b._zod.def.abort};b._zod.def.params&&(E.params=b._zod.def.params),t.issues.push(xe(E))}}class qs{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...c){const b=c[0];if(this._map.set(t,b),b&&typeof b=="object"&&"id"in b){if(this._idmap.has(b.id))throw new Error(`ID ${b.id} already exists in the registry`);this._idmap.set(b.id,t)}return this}remove(t){return this._map.delete(t),this}get(t){return this._map.get(t)}has(t){return this._map.has(t)}}function Ks(){return new qs}const we=Ks();function Vs(e,t){return new e({type:"string",...G(t)})}function Gs(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...G(t)})}function wt(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...G(t)})}function Js(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...G(t)})}function Xs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...G(t)})}function Ys(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...G(t)})}function Qs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...G(t)})}function en(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...G(t)})}function tn(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...G(t)})}function rn(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...G(t)})}function sn(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...G(t)})}function nn(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...G(t)})}function on(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...G(t)})}function an(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...G(t)})}function cn(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...G(t)})}function hn(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...G(t)})}function ln(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...G(t)})}function un(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...G(t)})}function dn(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...G(t)})}function fn(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...G(t)})}function _n(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...G(t)})}function pn(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...G(t)})}function gn(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...G(t)})}function vn(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...G(t)})}function mn(e,t){return new e({type:"string",format:"date",check:"string_format",...G(t)})}function bn(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...G(t)})}function Sn(e,t){return new e({type:"string",format:"duration",check:"string_format",...G(t)})}function Xt(e,t){return new Yi({check:"max_length",...G(t),maximum:e})}function $e(e,t){return new Qi({check:"min_length",...G(t),minimum:e})}function Yt(e,t){return new es({check:"length_equals",...G(t),length:e})}function Cn(e,t){return new ts({check:"string_format",format:"regex",...G(t),pattern:e})}function wn(e){return new rs({check:"string_format",format:"lowercase",...G(e)})}function yn(e){return new is({check:"string_format",format:"uppercase",...G(e)})}function En(e,t){return new ss({check:"string_format",format:"includes",...G(t),includes:e})}function kn(e,t){return new ns({check:"string_format",format:"starts_with",...G(t),prefix:e})}function xn(e,t){return new os({check:"string_format",format:"ends_with",...G(t),suffix:e})}function Ae(e){return new as({check:"overwrite",tx:e})}function Rn(e){return Ae(t=>t.normalize(e))}function Dn(){return Ae(e=>e.trim())}function Ln(){return Ae(e=>e.toLowerCase())}function An(){return Ae(e=>e.toUpperCase())}function Bn(e,t,c){return new e({type:"array",element:t,...G(c)})}function Tn(e,t,c){return new e({type:"custom",check:"custom",fn:t,...G(c)})}const On=W("ZodISODateTime",(e,t)=>{Ss.init(e,t),te.init(e,t)});function Pn(e){return vn(On,e)}const Mn=W("ZodISODate",(e,t)=>{Cs.init(e,t),te.init(e,t)});function In(e){return mn(Mn,e)}const Hn=W("ZodISOTime",(e,t)=>{ws.init(e,t),te.init(e,t)});function Fn(e){return bn(Hn,e)}const $n=W("ZodISODuration",(e,t)=>{ys.init(e,t),te.init(e,t)});function zn(e){return Sn($n,e)}class We extends Le{format(t){return ki(this,t)}flatten(t){return Ei(this,t)}addIssue(t){this.issues.push(t)}addIssues(t){this.issues.push(...t)}get isEmpty(){return this.issues.length===0}}const Wn=Kt.bind({Error:We}),Un=xi.bind({Error:We}),Nn=Vt.bind({Error:We}),jn=Ri.bind({Error:We}),ae=W("ZodType",(e,t)=>(oe.init(e,t),e.def=t,e._def=t,e.check=(...c)=>e.clone({...t,checks:[...t.checks??[],...c.map(b=>typeof b=="function"?{_zod:{check:b,def:{check:"custom"},onattach:[]}}:b)]}),e.clone=c=>wi(e,c),e.brand=()=>e,e.register=(c,b)=>(c.add(e,b),e),e.parse=(c,b)=>Wn(e,c,b),e.safeParse=(c,b)=>Un(e,c,b),e.parseAsync=async(c,b)=>Nn(e,c,b),e.safeParseAsync=async(c,b)=>jn(e,c,b),e.spa=e.safeParseAsync,e.refine=(c,b)=>e.check(To(c,b)),e.superRefine=c=>e.check(Oo(c)),e.overwrite=c=>e.check(Ae(c)),e.optional=c=>Et(e,c),e.nullable=c=>kt(e,c),e.nullish=()=>Et(kt(e)),e.nonoptional=c=>Eo(e,c),e.array=()=>uo(e),e.or=c=>_o([e,c]),e.and=c=>go(e,c),e.transform=c=>xt(e,mo(c)),e.default=(c,b)=>wo(e,c,b),e.catch=c=>xo(e,c),e.pipe=c=>xt(e,c),e.readonly=()=>Lo(e),e.describe=c=>{const b=e.clone(),E={...we.get(e)??{},description:c};return delete E.id,we.add(b,E),b},Object.defineProperty(e,"description",{get(){var c;return(c=we.get(e))==null?void 0:c.description},configurable:!0}),e.meta=(...c)=>{if(c.length===0)return we.get(e);const b=e.clone();return we.add(b,c[0]),b},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Qt=W("_ZodString",(e,t)=>{rt.init(e,t),ae.init(e,t),e.format=e._zod.computed.format??null,e.minLength=e._zod.computed.minimum??null,e.maxLength=e._zod.computed.maximum??null,e.regex=(...c)=>e.check(Cn(...c)),e.includes=(...c)=>e.check(En(...c)),e.startsWith=c=>e.check(kn(c)),e.endsWith=c=>e.check(xn(c)),e.min=(...c)=>e.check($e(...c)),e.max=(...c)=>e.check(Xt(...c)),e.length=(...c)=>e.check(Yt(...c)),e.nonempty=(...c)=>e.check($e(1,...c)),e.lowercase=c=>e.check(wn(c)),e.uppercase=c=>e.check(yn(c)),e.trim=()=>e.check(Dn()),e.normalize=(...c)=>e.check(Rn(...c)),e.toLowerCase=()=>e.check(Ln()),e.toUpperCase=()=>e.check(An())}),Zn=W("ZodString",(e,t)=>{rt.init(e,t),Qt.init(e,t),e.email=c=>e.check(Gs(Kn,c)),e.url=c=>e.check(en(Vn,c)),e.jwt=c=>e.check(gn(ho,c)),e.emoji=c=>e.check(tn(Gn,c)),e.guid=c=>e.check(wt(yt,c)),e.uuid=c=>e.check(Js(Me,c)),e.uuidv4=c=>e.check(Xs(Me,c)),e.uuidv6=c=>e.check(Ys(Me,c)),e.uuidv7=c=>e.check(Qs(Me,c)),e.nanoid=c=>e.check(rn(Jn,c)),e.guid=c=>e.check(wt(yt,c)),e.cuid=c=>e.check(sn(Xn,c)),e.cuid2=c=>e.check(nn(Yn,c)),e.ulid=c=>e.check(on(Qn,c)),e.base64=c=>e.check(fn(oo,c)),e.base64url=c=>e.check(_n(ao,c)),e.xid=c=>e.check(an(eo,c)),e.ksuid=c=>e.check(cn(to,c)),e.ipv4=c=>e.check(hn(ro,c)),e.ipv6=c=>e.check(ln(io,c)),e.cidrv4=c=>e.check(un(so,c)),e.cidrv6=c=>e.check(dn(no,c)),e.e164=c=>e.check(pn(co,c)),e.datetime=c=>e.check(Pn(c)),e.date=c=>e.check(In(c)),e.time=c=>e.check(Fn(c)),e.duration=c=>e.check(zn(c))});function qn(e){return Vs(Zn,e)}const te=W("ZodStringFormat",(e,t)=>{Q.init(e,t),Qt.init(e,t)}),Kn=W("ZodEmail",(e,t)=>{us.init(e,t),te.init(e,t)}),yt=W("ZodGUID",(e,t)=>{hs.init(e,t),te.init(e,t)}),Me=W("ZodUUID",(e,t)=>{ls.init(e,t),te.init(e,t)}),Vn=W("ZodURL",(e,t)=>{ds.init(e,t),te.init(e,t)}),Gn=W("ZodEmoji",(e,t)=>{fs.init(e,t),te.init(e,t)}),Jn=W("ZodNanoID",(e,t)=>{_s.init(e,t),te.init(e,t)}),Xn=W("ZodCUID",(e,t)=>{ps.init(e,t),te.init(e,t)}),Yn=W("ZodCUID2",(e,t)=>{gs.init(e,t),te.init(e,t)}),Qn=W("ZodULID",(e,t)=>{vs.init(e,t),te.init(e,t)}),eo=W("ZodXID",(e,t)=>{ms.init(e,t),te.init(e,t)}),to=W("ZodKSUID",(e,t)=>{bs.init(e,t),te.init(e,t)}),ro=W("ZodIPv4",(e,t)=>{Es.init(e,t),te.init(e,t)}),io=W("ZodIPv6",(e,t)=>{ks.init(e,t),te.init(e,t)}),so=W("ZodCIDRv4",(e,t)=>{xs.init(e,t),te.init(e,t)}),no=W("ZodCIDRv6",(e,t)=>{Rs.init(e,t),te.init(e,t)}),oo=W("ZodBase64",(e,t)=>{Ds.init(e,t),te.init(e,t)}),ao=W("ZodBase64URL",(e,t)=>{Ls.init(e,t),te.init(e,t)}),co=W("ZodE164",(e,t)=>{As.init(e,t),te.init(e,t)}),ho=W("ZodJWT",(e,t)=>{Ts.init(e,t),te.init(e,t)}),lo=W("ZodArray",(e,t)=>{Os.init(e,t),ae.init(e,t),e.element=t.element,e.min=(c,b)=>e.check($e(c,b)),e.nonempty=c=>e.check($e(1,c)),e.max=(c,b)=>e.check(Xt(c,b)),e.length=(c,b)=>e.check(Yt(c,b))});function uo(e,t){return Bn(lo,e,t)}const fo=W("ZodUnion",(e,t)=>{Ms.init(e,t),ae.init(e,t),e.options=t.options});function _o(e,t){return new fo({type:"union",options:e,...G(t)})}const po=W("ZodIntersection",(e,t)=>{Is.init(e,t),ae.init(e,t)});function go(e,t,c){return new po({type:"intersection",left:e,right:t,...G(c)})}const vo=W("ZodTransform",(e,t)=>{Hs.init(e,t),ae.init(e,t),e._zod.parse=(c,b)=>{c.addIssue=L=>{if(typeof L=="string")c.issues.push(xe(L,c.value,t));else{const x=L;x.fatal&&(x.continue=!1),x.code??(x.code="custom"),x.input??(x.input=c.value),x.inst??(x.inst=e),x.continue??(x.continue=!t.abort),c.issues.push(xe(x))}};const E=t.transform(c.value,c);return E instanceof Promise?E.then(L=>(c.value=L,c)):(c.value=E,c)}});function mo(e,t){return new vo({type:"transform",transform:e,...G(t)})}const bo=W("ZodOptional",(e,t)=>{Fs.init(e,t),ae.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Et(e,t){return new bo({type:"optional",innerType:e,...G(t)})}const So=W("ZodNullable",(e,t)=>{$s.init(e,t),ae.init(e,t),e.unwrap=()=>e._zod.def.innerType});function kt(e,t){return new So({type:"nullable",innerType:e,...G(t)})}const Co=W("ZodDefault",(e,t)=>{zs.init(e,t),ae.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function wo(e,t,c){return new Co({type:"default",defaultValue:typeof t=="function"?t:()=>t,innerType:e,...G(c)})}const yo=W("ZodNonOptional",(e,t)=>{Ws.init(e,t),ae.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Eo(e,t){return new yo({type:"nonoptional",innerType:e,...G(t)})}const ko=W("ZodCatch",(e,t)=>{Us.init(e,t),ae.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function xo(e,t,c){return new ko({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t,...G(c)})}const Ro=W("ZodPipe",(e,t)=>{Ns.init(e,t),ae.init(e,t),e.in=t.in,e.out=t.out});function xt(e,t,c){return new Ro({type:"pipe",in:e,out:t,...G(c)})}const Do=W("ZodReadonly",(e,t)=>{js.init(e,t),ae.init(e,t)});function Lo(e,t){return new Do({type:"readonly",innerType:e,...G(t)})}const Ao=W("ZodCustom",(e,t)=>{Zs.init(e,t),ae.init(e,t)});function Bo(e,t){const c=new ue({check:"custom",...G(t)});return c._zod.check=e,c}function To(e,t={}){return Tn(Ao,e,t)}function Oo(e,t){const c=Bo(b=>(b.addIssue=E=>{if(typeof E=="string")b.issues.push(xe(E,b.value,c._zod.def));else{const L=E;L.fatal&&(L.continue=!1),L.code??(L.code="custom"),L.input??(L.input=b.value),L.inst??(L.inst=c),L.continue??(L.continue=!c._zod.def.abort),b.issues.push(xe(L))}},e(b.value,b)),t);return c}function Po(e){const t=/\x1b\[<(\d+);(\d+);(\d+)([mM])/.exec(e);if(!t)return;if(!t[1]||!t[2]||!t[3]||!t[4])throw new Error(`Mouse event: Invalid match for data ${e}`);const c=parseInt(t[1],10),b=parseInt(t[2],10),E=parseInt(t[3],10),L=t[4]==="m";return console.log(`Mouse event: buttonCode=${c}, column=${b}, row=${E}, isRelease=${L}`),e}function er(e,t){const c=new vi.Terminal({cursorBlink:!1,convertEol:!0,fontSize:13}),b=Zt.macchiato.colors;c.options.theme={background:b.base.hex,black:b.crust.hex,brightBlack:b.surface2.hex,blue:b.blue.hex,brightBlue:b.blue.hex,brightCyan:b.sky.hex,brightRed:b.maroon.hex,brightYellow:b.yellow.hex,cursor:b.text.hex,cyan:b.sky.hex,foreground:b.text.hex,green:b.green.hex,magenta:b.lavender.hex,red:b.red.hex,white:b.text.hex,yellow:b.yellow.hex};const E=new pi.FitAddon;return c.loadAddon(E),c.open(e),E.fit(),window.addEventListener("resize",()=>{E.fit()}),c.onData(L=>{if(typeof L!="string")throw new Error(`unexpected onData message type: '${JSON.stringify(L)}'`);const x=Po(L);x&&t.onMouseEvent(x)}),c.onKey(L=>{t.onKeyPress(L)}),c}function tr(){let e=qn().safeParse(sessionStorage.getItem("tabId")).data;return e||(e=Math.random().toString(36),sessionStorage.setItem("tabId",e)),{tabId:e}}class Mo{constructor(t){se(this,"ready");se(this,"tabId");se(this,"terminal");se(this,"trpc");const c=Nt({links:[Lt({condition:L=>L.type==="subscription",true:jt({url:"/trpc"}),false:zt({url:"/trpc"})})]});this.trpc=c,this.tabId=tr();const b=this.tabId,E=er(t,{onMouseEvent(L){c.neovim.sendStdin.mutate({tabId:b,data:L}).catch(x=>{console.error("Error sending mouse event",x)})},onKeyPress(L){c.neovim.sendStdin.mutate({tabId:b,data:L.key})}});this.terminal=E,this.ready=new Promise(L=>{console.log("Subscribing to stdout"),c.neovim.initializeStdout.subscribe({client:b},{onStarted(){L()},onData(x){E.write(x)},onError(x){console.error("Error from the application",x)}})})}async startNeovim(t){return await this.ready,await this.trpc.neovim.start.mutate({startNeovimArguments:{filename:t.filename,additionalEnvironmentVariables:t.additionalEnvironmentVariables,startupScriptModifications:t.startupScriptModifications,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}},tabId:this.tabId})}async runBlockingShellCommand(t){return await this.ready,this.trpc.neovim.runBlockingShellCommand.mutate({...t,tabId:this.tabId})}async runLuaCode(t){return await this.ready,this.trpc.neovim.runLuaCode.mutate({...t,tabId:this.tabId})}async waitForLuaCode(t){await this.ready;try{return await this.trpc.neovim.waitForLuaCode.mutate({...t,tabId:this.tabId})}catch(c){throw c}}async runExCommand(t){return await this.ready,this.trpc.neovim.runExCommand.mutate({...t,tabId:this.tabId})}}function Io(e,t){e.parser.registerCsiHandler({final:"c"},()=>(t.onKeyPress({key:"\x1B[?1;2c",domEvent:new KeyboardEvent("keydown",{key:"Escape"})}),!0))}class Ho{constructor(t){se(this,"ready");se(this,"tabId");se(this,"terminal");se(this,"trpc");se(this,"terminalApi");const c=Nt({links:[Lt({condition:L=>L.type==="subscription",true:jt({url:"/trpc"}),false:zt({url:"/trpc"})})]});this.trpc=c,this.tabId=tr();const b=this.tabId;this.terminalApi={onMouseEvent(L){c.terminal.sendStdin.mutate({tabId:b,data:L}).catch(x=>{console.error("Error sending mouse event",x)})},onKeyPress(L){c.terminal.sendStdin.mutate({tabId:b,data:L.key})}};const E=er(t,this.terminalApi);this.terminal=E,this.ready=new Promise(L=>{console.log("Subscribing to stdout"),c.terminal.onStdout.subscribe({client:b},{onStarted(){L()},onData(x){E.write(x)},onError(x){console.error("Error from the application",x)}})})}async startTerminalApplication(t){var b,E;return await this.ready,(E=(b=t.browserSettings).configureTerminal)==null||E.call(b,{terminal:this.terminal,api:this.terminalApi,recipes:{supportDA1:()=>{Io(this.terminal,this.terminalApi)}}}),await this.trpc.terminal.start.mutate({tabId:this.tabId,startTerminalArguments:{additionalEnvironmentVariables:t.serverSettings.additionalEnvironmentVariables,commandToRun:t.serverSettings.commandToRun,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}}})}async runBlockingShellCommand(t){return await this.ready,this.trpc.terminal.runBlockingShellCommand.mutate({...t,tabId:this.tabId})}}class rr{constructor(t){se(this,"value");this.factory=t}get(){return this.value===void 0&&(this.value=this.factory()),this.value}}const it=document.querySelector("#app");if(!it)throw new Error("No app element found");const Fo=new rr(()=>new Mo(it)),$o=new rr(()=>new Ho(it));window.startNeovim=async function(e){const t=Fo.get(),c=await t.startNeovim({additionalEnvironmentVariables:e==null?void 0:e.additionalEnvironmentVariables,filename:(e==null?void 0:e.filename)??"initial-file.txt",startupScriptModifications:(e==null?void 0:e.startupScriptModifications)??[]});return{runBlockingShellCommand(E){return t.runBlockingShellCommand(E)},runLuaCode(E){return t.runLuaCode(E)},waitForLuaCode(E){return t.waitForLuaCode(E)},runExCommand(E){return t.runExCommand(E)},dir:c}};window.startTerminalApplication=async function(e){const t=$o.get();return{dir:await t.startTerminalApplication(e),runBlockingShellCommand(E){return t.runBlockingShellCommand(E)}}};