@tui-sandbox/library 7.7.1 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
- var Ar=Object.defineProperty;var Br=(c,e,a)=>e in c?Ar(c,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):c[e]=a;var Ke=(c,e,a)=>Br(c,typeof e!="symbol"?e+"":e,a);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))u(m);new MutationObserver(m=>{for(const y of m)if(y.type==="childList")for(const k of y.addedNodes)k.tagName==="LINK"&&k.rel==="modulepreload"&&u(k)}).observe(document,{childList:!0,subtree:!0});function a(m){const y={};return m.integrity&&(y.integrity=m.integrity),m.referrerPolicy&&(y.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?y.credentials="include":m.crossOrigin==="anonymous"?y.credentials="omit":y.credentials="same-origin",y}function u(m){if(m.ep)return;m.ep=!0;const y=a(m);fetch(m.href,y)}})();function $e(c){const e={subscribe(a){let u=null,m=!1,y=!1,k=!1;function t(){if(u===null){k=!0;return}y||(y=!0,typeof u=="function"?u():u&&u.unsubscribe())}return u=c({next(o){var l;m||(l=a.next)==null||l.call(a,o)},error(o){var l;m||(m=!0,(l=a.error)==null||l.call(a,o),t())},complete(){var o;m||(m=!0,(o=a.complete)==null||o.call(a),t())}}),k&&t(),{unsubscribe:t}},pipe(...a){return a.reduce(Or,e)}};return e}function Or(c,e){return e(c)}function Mr(c){const e=new AbortController;return new Promise((u,m)=>{let y=!1;function k(){y||(y=!0,t.unsubscribe())}e.signal.addEventListener("abort",()=>{m(e.signal.reason)});const t=c.subscribe({next(o){y=!0,u(o),k()},error(o){m(o)},complete(){e.abort(),k()}})})}function Ir(c){return e=>{let a=0,u=null;const m=[];function y(){u||(u=e.subscribe({next(t){var o;for(const l of m)(o=l.next)==null||o.call(l,t)},error(t){var o;for(const l of m)(o=l.error)==null||o.call(l,t)},complete(){var t;for(const o of m)(t=o.complete)==null||t.call(o)}}))}function k(){if(a===0&&u){const t=u;u=null,t.unsubscribe()}}return $e(t=>(a++,m.push(t),y(),{unsubscribe(){a--,k();const o=m.findIndex(l=>l===t);o>-1&&m.splice(o,1)}}))}}function Pr(c){let e=c;const a=[],u=k=>{e!==void 0&&k.next(e),a.push(k)},m=k=>{a.splice(a.indexOf(k),1)},y=$e(k=>(u(k),()=>{m(k)}));return y.next=k=>{if(e!==k){e=k;for(const t of a)t.next(k)}},y.get=()=>e,y}function cr(c){return $e(e=>{function a(m=0,y=c.op){const k=c.links[m];if(!k)throw new Error("No more links to execute - did you forget to add an ending link?");return k({op:y,next(o){return a(m+1,o)}})}return a().subscribe(e)})}const hr=()=>{},qt=c=>{Object.freeze&&Object.freeze(c)};function lr(c,e,a){var u,m;const y=e.join(".");return(u=a)[m=y]??(u[m]=new Proxy(hr,{get(k,t){if(!(typeof t!="string"||t==="then"))return lr(c,[...e,t],a)},apply(k,t,o){const l=e[e.length-1];let _={args:o,path:e};return l==="call"?_={args:o.length>=2?[o[1]]:[],path:e.slice(0,-1)}:l==="apply"&&(_={args:o.length>=2?o[1]:[],path:e.slice(0,-1)}),qt(_.args),qt(_.path),c(_)}})),a[y]}const Hr=c=>lr(c,[],Object.create(null)),Fr=c=>new Proxy(hr,{get(e,a){if(!(typeof a!="string"||a==="then"))return c(a)}}),_t={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNSUPPORTED_MEDIA_TYPE:-32015,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};function Je(c){return!!c&&!Array.isArray(c)&&typeof c=="object"}const dr=c=>c();function pt(c,e,a){return e in c?Object.defineProperty(c,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):c[e]=a,c}var ur;const At=new WeakMap,Nr=()=>{};ur=Symbol.toStringTag;let Wr=ur;class Ee{subscribe(){let e,a;const{settlement:u}=this;if(u===null){if(this.subscribers===null)throw new Error("Unpromise settled but still has subscribers");const m=Ur();this.subscribers=$r(this.subscribers,m),e=m.promise,a=()=>{this.subscribers!==null&&(this.subscribers=qr(this.subscribers,m))}}else{const{status:m}=u;m==="fulfilled"?e=Promise.resolve(u.value):e=Promise.reject(u.reason),a=Nr}return Object.assign(e,{unsubscribe:a})}then(e,a){const u=this.subscribe(),{unsubscribe:m}=u;return Object.assign(u.then(e,a),{unsubscribe:m})}catch(e){const a=this.subscribe(),{unsubscribe:u}=a;return Object.assign(a.catch(e),{unsubscribe:u})}finally(e){const a=this.subscribe(),{unsubscribe:u}=a;return Object.assign(a.finally(e),{unsubscribe:u})}static proxy(e){const a=Ee.getSubscribablePromise(e);return typeof a<"u"?a:Ee.createSubscribablePromise(e)}static createSubscribablePromise(e){const a=new Ee(e);return At.set(e,a),At.set(a,a),a}static getSubscribablePromise(e){return At.get(e)}static resolve(e){const a=typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"?e:Promise.resolve(e);return Ee.proxy(a).subscribe()}static async any(e){const u=(Array.isArray(e)?e:[...e]).map(Ee.resolve);try{return await Promise.any(u)}finally{u.forEach(({unsubscribe:m})=>{m()})}}static async race(e){const u=(Array.isArray(e)?e:[...e]).map(Ee.resolve);try{return await Promise.race(u)}finally{u.forEach(({unsubscribe:m})=>{m()})}}static async raceReferences(e){const a=e.map(jr);try{return await Promise.race(a)}finally{for(const u of a)u.unsubscribe()}}constructor(e){pt(this,"promise",void 0),pt(this,"subscribers",[]),pt(this,"settlement",null),pt(this,Wr,"Unpromise"),typeof e=="function"?this.promise=new Promise(e):this.promise=e;const a=this.promise.then(u=>{const{subscribers:m}=this;this.subscribers=null,this.settlement={status:"fulfilled",value:u},m==null||m.forEach(({resolve:y})=>{y(u)})});"catch"in a&&a.catch(u=>{const{subscribers:m}=this;this.subscribers=null,this.settlement={status:"rejected",reason:u},m==null||m.forEach(({reject:y})=>{y(u)})})}}function jr(c){return Ee.proxy(c).then(()=>[c])}function Ur(){let c,e;return{promise:new Promise((u,m)=>{c=u,e=m}),resolve:c,reject:e}}function $r(c,e){return[...c,e]}function zr(c,e){return[...c.slice(0,e),...c.slice(e+1)]}function qr(c,e){const a=c.indexOf(e);return a!==-1?zr(c,a):c}var Vt,Zt;(Vt=Symbol).dispose??(Vt.dispose=Symbol());(Zt=Symbol).asyncDispose??(Zt.asyncDispose=Symbol());function Vr(c,e){const a=c;if(a[Symbol.dispose])throw new Error("Symbol.dispose already exists");return a[Symbol.dispose]=e,a}function Zr(c,e){const a=c;if(a[Symbol.asyncDispose])throw new Error("Symbol.asyncDispose already exists");return a[Symbol.asyncDispose]=e,a}const fr=Symbol();function Kr(c){let e=null;return Vr({start(){if(e)throw new Error("Timer already started");return new Promise(u=>{e=setTimeout(()=>u(fr),c)})}},()=>{e&&clearTimeout(e)})}function _r(c,e,a){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var u,m;if(a){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");u=e[Symbol.asyncDispose]}if(u===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");u=e[Symbol.dispose],a&&(m=u)}if(typeof u!="function")throw new TypeError("Object not disposable.");m&&(u=function(){try{m.call(this)}catch(y){return Promise.reject(y)}}),c.stack.push({value:e,dispose:u,async:a})}else a&&c.stack.push({async:!0});return e}function Ut(c){var e=typeof SuppressedError=="function"?SuppressedError:function(a,u,m){var y=new Error(m);return y.name="SuppressedError",y.error=a,y.suppressed=u,y};return(Ut=function(u){function m(o){u.error=u.hasError?new e(o,u.error,"An error was suppressed during disposal."):o,u.hasError=!0}var y,k=0;function t(){for(;y=u.stack.pop();)try{if(!y.async&&k===1)return k=0,u.stack.push(y),Promise.resolve().then(t);if(y.dispose){var o=y.dispose.call(y.value);if(y.async)return k|=2,Promise.resolve(o).then(t,function(l){return m(l),t()})}else k|=1}catch(l){m(l)}if(k===1)return u.hasError?Promise.reject(u.error):Promise.resolve();if(u.hasError)throw u.error}return t()})(c)}const Gr="ping",Yr="serialized-error",Jr="connected";async function Xr(c){const e={stack:[],error:void 0,hasError:!1};try{const a=_r(e,Kr(c.timeoutMs),!1),u=await Ee.race([c.promise,a.start()]);return u===fr?await c.onTimeout():u}catch(a){e.error=a,e.hasError=!0}finally{Ut(e)}}function Qr(c){const{deserialize:e=t=>t}=c;let a={};const u=c.signal;let m=null;const y=()=>new ReadableStream({async start(t){const[o,l]=await Promise.all([c.url(),c.init()]),_=m=new c.EventSource(o,l);t.enqueue({type:"connecting",eventSource:m,event:null}),_.addEventListener(Jr,p=>{const C=JSON.parse(p.data);a=C,t.enqueue({type:"connected",options:C,eventSource:_})}),_.addEventListener(Yr,p=>{const v=p;t.enqueue({type:"serialized-error",error:e(JSON.parse(v.data)),eventSource:_})}),_.addEventListener(Gr,()=>{t.enqueue({type:"ping",eventSource:_})}),_.addEventListener("error",p=>{_.readyState===EventSource.CLOSED?t.error(p):t.enqueue({type:"connecting",eventSource:_,event:p})}),_.addEventListener("message",p=>{const v=p,f={data:e(JSON.parse(v.data))};v.lastEventId&&(f.id=v.lastEventId),t.enqueue({type:"data",data:f,eventSource:_})});const h=()=>{try{_.close(),t.close()}catch{}};u.aborted?h():u.addEventListener("abort",h)},cancel(){m==null||m.close()}}),k=()=>{let t=y(),o=t.getReader();async function l(){await o.cancel(),m=null}return Zr({read(){return o.read()},async recreate(){await l(),t=y(),o=t.getReader()}},l)};return dr(async function*(){const t={stack:[],error:void 0,hasError:!1};try{const o=_r(t,k(),!0);for(;;){let l=o.read();const _=a.reconnectAfterInactivityMs;_&&(l=Xr({promise:l,timeoutMs:_,onTimeout:async()=>{const p={value:{type:"timeout",ms:_,eventSource:m},done:!1};return await o.recreate(),p}}));const h=await l;if(h.done)return h.value;yield h.value}}catch(o){t.error=o,t.hasError=!0}finally{const o=Ut(t);o&&await o}})}function es(c,e){if("error"in c){const u=e.deserialize(c.error);return{ok:!1,error:{...c,error:u}}}return{ok:!0,result:{...c.result,...(!c.result.type||c.result.type==="data")&&{type:"data",data:e.deserialize(c.result.data)}}}}class Bt extends Error{constructor(){super("Unable to transform response from server")}}function ts(c,e){let a;try{a=es(c,e)}catch{throw new Bt}if(!a.ok&&(!Je(a.error.error)||typeof a.error.error.code!="number"))throw new Bt;if(a.ok&&!Je(a.result))throw new Bt;return a}var rr,sr,ir,nr,or,ar;typeof window>"u"||"Deno"in window||((sr=(rr=globalThis.process)==null?void 0:rr.env)==null?void 0:sr.NODE_ENV)==="test"||(nr=(ir=globalThis.process)==null?void 0:ir.env)!=null&&nr.JEST_WORKER_ID||(ar=(or=globalThis.process)==null?void 0:or.env)!=null&&ar.VITEST_WORKER_ID;function gt(c,e,a){return e in c?Object.defineProperty(c,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):c[e]=a,c}function rs(c){return c instanceof pe||c instanceof Error&&c.name==="TRPCClientError"}function ss(c){return Je(c)&&Je(c.error)&&typeof c.error.code=="number"&&typeof c.error.message=="string"}function is(c,e){return typeof c=="string"?c:Je(c)&&typeof c.message=="string"?c.message:e}class pe extends Error{static from(e,a={}){const u=e;return rs(u)?(a.meta&&(u.meta={...u.meta,...a.meta}),u):ss(u)?new pe(u.error.message,{...a,result:u}):new pe(is(u,"Unknown error"),{...a,cause:u})}constructor(e,a){var m,y;const u=a==null?void 0:a.cause;super(e,{cause:u}),gt(this,"cause",void 0),gt(this,"shape",void 0),gt(this,"data",void 0),gt(this,"meta",void 0),this.meta=a==null?void 0:a.meta,this.cause=u,this.shape=(m=a==null?void 0:a.result)==null?void 0:m.error,this.data=(y=a==null?void 0:a.result)==null?void 0:y.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,pe.prototype)}}function Ot(c,e,a){return e in c?Object.defineProperty(c,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):c[e]=a,c}class ns{$request(e){return cr({links:this.links,op:{...e,context:e.context??{},id:++this.requestId}}).pipe(Ir())}async requestAsPromise(e){try{const a=this.$request(e);return(await Mr(a)).result.data}catch(a){throw pe.from(a)}}query(e,a,u){return this.requestAsPromise({type:"query",path:e,input:a,context:u==null?void 0:u.context,signal:u==null?void 0:u.signal})}mutation(e,a,u){return this.requestAsPromise({type:"mutation",path:e,input:a,context:u==null?void 0:u.context,signal:u==null?void 0:u.signal})}subscription(e,a,u){return this.$request({type:"subscription",path:e,input:a,context:u.context,signal:u.signal}).subscribe({next(y){var k,t,o,l;switch(y.result.type){case"state":{(k=u.onConnectionStateChange)==null||k.call(u,y.result);break}case"started":{(t=u.onStarted)==null||t.call(u,{context:y.context});break}case"stopped":{(o=u.onStopped)==null||o.call(u);break}case"data":case void 0:{(l=u.onData)==null||l.call(u,y.result.data);break}}},error(y){var k;(k=u.onError)==null||k.call(u,y)},complete(){var y;(y=u.onComplete)==null||y.call(u)}})}constructor(e){Ot(this,"links",void 0),Ot(this,"runtime",void 0),Ot(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(a=>a(this.runtime))}}const os={query:"query",mutate:"mutation",subscribe:"subscription"},as=c=>os[c];function cs(c){const e=Hr(({path:a,args:u})=>{const m=[...a],y=as(m.pop()),k=m.join(".");return c[y](k,...u)});return Fr(a=>c.hasOwnProperty(a)?c[a]:a==="__untypedClient"?c:e[a])}function hs(c){const e=new ns(c);return cs(e)}const Kt=c=>typeof c=="function";function ls(c){if(c)return c;if(typeof window<"u"&&Kt(window.fetch))return window.fetch;if(typeof globalThis<"u"&&Kt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}const Gt=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Yt(c){let e=null,a=null;const u=()=>{clearTimeout(a),a=null,e=null};function m(t){var _,h;const o=[[]];let l=0;for(;;){const p=t[l];if(!p)break;const v=o[o.length-1];if(p.aborted){(_=p.reject)==null||_.call(p,new Error("Aborted")),l++;continue}if(c.validate(v.concat(p).map(f=>f.key))){v.push(p),l++;continue}if(v.length===0){(h=p.reject)==null||h.call(p,new Error("Input is too big for a single dispatch")),l++;continue}o.push([])}return o}function y(){const t=m(e);u();for(const o of t){if(!o.length)continue;const l={items:o};for(const h of o)h.batch=l;c.fetch(l.items.map(h=>h.key)).then(async h=>{var p;await Promise.all(h.map(async(v,C)=>{var i,n;const f=l.items[C];try{const r=await Promise.resolve(v);(i=f.resolve)==null||i.call(f,r)}catch(r){(n=f.reject)==null||n.call(f,r)}f.batch=null,f.reject=null,f.resolve=null}));for(const v of l.items)(p=v.reject)==null||p.call(v,new Error("Missing result")),v.batch=null}).catch(h=>{var p;for(const v of l.items)(p=v.reject)==null||p.call(v,h),v.batch=null})}}function k(t){const o={aborted:!1,key:t,batch:null,resolve:Gt,reject:Gt},l=new Promise((_,h)=>{o.reject=h,o.resolve=_,e||(e=[]),e.push(o)});return a||(a=setTimeout(y)),l}return{load:k}}function ds(...c){const e=new AbortController,a=c.length;let u=0;const m=()=>{++u===a&&e.abort()};for(const y of c)y!=null&&y.aborted?m():y==null||y.addEventListener("abort",m,{once:!0});return e.signal}function us(...c){const e=new AbortController;for(const a of c)a!=null&&a.aborted?e.abort():a==null||a.addEventListener("abort",()=>e.abort(),{once:!0});return e.signal}function pr(c){const e=c;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:a=>a,deserialize:a=>a},output:{serialize:a=>a,deserialize:a=>a}}}function fs(c){return{url:c.url.toString(),fetch:c.fetch,transformer:pr(c.transformer),methodOverride:c.methodOverride}}function _s(c){const e={};for(let a=0;a<c.length;a++){const u=c[a];e[a]=u}return e}const ps={query:"GET",mutation:"POST",subscription:"PATCH"};function gr(c){return"input"in c?c.transformer.input.serialize(c.input):_s(c.inputs.map(e=>c.transformer.input.serialize(e)))}const $t=c=>{const e=c.url.split("?");let u=e[0].replace(/\/$/,"")+"/"+c.path;const m=[];if(e[1]&&m.push(e[1]),"inputs"in c&&m.push("batch=1"),c.type==="query"||c.type==="subscription"){const y=gr(c);y!==void 0&&c.methodOverride!=="POST"&&m.push(`input=${encodeURIComponent(JSON.stringify(y))}`)}return m.length&&(u+="?"+m.join("&")),u},gs=c=>{if(c.type==="query"&&c.methodOverride!=="POST")return;const e=gr(c);return e!==void 0?JSON.stringify(e):void 0},vs=c=>ys({...c,contentTypeHeader:"application/json",getUrl:$t,getBody:gs});class ms extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}}const bs=c=>{var e;if(c!=null&&c.aborted)throw(e=c.throwIfAborted)==null||e.call(c),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new ms};async function Ss(c){bs(c.signal);const e=c.getUrl(c),a=c.getBody(c),{type:u}=c,m=await(async()=>{const k=await c.headers();return Symbol.iterator in k?Object.fromEntries(k):k})(),y={...c.contentTypeHeader?{"content-type":c.contentTypeHeader}:{},...c.trpcAcceptHeader?{"trpc-accept":c.trpcAcceptHeader}:void 0,...m};return ls(c.fetch)(e,{method:c.methodOverride??ps[u],signal:c.signal,body:a,headers:y})}async function ys(c){const e={},a=await Ss(c);e.response=a;const u=await a.json();return e.responseJSON=u,{json:u,meta:e}}function Cs(c){const e=fs(c),a=c.maxURLLength??1/0;return()=>{const u=t=>({validate(o){if(a===1/0)return!0;const l=o.map(p=>p.path).join(","),_=o.map(p=>p.input);return $t({...e,type:t,path:l,inputs:_,signal:null}).length<=a},async fetch(o){const l=o.map(f=>f.path).join(","),_=o.map(f=>f.input),h=ds(...o.map(f=>f.signal)),p=await vs({...e,path:l,inputs:_,type:t,headers(){return c.headers?typeof c.headers=="function"?c.headers({opList:o}):c.headers:{}},signal:h});return(Array.isArray(p.json)?p.json:o.map(()=>p.json)).map(f=>({meta:p.meta,json:f}))}}),m=Yt(u("query")),y=Yt(u("mutation")),k={query:m,mutation:y};return({op:t})=>$e(o=>{/* istanbul ignore if -- @preserve */if(t.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const _=k[t.type].load(t);let h;return _.then(p=>{h=p;const v=ts(p.json,e.transformer.output);if(!v.ok){o.error(pe.from(v.error,{meta:p.meta}));return}o.next({context:p.meta,result:v.result}),o.complete()}).catch(p=>{o.error(pe.from(p,{meta:h==null?void 0:h.meta}))}),()=>{}})}}function Jt(c){return Array.isArray(c)?c:[c]}function ws(c){return e=>{const a=Jt(c.true).map(m=>m(e)),u=Jt(c.false).map(m=>m(e));return m=>$e(y=>{const k=c.condition(m.op)?a:u;return cr({op:m.op,links:k}).subscribe(y)})}}const Ht=(c,...e)=>typeof c=="function"?c(...e):c;function Es(c,e){return!e||c!=null&&typeof c!="object"?c:{...c??{},lastEventId:e}}async function xs(c){let e=await Ht(c.url);if(c.connectionParams){const a=await Ht(c.connectionParams),u=e.includes("?")?"&":"?";e+=u+"connectionParams="+encodeURIComponent(JSON.stringify(a))}return e}const ks=[_t.BAD_GATEWAY,_t.SERVICE_UNAVAILABLE,_t.GATEWAY_TIMEOUT,_t.INTERNAL_SERVER_ERROR];function Rs(c){const e=pr(c.transformer);return()=>({op:a})=>$e(u=>{const{type:m,path:y,input:k}=a;/* istanbul ignore if -- @preserve */if(m!=="subscription")throw new Error("httpSubscriptionLink only supports subscriptions");let t;const o=new AbortController,l=us(a.signal,o.signal),_=Qr({url:async()=>$t({transformer:e,url:await xs(c),input:Es(k,t),path:y,type:m,signal:null}),init:()=>Ht(c.eventSourceOptions,{op:a}),signal:l,deserialize:e.output.deserialize,EventSource:c.EventSource??globalThis.EventSource}),h=Pr({type:"state",state:"connecting",error:null}),p=h.subscribe({next(v){u.next({result:v})}});return dr(async()=>{for await(const v of _)switch(v.type){case"ping":break;case"data":const C=v.data;let f;C.id?(t=C.id,f={id:C.id,data:C}):f={data:C.data},u.next({result:f,context:{eventSource:v.eventSource}});break;case"connected":{u.next({result:{type:"started"},context:{eventSource:v.eventSource}}),h.next({type:"state",state:"pending",error:null});break}case"serialized-error":{const i=pe.from({error:v.error});if(ks.includes(v.error.code)){h.next({type:"state",state:"connecting",error:i});break}throw i}case"connecting":{const i=h.get(),n=v.event&&pe.from(v.event);if(!n&&i.state==="connecting")break;h.next({type:"state",state:"connecting",error:n});break}case"timeout":h.next({type:"state",state:"connecting",error:new pe(`Timeout of ${v.ms}ms reached while waiting for a response`)})}u.next({result:{type:"stopped"}}),u.complete()}).catch(v=>{u.error(pe.from(v))}),()=>{u.complete(),o.abort(),p.unsubscribe()}})}const Ls={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}}}}},vt=c=>Object.entries(c),{version:Ki,...Ds}=Ls,vr=vt(Ds).reduce((c,[e,a])=>(c[e]={...a,colorEntries:vt(a.colors),ansiColorEntries:vt(a.ansiColors)},c),{});vt(vr);var Mt={exports:{}},Xt;function Ts(){return Xt||(Xt=1,function(c,e){(function(a,u){c.exports=u()})(self,()=>(()=>{var a={};return(()=>{var u=a;Object.defineProperty(u,"__esModule",{value:!0}),u.FitAddon=void 0,u.FitAddon=class{activate(m){this._terminal=m}dispose(){}fit(){const m=this.proposeDimensions();if(!m||!this._terminal||isNaN(m.cols)||isNaN(m.rows))return;const y=this._terminal._core;this._terminal.rows===m.rows&&this._terminal.cols===m.cols||(y._renderService.clear(),this._terminal.resize(m.cols,m.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const m=this._terminal._core,y=m._renderService.dimensions;if(y.css.cell.width===0||y.css.cell.height===0)return;const k=this._terminal.options.scrollback===0?0:m.viewport.scrollBarWidth,t=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(t.getPropertyValue("height")),l=Math.max(0,parseInt(t.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),h=o-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),p=l-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-k;return{cols:Math.max(2,Math.floor(p/y.css.cell.width)),rows:Math.max(1,Math.floor(h/y.css.cell.height))}}}})(),a})())}(Mt)),Mt.exports}var As=Ts(),It={exports:{}},Qt;function Bs(){return Qt||(Qt=1,function(c,e){(function(a,u){c.exports=u()})(globalThis,()=>(()=>{var a={4567:function(k,t,o){var l=this&&this.__decorate||function(r,s,d,S){var b,w=arguments.length,g=w<3?s:S===null?S=Object.getOwnPropertyDescriptor(s,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,s,d,S);else for(var E=r.length-1;E>=0;E--)(b=r[E])&&(g=(w<3?b(g):w>3?b(s,d,g):b(s,d))||g);return w>3&&g&&Object.defineProperty(s,d,g),g},_=this&&this.__param||function(r,s){return function(d,S){s(d,S,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const h=o(9042),p=o(9924),v=o(844),C=o(4725),f=o(2585),i=o(3656);let n=t.AccessibilityManager=class extends v.Disposable{constructor(r,s,d,S){super(),this._terminal=r,this._coreBrowserService=d,this._renderService=S,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 b=0;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);if(this._topBoundaryFocusListener=b=>this._handleBoundaryFocus(b,0),this._bottomBoundaryFocusListener=b=>this._handleBoundaryFocus(b,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 p.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(b=>this._handleResize(b.rows))),this.register(this._terminal.onRender(b=>this._refreshRows(b.start,b.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(b=>this._handleChar(b))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
1
+ var Ar=Object.defineProperty;var Br=(h,e,a)=>e in h?Ar(h,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):h[e]=a;var Ke=(h,e,a)=>Br(h,typeof e!="symbol"?e+"":e,a);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const m of document.querySelectorAll('link[rel="modulepreload"]'))u(m);new MutationObserver(m=>{for(const y of m)if(y.type==="childList")for(const k of y.addedNodes)k.tagName==="LINK"&&k.rel==="modulepreload"&&u(k)}).observe(document,{childList:!0,subtree:!0});function a(m){const y={};return m.integrity&&(y.integrity=m.integrity),m.referrerPolicy&&(y.referrerPolicy=m.referrerPolicy),m.crossOrigin==="use-credentials"?y.credentials="include":m.crossOrigin==="anonymous"?y.credentials="omit":y.credentials="same-origin",y}function u(m){if(m.ep)return;m.ep=!0;const y=a(m);fetch(m.href,y)}})();function $e(h){const e={subscribe(a){let u=null,m=!1,y=!1,k=!1;function t(){if(u===null){k=!0;return}y||(y=!0,typeof u=="function"?u():u&&u.unsubscribe())}return u=h({next(o){var l;m||(l=a.next)==null||l.call(a,o)},error(o){var l;m||(m=!0,(l=a.error)==null||l.call(a,o),t())},complete(){var o;m||(m=!0,(o=a.complete)==null||o.call(a),t())}}),k&&t(),{unsubscribe:t}},pipe(...a){return a.reduce(Or,e)}};return e}function Or(h,e){return e(h)}function Mr(h){const e=new AbortController;return new Promise((u,m)=>{let y=!1;function k(){y||(y=!0,t.unsubscribe())}e.signal.addEventListener("abort",()=>{m(e.signal.reason)});const t=h.subscribe({next(o){y=!0,u(o),k()},error(o){m(o)},complete(){e.abort(),k()}})})}function Ir(h){return e=>{let a=0,u=null;const m=[];function y(){u||(u=e.subscribe({next(t){var o;for(const l of m)(o=l.next)==null||o.call(l,t)},error(t){var o;for(const l of m)(o=l.error)==null||o.call(l,t)},complete(){var t;for(const o of m)(t=o.complete)==null||t.call(o)}}))}function k(){if(a===0&&u){const t=u;u=null,t.unsubscribe()}}return $e(t=>(a++,m.push(t),y(),{unsubscribe(){a--,k();const o=m.findIndex(l=>l===t);o>-1&&m.splice(o,1)}}))}}function Pr(h){let e=h;const a=[],u=k=>{e!==void 0&&k.next(e),a.push(k)},m=k=>{a.splice(a.indexOf(k),1)},y=$e(k=>(u(k),()=>{m(k)}));return y.next=k=>{if(e!==k){e=k;for(const t of a)t.next(k)}},y.get=()=>e,y}function cr(h){return $e(e=>{function a(m=0,y=h.op){const k=h.links[m];if(!k)throw new Error("No more links to execute - did you forget to add an ending link?");return k({op:y,next(o){return a(m+1,o)}})}return a().subscribe(e)})}const hr=()=>{},qt=h=>{Object.freeze&&Object.freeze(h)};function lr(h,e,a){var u,m;const y=e.join(".");return(u=a)[m=y]??(u[m]=new Proxy(hr,{get(k,t){if(!(typeof t!="string"||t==="then"))return lr(h,[...e,t],a)},apply(k,t,o){const l=e[e.length-1];let _={args:o,path:e};return l==="call"?_={args:o.length>=2?[o[1]]:[],path:e.slice(0,-1)}:l==="apply"&&(_={args:o.length>=2?o[1]:[],path:e.slice(0,-1)}),qt(_.args),qt(_.path),h(_)}})),a[y]}const Hr=h=>lr(h,[],Object.create(null)),Fr=h=>new Proxy(hr,{get(e,a){if(!(typeof a!="string"||a==="then"))return h(a)}}),_t={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,BAD_GATEWAY:-32603,SERVICE_UNAVAILABLE:-32603,GATEWAY_TIMEOUT:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNSUPPORTED_MEDIA_TYPE:-32015,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};function Je(h){return!!h&&!Array.isArray(h)&&typeof h=="object"}const dr=h=>h();function pt(h,e,a){return e in h?Object.defineProperty(h,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):h[e]=a,h}var ur;const At=new WeakMap,Nr=()=>{};ur=Symbol.toStringTag;let Wr=ur;class Ee{subscribe(){let e,a;const{settlement:u}=this;if(u===null){if(this.subscribers===null)throw new Error("Unpromise settled but still has subscribers");const m=Ur();this.subscribers=$r(this.subscribers,m),e=m.promise,a=()=>{this.subscribers!==null&&(this.subscribers=qr(this.subscribers,m))}}else{const{status:m}=u;m==="fulfilled"?e=Promise.resolve(u.value):e=Promise.reject(u.reason),a=Nr}return Object.assign(e,{unsubscribe:a})}then(e,a){const u=this.subscribe(),{unsubscribe:m}=u;return Object.assign(u.then(e,a),{unsubscribe:m})}catch(e){const a=this.subscribe(),{unsubscribe:u}=a;return Object.assign(a.catch(e),{unsubscribe:u})}finally(e){const a=this.subscribe(),{unsubscribe:u}=a;return Object.assign(a.finally(e),{unsubscribe:u})}static proxy(e){const a=Ee.getSubscribablePromise(e);return typeof a<"u"?a:Ee.createSubscribablePromise(e)}static createSubscribablePromise(e){const a=new Ee(e);return At.set(e,a),At.set(a,a),a}static getSubscribablePromise(e){return At.get(e)}static resolve(e){const a=typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"?e:Promise.resolve(e);return Ee.proxy(a).subscribe()}static async any(e){const u=(Array.isArray(e)?e:[...e]).map(Ee.resolve);try{return await Promise.any(u)}finally{u.forEach(({unsubscribe:m})=>{m()})}}static async race(e){const u=(Array.isArray(e)?e:[...e]).map(Ee.resolve);try{return await Promise.race(u)}finally{u.forEach(({unsubscribe:m})=>{m()})}}static async raceReferences(e){const a=e.map(jr);try{return await Promise.race(a)}finally{for(const u of a)u.unsubscribe()}}constructor(e){pt(this,"promise",void 0),pt(this,"subscribers",[]),pt(this,"settlement",null),pt(this,Wr,"Unpromise"),typeof e=="function"?this.promise=new Promise(e):this.promise=e;const a=this.promise.then(u=>{const{subscribers:m}=this;this.subscribers=null,this.settlement={status:"fulfilled",value:u},m==null||m.forEach(({resolve:y})=>{y(u)})});"catch"in a&&a.catch(u=>{const{subscribers:m}=this;this.subscribers=null,this.settlement={status:"rejected",reason:u},m==null||m.forEach(({reject:y})=>{y(u)})})}}function jr(h){return Ee.proxy(h).then(()=>[h])}function Ur(){let h,e;return{promise:new Promise((u,m)=>{h=u,e=m}),resolve:h,reject:e}}function $r(h,e){return[...h,e]}function zr(h,e){return[...h.slice(0,e),...h.slice(e+1)]}function qr(h,e){const a=h.indexOf(e);return a!==-1?zr(h,a):h}var Vt,Zt;(Vt=Symbol).dispose??(Vt.dispose=Symbol());(Zt=Symbol).asyncDispose??(Zt.asyncDispose=Symbol());function Vr(h,e){const a=h;if(a[Symbol.dispose])throw new Error("Symbol.dispose already exists");return a[Symbol.dispose]=e,a}function Zr(h,e){const a=h;if(a[Symbol.asyncDispose])throw new Error("Symbol.asyncDispose already exists");return a[Symbol.asyncDispose]=e,a}const fr=Symbol();function Kr(h){let e=null;return Vr({start(){if(e)throw new Error("Timer already started");return new Promise(u=>{e=setTimeout(()=>u(fr),h)})}},()=>{e&&clearTimeout(e)})}function _r(h,e,a){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var u,m;if(a){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");u=e[Symbol.asyncDispose]}if(u===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");u=e[Symbol.dispose],a&&(m=u)}if(typeof u!="function")throw new TypeError("Object not disposable.");m&&(u=function(){try{m.call(this)}catch(y){return Promise.reject(y)}}),h.stack.push({value:e,dispose:u,async:a})}else a&&h.stack.push({async:!0});return e}function Ut(h){var e=typeof SuppressedError=="function"?SuppressedError:function(a,u,m){var y=new Error(m);return y.name="SuppressedError",y.error=a,y.suppressed=u,y};return(Ut=function(u){function m(o){u.error=u.hasError?new e(o,u.error,"An error was suppressed during disposal."):o,u.hasError=!0}var y,k=0;function t(){for(;y=u.stack.pop();)try{if(!y.async&&k===1)return k=0,u.stack.push(y),Promise.resolve().then(t);if(y.dispose){var o=y.dispose.call(y.value);if(y.async)return k|=2,Promise.resolve(o).then(t,function(l){return m(l),t()})}else k|=1}catch(l){m(l)}if(k===1)return u.hasError?Promise.reject(u.error):Promise.resolve();if(u.hasError)throw u.error}return t()})(h)}const Gr="ping",Yr="serialized-error",Jr="connected";async function Xr(h){const e={stack:[],error:void 0,hasError:!1};try{const a=_r(e,Kr(h.timeoutMs),!1),u=await Ee.race([h.promise,a.start()]);return u===fr?await h.onTimeout():u}catch(a){e.error=a,e.hasError=!0}finally{Ut(e)}}function Qr(h){const{deserialize:e=t=>t}=h;let a={};const u=h.signal;let m=null;const y=()=>new ReadableStream({async start(t){const[o,l]=await Promise.all([h.url(),h.init()]),_=m=new h.EventSource(o,l);t.enqueue({type:"connecting",eventSource:m,event:null}),_.addEventListener(Jr,p=>{const C=JSON.parse(p.data);a=C,t.enqueue({type:"connected",options:C,eventSource:_})}),_.addEventListener(Yr,p=>{const v=p;t.enqueue({type:"serialized-error",error:e(JSON.parse(v.data)),eventSource:_})}),_.addEventListener(Gr,()=>{t.enqueue({type:"ping",eventSource:_})}),_.addEventListener("error",p=>{_.readyState===EventSource.CLOSED?t.error(p):t.enqueue({type:"connecting",eventSource:_,event:p})}),_.addEventListener("message",p=>{const v=p,f={data:e(JSON.parse(v.data))};v.lastEventId&&(f.id=v.lastEventId),t.enqueue({type:"data",data:f,eventSource:_})});const c=()=>{try{_.close(),t.close()}catch{}};u.aborted?c():u.addEventListener("abort",c)},cancel(){m==null||m.close()}}),k=()=>{let t=y(),o=t.getReader();async function l(){await o.cancel(),m=null}return Zr({read(){return o.read()},async recreate(){await l(),t=y(),o=t.getReader()}},l)};return dr(async function*(){const t={stack:[],error:void 0,hasError:!1};try{const o=_r(t,k(),!0);for(;;){let l=o.read();const _=a.reconnectAfterInactivityMs;_&&(l=Xr({promise:l,timeoutMs:_,onTimeout:async()=>{const p={value:{type:"timeout",ms:_,eventSource:m},done:!1};return await o.recreate(),p}}));const c=await l;if(c.done)return c.value;yield c.value}}catch(o){t.error=o,t.hasError=!0}finally{const o=Ut(t);o&&await o}})}function es(h,e){if("error"in h){const u=e.deserialize(h.error);return{ok:!1,error:{...h,error:u}}}return{ok:!0,result:{...h.result,...(!h.result.type||h.result.type==="data")&&{type:"data",data:e.deserialize(h.result.data)}}}}class Bt extends Error{constructor(){super("Unable to transform response from server")}}function ts(h,e){let a;try{a=es(h,e)}catch{throw new Bt}if(!a.ok&&(!Je(a.error.error)||typeof a.error.error.code!="number"))throw new Bt;if(a.ok&&!Je(a.result))throw new Bt;return a}var rr,sr,ir,nr,or,ar;typeof window>"u"||"Deno"in window||((sr=(rr=globalThis.process)==null?void 0:rr.env)==null?void 0:sr.NODE_ENV)==="test"||(nr=(ir=globalThis.process)==null?void 0:ir.env)!=null&&nr.JEST_WORKER_ID||(ar=(or=globalThis.process)==null?void 0:or.env)!=null&&ar.VITEST_WORKER_ID;function gt(h,e,a){return e in h?Object.defineProperty(h,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):h[e]=a,h}function rs(h){return h instanceof pe||h instanceof Error&&h.name==="TRPCClientError"}function ss(h){return Je(h)&&Je(h.error)&&typeof h.error.code=="number"&&typeof h.error.message=="string"}function is(h,e){return typeof h=="string"?h:Je(h)&&typeof h.message=="string"?h.message:e}class pe extends Error{static from(e,a={}){const u=e;return rs(u)?(a.meta&&(u.meta={...u.meta,...a.meta}),u):ss(u)?new pe(u.error.message,{...a,result:u}):new pe(is(u,"Unknown error"),{...a,cause:u})}constructor(e,a){var m,y;const u=a==null?void 0:a.cause;super(e,{cause:u}),gt(this,"cause",void 0),gt(this,"shape",void 0),gt(this,"data",void 0),gt(this,"meta",void 0),this.meta=a==null?void 0:a.meta,this.cause=u,this.shape=(m=a==null?void 0:a.result)==null?void 0:m.error,this.data=(y=a==null?void 0:a.result)==null?void 0:y.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,pe.prototype)}}function Ot(h,e,a){return e in h?Object.defineProperty(h,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):h[e]=a,h}class ns{$request(e){return cr({links:this.links,op:{...e,context:e.context??{},id:++this.requestId}}).pipe(Ir())}async requestAsPromise(e){try{const a=this.$request(e);return(await Mr(a)).result.data}catch(a){throw pe.from(a)}}query(e,a,u){return this.requestAsPromise({type:"query",path:e,input:a,context:u==null?void 0:u.context,signal:u==null?void 0:u.signal})}mutation(e,a,u){return this.requestAsPromise({type:"mutation",path:e,input:a,context:u==null?void 0:u.context,signal:u==null?void 0:u.signal})}subscription(e,a,u){return this.$request({type:"subscription",path:e,input:a,context:u.context,signal:u.signal}).subscribe({next(y){var k,t,o,l;switch(y.result.type){case"state":{(k=u.onConnectionStateChange)==null||k.call(u,y.result);break}case"started":{(t=u.onStarted)==null||t.call(u,{context:y.context});break}case"stopped":{(o=u.onStopped)==null||o.call(u);break}case"data":case void 0:{(l=u.onData)==null||l.call(u,y.result.data);break}}},error(y){var k;(k=u.onError)==null||k.call(u,y)},complete(){var y;(y=u.onComplete)==null||y.call(u)}})}constructor(e){Ot(this,"links",void 0),Ot(this,"runtime",void 0),Ot(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(a=>a(this.runtime))}}const os={query:"query",mutate:"mutation",subscribe:"subscription"},as=h=>os[h];function cs(h){const e=Hr(({path:a,args:u})=>{const m=[...a],y=as(m.pop()),k=m.join(".");return h[y](k,...u)});return Fr(a=>h.hasOwnProperty(a)?h[a]:a==="__untypedClient"?h:e[a])}function hs(h){const e=new ns(h);return cs(e)}const Kt=h=>typeof h=="function";function ls(h){if(h)return h;if(typeof window<"u"&&Kt(window.fetch))return window.fetch;if(typeof globalThis<"u"&&Kt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}const Gt=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Yt(h){let e=null,a=null;const u=()=>{clearTimeout(a),a=null,e=null};function m(t){var _,c;const o=[[]];let l=0;for(;;){const p=t[l];if(!p)break;const v=o[o.length-1];if(p.aborted){(_=p.reject)==null||_.call(p,new Error("Aborted")),l++;continue}if(h.validate(v.concat(p).map(f=>f.key))){v.push(p),l++;continue}if(v.length===0){(c=p.reject)==null||c.call(p,new Error("Input is too big for a single dispatch")),l++;continue}o.push([])}return o}function y(){const t=m(e);u();for(const o of t){if(!o.length)continue;const l={items:o};for(const c of o)c.batch=l;h.fetch(l.items.map(c=>c.key)).then(async c=>{var p;await Promise.all(c.map(async(v,C)=>{var i,n;const f=l.items[C];try{const r=await Promise.resolve(v);(i=f.resolve)==null||i.call(f,r)}catch(r){(n=f.reject)==null||n.call(f,r)}f.batch=null,f.reject=null,f.resolve=null}));for(const v of l.items)(p=v.reject)==null||p.call(v,new Error("Missing result")),v.batch=null}).catch(c=>{var p;for(const v of l.items)(p=v.reject)==null||p.call(v,c),v.batch=null})}}function k(t){const o={aborted:!1,key:t,batch:null,resolve:Gt,reject:Gt},l=new Promise((_,c)=>{o.reject=c,o.resolve=_,e||(e=[]),e.push(o)});return a||(a=setTimeout(y)),l}return{load:k}}function ds(...h){const e=new AbortController,a=h.length;let u=0;const m=()=>{++u===a&&e.abort()};for(const y of h)y!=null&&y.aborted?m():y==null||y.addEventListener("abort",m,{once:!0});return e.signal}function us(...h){const e=new AbortController;for(const a of h)a!=null&&a.aborted?e.abort():a==null||a.addEventListener("abort",()=>e.abort(),{once:!0});return e.signal}function pr(h){const e=h;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:a=>a,deserialize:a=>a},output:{serialize:a=>a,deserialize:a=>a}}}function fs(h){return{url:h.url.toString(),fetch:h.fetch,transformer:pr(h.transformer),methodOverride:h.methodOverride}}function _s(h){const e={};for(let a=0;a<h.length;a++){const u=h[a];e[a]=u}return e}const ps={query:"GET",mutation:"POST",subscription:"PATCH"};function gr(h){return"input"in h?h.transformer.input.serialize(h.input):_s(h.inputs.map(e=>h.transformer.input.serialize(e)))}const $t=h=>{const e=h.url.split("?");let u=e[0].replace(/\/$/,"")+"/"+h.path;const m=[];if(e[1]&&m.push(e[1]),"inputs"in h&&m.push("batch=1"),h.type==="query"||h.type==="subscription"){const y=gr(h);y!==void 0&&h.methodOverride!=="POST"&&m.push(`input=${encodeURIComponent(JSON.stringify(y))}`)}return m.length&&(u+="?"+m.join("&")),u},gs=h=>{if(h.type==="query"&&h.methodOverride!=="POST")return;const e=gr(h);return e!==void 0?JSON.stringify(e):void 0},vs=h=>ys({...h,contentTypeHeader:"application/json",getUrl:$t,getBody:gs});class ms extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}}const bs=h=>{var e;if(h!=null&&h.aborted)throw(e=h.throwIfAborted)==null||e.call(h),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new ms};async function Ss(h){bs(h.signal);const e=h.getUrl(h),a=h.getBody(h),{type:u}=h,m=await(async()=>{const k=await h.headers();return Symbol.iterator in k?Object.fromEntries(k):k})(),y={...h.contentTypeHeader?{"content-type":h.contentTypeHeader}:{},...h.trpcAcceptHeader?{"trpc-accept":h.trpcAcceptHeader}:void 0,...m};return ls(h.fetch)(e,{method:h.methodOverride??ps[u],signal:h.signal,body:a,headers:y})}async function ys(h){const e={},a=await Ss(h);e.response=a;const u=await a.json();return e.responseJSON=u,{json:u,meta:e}}function Cs(h){const e=fs(h),a=h.maxURLLength??1/0;return()=>{const u=t=>({validate(o){if(a===1/0)return!0;const l=o.map(p=>p.path).join(","),_=o.map(p=>p.input);return $t({...e,type:t,path:l,inputs:_,signal:null}).length<=a},async fetch(o){const l=o.map(f=>f.path).join(","),_=o.map(f=>f.input),c=ds(...o.map(f=>f.signal)),p=await vs({...e,path:l,inputs:_,type:t,headers(){return h.headers?typeof h.headers=="function"?h.headers({opList:o}):h.headers:{}},signal:c});return(Array.isArray(p.json)?p.json:o.map(()=>p.json)).map(f=>({meta:p.meta,json:f}))}}),m=Yt(u("query")),y=Yt(u("mutation")),k={query:m,mutation:y};return({op:t})=>$e(o=>{/* istanbul ignore if -- @preserve */if(t.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const _=k[t.type].load(t);let c;return _.then(p=>{c=p;const v=ts(p.json,e.transformer.output);if(!v.ok){o.error(pe.from(v.error,{meta:p.meta}));return}o.next({context:p.meta,result:v.result}),o.complete()}).catch(p=>{o.error(pe.from(p,{meta:c==null?void 0:c.meta}))}),()=>{}})}}function Jt(h){return Array.isArray(h)?h:[h]}function ws(h){return e=>{const a=Jt(h.true).map(m=>m(e)),u=Jt(h.false).map(m=>m(e));return m=>$e(y=>{const k=h.condition(m.op)?a:u;return cr({op:m.op,links:k}).subscribe(y)})}}const Ht=(h,...e)=>typeof h=="function"?h(...e):h;function Es(h,e){return!e||h!=null&&typeof h!="object"?h:{...h??{},lastEventId:e}}async function xs(h){let e=await Ht(h.url);if(h.connectionParams){const a=await Ht(h.connectionParams),u=e.includes("?")?"&":"?";e+=u+"connectionParams="+encodeURIComponent(JSON.stringify(a))}return e}const ks=[_t.BAD_GATEWAY,_t.SERVICE_UNAVAILABLE,_t.GATEWAY_TIMEOUT,_t.INTERNAL_SERVER_ERROR];function Rs(h){const e=pr(h.transformer);return()=>({op:a})=>$e(u=>{const{type:m,path:y,input:k}=a;/* istanbul ignore if -- @preserve */if(m!=="subscription")throw new Error("httpSubscriptionLink only supports subscriptions");let t;const o=new AbortController,l=us(a.signal,o.signal),_=Qr({url:async()=>$t({transformer:e,url:await xs(h),input:Es(k,t),path:y,type:m,signal:null}),init:()=>Ht(h.eventSourceOptions,{op:a}),signal:l,deserialize:e.output.deserialize,EventSource:h.EventSource??globalThis.EventSource}),c=Pr({type:"state",state:"connecting",error:null}),p=c.subscribe({next(v){u.next({result:v})}});return dr(async()=>{for await(const v of _)switch(v.type){case"ping":break;case"data":const C=v.data;let f;C.id?(t=C.id,f={id:C.id,data:C}):f={data:C.data},u.next({result:f,context:{eventSource:v.eventSource}});break;case"connected":{u.next({result:{type:"started"},context:{eventSource:v.eventSource}}),c.next({type:"state",state:"pending",error:null});break}case"serialized-error":{const i=pe.from({error:v.error});if(ks.includes(v.error.code)){c.next({type:"state",state:"connecting",error:i});break}throw i}case"connecting":{const i=c.get(),n=v.event&&pe.from(v.event);if(!n&&i.state==="connecting")break;c.next({type:"state",state:"connecting",error:n});break}case"timeout":c.next({type:"state",state:"connecting",error:new pe(`Timeout of ${v.ms}ms reached while waiting for a response`)})}u.next({result:{type:"stopped"}}),u.complete()}).catch(v=>{u.error(pe.from(v))}),()=>{u.complete(),o.abort(),p.unsubscribe()}})}const Ls={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}}}}},mt=h=>Object.entries(h),{version:Ki,...Ds}=Ls,vr=mt(Ds).reduce((h,[e,a])=>(h[e]={...a,colorEntries:mt(a.colors),ansiColorEntries:mt(a.ansiColors)},h),{});mt(vr);var Mt={exports:{}},Xt;function Ts(){return Xt||(Xt=1,function(h,e){(function(a,u){h.exports=u()})(self,()=>(()=>{var a={};return(()=>{var u=a;Object.defineProperty(u,"__esModule",{value:!0}),u.FitAddon=void 0,u.FitAddon=class{activate(m){this._terminal=m}dispose(){}fit(){const m=this.proposeDimensions();if(!m||!this._terminal||isNaN(m.cols)||isNaN(m.rows))return;const y=this._terminal._core;this._terminal.rows===m.rows&&this._terminal.cols===m.cols||(y._renderService.clear(),this._terminal.resize(m.cols,m.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const m=this._terminal._core,y=m._renderService.dimensions;if(y.css.cell.width===0||y.css.cell.height===0)return;const k=this._terminal.options.scrollback===0?0:m.viewport.scrollBarWidth,t=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(t.getPropertyValue("height")),l=Math.max(0,parseInt(t.getPropertyValue("width"))),_=window.getComputedStyle(this._terminal.element),c=o-(parseInt(_.getPropertyValue("padding-top"))+parseInt(_.getPropertyValue("padding-bottom"))),p=l-(parseInt(_.getPropertyValue("padding-right"))+parseInt(_.getPropertyValue("padding-left")))-k;return{cols:Math.max(2,Math.floor(p/y.css.cell.width)),rows:Math.max(1,Math.floor(c/y.css.cell.height))}}}})(),a})())}(Mt)),Mt.exports}var As=Ts(),It={exports:{}},Qt;function Bs(){return Qt||(Qt=1,function(h,e){(function(a,u){h.exports=u()})(globalThis,()=>(()=>{var a={4567:function(k,t,o){var l=this&&this.__decorate||function(r,s,d,S){var b,w=arguments.length,g=w<3?s:S===null?S=Object.getOwnPropertyDescriptor(s,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,s,d,S);else for(var E=r.length-1;E>=0;E--)(b=r[E])&&(g=(w<3?b(g):w>3?b(s,d,g):b(s,d))||g);return w>3&&g&&Object.defineProperty(s,d,g),g},_=this&&this.__param||function(r,s){return function(d,S){s(d,S,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const c=o(9042),p=o(9924),v=o(844),C=o(4725),f=o(2585),i=o(3656);let n=t.AccessibilityManager=class extends v.Disposable{constructor(r,s,d,S){super(),this._terminal=r,this._coreBrowserService=d,this._renderService=S,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 b=0;b<this._terminal.rows;b++)this._rowElements[b]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[b]);if(this._topBoundaryFocusListener=b=>this._handleBoundaryFocus(b,0),this._bottomBoundaryFocusListener=b=>this._handleBoundaryFocus(b,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 p.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(b=>this._handleResize(b.rows))),this.register(this._terminal.onRender(b=>this._refreshRows(b.start,b.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(b=>this._handleChar(b))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
2
2
  `))),this.register(this._terminal.onA11yTab(b=>this._handleTab(b))),this.register(this._terminal.onKey(b=>this._handleKey(b.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,i.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,v.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(r){for(let s=0;s<r;s++)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,s){this._liveRegionDebouncer.refresh(r,s,this._terminal.rows)}_renderRows(r,s){const d=this._terminal.buffer,S=d.lines.length.toString();for(let b=r;b<=s;b++){const w=d.lines.get(d.ydisp+b),g=[],E=(w==null?void 0:w.translateToString(!0,void 0,void 0,g))||"",T=(d.ydisp+b+1).toString(),B=this._rowElements[b];B&&(E.length===0?(B.innerText=" ",this._rowColumns.set(B,[0,1])):(B.textContent=E,this._rowColumns.set(B,g)),B.setAttribute("aria-posinset",T),B.setAttribute("aria-setsize",S))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(r,s){const d=r.target,S=this._rowElements[s===0?1:this._rowElements.length-2];if(d.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||r.relatedTarget!==S)return;let b,w;if(s===0?(b=d,w=this._rowElements.pop(),this._rowContainer.removeChild(w)):(b=this._rowElements.shift(),w=d,this._rowContainer.removeChild(b)),b.removeEventListener("focus",this._topBoundaryFocusListener),w.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){const g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{const g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(s===0?-1:1),this._rowElements[s===0?1:this._rowElements.length-2].focus(),r.preventDefault(),r.stopImmediatePropagation()}_handleSelectionChange(){var E;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 s={node:r.anchorNode,offset:r.anchorOffset},d={node:r.focusNode,offset:r.focusOffset};if((s.node.compareDocumentPosition(d.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===d.node&&s.offset>d.offset)&&([s,d]=[d,s]),s.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(s={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(s.node))return;const S=this._rowElements.slice(-1)[0];if(d.node.compareDocumentPosition(S)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(d={node:S,offset:((E=S.textContent)==null?void 0:E.length)??0}),!this._rowContainer.contains(d.node))return;const b=({node:T,offset:B})=>{const O=T instanceof Text?T.parentNode:T;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 P=this._rowColumns.get(O);if(!P)return console.warn("columns is null. Race condition?"),null;let F=B<P.length?P[B]:P.slice(-1)[0]+1;return F>=this._terminal.cols&&(++D,F=0),{row:D,column:F}},w=b(s),g=b(d);if(w&&g){if(w.row>g.row||w.row===g.row&&w.column>=g.column)throw new Error("invalid range");this._terminal.select(w.column,w.row,(g.row-w.row)*this._terminal.cols-w.column+g.column)}}_handleResize(r){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let s=this._rowContainer.children.length;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);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`}};t.AccessibilityManager=n=l([_(1,f.IInstantiationService),_(2,C.ICoreBrowserService),_(3,C.IRenderService)],n)},3614:(k,t)=>{function o(p){return p.replace(/\r?\n/g,"\r")}function l(p,v){return v?"\x1B[200~"+p+"\x1B[201~":p}function _(p,v,C,f){p=l(p=o(p),C.decPrivateModes.bracketedPasteMode&&f.rawOptions.ignoreBracketedPasteMode!==!0),C.triggerDataEvent(p,!0),v.value=""}function h(p,v,C){const f=C.getBoundingClientRect(),i=p.clientX-f.left-10,n=p.clientY-f.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${i}px`,v.style.top=`${n}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=o,t.bracketTextForPaste=l,t.copyHandler=function(p,v){p.clipboardData&&p.clipboardData.setData("text/plain",v.selectionText),p.preventDefault()},t.handlePasteEvent=function(p,v,C,f){p.stopPropagation(),p.clipboardData&&_(p.clipboardData.getData("text/plain"),v,C,f)},t.paste=_,t.moveTextAreaUnderMouseCursor=h,t.rightClickHandler=function(p,v,C,f,i){h(p,v,C),i&&f.rightClickSelect(p),v.value=f.selectionText,v.select()}},7239:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const l=o(1505);t.ColorContrastCache=class{constructor(){this._color=new l.TwoKeyMap,this._css=new l.TwoKeyMap}setCss(_,h,p){this._css.set(_,h,p)}getCss(_,h){return this._css.get(_,h)}setColor(_,h,p){this._color.set(_,h,p)}getColor(_,h){return this._color.get(_,h)}clear(){this._color.clear(),this._css.clear()}}},3656:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(o,l,_,h){o.addEventListener(l,_,h);let p=!1;return{dispose:()=>{p||(p=!0,o.removeEventListener(l,_,h))}}}},3551:function(k,t,o){var l=this&&this.__decorate||function(n,r,s,d){var S,b=arguments.length,w=b<3?r:d===null?d=Object.getOwnPropertyDescriptor(r,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,r,s,d);else for(var g=n.length-1;g>=0;g--)(S=n[g])&&(w=(b<3?S(w):b>3?S(r,s,w):S(r,s))||w);return b>3&&w&&Object.defineProperty(r,s,w),w},_=this&&this.__param||function(n,r){return function(s,d){r(s,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const h=o(3656),p=o(8460),v=o(844),C=o(2585),f=o(4725);let i=t.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(n,r,s,d,S){super(),this._element=n,this._mouseService=r,this._renderService=s,this._bufferService=d,this._linkProviderService=S,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)(()=>{var b;this._lastMouseEvent=void 0,(b=this._activeProviderReplies)==null||b.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(n){this._lastMouseEvent=n;const r=this._positionFromMouseEvent(n,this._element,this._mouseService);if(!r)return;this._isMouseOut=!1;const s=n.composedPath();for(let d=0;d<s.length;d++){const S=s[d];if(S.classList.contains("xterm"))break;if(S.classList.contains("xterm-hover"))return}this._lastBufferCell&&r.x===this._lastBufferCell.x&&r.y===this._lastBufferCell.y||(this._handleHover(r),this._lastBufferCell=r)}_handleHover(n){if(this._activeLine!==n.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(n,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,n)||(this._clearCurrentLink(),this._askForLink(n,!0))}_askForLink(n,r){var d,S;this._activeProviderReplies&&r||((d=this._activeProviderReplies)==null||d.forEach(b=>{b==null||b.forEach(w=>{w.link.dispose&&w.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=n.y);let s=!1;for(const[b,w]of this._linkProviderService.linkProviders.entries())r?(S=this._activeProviderReplies)!=null&&S.get(b)&&(s=this._checkLinkProviderResult(b,n,s)):w.provideLinks(n.y,g=>{var T,B;if(this._isMouseOut)return;const E=g==null?void 0:g.map(O=>({link:O}));(T=this._activeProviderReplies)==null||T.set(b,E),s=this._checkLinkProviderResult(b,n,s),((B=this._activeProviderReplies)==null?void 0:B.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(n.y,this._activeProviderReplies)})}_removeIntersectingLinks(n,r){const s=new Set;for(let d=0;d<r.size;d++){const S=r.get(d);if(S)for(let b=0;b<S.length;b++){const w=S[b],g=w.link.range.start.y<n?0:w.link.range.start.x,E=w.link.range.end.y>n?this._bufferService.cols:w.link.range.end.x;for(let T=g;T<=E;T++){if(s.has(T)){S.splice(b--,1);break}s.add(T)}}}}_checkLinkProviderResult(n,r,s){var b;if(!this._activeProviderReplies)return s;const d=this._activeProviderReplies.get(n);let S=!1;for(let w=0;w<n;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(S=!0);if(!S&&d){const w=d.find(g=>this._linkAtPosition(g.link,r));w&&(s=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let w=0;w<this._activeProviderReplies.size;w++){const g=(b=this._activeProviderReplies.get(w))==null?void 0:b.find(E=>this._linkAtPosition(E.link,r));if(g){s=!0,this._handleNewLink(g);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(n){if(!this._currentLink)return;const r=this._positionFromMouseEvent(n,this._element,this._mouseService);r&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,r)&&this._currentLink.link.activate(n,this._currentLink.link.text)}_clearCurrentLink(n,r){this._currentLink&&this._lastMouseEvent&&(!n||!r||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=r)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(n){if(!this._lastMouseEvent)return;const r=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);r&&this._linkAtPosition(n.link,r)&&(this._currentLink=n,this._currentLink.state={decorations:{underline:n.link.decorations===void 0||n.link.decorations.underline,pointerCursor:n.link.decorations===void 0||n.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,n.link,this._lastMouseEvent),n.link.decorations={},Object.defineProperties(n.link.decorations,{pointerCursor:{get:()=>{var s,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.pointerCursor},set:s=>{var d;(d=this._currentLink)!=null&&d.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>{var s,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.underline},set:s=>{var d,S,b;(d=this._currentLink)!=null&&d.state&&((b=(S=this._currentLink)==null?void 0:S.state)==null?void 0:b.decorations.underline)!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(n.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;const d=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,S=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=S&&(this._clearCurrentLink(d,S),this._lastMouseEvent)){const b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._askForLink(b,!1)}})))}_linkHover(n,r,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),r.hover&&r.hover(s,r.text)}_fireUnderlineEvent(n,r){const s=n.range,d=this._bufferService.buffer.ydisp,S=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-d-1,s.end.x,s.end.y-d-1,void 0);(r?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(S)}_linkLeave(n,r,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),r.leave&&r.leave(s,r.text)}_linkAtPosition(n,r){const s=n.range.start.y*this._bufferService.cols+n.range.start.x,d=n.range.end.y*this._bufferService.cols+n.range.end.x,S=r.y*this._bufferService.cols+r.x;return s<=S&&S<=d}_positionFromMouseEvent(n,r,s){const d=s.getCoords(n,r,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(n,r,s,d,S){return{x1:n,y1:r,x2:s,y2:d,cols:this._bufferService.cols,fg:S}}};t.Linkifier=i=l([_(1,f.IMouseService),_(2,f.IRenderService),_(3,C.IBufferService),_(4,f.ILinkProviderService)],i)},9042:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(k,t,o){var l=this&&this.__decorate||function(f,i,n,r){var s,d=arguments.length,S=d<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,n):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(f,i,n,r);else for(var b=f.length-1;b>=0;b--)(s=f[b])&&(S=(d<3?s(S):d>3?s(i,n,S):s(i,n))||S);return d>3&&S&&Object.defineProperty(i,n,S),S},_=this&&this.__param||function(f,i){return function(n,r){i(n,r,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const h=o(511),p=o(2585);let v=t.OscLinkProvider=class{constructor(f,i,n){this._bufferService=f,this._optionsService=i,this._oscLinkService=n}provideLinks(f,i){var E;const n=this._bufferService.buffer.lines.get(f-1);if(!n)return void i(void 0);const r=[],s=this._optionsService.rawOptions.linkHandler,d=new h.CellData,S=n.getTrimmedLength();let b=-1,w=-1,g=!1;for(let T=0;T<S;T++)if(w!==-1||n.hasContent(T)){if(n.loadCell(T,d),d.hasExtendedAttrs()&&d.extended.urlId){if(w===-1){w=T,b=d.extended.urlId;continue}g=d.extended.urlId!==b}else w!==-1&&(g=!0);if(g||w!==-1&&T===S-1){const B=(E=this._oscLinkService.getLinkData(b))==null?void 0:E.uri;if(B){const O={start:{x:w+1,y:f},end:{x:T+(g||T!==S-1?0:1),y:f}};let D=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{const P=new URL(B);["http:","https:"].includes(P.protocol)||(D=!0)}catch{D=!0}D||r.push({text:B,range:O,activate:(P,F)=>s?s.activate(P,F,O):C(0,F),hover:(P,F)=>{var U;return(U=s==null?void 0:s.hover)==null?void 0:U.call(s,P,F,O)},leave:(P,F)=>{var U;return(U=s==null?void 0:s.leave)==null?void 0:U.call(s,P,F,O)}})}g=!1,d.hasExtendedAttrs()&&d.extended.urlId?(w=T,b=d.extended.urlId):(w=-1,b=-1)}}i(r)}};function C(f,i){if(confirm(`Do you want to navigate to ${i}?
3
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=c.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,s){this._liveRegionDebouncer.refresh(r,s,this._terminal.rows)}_renderRows(r,s){const d=this._terminal.buffer,S=d.lines.length.toString();for(let b=r;b<=s;b++){const w=d.lines.get(d.ydisp+b),g=[],E=(w==null?void 0:w.translateToString(!0,void 0,void 0,g))||"",T=(d.ydisp+b+1).toString(),B=this._rowElements[b];B&&(E.length===0?(B.innerText=" ",this._rowColumns.set(B,[0,1])):(B.textContent=E,this._rowColumns.set(B,g)),B.setAttribute("aria-posinset",T),B.setAttribute("aria-setsize",S))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(r,s){const d=r.target,S=this._rowElements[s===0?1:this._rowElements.length-2];if(d.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||r.relatedTarget!==S)return;let b,w;if(s===0?(b=d,w=this._rowElements.pop(),this._rowContainer.removeChild(w)):(b=this._rowElements.shift(),w=d,this._rowContainer.removeChild(b)),b.removeEventListener("focus",this._topBoundaryFocusListener),w.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){const g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{const g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(s===0?-1:1),this._rowElements[s===0?1:this._rowElements.length-2].focus(),r.preventDefault(),r.stopImmediatePropagation()}_handleSelectionChange(){var E;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 s={node:r.anchorNode,offset:r.anchorOffset},d={node:r.focusNode,offset:r.focusOffset};if((s.node.compareDocumentPosition(d.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===d.node&&s.offset>d.offset)&&([s,d]=[d,s]),s.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(s={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(s.node))return;const S=this._rowElements.slice(-1)[0];if(d.node.compareDocumentPosition(S)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(d={node:S,offset:((E=S.textContent)==null?void 0:E.length)??0}),!this._rowContainer.contains(d.node))return;const b=({node:T,offset:B})=>{const O=T instanceof Text?T.parentNode:T;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 P=this._rowColumns.get(O);if(!P)return console.warn("columns is null. Race condition?"),null;let F=B<P.length?P[B]:P.slice(-1)[0]+1;return F>=this._terminal.cols&&(++D,F=0),{row:D,column:F}},w=b(s),g=b(d);if(w&&g){if(w.row>g.row||w.row===g.row&&w.column>=g.column)throw new Error("invalid range");this._terminal.select(w.column,w.row,(g.row-w.row)*this._terminal.cols-w.column+g.column)}}_handleResize(r){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let s=this._rowContainer.children.length;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);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`}};t.AccessibilityManager=n=l([_(1,f.IInstantiationService),_(2,C.ICoreBrowserService),_(3,C.IRenderService)],n)},3614:(k,t)=>{function o(p){return p.replace(/\r?\n/g,"\r")}function l(p,v){return v?"\x1B[200~"+p+"\x1B[201~":p}function _(p,v,C,f){p=l(p=o(p),C.decPrivateModes.bracketedPasteMode&&f.rawOptions.ignoreBracketedPasteMode!==!0),C.triggerDataEvent(p,!0),v.value=""}function c(p,v,C){const f=C.getBoundingClientRect(),i=p.clientX-f.left-10,n=p.clientY-f.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${i}px`,v.style.top=`${n}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=o,t.bracketTextForPaste=l,t.copyHandler=function(p,v){p.clipboardData&&p.clipboardData.setData("text/plain",v.selectionText),p.preventDefault()},t.handlePasteEvent=function(p,v,C,f){p.stopPropagation(),p.clipboardData&&_(p.clipboardData.getData("text/plain"),v,C,f)},t.paste=_,t.moveTextAreaUnderMouseCursor=c,t.rightClickHandler=function(p,v,C,f,i){c(p,v,C),i&&f.rightClickSelect(p),v.value=f.selectionText,v.select()}},7239:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const l=o(1505);t.ColorContrastCache=class{constructor(){this._color=new l.TwoKeyMap,this._css=new l.TwoKeyMap}setCss(_,c,p){this._css.set(_,c,p)}getCss(_,c){return this._css.get(_,c)}setColor(_,c,p){this._color.set(_,c,p)}getColor(_,c){return this._color.get(_,c)}clear(){this._color.clear(),this._css.clear()}}},3656:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(o,l,_,c){o.addEventListener(l,_,c);let p=!1;return{dispose:()=>{p||(p=!0,o.removeEventListener(l,_,c))}}}},3551:function(k,t,o){var l=this&&this.__decorate||function(n,r,s,d){var S,b=arguments.length,w=b<3?r:d===null?d=Object.getOwnPropertyDescriptor(r,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,r,s,d);else for(var g=n.length-1;g>=0;g--)(S=n[g])&&(w=(b<3?S(w):b>3?S(r,s,w):S(r,s))||w);return b>3&&w&&Object.defineProperty(r,s,w),w},_=this&&this.__param||function(n,r){return function(s,d){r(s,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const c=o(3656),p=o(8460),v=o(844),C=o(2585),f=o(4725);let i=t.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(n,r,s,d,S){super(),this._element=n,this._mouseService=r,this._renderService=s,this._bufferService=d,this._linkProviderService=S,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)(()=>{var b;this._lastMouseEvent=void 0,(b=this._activeProviderReplies)==null||b.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,c.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,c.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,c.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(n){this._lastMouseEvent=n;const r=this._positionFromMouseEvent(n,this._element,this._mouseService);if(!r)return;this._isMouseOut=!1;const s=n.composedPath();for(let d=0;d<s.length;d++){const S=s[d];if(S.classList.contains("xterm"))break;if(S.classList.contains("xterm-hover"))return}this._lastBufferCell&&r.x===this._lastBufferCell.x&&r.y===this._lastBufferCell.y||(this._handleHover(r),this._lastBufferCell=r)}_handleHover(n){if(this._activeLine!==n.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(n,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,n)||(this._clearCurrentLink(),this._askForLink(n,!0))}_askForLink(n,r){var d,S;this._activeProviderReplies&&r||((d=this._activeProviderReplies)==null||d.forEach(b=>{b==null||b.forEach(w=>{w.link.dispose&&w.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=n.y);let s=!1;for(const[b,w]of this._linkProviderService.linkProviders.entries())r?(S=this._activeProviderReplies)!=null&&S.get(b)&&(s=this._checkLinkProviderResult(b,n,s)):w.provideLinks(n.y,g=>{var T,B;if(this._isMouseOut)return;const E=g==null?void 0:g.map(O=>({link:O}));(T=this._activeProviderReplies)==null||T.set(b,E),s=this._checkLinkProviderResult(b,n,s),((B=this._activeProviderReplies)==null?void 0:B.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(n.y,this._activeProviderReplies)})}_removeIntersectingLinks(n,r){const s=new Set;for(let d=0;d<r.size;d++){const S=r.get(d);if(S)for(let b=0;b<S.length;b++){const w=S[b],g=w.link.range.start.y<n?0:w.link.range.start.x,E=w.link.range.end.y>n?this._bufferService.cols:w.link.range.end.x;for(let T=g;T<=E;T++){if(s.has(T)){S.splice(b--,1);break}s.add(T)}}}}_checkLinkProviderResult(n,r,s){var b;if(!this._activeProviderReplies)return s;const d=this._activeProviderReplies.get(n);let S=!1;for(let w=0;w<n;w++)this._activeProviderReplies.has(w)&&!this._activeProviderReplies.get(w)||(S=!0);if(!S&&d){const w=d.find(g=>this._linkAtPosition(g.link,r));w&&(s=!0,this._handleNewLink(w))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let w=0;w<this._activeProviderReplies.size;w++){const g=(b=this._activeProviderReplies.get(w))==null?void 0:b.find(E=>this._linkAtPosition(E.link,r));if(g){s=!0,this._handleNewLink(g);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(n){if(!this._currentLink)return;const r=this._positionFromMouseEvent(n,this._element,this._mouseService);r&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,r)&&this._currentLink.link.activate(n,this._currentLink.link.text)}_clearCurrentLink(n,r){this._currentLink&&this._lastMouseEvent&&(!n||!r||this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=r)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(n){if(!this._lastMouseEvent)return;const r=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);r&&this._linkAtPosition(n.link,r)&&(this._currentLink=n,this._currentLink.state={decorations:{underline:n.link.decorations===void 0||n.link.decorations.underline,pointerCursor:n.link.decorations===void 0||n.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,n.link,this._lastMouseEvent),n.link.decorations={},Object.defineProperties(n.link.decorations,{pointerCursor:{get:()=>{var s,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.pointerCursor},set:s=>{var d;(d=this._currentLink)!=null&&d.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>{var s,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.underline},set:s=>{var d,S,b;(d=this._currentLink)!=null&&d.state&&((b=(S=this._currentLink)==null?void 0:S.state)==null?void 0:b.decorations.underline)!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(n.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;const d=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,S=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=d&&this._currentLink.link.range.end.y<=S&&(this._clearCurrentLink(d,S),this._lastMouseEvent)){const b=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);b&&this._askForLink(b,!1)}})))}_linkHover(n,r,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!0),this._currentLink.state.decorations.pointerCursor&&n.classList.add("xterm-cursor-pointer")),r.hover&&r.hover(s,r.text)}_fireUnderlineEvent(n,r){const s=n.range,d=this._bufferService.buffer.ydisp,S=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-d-1,s.end.x,s.end.y-d-1,void 0);(r?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(S)}_linkLeave(n,r,s){var d;(d=this._currentLink)!=null&&d.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!1),this._currentLink.state.decorations.pointerCursor&&n.classList.remove("xterm-cursor-pointer")),r.leave&&r.leave(s,r.text)}_linkAtPosition(n,r){const s=n.range.start.y*this._bufferService.cols+n.range.start.x,d=n.range.end.y*this._bufferService.cols+n.range.end.x,S=r.y*this._bufferService.cols+r.x;return s<=S&&S<=d}_positionFromMouseEvent(n,r,s){const d=s.getCoords(n,r,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(n,r,s,d,S){return{x1:n,y1:r,x2:s,y2:d,cols:this._bufferService.cols,fg:S}}};t.Linkifier=i=l([_(1,f.IMouseService),_(2,f.IRenderService),_(3,C.IBufferService),_(4,f.ILinkProviderService)],i)},9042:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(k,t,o){var l=this&&this.__decorate||function(f,i,n,r){var s,d=arguments.length,S=d<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,n):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(f,i,n,r);else for(var b=f.length-1;b>=0;b--)(s=f[b])&&(S=(d<3?s(S):d>3?s(i,n,S):s(i,n))||S);return d>3&&S&&Object.defineProperty(i,n,S),S},_=this&&this.__param||function(f,i){return function(n,r){i(n,r,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const c=o(511),p=o(2585);let v=t.OscLinkProvider=class{constructor(f,i,n){this._bufferService=f,this._optionsService=i,this._oscLinkService=n}provideLinks(f,i){var E;const n=this._bufferService.buffer.lines.get(f-1);if(!n)return void i(void 0);const r=[],s=this._optionsService.rawOptions.linkHandler,d=new c.CellData,S=n.getTrimmedLength();let b=-1,w=-1,g=!1;for(let T=0;T<S;T++)if(w!==-1||n.hasContent(T)){if(n.loadCell(T,d),d.hasExtendedAttrs()&&d.extended.urlId){if(w===-1){w=T,b=d.extended.urlId;continue}g=d.extended.urlId!==b}else w!==-1&&(g=!0);if(g||w!==-1&&T===S-1){const B=(E=this._oscLinkService.getLinkData(b))==null?void 0:E.uri;if(B){const O={start:{x:w+1,y:f},end:{x:T+(g||T!==S-1?0:1),y:f}};let D=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{const P=new URL(B);["http:","https:"].includes(P.protocol)||(D=!0)}catch{D=!0}D||r.push({text:B,range:O,activate:(P,F)=>s?s.activate(P,F,O):C(0,F),hover:(P,F)=>{var U;return(U=s==null?void 0:s.hover)==null?void 0:U.call(s,P,F,O)},leave:(P,F)=>{var U;return(U=s==null?void 0:s.leave)==null?void 0:U.call(s,P,F,O)}})}g=!1,d.hasExtendedAttrs()&&d.extended.urlId?(w=T,b=d.extended.urlId):(w=-1,b=-1)}}i(r)}};function C(f,i){if(confirm(`Do you want to navigate to ${i}?
4
4
 
5
- WARNING: This link could potentially be dangerous`)){const n=window.open();if(n){try{n.opener=null}catch{}n.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=v=l([_(0,p.IBufferService),_(1,p.IOptionsService),_(2,p.IOscLinkService)],v)},6193:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(o,l){this._renderCallback=o,this._coreBrowserService=l,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(o,l,_){this._rowCount=_,o=o!==void 0?o:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,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 o=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,l),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const l=o(3614),_=o(3656),h=o(3551),p=o(9042),v=o(3730),C=o(1680),f=o(3107),i=o(5744),n=o(2950),r=o(1296),s=o(428),d=o(4269),S=o(5114),b=o(8934),w=o(3230),g=o(9312),E=o(4725),T=o(6731),B=o(8055),O=o(8969),D=o(8460),P=o(844),F=o(6114),U=o(8437),G=o(2584),$=o(7399),x=o(5941),L=o(9074),A=o(2585),M=o(5435),N=o(4567),z=o(779);class J 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(I={}){super(I),this.browser=F,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new P.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(L.DecorationService),this._instantiationService.setService(A.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(z.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((R,W)=>this.refresh(R,W))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(R=>this._reportWindowsOptions(R))),this.register(this._inputHandler.onColor(R=>this._handleColorEvent(R))),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(R=>this._afterResize(R.cols,R.rows))),this.register((0,P.toDisposable)(()=>{var R,W;this._customKeyEventHandler=void 0,(W=(R=this.element)==null?void 0:R.parentNode)==null||W.removeChild(this.element)}))}_handleColorEvent(I){if(this._themeService)for(const R of I){let W,H="";switch(R.index){case 256:W="foreground",H="10";break;case 257:W="background",H="11";break;case 258:W="cursor",H="12";break;default:W="ansi",H="4;"+R.index}switch(R.type){case 0:const Z=B.color.toColorRGB(W==="ansi"?this._themeService.colors.ansi[R.index]:this._themeService.colors[W]);this.coreService.triggerDataEvent(`${G.C0.ESC}]${H};${(0,x.toRgbString)(Z)}${G.C1_ESCAPED.ST}`);break;case 1:if(W==="ansi")this._themeService.modifyColors(V=>V.ansi[R.index]=B.channels.toColor(...R.color));else{const V=W;this._themeService.modifyColors(ie=>ie[V]=B.channels.toColor(...R.color))}break;case 2:this._themeService.restoreColor(R.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(I){I?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(I){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var I;return(I=this.textarea)==null?void 0:I.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.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 I=this.buffer.ybase+this.buffer.y,R=this.buffer.lines.get(I);if(!R)return;const W=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,Z=R.getWidth(W),V=this._renderService.dimensions.css.cell.width*Z,ie=this.buffer.y*this._renderService.dimensions.css.cell.height,ce=W*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ce+"px",this.textarea.style.top=ie+"px",this.textarea.style.width=V+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",R=>{this.hasSelection()&&(0,l.copyHandler)(R,this._selectionService)}));const I=R=>(0,l.handlePasteEvent)(R,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",I)),this.register((0,_.addDisposableDomListener)(this.element,"paste",I)),F.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",R=>{R.button===2&&(0,l.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",R=>{(0,l.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),F.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",R=>{R.button===1&&(0,l.moveTextAreaUnderMouseCursor)(R,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",I=>this._keyUp(I),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",I=>this._keyDown(I),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",I=>this._keyPress(I),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",I=>this._compositionHelper.compositionupdate(I))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,_.addDisposableDomListener)(this.textarea,"input",I=>this._inputEvent(I),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(I){var W;if(!I)throw new Error("Terminal requires a parent element.");if(I.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((W=this.element)==null?void 0:W.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=I.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"),I.appendChild(this.element);const R=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),R.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,_.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),R.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.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(S.CoreBrowserService,this.textarea,I.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",H=>this._handleTextAreaFocus(H))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(s.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(T.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(d.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(w.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.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(n.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(b.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(h.Linkifier,this.screenElement)),this.element.appendChild(R);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(C.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(g.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.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,_.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(f.BufferDecorationRenderer,this.screenElement)),this.register((0,_.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(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",H=>this._handleScreenReaderModeOptionChange(H))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",H=>{!this._overviewRulerRenderer&&H&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.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 I=this,R=this.element;function W(V){const ie=I._mouseService.getMouseReportCoords(V,I.screenElement);if(!ie)return!1;let ce,he;switch(V.overrideType||V.type){case"mousemove":he=32,V.buttons===void 0?(ce=3,V.button!==void 0&&(ce=V.button<3?V.button:3)):ce=1&V.buttons?0:4&V.buttons?1:2&V.buttons?2:3;break;case"mouseup":he=0,ce=V.button<3?V.button:3;break;case"mousedown":he=1,ce=V.button<3?V.button:3;break;case"wheel":if(I._customWheelEventHandler&&I._customWheelEventHandler(V)===!1||I.viewport.getLinesScrolled(V)===0)return!1;he=V.deltaY<0?0:1,ce=4;break;default:return!1}return!(he===void 0||ce===void 0||ce>4)&&I.coreMouseService.triggerMouseEvent({col:ie.col,row:ie.row,x:ie.x,y:ie.y,button:ce,action:he,ctrl:V.ctrlKey,alt:V.altKey,shift:V.shiftKey})}const H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Z={mouseup:V=>(W(V),V.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(V)),wheel:V=>(W(V),this.cancel(V,!0)),mousedrag:V=>{V.buttons&&W(V)},mousemove:V=>{V.buttons||W(V)}};this.register(this.coreMouseService.onProtocolChange(V=>{V?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(V)),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&V?H.mousemove||(R.addEventListener("mousemove",Z.mousemove),H.mousemove=Z.mousemove):(R.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&V?H.wheel||(R.addEventListener("wheel",Z.wheel,{passive:!1}),H.wheel=Z.wheel):(R.removeEventListener("wheel",H.wheel),H.wheel=null),2&V?H.mouseup||(H.mouseup=Z.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&V?H.mousedrag||(H.mousedrag=Z.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(R,"mousedown",V=>{if(V.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(V))return W(V),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(V)})),this.register((0,_.addDisposableDomListener)(R,"wheel",V=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(V)===!1)return!1;if(!this.buffer.hasScrollback){const ie=this.viewport.getLinesScrolled(V);if(ie===0)return;const ce=G.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(V.deltaY<0?"A":"B");let he="";for(let ue=0;ue<Math.abs(ie);ue++)he+=ce;return this.coreService.triggerDataEvent(he,!0),this.cancel(V,!0)}return this.viewport.handleWheel(V)?this.cancel(V):void 0}},{passive:!1})),this.register((0,_.addDisposableDomListener)(R,"touchstart",V=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(V),this.cancel(V)},{passive:!0})),this.register((0,_.addDisposableDomListener)(R,"touchmove",V=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(V)?void 0:this.cancel(V)},{passive:!1}))}refresh(I,R){var W;(W=this._renderService)==null||W.refreshRows(I,R)}updateCursorStyle(I){var R;(R=this._selectionService)!=null&&R.shouldColumnSelect(I)?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(I,R,W=0){var H;W===1?(super.scrollLines(I,R,W),this.refresh(0,this.rows-1)):(H=this.viewport)==null||H.scrollLines(I)}paste(I){(0,l.paste)(I,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(I){this._customKeyEventHandler=I}attachCustomWheelEventHandler(I){this._customWheelEventHandler=I}registerLinkProvider(I){return this._linkProviderService.registerLinkProvider(I)}registerCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const R=this._characterJoinerService.register(I);return this.refresh(0,this.rows-1),R}deregisterCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(I)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(I){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+I)}registerDecoration(I){return this._decorationService.registerDecoration(I)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(I,R,W){this._selectionService.setSelection(I,R,W)}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 I;(I=this._selectionService)==null||I.clearSelection()}selectAll(){var I;(I=this._selectionService)==null||I.selectAll()}selectLines(I,R){var W;(W=this._selectionService)==null||W.selectLines(I,R)}_keyDown(I){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;const R=this.browser.isMac&&this.options.macOptionIsMeta&&I.altKey;if(!R&&!this._compositionHelper.keydown(I))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;R||I.key!=="Dead"&&I.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const W=(0,$.evaluateKeyboardEvent)(I,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(I),W.type===3||W.type===2){const H=this.rows-1;return this.scrollLines(W.type===2?-H:H),this.cancel(I,!0)}return W.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,I)||(W.cancel&&this.cancel(I,!0),!W.key||!!(I.key&&!I.ctrlKey&&!I.altKey&&!I.metaKey&&I.key.length===1&&I.key.charCodeAt(0)>=65&&I.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(W.key!==G.C0.ETX&&W.key!==G.C0.CR||(this.textarea.value=""),this._onKey.fire({key:W.key,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(W.key,!0),!this.optionsService.rawOptions.screenReaderMode||I.altKey||I.ctrlKey?this.cancel(I,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(I,R){const W=I.isMac&&!this.options.macOptionIsMeta&&R.altKey&&!R.ctrlKey&&!R.metaKey||I.isWindows&&R.altKey&&R.ctrlKey&&!R.metaKey||I.isWindows&&R.getModifierState("AltGraph");return R.type==="keypress"?W:W&&(!R.keyCode||R.keyCode>47)}_keyUp(I){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1||(function(R){return R.keyCode===16||R.keyCode===17||R.keyCode===18}(I)||this.focus(),this.updateCursorStyle(I),this._keyPressHandled=!1)}_keyPress(I){let R;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;if(this.cancel(I),I.charCode)R=I.charCode;else if(I.which===null||I.which===void 0)R=I.keyCode;else{if(I.which===0||I.charCode===0)return!1;R=I.which}return!(!R||(I.altKey||I.ctrlKey||I.metaKey)&&!this._isThirdLevelShift(this.browser,I)||(R=String.fromCharCode(R),this._onKey.fire({key:R,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(R,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(I){if(I.data&&I.inputType==="insertText"&&(!I.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const R=I.data;return this.coreService.triggerDataEvent(R,!0),this.cancel(I),!0}return!1}resize(I,R){I!==this.cols||R!==this.rows?super.resize(I,R):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(I,R){var W,H;(W=this._charSizeService)==null||W.measure(),(H=this.viewport)==null||H.syncScrollArea(!0)}clear(){var I;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 R=1;R<this.rows;R++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(I=this.viewport)==null||I.reset(),this.refresh(0,this.rows-1)}}reset(){var R,W;this.options.rows=this.rows,this.options.cols=this.cols;const I=this._customKeyEventHandler;this._setup(),super.reset(),(R=this._selectionService)==null||R.reset(),this._decorationService.reset(),(W=this.viewport)==null||W.reset(),this._customKeyEventHandler=I,this.refresh(0,this.rows-1)}clearTextureAtlas(){var I;(I=this._renderService)==null||I.clearTextureAtlas()}_reportFocus(){var I;(I=this.element)!=null&&I.classList.contains("focus")?this.coreService.triggerDataEvent(G.C0.ESC+"[I"):this.coreService.triggerDataEvent(G.C0.ESC+"[O")}_reportWindowsOptions(I){if(this._renderService)switch(I){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const R=this._renderService.dimensions.css.canvas.width.toFixed(0),W=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[4;${W};${R}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const H=this._renderService.dimensions.css.cell.width.toFixed(0),Z=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[6;${Z};${H}t`)}}cancel(I,R){if(this.options.cancelEvents||R)return I.preventDefault(),I.stopPropagation(),!1}}t.Terminal=J},9924:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(o,l=1e3){this._renderCallback=o,this._debounceThresholdMS=l,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,l,_){this._rowCount=_,o=o!==void 0?o:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,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 p=h-this._lastRefreshMs,v=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,l)}}},1680:function(k,t,o){var l=this&&this.__decorate||function(n,r,s,d){var S,b=arguments.length,w=b<3?r:d===null?d=Object.getOwnPropertyDescriptor(r,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,r,s,d);else for(var g=n.length-1;g>=0;g--)(S=n[g])&&(w=(b<3?S(w):b>3?S(r,s,w):S(r,s))||w);return b>3&&w&&Object.defineProperty(r,s,w),w},_=this&&this.__param||function(n,r){return function(s,d){r(s,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const h=o(3656),p=o(4725),v=o(8460),C=o(844),f=o(2585);let i=t.Viewport=class extends C.Disposable{constructor(n,r,s,d,S,b,w,g){super(),this._viewportElement=n,this._scrollArea=r,this._bufferService=s,this._optionsService=d,this._charSizeService=S,this._renderService=b,this._coreBrowserService=w,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 v.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(E=>this._activeBuffer=E.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(E=>this._renderDimensions=E)),this._handleThemeChange(g.colors),this.register(g.onChangeColors(E=>this._handleThemeChange(E))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(n){this._viewportElement.style.backgroundColor=n.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(n){if(n)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 n=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==n&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=n),this._refreshAnimationFrame=null}syncScrollArea(n=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(n);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(n)}_handleScroll(n){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 n=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(n*(this._smoothScrollState.target-this._smoothScrollState.origin)),n<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(n,r){const s=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(r<0&&this._viewportElement.scrollTop!==0||r>0&&s<this._lastRecordedBufferHeight)||(n.cancelable&&n.preventDefault(),!1)}handleWheel(n){const r=this._getPixelsScrolled(n);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(n,r))}scrollLines(n){if(n!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const r=n*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:n,suppressScrollEvent:!1})}_getPixelsScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let r=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_LINE?r*=this._currentRowHeight:n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._currentRowHeight*this._bufferService.rows),r}getBufferElements(n,r){var g;let s,d="";const S=[],b=r??this._bufferService.buffer.lines.length,w=this._bufferService.buffer.lines;for(let E=n;E<b;E++){const T=w.get(E);if(!T)continue;const B=(g=w.get(E+1))==null?void 0:g.isWrapped;if(d+=T.translateToString(!B),!B||E===w.length-1){const O=document.createElement("div");O.textContent=d,S.push(O),d.length>0&&(s=O),d=""}}return{bufferElements:S,cursorElement:s}}getLinesScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let r=this._applyScrollModifier(n.deltaY,n);return n.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):n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(n,r){const s=this._optionsService.rawOptions.fastScrollModifier;return s==="alt"&&r.altKey||s==="ctrl"&&r.ctrlKey||s==="shift"&&r.shiftKey?n*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:n*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(n){this._lastTouchY=n.touches[0].pageY}handleTouchMove(n){const r=this._lastTouchY-n.touches[0].pageY;return this._lastTouchY=n.touches[0].pageY,r!==0&&(this._viewportElement.scrollTop+=r,this._bubbleScroll(n,r))}};t.Viewport=i=l([_(2,f.IBufferService),_(3,f.IOptionsService),_(4,p.ICharSizeService),_(5,p.IRenderService),_(6,p.ICoreBrowserService),_(7,p.IThemeService)],i)},3107:function(k,t,o){var l=this&&this.__decorate||function(f,i,n,r){var s,d=arguments.length,S=d<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,n):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(f,i,n,r);else for(var b=f.length-1;b>=0;b--)(s=f[b])&&(S=(d<3?s(S):d>3?s(i,n,S):s(i,n))||S);return d>3&&S&&Object.defineProperty(i,n,S),S},_=this&&this.__param||function(f,i){return function(n,r){i(n,r,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const h=o(4725),p=o(844),v=o(2585);let C=t.BufferDecorationRenderer=class extends p.Disposable{constructor(f,i,n,r,s){super(),this._screenElement=f,this._bufferService=i,this._coreBrowserService=n,this._decorationService=r,this._renderService=s,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(d=>this._removeDecoration(d))),this.register((0,p.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 f of this._decorationService.decorations)this._renderDecoration(f);this._dimensionsChanged=!1}_renderDecoration(f){this._refreshStyle(f),this._dimensionsChanged&&this._refreshXPosition(f)}_createElement(f){var r;const i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",((r=f==null?void 0:f.options)==null?void 0:r.layer)==="top"),i.style.width=`${Math.round((f.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(f.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(f.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const n=f.options.x??0;return n&&n>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(f,i),i}_refreshStyle(f){const i=f.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)f.element&&(f.element.style.display="none",f.onRenderEmitter.fire(f.element));else{let n=this._decorationElements.get(f);n||(n=this._createElement(f),f.element=n,this._decorationElements.set(f,n),this._container.appendChild(n),f.onDispose(()=>{this._decorationElements.delete(f),n.remove()})),n.style.top=i*this._renderService.dimensions.css.cell.height+"px",n.style.display=this._altBufferIsActive?"none":"block",f.onRenderEmitter.fire(n)}}_refreshXPosition(f,i=f.element){if(!i)return;const n=f.options.x??0;(f.options.anchor||"left")==="right"?i.style.right=n?n*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=n?n*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(f){var i;(i=this._decorationElements.get(f))==null||i.remove(),this._decorationElements.delete(f),f.dispose()}};t.BufferDecorationRenderer=C=l([_(1,v.IBufferService),_(2,h.ICoreBrowserService),_(3,v.IDecorationService),_(4,h.IRenderService)],C)},5871:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.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(o){if(o.options.overviewRulerOptions){for(const l of this._zones)if(l.color===o.options.overviewRulerOptions.color&&l.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(l,o.marker.line))return;if(this._lineAdjacentToZone(l,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(l,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,l){return l>=o.startBufferLine&&l<=o.endBufferLine}_lineAdjacentToZone(o,l,_){return l>=o.startBufferLine-this._linePadding[_||"full"]&&l<=o.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(o,l){o.startBufferLine=Math.min(o.startBufferLine,l),o.endBufferLine=Math.max(o.endBufferLine,l)}}},5744:function(k,t,o){var l=this&&this.__decorate||function(s,d,S,b){var w,g=arguments.length,E=g<3?d:b===null?b=Object.getOwnPropertyDescriptor(d,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(s,d,S,b);else for(var T=s.length-1;T>=0;T--)(w=s[T])&&(E=(g<3?w(E):g>3?w(d,S,E):w(d,S))||E);return g>3&&E&&Object.defineProperty(d,S,E),E},_=this&&this.__param||function(s,d){return function(S,b){d(S,b,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const h=o(5871),p=o(4725),v=o(844),C=o(2585),f={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},n={full:0,left:0,center:0,right:0};let r=t.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,d,S,b,w,g,E){var B;super(),this._viewportElement=s,this._screenElement=d,this._bufferService=S,this._decorationService=b,this._renderService=w,this._optionsService=g,this._coreBrowserService=E,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(),(B=this._viewportElement.parentElement)==null||B.insertBefore(this._canvas,this._viewportElement);const T=this._canvas.getContext("2d");if(!T)throw new Error("Ctx cannot be null");this._ctx=T,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.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 s=Math.floor(this._canvas.width/3),d=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=s,i.center=d,i.right=s,this._refreshDrawHeightConstants(),n.full=0,n.left=0,n.center=i.left,n.right=i.left+i.center}_refreshDrawHeightConstants(){f.full=Math.round(2*this._coreBrowserService.dpr);const s=this._canvas.height/this._bufferService.buffer.lines.length,d=Math.round(Math.max(Math.min(s,12),6)*this._coreBrowserService.dpr);f.left=d,f.center=d,f.right=d}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.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 d of this._decorationService.decorations)this._colorZoneStore.addDecoration(d);this._ctx.lineWidth=1;const s=this._colorZoneStore.zones;for(const d of s)d.position!=="full"&&this._renderColorZone(d);for(const d of s)d.position==="full"&&this._renderColorZone(d);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(s){this._ctx.fillStyle=s.color,this._ctx.fillRect(n[s.position||"full"],Math.round((this._canvas.height-1)*(s.startBufferLine/this._bufferService.buffers.active.lines.length)-f[s.position||"full"]/2),i[s.position||"full"],Math.round((this._canvas.height-1)*((s.endBufferLine-s.startBufferLine)/this._bufferService.buffers.active.lines.length)+f[s.position||"full"]))}_queueRefresh(s,d){this._shouldUpdateDimensions=s||this._shouldUpdateDimensions,this._shouldUpdateAnchor=d||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=r=l([_(2,C.IBufferService),_(3,C.IDecorationService),_(4,p.IRenderService),_(5,C.IOptionsService),_(6,p.ICoreBrowserService)],r)},2950:function(k,t,o){var l=this&&this.__decorate||function(f,i,n,r){var s,d=arguments.length,S=d<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,n):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(f,i,n,r);else for(var b=f.length-1;b>=0;b--)(s=f[b])&&(S=(d<3?s(S):d>3?s(i,n,S):s(i,n))||S);return d>3&&S&&Object.defineProperty(i,n,S),S},_=this&&this.__param||function(f,i){return function(n,r){i(n,r,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const h=o(4725),p=o(2585),v=o(2584);let C=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(f,i,n,r,s,d){this._textarea=f,this._compositionView=i,this._bufferService=n,this._optionsService=r,this._coreService=s,this._renderService=d,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(f){this._compositionView.textContent=f.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(f){if(this._isComposing||this._isSendingComposition){if(f.keyCode===229||f.keyCode===16||f.keyCode===17||f.keyCode===18)return!1;this._finalizeComposition(!1)}return f.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(f){if(this._compositionView.classList.remove("active"),this._isComposing=!1,f){const i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let n;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,n=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;const i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){const f=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const i=this._textarea.value,n=i.replace(f,"");this._dataAlreadySent=n,i.length>f.length?this._coreService.triggerDataEvent(n,!0):i.length<f.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):i.length===f.length&&i!==f&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(f){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const d=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(d.width,1)+"px",this._textarea.style.height=Math.max(d.height,1)+"px",this._textarea.style.lineHeight=d.height+"px"}f||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=C=l([_(2,p.IBufferService),_(3,p.IOptionsService),_(4,p.ICoreService),_(5,h.IRenderService)],C)},9806:(k,t)=>{function o(l,_,h){const p=h.getBoundingClientRect(),v=l.getComputedStyle(h),C=parseInt(v.getPropertyValue("padding-left")),f=parseInt(v.getPropertyValue("padding-top"));return[_.clientX-p.left-C,_.clientY-p.top-f]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=o,t.getCoords=function(l,_,h,p,v,C,f,i,n){if(!C)return;const r=o(l,_,h);return r?(r[0]=Math.ceil((r[0]+(n?f/2:0))/f),r[1]=Math.ceil(r[1]/i),r[0]=Math.min(Math.max(r[0],1),p+(n?1:0)),r[1]=Math.min(Math.max(r[1],1),v),r):void 0}},9504:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const l=o(2584);function _(i,n,r,s){const d=i-h(i,r),S=n-h(n,r),b=Math.abs(d-S)-function(w,g,E){let T=0;const B=w-h(w,E),O=g-h(g,E);for(let D=0;D<Math.abs(B-O);D++){const P=p(w,g)==="A"?-1:1,F=E.buffer.lines.get(B+P*D);F!=null&&F.isWrapped&&T++}return T}(i,n,r);return f(b,C(p(i,n),s))}function h(i,n){let r=0,s=n.buffer.lines.get(i),d=s==null?void 0:s.isWrapped;for(;d&&i>=0&&i<n.rows;)r++,s=n.buffer.lines.get(--i),d=s==null?void 0:s.isWrapped;return r}function p(i,n){return i>n?"A":"B"}function v(i,n,r,s,d,S){let b=i,w=n,g="";for(;b!==r||w!==s;)b+=d?1:-1,d&&b>S.cols-1?(g+=S.buffer.translateBufferLineToString(w,!1,i,b),b=0,i=0,w++):!d&&b<0&&(g+=S.buffer.translateBufferLineToString(w,!1,0,i+1),b=S.cols-1,i=b,w--);return g+S.buffer.translateBufferLineToString(w,!1,i,b)}function C(i,n){const r=n?"O":"[";return l.C0.ESC+r+i}function f(i,n){i=Math.floor(i);let r="";for(let s=0;s<i;s++)r+=n;return r}t.moveToCellSequence=function(i,n,r,s){const d=r.buffer.x,S=r.buffer.y;if(!r.buffer.hasScrollback)return function(g,E,T,B,O,D){return _(E,B,O,D).length===0?"":f(v(g,E,g,E-h(E,O),!1,O).length,C("D",D))}(d,S,0,n,r,s)+_(S,n,r,s)+function(g,E,T,B,O,D){let P;P=_(E,B,O,D).length>0?B-h(B,O):E;const F=B,U=function(G,$,x,L,A,M){let N;return N=_(x,L,A,M).length>0?L-h(L,A):$,G<x&&N<=L||G>=x&&N<L?"C":"D"}(g,E,T,B,O,D);return f(v(g,P,T,F,U==="C",O).length,C(U,D))}(d,S,i,n,r,s);let b;if(S===n)return b=d>i?"D":"C",f(Math.abs(d-i),C(b,s));b=S>n?"D":"C";const w=Math.abs(S-n);return f(function(g,E){return E.cols-g}(S>n?i:d,r)+(w-1)*r.cols+1+((S>n?d:i)-1),C(b,s))}},1296:function(k,t,o){var l=this&&this.__decorate||function(D,P,F,U){var G,$=arguments.length,x=$<3?P:U===null?U=Object.getOwnPropertyDescriptor(P,F):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(D,P,F,U);else for(var L=D.length-1;L>=0;L--)(G=D[L])&&(x=($<3?G(x):$>3?G(P,F,x):G(P,F))||x);return $>3&&x&&Object.defineProperty(P,F,x),x},_=this&&this.__param||function(D,P){return function(F,U){P(F,U,D)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const h=o(3787),p=o(2550),v=o(2223),C=o(6171),f=o(6052),i=o(4725),n=o(8055),r=o(8460),s=o(844),d=o(2585),S="xterm-dom-renderer-owner-",b="xterm-rows",w="xterm-fg-",g="xterm-bg-",E="xterm-focus",T="xterm-selection";let B=1,O=t.DomRenderer=class extends s.Disposable{constructor(D,P,F,U,G,$,x,L,A,M,N,z,J){super(),this._terminal=D,this._document=P,this._element=F,this._screenElement=U,this._viewportElement=G,this._helperContainer=$,this._linkifier2=x,this._charSizeService=A,this._optionsService=M,this._bufferService=N,this._coreBrowserService=z,this._themeService=J,this._terminalClass=B++,this._rowElements=[],this._selectionRenderModel=(0,f.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new r.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(b),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(T),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,C.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(ee=>this._injectCss(ee))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(h.DomRendererRowFactory,document),this._element.classList.add(S+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(ee=>this._handleLinkHover(ee))),this.register(this._linkifier2.onHideLinkUnderline(ee=>this._handleLinkLeave(ee))),this.register((0,s.toDisposable)(()=>{this._element.classList.remove(S+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new p.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 P=`${this._terminalSelector} .${b} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=P,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 P=`${this._terminalSelector} .${b} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;P+=`${this._terminalSelector} .${b} .xterm-dim { color: ${n.color.multiplyOpacity(D.foreground,.5).css};}`,P+=`${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}`,G=`blink_block_${this._terminalClass}`;P+=`@keyframes ${F} { 50% { border-bottom-style: hidden; }}`,P+=`@keyframes ${U} { 50% { box-shadow: none; }}`,P+=`@keyframes ${G} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,P+=`${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,P+=`${this._terminalSelector} .${T} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${T} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${T} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(const[$,x]of D.ansi.entries())P+=`${this._terminalSelector} .${w}${$} { color: ${x.css}; }${this._terminalSelector} .${w}${$}.xterm-dim { color: ${n.color.multiplyOpacity(x,.5).css}; }${this._terminalSelector} .${g}${$} { background-color: ${x.css}; }`;P+=`${this._terminalSelector} .${w}${v.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(D.background).css}; }${this._terminalSelector} .${w}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${g}${v.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=P}_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,P){for(let F=this._rowElements.length;F<=P;F++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>P;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,P){this._refreshRowElements(D,P),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(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(D,P,F){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,P,F),this.renderRows(0,this._bufferService.rows-1),!D||!P)return;this._selectionRenderModel.update(this._terminal,D,P,F);const U=this._selectionRenderModel.viewportStartRow,G=this._selectionRenderModel.viewportEndRow,$=this._selectionRenderModel.viewportCappedStartRow,x=this._selectionRenderModel.viewportCappedEndRow;if($>=this._bufferService.rows||x<0)return;const L=this._document.createDocumentFragment();if(F){const A=D[0]>P[0];L.appendChild(this._createSelectionElement($,A?P[0]:D[0],A?D[0]:P[0],x-$+1))}else{const A=U===$?D[0]:0,M=$===G?P[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement($,A,M));const N=x-$-1;if(L.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,N)),$!==x){const z=G===x?P[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(x,0,z))}}this._selectionContainer.appendChild(L)}_createSelectionElement(D,P,F,U=1){const G=this._document.createElement("div"),$=P*this.dimensions.css.cell.width;let x=this.dimensions.css.cell.width*(F-P);return $+x>this.dimensions.css.canvas.width&&(x=this.dimensions.css.canvas.width-$),G.style.height=U*this.dimensions.css.cell.height+"px",G.style.top=D*this.dimensions.css.cell.height+"px",G.style.left=`${$}px`,G.style.width=`${x}px`,G}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,P){const F=this._bufferService.buffer,U=F.ybase+F.y,G=Math.min(F.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,x=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let A=D;A<=P;A++){const M=A+F.ydisp,N=this._rowElements[A],z=F.lines.get(M);if(!N||!z)break;N.replaceChildren(...this._rowFactory.createRow(z,M,M===U,x,L,G,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${S}${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,P,F,U,G,$){F<0&&(D=0),U<0&&(P=0);const x=this._bufferService.rows-1;F=Math.max(Math.min(F,x),0),U=Math.max(Math.min(U,x),0),G=Math.min(G,this._bufferService.cols);const L=this._bufferService.buffer,A=L.ybase+L.y,M=Math.min(L.x,G-1),N=this._optionsService.rawOptions.cursorBlink,z=this._optionsService.rawOptions.cursorStyle,J=this._optionsService.rawOptions.cursorInactiveStyle;for(let ee=F;ee<=U;++ee){const I=ee+L.ydisp,R=this._rowElements[ee],W=L.lines.get(I);if(!R||!W)break;R.replaceChildren(...this._rowFactory.createRow(W,I,I===A,z,J,M,N,this.dimensions.css.cell.width,this._widthCache,$?ee===F?D:0:-1,$?(ee===U?P:G)-1:-1))}}};t.DomRenderer=O=l([_(7,d.IInstantiationService),_(8,i.ICharSizeService),_(9,d.IOptionsService),_(10,d.IBufferService),_(11,i.ICoreBrowserService),_(12,i.IThemeService)],O)},3787:function(k,t,o){var l=this&&this.__decorate||function(b,w,g,E){var T,B=arguments.length,O=B<3?w:E===null?E=Object.getOwnPropertyDescriptor(w,g):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(b,w,g,E);else for(var D=b.length-1;D>=0;D--)(T=b[D])&&(O=(B<3?T(O):B>3?T(w,g,O):T(w,g))||O);return B>3&&O&&Object.defineProperty(w,g,O),O},_=this&&this.__param||function(b,w){return function(g,E){w(g,E,b)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const h=o(2223),p=o(643),v=o(511),C=o(2585),f=o(8055),i=o(4725),n=o(4269),r=o(6171),s=o(3734);let d=t.DomRendererRowFactory=class{constructor(b,w,g,E,T,B,O){this._document=b,this._characterJoinerService=w,this._optionsService=g,this._coreBrowserService=E,this._coreService=T,this._decorationService=B,this._themeService=O,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(b,w,g){this._selectionStart=b,this._selectionEnd=w,this._columnSelectMode=g}createRow(b,w,g,E,T,B,O,D,P,F,U){const G=[],$=this._characterJoinerService.getJoinedCharacters(w),x=this._themeService.colors;let L,A=b.getNoBgTrimmedLength();g&&A<B+1&&(A=B+1);let M=0,N="",z=0,J=0,ee=0,I=!1,R=0,W=!1,H=0;const Z=[],V=F!==-1&&U!==-1;for(let ie=0;ie<A;ie++){b.loadCell(ie,this._workCell);let ce=this._workCell.getWidth();if(ce===0)continue;let he=!1,ue=ie,te=this._workCell;if($.length>0&&ie===$[0][0]){he=!0;const oe=$.shift();te=new n.JoinedCellData(this._workCell,b.translateToString(!0,oe[0],oe[1]),oe[1]-oe[0]),ue=oe[1]-1,ce=te.getWidth()}const ze=this._isCellInSelection(ie,w),Rt=g&&ie===B,Lt=V&&ie>=F&&ie<=U;let Dt=!1;this._decorationService.forEachDecorationAtCell(ie,w,void 0,oe=>{Dt=!0});let ut=te.getChars()||p.WHITESPACE_CELL_CHAR;if(ut===" "&&(te.isUnderline()||te.isOverline())&&(ut=" "),H=ce*D-P.get(ut,te.isBold(),te.isItalic()),L){if(M&&(ze&&W||!ze&&!W&&te.bg===z)&&(ze&&W&&x.selectionForeground||te.fg===J)&&te.extended.ext===ee&&Lt===I&&H===R&&!Rt&&!he&&!Dt){te.isInvisible()?N+=p.WHITESPACE_CELL_CHAR:N+=ut,M++;continue}M&&(L.textContent=N),L=this._document.createElement("span"),M=0,N=""}else L=this._document.createElement("span");if(z=te.bg,J=te.fg,ee=te.extended.ext,I=Lt,R=H,W=ze,he&&B>=ie&&B<=ue&&(B=ie),!this._coreService.isCursorHidden&&Rt&&this._coreService.isCursorInitialized){if(Z.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&Z.push("xterm-cursor-blink"),Z.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(T)switch(T){case"outline":Z.push("xterm-cursor-outline");break;case"block":Z.push("xterm-cursor-block");break;case"bar":Z.push("xterm-cursor-bar");break;case"underline":Z.push("xterm-cursor-underline")}}if(te.isBold()&&Z.push("xterm-bold"),te.isItalic()&&Z.push("xterm-italic"),te.isDim()&&Z.push("xterm-dim"),N=te.isInvisible()?p.WHITESPACE_CELL_CHAR:te.getChars()||p.WHITESPACE_CELL_CHAR,te.isUnderline()&&(Z.push(`xterm-underline-${te.extended.underlineStyle}`),N===" "&&(N=" "),!te.isUnderlineColorDefault()))if(te.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(te.getUnderlineColor()).join(",")})`;else{let oe=te.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&te.isBold()&&oe<8&&(oe+=8),L.style.textDecorationColor=x.ansi[oe].css}te.isOverline()&&(Z.push("xterm-overline"),N===" "&&(N=" ")),te.isStrikethrough()&&Z.push("xterm-strikethrough"),Lt&&(L.style.textDecoration="underline");let _e=te.getFgColor(),qe=te.getFgColorMode(),be=te.getBgColor(),Ve=te.getBgColorMode();const Tt=!!te.isInverse();if(Tt){const oe=_e;_e=be,be=oe;const Tr=qe;qe=Ve,Ve=Tr}let Re,ft,Le,Ze=!1;switch(this._decorationService.forEachDecorationAtCell(ie,w,void 0,oe=>{oe.options.layer!=="top"&&Ze||(oe.backgroundColorRGB&&(Ve=50331648,be=oe.backgroundColorRGB.rgba>>8&16777215,Re=oe.backgroundColorRGB),oe.foregroundColorRGB&&(qe=50331648,_e=oe.foregroundColorRGB.rgba>>8&16777215,ft=oe.foregroundColorRGB),Ze=oe.options.layer==="top")}),!Ze&&ze&&(Re=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,be=Re.rgba>>8&16777215,Ve=50331648,Ze=!0,x.selectionForeground&&(qe=50331648,_e=x.selectionForeground.rgba>>8&16777215,ft=x.selectionForeground)),Ze&&Z.push("xterm-decoration-top"),Ve){case 16777216:case 33554432:Le=x.ansi[be],Z.push(`xterm-bg-${be}`);break;case 50331648:Le=f.channels.toColor(be>>16,be>>8&255,255&be),this._addStyle(L,`background-color:#${S((be>>>0).toString(16),"0",6)}`);break;default:Tt?(Le=x.foreground,Z.push(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)):Le=x.background}switch(Re||te.isDim()&&(Re=f.color.multiplyOpacity(Le,.5)),qe){case 16777216:case 33554432:te.isBold()&&_e<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(_e+=8),this._applyMinimumContrast(L,Le,x.ansi[_e],te,Re,void 0)||Z.push(`xterm-fg-${_e}`);break;case 50331648:const oe=f.channels.toColor(_e>>16&255,_e>>8&255,255&_e);this._applyMinimumContrast(L,Le,oe,te,Re,ft)||this._addStyle(L,`color:#${S(_e.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Le,x.foreground,te,Re,ft)||Tt&&Z.push(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)}Z.length&&(L.className=Z.join(" "),Z.length=0),Rt||he||Dt?L.textContent=N:M++,H!==this.defaultSpacing&&(L.style.letterSpacing=`${H}px`),G.push(L),ie=ue}return L&&M&&(L.textContent=N),G}_applyMinimumContrast(b,w,g,E,T,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,r.treatGlyphAsBackgroundColor)(E.getCode()))return!1;const O=this._getContrastCache(E);let D;if(T||B||(D=O.getColor(w.rgba,g.rgba)),D===void 0){const P=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);D=f.color.ensureContrastRatio(T||w,B||g,P),O.setColor((T||w).rgba,(B||g).rgba,D??null)}return!!D&&(this._addStyle(b,`color:${D.css}`),!0)}_getContrastCache(b){return b.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(b,w){b.setAttribute("style",`${b.getAttribute("style")||""}${w};`)}_isCellInSelection(b,w){const g=this._selectionStart,E=this._selectionEnd;return!(!g||!E)&&(this._columnSelectMode?g[0]<=E[0]?b>=g[0]&&w>=g[1]&&b<E[0]&&w<=E[1]:b<g[0]&&w>=g[1]&&b>=E[0]&&w<=E[1]:w>g[1]&&w<E[1]||g[1]===E[1]&&w===g[1]&&b>=g[0]&&b<E[0]||g[1]<E[1]&&w===E[1]&&b<E[0]||g[1]<E[1]&&w===g[1]&&b>=g[0])}};function S(b,w,g){for(;b.length<g;)b=w+b;return b}t.DomRendererRowFactory=d=l([_(1,i.ICharacterJoinerService),_(2,C.IOptionsService),_(3,i.ICoreBrowserService),_(4,C.ICoreService),_(5,C.IDecorationService),_(6,i.IThemeService)],d)},2550:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(o,l){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.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 _=o.createElement("span");_.classList.add("xterm-char-measure-element");const h=o.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold";const p=o.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontStyle="italic";const v=o.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[_,h,p,v],this._container.appendChild(_),this._container.appendChild(h),this._container.appendChild(p),this._container.appendChild(v),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(o,l,_,h){o===this._font&&l===this._fontSize&&_===this._weight&&h===this._weightBold||(this._font=o,this._fontSize=l,this._weight=_,this._weightBold=h,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${_}`,this._measureElements[1].style.fontWeight=`${h}`,this._measureElements[2].style.fontWeight=`${_}`,this._measureElements[3].style.fontWeight=`${h}`,this.clear())}get(o,l,_){let h=0;if(!l&&!_&&o.length===1&&(h=o.charCodeAt(0))<256){if(this._flat[h]!==-9999)return this._flat[h];const C=this._measure(o,0);return C>0&&(this._flat[h]=C),C}let p=o;l&&(p+="B"),_&&(p+="I");let v=this._holey.get(p);if(v===void 0){let C=0;l&&(C|=1),_&&(C|=2),v=this._measure(o,C),v>0&&this._holey.set(p,v)}return v}_measure(o,l){const _=this._measureElements[l];return _.textContent=o.repeat(32),_.offsetWidth/32}}},2223:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const l=o(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},6171:(k,t)=>{function o(_){return 57508<=_&&_<=57558}function l(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},t.isPowerlineGlyph=o,t.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},t.isEmoji=l,t.allowRescaling=function(_,h,p,v){return h===1&&p>Math.ceil(1.5*v)&&_!==void 0&&_>255&&!l(_)&&!o(_)&&!function(C){return 57344<=C&&C<=63743}(_)},t.treatGlyphAsBackgroundColor=function(_){return o(_)||function(h){return 9472<=h&&h<=9631}(_)},t.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}}}},t.computeNextVariantOffset=function(_,h,p=0){return(_-(2*Math.round(h)-p))%(2*Math.round(h))}},6052:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class o{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(_,h,p,v=!1){if(this.selectionStart=h,this.selectionEnd=p,!h||!p||h[0]===p[0]&&h[1]===p[1])return void this.clear();const C=_.buffers.active.ydisp,f=h[1]-C,i=p[1]-C,n=Math.max(f,0),r=Math.min(i,_.rows-1);n>=_.rows||r<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=f,this.viewportEndRow=i,this.viewportCappedStartRow=n,this.viewportCappedEndRow=r,this.startCol=h[0],this.endCol=p[0])}isCellSelected(_,h,p){return!!this.hasSelection&&(p-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?h>=this.startCol&&p>=this.viewportCappedStartRow&&h<this.endCol&&p<=this.viewportCappedEndRow:h<this.startCol&&p>=this.viewportCappedStartRow&&h>=this.endCol&&p<=this.viewportCappedEndRow:p>this.viewportStartRow&&p<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&p===this.viewportStartRow&&h>=this.startCol&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportEndRow&&h<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportStartRow&&h>=this.startCol)}}t.createSelectionRenderModel=function(){return new o}},456:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(o){this._bufferService=o,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 o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,l=this.selectionEnd;return!(!o||!l)&&(o[1]>l[1]||o[1]===l[1]&&o[0]>l[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(k,t,o){var l=this&&this.__decorate||function(r,s,d,S){var b,w=arguments.length,g=w<3?s:S===null?S=Object.getOwnPropertyDescriptor(s,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,s,d,S);else for(var E=r.length-1;E>=0;E--)(b=r[E])&&(g=(w<3?b(g):w>3?b(s,d,g):b(s,d))||g);return w>3&&g&&Object.defineProperty(s,d,g),g},_=this&&this.__param||function(r,s){return function(d,S){s(d,S,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const h=o(2585),p=o(8460),v=o(844);let C=t.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(r,s,d){super(),this._optionsService=d,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new n(this._optionsService))}catch{this._measureStrategy=this.register(new i(r,s,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())}};t.CharSizeService=C=l([_(2,h.IOptionsService)],C);class f extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(s,d){s!==void 0&&s>0&&d!==void 0&&d>0&&(this._result.width=s,this._result.height=d)}}class i extends f{constructor(s,d,S){super(),this._document=s,this._parentElement=d,this._optionsService=S,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 n extends f{constructor(s){super(),this._optionsService=s,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const d=this._ctx.measureText("W");if(!("width"in d&&"fontBoundingBoxAscent"in d&&"fontBoundingBoxDescent"in d))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const s=this._ctx.measureText("W");return this._validateAndSet(s.width,s.fontBoundingBoxAscent+s.fontBoundingBoxDescent),this._result}}},4269:function(k,t,o){var l=this&&this.__decorate||function(n,r,s,d){var S,b=arguments.length,w=b<3?r:d===null?d=Object.getOwnPropertyDescriptor(r,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,r,s,d);else for(var g=n.length-1;g>=0;g--)(S=n[g])&&(w=(b<3?S(w):b>3?S(r,s,w):S(r,s))||w);return b>3&&w&&Object.defineProperty(r,s,w),w},_=this&&this.__param||function(n,r){return function(s,d){r(s,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const h=o(3734),p=o(643),v=o(511),C=o(2585);class f extends h.AttributeData{constructor(r,s,d){super(),this.content=0,this.combinedData="",this.fg=r.fg,this.bg=r.bg,this.combinedData=s,this._width=d}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()]}}t.JoinedCellData=f;let i=t.CharacterJoinerService=class mr{constructor(r){this._bufferService=r,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(r){const s={id:this._nextCharacterJoinerId++,handler:r};return this._characterJoiners.push(s),s.id}deregister(r){for(let s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===r)return this._characterJoiners.splice(s,1),!0;return!1}getJoinedCharacters(r){if(this._characterJoiners.length===0)return[];const s=this._bufferService.buffer.lines.get(r);if(!s||s.length===0)return[];const d=[],S=s.translateToString(!0);let b=0,w=0,g=0,E=s.getFg(0),T=s.getBg(0);for(let B=0;B<s.getTrimmedLength();B++)if(s.loadCell(B,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==T){if(B-b>1){const O=this._getJoinedRanges(S,g,w,s,b);for(let D=0;D<O.length;D++)d.push(O[D])}b=B,g=w,E=this._workCell.fg,T=this._workCell.bg}w+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-b>1){const B=this._getJoinedRanges(S,g,w,s,b);for(let O=0;O<B.length;O++)d.push(B[O])}return d}_getJoinedRanges(r,s,d,S,b){const w=r.substring(s,d);let g=[];try{g=this._characterJoiners[0].handler(w)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{const T=this._characterJoiners[E].handler(w);for(let B=0;B<T.length;B++)mr._mergeRanges(g,T[B])}catch(T){console.error(T)}return this._stringRangesToCellRanges(g,S,b),g}_stringRangesToCellRanges(r,s,d){let S=0,b=!1,w=0,g=r[S];if(g){for(let E=d;E<this._bufferService.cols;E++){const T=s.getWidth(E),B=s.getString(E).length||p.WHITESPACE_CELL_CHAR.length;if(T!==0){if(!b&&g[0]<=w&&(g[0]=E,b=!0),g[1]<=w){if(g[1]=E,g=r[++S],!g)break;g[0]<=w?(g[0]=E,b=!0):b=!1}w+=B}}g&&(g[1]=this._bufferService.cols)}}static _mergeRanges(r,s){let d=!1;for(let S=0;S<r.length;S++){const b=r[S];if(d){if(s[1]<=b[0])return r[S-1][1]=s[1],r;if(s[1]<=b[1])return r[S-1][1]=Math.max(s[1],b[1]),r.splice(S,1),r;r.splice(S,1),S--}else{if(s[1]<=b[0])return r.splice(S,0,s),r;if(s[1]<=b[1])return b[0]=Math.min(s[0],b[0]),r;s[0]<b[1]&&(b[0]=Math.min(s[0],b[0]),d=!0)}}return d?r[r.length-1][1]=s[1]:r.push(s),r}};t.CharacterJoinerService=i=l([_(0,C.IBufferService)],i)},5114:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const l=o(844),_=o(8460),h=o(3656);class p extends l.Disposable{constructor(f,i,n){super(),this._textarea=f,this._window=i,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new _.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this.register((0,_.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(f){this._window!==f&&(this._window=f,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}}t.CoreBrowserService=p;class v extends l.Disposable{constructor(f){super(),this._parentWindow=f,this._windowResizeListener=this.register(new l.MutableDisposable),this._onDprChange=this.register(new _.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(f){this._parentWindow=f,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 f;this._outerListener&&((f=this._resolutionMediaMatchList)==null||f.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:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const l=o(844);class _ extends l.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,l.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(p){return this.linkProviders.push(p),{dispose:()=>{const v=this.linkProviders.indexOf(p);v!==-1&&this.linkProviders.splice(v,1)}}}}t.LinkProviderService=_},8934:function(k,t,o){var l=this&&this.__decorate||function(C,f,i,n){var r,s=arguments.length,d=s<3?f:n===null?n=Object.getOwnPropertyDescriptor(f,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(C,f,i,n);else for(var S=C.length-1;S>=0;S--)(r=C[S])&&(d=(s<3?r(d):s>3?r(f,i,d):r(f,i))||d);return s>3&&d&&Object.defineProperty(f,i,d),d},_=this&&this.__param||function(C,f){return function(i,n){f(i,n,C)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const h=o(4725),p=o(9806);let v=t.MouseService=class{constructor(C,f){this._renderService=C,this._charSizeService=f}getCoords(C,f,i,n,r){return(0,p.getCoords)(window,C,f,i,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(C,f){const i=(0,p.getCoordsRelativeToElement)(window,C,f);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};t.MouseService=v=l([_(0,h.IRenderService),_(1,h.ICharSizeService)],v)},3230:function(k,t,o){var l=this&&this.__decorate||function(r,s,d,S){var b,w=arguments.length,g=w<3?s:S===null?S=Object.getOwnPropertyDescriptor(s,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,s,d,S);else for(var E=r.length-1;E>=0;E--)(b=r[E])&&(g=(w<3?b(g):w>3?b(s,d,g):b(s,d))||g);return w>3&&g&&Object.defineProperty(s,d,g),g},_=this&&this.__param||function(r,s){return function(d,S){s(d,S,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const h=o(6193),p=o(4725),v=o(8460),C=o(844),f=o(7226),i=o(2585);let n=t.RenderService=class extends C.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(r,s,d,S,b,w,g,E){super(),this._rowCount=r,this._charSizeService=S,this._renderer=this.register(new C.MutableDisposable),this._pausedResizeTask=new f.DebouncedIdleTask,this._observerDisposable=this.register(new C.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 v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new h.RenderDebouncer((T,B)=>this._renderRows(T,B),g),this.register(this._renderDebouncer),this.register(g.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(w.onResize(()=>this._fullRefresh())),this.register(w.buffers.onBufferActivate(()=>{var T;return(T=this._renderer.value)==null?void 0:T.clear()})),this.register(d.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(b.onDecorationRegistered(()=>this._fullRefresh())),this.register(b.onDecorationRemoved(()=>this._fullRefresh())),this.register(d.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(w.cols,w.rows),this._fullRefresh()})),this.register(d.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(w.buffer.y,w.buffer.y,!0))),this.register(E.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(g.window,s),this.register(g.onWindowChange(T=>this._registerIntersectionObserver(T,s)))}_registerIntersectionObserver(r,s){if("IntersectionObserver"in r){const d=new r.IntersectionObserver(S=>this._handleIntersectionChange(S[S.length-1]),{threshold:0});d.observe(s),this._observerDisposable.value=(0,C.toDisposable)(()=>d.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,s,d=!1){this._isPaused?this._needsFullRefresh=!0:(d||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(r,s,this._rowCount))}_renderRows(r,s){this._renderer.value&&(r=Math.min(r,this._rowCount-1),s=Math.min(s,this._rowCount-1),this._renderer.value.renderRows(r,s),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:s}),this._onRender.fire({start:r,end:s}),this._isNextRenderRedrawOnly=!0)}resize(r,s){this._rowCount=s,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(s=>this.refreshRows(s.start,s.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,s;this._renderer.value&&((s=(r=this._renderer.value).clearTextureAtlas)==null||s.call(r),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(r,s){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var d;return(d=this._renderer.value)==null?void 0:d.handleResize(r,s)}):this._renderer.value.handleResize(r,s),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,s,d){var S;this._selectionState.start=r,this._selectionState.end=s,this._selectionState.columnSelectMode=d,(S=this._renderer.value)==null||S.handleSelectionChanged(r,s,d)}handleCursorMove(){var r;(r=this._renderer.value)==null||r.handleCursorMove()}clear(){var r;(r=this._renderer.value)==null||r.clear()}};t.RenderService=n=l([_(2,i.IOptionsService),_(3,p.ICharSizeService),_(4,i.IDecorationService),_(5,i.IBufferService),_(6,p.ICoreBrowserService),_(7,p.IThemeService)],n)},9312:function(k,t,o){var l=this&&this.__decorate||function(g,E,T,B){var O,D=arguments.length,P=D<3?E:B===null?B=Object.getOwnPropertyDescriptor(E,T):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(g,E,T,B);else for(var F=g.length-1;F>=0;F--)(O=g[F])&&(P=(D<3?O(P):D>3?O(E,T,P):O(E,T))||P);return D>3&&P&&Object.defineProperty(E,T,P),P},_=this&&this.__param||function(g,E){return function(T,B){E(T,B,g)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const h=o(9806),p=o(9504),v=o(456),C=o(4725),f=o(8460),i=o(844),n=o(6114),r=o(4841),s=o(511),d=o(2585),S=" ",b=new RegExp(S,"g");let w=t.SelectionService=class extends i.Disposable{constructor(g,E,T,B,O,D,P,F,U){super(),this._element=g,this._screenElement=E,this._linkifier=T,this._bufferService=B,this._coreService=O,this._mouseService=D,this._optionsService=P,this._renderService=F,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new s.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new f.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new f.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new f.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=G=>this._handleMouseMove(G),this._mouseUpListener=G=>this._handleMouseUp(G),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(G=>this._handleTrim(G)),this.register(this._bufferService.buffers.onBufferActivate(G=>this._handleBufferActivate(G))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.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 g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!g||!E||g[0]===E[0]&&g[1]===E[1])}get selectionText(){const g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!g||!E)return"";const T=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(g[0]===E[0])return"";const O=g[0]<E[0]?g[0]:E[0],D=g[0]<E[0]?E[0]:g[0];for(let P=g[1];P<=E[1];P++){const F=T.translateBufferLineToString(P,!0,O,D);B.push(F)}}else{const O=g[1]===E[1]?E[0]:void 0;B.push(T.translateBufferLineToString(g[1],!0,g[0],O));for(let D=g[1]+1;D<=E[1]-1;D++){const P=T.lines.get(D),F=T.translateBufferLineToString(D,!0);P!=null&&P.isWrapped?B[B.length-1]+=F:B.push(F)}if(g[1]!==E[1]){const D=T.lines.get(E[1]),P=T.translateBufferLineToString(E[1],!0,0,E[0]);D&&D.isWrapped?B[B.length-1]+=P:B.push(P)}}return B.map(O=>O.replace(b," ")).join(n.isWindows?`\r
5
+ WARNING: This link could potentially be dangerous`)){const n=window.open();if(n){try{n.opener=null}catch{}n.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}t.OscLinkProvider=v=l([_(0,p.IBufferService),_(1,p.IOptionsService),_(2,p.IOscLinkService)],v)},6193:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(o,l){this._renderCallback=o,this._coreBrowserService=l,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(o){return this._refreshCallbacks.push(o),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(o,l,_){this._rowCount=_,o=o!==void 0?o:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,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 o=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,l),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const l=o(3614),_=o(3656),c=o(3551),p=o(9042),v=o(3730),C=o(1680),f=o(3107),i=o(5744),n=o(2950),r=o(1296),s=o(428),d=o(4269),S=o(5114),b=o(8934),w=o(3230),g=o(9312),E=o(4725),T=o(6731),B=o(8055),O=o(8969),D=o(8460),P=o(844),F=o(6114),U=o(8437),G=o(2584),$=o(7399),x=o(5941),L=o(9074),A=o(2585),M=o(5435),N=o(4567),z=o(779);class J 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(I={}){super(I),this.browser=F,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new P.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(L.DecorationService),this._instantiationService.setService(A.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(z.LinkProviderService),this._instantiationService.setService(E.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((R,W)=>this.refresh(R,W))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(R=>this._reportWindowsOptions(R))),this.register(this._inputHandler.onColor(R=>this._handleColorEvent(R))),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(R=>this._afterResize(R.cols,R.rows))),this.register((0,P.toDisposable)(()=>{var R,W;this._customKeyEventHandler=void 0,(W=(R=this.element)==null?void 0:R.parentNode)==null||W.removeChild(this.element)}))}_handleColorEvent(I){if(this._themeService)for(const R of I){let W,H="";switch(R.index){case 256:W="foreground",H="10";break;case 257:W="background",H="11";break;case 258:W="cursor",H="12";break;default:W="ansi",H="4;"+R.index}switch(R.type){case 0:const Z=B.color.toColorRGB(W==="ansi"?this._themeService.colors.ansi[R.index]:this._themeService.colors[W]);this.coreService.triggerDataEvent(`${G.C0.ESC}]${H};${(0,x.toRgbString)(Z)}${G.C1_ESCAPED.ST}`);break;case 1:if(W==="ansi")this._themeService.modifyColors(V=>V.ansi[R.index]=B.channels.toColor(...R.color));else{const V=W;this._themeService.modifyColors(ie=>ie[V]=B.channels.toColor(...R.color))}break;case 2:this._themeService.restoreColor(R.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(I){I?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(N.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(I){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var I;return(I=this.textarea)==null?void 0:I.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(G.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 I=this.buffer.ybase+this.buffer.y,R=this.buffer.lines.get(I);if(!R)return;const W=Math.min(this.buffer.x,this.cols-1),H=this._renderService.dimensions.css.cell.height,Z=R.getWidth(W),V=this._renderService.dimensions.css.cell.width*Z,ie=this.buffer.y*this._renderService.dimensions.css.cell.height,ce=W*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ce+"px",this.textarea.style.top=ie+"px",this.textarea.style.width=V+"px",this.textarea.style.height=H+"px",this.textarea.style.lineHeight=H+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,_.addDisposableDomListener)(this.element,"copy",R=>{this.hasSelection()&&(0,l.copyHandler)(R,this._selectionService)}));const I=R=>(0,l.handlePasteEvent)(R,this.textarea,this.coreService,this.optionsService);this.register((0,_.addDisposableDomListener)(this.textarea,"paste",I)),this.register((0,_.addDisposableDomListener)(this.element,"paste",I)),F.isFirefox?this.register((0,_.addDisposableDomListener)(this.element,"mousedown",R=>{R.button===2&&(0,l.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,_.addDisposableDomListener)(this.element,"contextmenu",R=>{(0,l.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),F.isLinux&&this.register((0,_.addDisposableDomListener)(this.element,"auxclick",R=>{R.button===1&&(0,l.moveTextAreaUnderMouseCursor)(R,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,_.addDisposableDomListener)(this.textarea,"keyup",I=>this._keyUp(I),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keydown",I=>this._keyDown(I),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"keypress",I=>this._keyPress(I),!0)),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionupdate",I=>this._compositionHelper.compositionupdate(I))),this.register((0,_.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,_.addDisposableDomListener)(this.textarea,"input",I=>this._inputEvent(I),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(I){var W;if(!I)throw new Error("Terminal requires a parent element.");if(I.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((W=this.element)==null?void 0:W.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=I.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"),I.appendChild(this.element);const R=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),R.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,_.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),R.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",p.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(S.CoreBrowserService,this.textarea,I.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(E.ICoreBrowserService,this._coreBrowserService),this.register((0,_.addDisposableDomListener)(this.textarea,"focus",H=>this._handleTextAreaFocus(H))),this.register((0,_.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(s.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(E.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(T.ThemeService),this._instantiationService.setService(E.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(d.CharacterJoinerService),this._instantiationService.setService(E.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(w.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(E.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(n.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(b.MouseService),this._instantiationService.setService(E.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(c.Linkifier,this.screenElement)),this.element.appendChild(R);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(C.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(g.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(E.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,_.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(f.BufferDecorationRenderer,this.screenElement)),this.register((0,_.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(N.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",H=>this._handleScreenReaderModeOptionChange(H))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",H=>{!this._overviewRulerRenderer&&H&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(i.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 I=this,R=this.element;function W(V){const ie=I._mouseService.getMouseReportCoords(V,I.screenElement);if(!ie)return!1;let ce,he;switch(V.overrideType||V.type){case"mousemove":he=32,V.buttons===void 0?(ce=3,V.button!==void 0&&(ce=V.button<3?V.button:3)):ce=1&V.buttons?0:4&V.buttons?1:2&V.buttons?2:3;break;case"mouseup":he=0,ce=V.button<3?V.button:3;break;case"mousedown":he=1,ce=V.button<3?V.button:3;break;case"wheel":if(I._customWheelEventHandler&&I._customWheelEventHandler(V)===!1||I.viewport.getLinesScrolled(V)===0)return!1;he=V.deltaY<0?0:1,ce=4;break;default:return!1}return!(he===void 0||ce===void 0||ce>4)&&I.coreMouseService.triggerMouseEvent({col:ie.col,row:ie.row,x:ie.x,y:ie.y,button:ce,action:he,ctrl:V.ctrlKey,alt:V.altKey,shift:V.shiftKey})}const H={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Z={mouseup:V=>(W(V),V.buttons||(this._document.removeEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.removeEventListener("mousemove",H.mousedrag)),this.cancel(V)),wheel:V=>(W(V),this.cancel(V,!0)),mousedrag:V=>{V.buttons&&W(V)},mousemove:V=>{V.buttons||W(V)}};this.register(this.coreMouseService.onProtocolChange(V=>{V?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(V)),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&V?H.mousemove||(R.addEventListener("mousemove",Z.mousemove),H.mousemove=Z.mousemove):(R.removeEventListener("mousemove",H.mousemove),H.mousemove=null),16&V?H.wheel||(R.addEventListener("wheel",Z.wheel,{passive:!1}),H.wheel=Z.wheel):(R.removeEventListener("wheel",H.wheel),H.wheel=null),2&V?H.mouseup||(H.mouseup=Z.mouseup):(this._document.removeEventListener("mouseup",H.mouseup),H.mouseup=null),4&V?H.mousedrag||(H.mousedrag=Z.mousedrag):(this._document.removeEventListener("mousemove",H.mousedrag),H.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,_.addDisposableDomListener)(R,"mousedown",V=>{if(V.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(V))return W(V),H.mouseup&&this._document.addEventListener("mouseup",H.mouseup),H.mousedrag&&this._document.addEventListener("mousemove",H.mousedrag),this.cancel(V)})),this.register((0,_.addDisposableDomListener)(R,"wheel",V=>{if(!H.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(V)===!1)return!1;if(!this.buffer.hasScrollback){const ie=this.viewport.getLinesScrolled(V);if(ie===0)return;const ce=G.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(V.deltaY<0?"A":"B");let he="";for(let ue=0;ue<Math.abs(ie);ue++)he+=ce;return this.coreService.triggerDataEvent(he,!0),this.cancel(V,!0)}return this.viewport.handleWheel(V)?this.cancel(V):void 0}},{passive:!1})),this.register((0,_.addDisposableDomListener)(R,"touchstart",V=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(V),this.cancel(V)},{passive:!0})),this.register((0,_.addDisposableDomListener)(R,"touchmove",V=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(V)?void 0:this.cancel(V)},{passive:!1}))}refresh(I,R){var W;(W=this._renderService)==null||W.refreshRows(I,R)}updateCursorStyle(I){var R;(R=this._selectionService)!=null&&R.shouldColumnSelect(I)?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(I,R,W=0){var H;W===1?(super.scrollLines(I,R,W),this.refresh(0,this.rows-1)):(H=this.viewport)==null||H.scrollLines(I)}paste(I){(0,l.paste)(I,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(I){this._customKeyEventHandler=I}attachCustomWheelEventHandler(I){this._customWheelEventHandler=I}registerLinkProvider(I){return this._linkProviderService.registerLinkProvider(I)}registerCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const R=this._characterJoinerService.register(I);return this.refresh(0,this.rows-1),R}deregisterCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(I)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(I){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+I)}registerDecoration(I){return this._decorationService.registerDecoration(I)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(I,R,W){this._selectionService.setSelection(I,R,W)}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 I;(I=this._selectionService)==null||I.clearSelection()}selectAll(){var I;(I=this._selectionService)==null||I.selectAll()}selectLines(I,R){var W;(W=this._selectionService)==null||W.selectLines(I,R)}_keyDown(I){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;const R=this.browser.isMac&&this.options.macOptionIsMeta&&I.altKey;if(!R&&!this._compositionHelper.keydown(I))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;R||I.key!=="Dead"&&I.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const W=(0,$.evaluateKeyboardEvent)(I,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(I),W.type===3||W.type===2){const H=this.rows-1;return this.scrollLines(W.type===2?-H:H),this.cancel(I,!0)}return W.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,I)||(W.cancel&&this.cancel(I,!0),!W.key||!!(I.key&&!I.ctrlKey&&!I.altKey&&!I.metaKey&&I.key.length===1&&I.key.charCodeAt(0)>=65&&I.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(W.key!==G.C0.ETX&&W.key!==G.C0.CR||(this.textarea.value=""),this._onKey.fire({key:W.key,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(W.key,!0),!this.optionsService.rawOptions.screenReaderMode||I.altKey||I.ctrlKey?this.cancel(I,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(I,R){const W=I.isMac&&!this.options.macOptionIsMeta&&R.altKey&&!R.ctrlKey&&!R.metaKey||I.isWindows&&R.altKey&&R.ctrlKey&&!R.metaKey||I.isWindows&&R.getModifierState("AltGraph");return R.type==="keypress"?W:W&&(!R.keyCode||R.keyCode>47)}_keyUp(I){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1||(function(R){return R.keyCode===16||R.keyCode===17||R.keyCode===18}(I)||this.focus(),this.updateCursorStyle(I),this._keyPressHandled=!1)}_keyPress(I){let R;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;if(this.cancel(I),I.charCode)R=I.charCode;else if(I.which===null||I.which===void 0)R=I.keyCode;else{if(I.which===0||I.charCode===0)return!1;R=I.which}return!(!R||(I.altKey||I.ctrlKey||I.metaKey)&&!this._isThirdLevelShift(this.browser,I)||(R=String.fromCharCode(R),this._onKey.fire({key:R,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(R,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(I){if(I.data&&I.inputType==="insertText"&&(!I.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const R=I.data;return this.coreService.triggerDataEvent(R,!0),this.cancel(I),!0}return!1}resize(I,R){I!==this.cols||R!==this.rows?super.resize(I,R):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(I,R){var W,H;(W=this._charSizeService)==null||W.measure(),(H=this.viewport)==null||H.syncScrollArea(!0)}clear(){var I;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 R=1;R<this.rows;R++)this.buffer.lines.push(this.buffer.getBlankLine(U.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(I=this.viewport)==null||I.reset(),this.refresh(0,this.rows-1)}}reset(){var R,W;this.options.rows=this.rows,this.options.cols=this.cols;const I=this._customKeyEventHandler;this._setup(),super.reset(),(R=this._selectionService)==null||R.reset(),this._decorationService.reset(),(W=this.viewport)==null||W.reset(),this._customKeyEventHandler=I,this.refresh(0,this.rows-1)}clearTextureAtlas(){var I;(I=this._renderService)==null||I.clearTextureAtlas()}_reportFocus(){var I;(I=this.element)!=null&&I.classList.contains("focus")?this.coreService.triggerDataEvent(G.C0.ESC+"[I"):this.coreService.triggerDataEvent(G.C0.ESC+"[O")}_reportWindowsOptions(I){if(this._renderService)switch(I){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const R=this._renderService.dimensions.css.canvas.width.toFixed(0),W=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[4;${W};${R}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const H=this._renderService.dimensions.css.cell.width.toFixed(0),Z=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${G.C0.ESC}[6;${Z};${H}t`)}}cancel(I,R){if(this.options.cancelEvents||R)return I.preventDefault(),I.stopPropagation(),!1}}t.Terminal=J},9924:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(o,l=1e3){this._renderCallback=o,this._debounceThresholdMS=l,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,l,_){this._rowCount=_,o=o!==void 0?o:0,l=l!==void 0?l:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,o):o,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,l):l;const c=Date.now();if(c-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=c,this._innerRefresh();else if(!this._additionalRefreshRequested){const p=c-this._lastRefreshMs,v=this._debounceThresholdMS-p;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),l=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,l)}}},1680:function(k,t,o){var l=this&&this.__decorate||function(n,r,s,d){var S,b=arguments.length,w=b<3?r:d===null?d=Object.getOwnPropertyDescriptor(r,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,r,s,d);else for(var g=n.length-1;g>=0;g--)(S=n[g])&&(w=(b<3?S(w):b>3?S(r,s,w):S(r,s))||w);return b>3&&w&&Object.defineProperty(r,s,w),w},_=this&&this.__param||function(n,r){return function(s,d){r(s,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const c=o(3656),p=o(4725),v=o(8460),C=o(844),f=o(2585);let i=t.Viewport=class extends C.Disposable{constructor(n,r,s,d,S,b,w,g){super(),this._viewportElement=n,this._scrollArea=r,this._bufferService=s,this._optionsService=d,this._charSizeService=S,this._renderService=b,this._coreBrowserService=w,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 v.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,c.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(E=>this._activeBuffer=E.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(E=>this._renderDimensions=E)),this._handleThemeChange(g.colors),this.register(g.onChangeColors(E=>this._handleThemeChange(E))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(n){this._viewportElement.style.backgroundColor=n.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(n){if(n)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 n=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==n&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=n),this._refreshAnimationFrame=null}syncScrollArea(n=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(n);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(n)}_handleScroll(n){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 n=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(n*(this._smoothScrollState.target-this._smoothScrollState.origin)),n<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(n,r){const s=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(r<0&&this._viewportElement.scrollTop!==0||r>0&&s<this._lastRecordedBufferHeight)||(n.cancelable&&n.preventDefault(),!1)}handleWheel(n){const r=this._getPixelsScrolled(n);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(n,r))}scrollLines(n){if(n!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const r=n*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:n,suppressScrollEvent:!1})}_getPixelsScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let r=this._applyScrollModifier(n.deltaY,n);return n.deltaMode===WheelEvent.DOM_DELTA_LINE?r*=this._currentRowHeight:n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._currentRowHeight*this._bufferService.rows),r}getBufferElements(n,r){var g;let s,d="";const S=[],b=r??this._bufferService.buffer.lines.length,w=this._bufferService.buffer.lines;for(let E=n;E<b;E++){const T=w.get(E);if(!T)continue;const B=(g=w.get(E+1))==null?void 0:g.isWrapped;if(d+=T.translateToString(!B),!B||E===w.length-1){const O=document.createElement("div");O.textContent=d,S.push(O),d.length>0&&(s=O),d=""}}return{bufferElements:S,cursorElement:s}}getLinesScrolled(n){if(n.deltaY===0||n.shiftKey)return 0;let r=this._applyScrollModifier(n.deltaY,n);return n.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):n.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(n,r){const s=this._optionsService.rawOptions.fastScrollModifier;return s==="alt"&&r.altKey||s==="ctrl"&&r.ctrlKey||s==="shift"&&r.shiftKey?n*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:n*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(n){this._lastTouchY=n.touches[0].pageY}handleTouchMove(n){const r=this._lastTouchY-n.touches[0].pageY;return this._lastTouchY=n.touches[0].pageY,r!==0&&(this._viewportElement.scrollTop+=r,this._bubbleScroll(n,r))}};t.Viewport=i=l([_(2,f.IBufferService),_(3,f.IOptionsService),_(4,p.ICharSizeService),_(5,p.IRenderService),_(6,p.ICoreBrowserService),_(7,p.IThemeService)],i)},3107:function(k,t,o){var l=this&&this.__decorate||function(f,i,n,r){var s,d=arguments.length,S=d<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,n):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(f,i,n,r);else for(var b=f.length-1;b>=0;b--)(s=f[b])&&(S=(d<3?s(S):d>3?s(i,n,S):s(i,n))||S);return d>3&&S&&Object.defineProperty(i,n,S),S},_=this&&this.__param||function(f,i){return function(n,r){i(n,r,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const c=o(4725),p=o(844),v=o(2585);let C=t.BufferDecorationRenderer=class extends p.Disposable{constructor(f,i,n,r,s){super(),this._screenElement=f,this._bufferService=i,this._coreBrowserService=n,this._decorationService=r,this._renderService=s,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(d=>this._removeDecoration(d))),this.register((0,p.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 f of this._decorationService.decorations)this._renderDecoration(f);this._dimensionsChanged=!1}_renderDecoration(f){this._refreshStyle(f),this._dimensionsChanged&&this._refreshXPosition(f)}_createElement(f){var r;const i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",((r=f==null?void 0:f.options)==null?void 0:r.layer)==="top"),i.style.width=`${Math.round((f.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=(f.options.height||1)*this._renderService.dimensions.css.cell.height+"px",i.style.top=(f.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const n=f.options.x??0;return n&&n>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(f,i),i}_refreshStyle(f){const i=f.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)f.element&&(f.element.style.display="none",f.onRenderEmitter.fire(f.element));else{let n=this._decorationElements.get(f);n||(n=this._createElement(f),f.element=n,this._decorationElements.set(f,n),this._container.appendChild(n),f.onDispose(()=>{this._decorationElements.delete(f),n.remove()})),n.style.top=i*this._renderService.dimensions.css.cell.height+"px",n.style.display=this._altBufferIsActive?"none":"block",f.onRenderEmitter.fire(n)}}_refreshXPosition(f,i=f.element){if(!i)return;const n=f.options.x??0;(f.options.anchor||"left")==="right"?i.style.right=n?n*this._renderService.dimensions.css.cell.width+"px":"":i.style.left=n?n*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(f){var i;(i=this._decorationElements.get(f))==null||i.remove(),this._decorationElements.delete(f),f.dispose()}};t.BufferDecorationRenderer=C=l([_(1,v.IBufferService),_(2,c.ICoreBrowserService),_(3,v.IDecorationService),_(4,c.IRenderService)],C)},5871:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.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(o){if(o.options.overviewRulerOptions){for(const l of this._zones)if(l.color===o.options.overviewRulerOptions.color&&l.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(l,o.marker.line))return;if(this._lineAdjacentToZone(l,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(l,o.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=o.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=o.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=o.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=o.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:o.options.overviewRulerOptions.color,position:o.options.overviewRulerOptions.position,startBufferLine:o.marker.line,endBufferLine:o.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(o){this._linePadding=o}_lineIntersectsZone(o,l){return l>=o.startBufferLine&&l<=o.endBufferLine}_lineAdjacentToZone(o,l,_){return l>=o.startBufferLine-this._linePadding[_||"full"]&&l<=o.endBufferLine+this._linePadding[_||"full"]}_addLineToZone(o,l){o.startBufferLine=Math.min(o.startBufferLine,l),o.endBufferLine=Math.max(o.endBufferLine,l)}}},5744:function(k,t,o){var l=this&&this.__decorate||function(s,d,S,b){var w,g=arguments.length,E=g<3?d:b===null?b=Object.getOwnPropertyDescriptor(d,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(s,d,S,b);else for(var T=s.length-1;T>=0;T--)(w=s[T])&&(E=(g<3?w(E):g>3?w(d,S,E):w(d,S))||E);return g>3&&E&&Object.defineProperty(d,S,E),E},_=this&&this.__param||function(s,d){return function(S,b){d(S,b,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const c=o(5871),p=o(4725),v=o(844),C=o(2585),f={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0},n={full:0,left:0,center:0,right:0};let r=t.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,d,S,b,w,g,E){var B;super(),this._viewportElement=s,this._screenElement=d,this._bufferService=S,this._decorationService=b,this._renderService=w,this._optionsService=g,this._coreBrowserService=E,this._colorZoneStore=new c.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(),(B=this._viewportElement.parentElement)==null||B.insertBefore(this._canvas,this._viewportElement);const T=this._canvas.getContext("2d");if(!T)throw new Error("Ctx cannot be null");this._ctx=T,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.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 s=Math.floor(this._canvas.width/3),d=Math.ceil(this._canvas.width/3);i.full=this._canvas.width,i.left=s,i.center=d,i.right=s,this._refreshDrawHeightConstants(),n.full=0,n.left=0,n.center=i.left,n.right=i.left+i.center}_refreshDrawHeightConstants(){f.full=Math.round(2*this._coreBrowserService.dpr);const s=this._canvas.height/this._bufferService.buffer.lines.length,d=Math.round(Math.max(Math.min(s,12),6)*this._coreBrowserService.dpr);f.left=d,f.center=d,f.right=d}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*f.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 d of this._decorationService.decorations)this._colorZoneStore.addDecoration(d);this._ctx.lineWidth=1;const s=this._colorZoneStore.zones;for(const d of s)d.position!=="full"&&this._renderColorZone(d);for(const d of s)d.position==="full"&&this._renderColorZone(d);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(s){this._ctx.fillStyle=s.color,this._ctx.fillRect(n[s.position||"full"],Math.round((this._canvas.height-1)*(s.startBufferLine/this._bufferService.buffers.active.lines.length)-f[s.position||"full"]/2),i[s.position||"full"],Math.round((this._canvas.height-1)*((s.endBufferLine-s.startBufferLine)/this._bufferService.buffers.active.lines.length)+f[s.position||"full"]))}_queueRefresh(s,d){this._shouldUpdateDimensions=s||this._shouldUpdateDimensions,this._shouldUpdateAnchor=d||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=r=l([_(2,C.IBufferService),_(3,C.IDecorationService),_(4,p.IRenderService),_(5,C.IOptionsService),_(6,p.ICoreBrowserService)],r)},2950:function(k,t,o){var l=this&&this.__decorate||function(f,i,n,r){var s,d=arguments.length,S=d<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,n):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(f,i,n,r);else for(var b=f.length-1;b>=0;b--)(s=f[b])&&(S=(d<3?s(S):d>3?s(i,n,S):s(i,n))||S);return d>3&&S&&Object.defineProperty(i,n,S),S},_=this&&this.__param||function(f,i){return function(n,r){i(n,r,f)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const c=o(4725),p=o(2585),v=o(2584);let C=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(f,i,n,r,s,d){this._textarea=f,this._compositionView=i,this._bufferService=n,this._optionsService=r,this._coreService=s,this._renderService=d,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(f){this._compositionView.textContent=f.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(f){if(this._isComposing||this._isSendingComposition){if(f.keyCode===229||f.keyCode===16||f.keyCode===17||f.keyCode===18)return!1;this._finalizeComposition(!1)}return f.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(f){if(this._compositionView.classList.remove("active"),this._isComposing=!1,f){const i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let n;this._isSendingComposition=!1,i.start+=this._dataAlreadySent.length,n=this._isComposing?this._textarea.value.substring(i.start,i.end):this._textarea.value.substring(i.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;const i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){const f=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const i=this._textarea.value,n=i.replace(f,"");this._dataAlreadySent=n,i.length>f.length?this._coreService.triggerDataEvent(n,!0):i.length<f.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):i.length===f.length&&i!==f&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(f){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const d=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(d.width,1)+"px",this._textarea.style.height=Math.max(d.height,1)+"px",this._textarea.style.lineHeight=d.height+"px"}f||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=C=l([_(2,p.IBufferService),_(3,p.IOptionsService),_(4,p.ICoreService),_(5,c.IRenderService)],C)},9806:(k,t)=>{function o(l,_,c){const p=c.getBoundingClientRect(),v=l.getComputedStyle(c),C=parseInt(v.getPropertyValue("padding-left")),f=parseInt(v.getPropertyValue("padding-top"));return[_.clientX-p.left-C,_.clientY-p.top-f]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=o,t.getCoords=function(l,_,c,p,v,C,f,i,n){if(!C)return;const r=o(l,_,c);return r?(r[0]=Math.ceil((r[0]+(n?f/2:0))/f),r[1]=Math.ceil(r[1]/i),r[0]=Math.min(Math.max(r[0],1),p+(n?1:0)),r[1]=Math.min(Math.max(r[1],1),v),r):void 0}},9504:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const l=o(2584);function _(i,n,r,s){const d=i-c(i,r),S=n-c(n,r),b=Math.abs(d-S)-function(w,g,E){let T=0;const B=w-c(w,E),O=g-c(g,E);for(let D=0;D<Math.abs(B-O);D++){const P=p(w,g)==="A"?-1:1,F=E.buffer.lines.get(B+P*D);F!=null&&F.isWrapped&&T++}return T}(i,n,r);return f(b,C(p(i,n),s))}function c(i,n){let r=0,s=n.buffer.lines.get(i),d=s==null?void 0:s.isWrapped;for(;d&&i>=0&&i<n.rows;)r++,s=n.buffer.lines.get(--i),d=s==null?void 0:s.isWrapped;return r}function p(i,n){return i>n?"A":"B"}function v(i,n,r,s,d,S){let b=i,w=n,g="";for(;b!==r||w!==s;)b+=d?1:-1,d&&b>S.cols-1?(g+=S.buffer.translateBufferLineToString(w,!1,i,b),b=0,i=0,w++):!d&&b<0&&(g+=S.buffer.translateBufferLineToString(w,!1,0,i+1),b=S.cols-1,i=b,w--);return g+S.buffer.translateBufferLineToString(w,!1,i,b)}function C(i,n){const r=n?"O":"[";return l.C0.ESC+r+i}function f(i,n){i=Math.floor(i);let r="";for(let s=0;s<i;s++)r+=n;return r}t.moveToCellSequence=function(i,n,r,s){const d=r.buffer.x,S=r.buffer.y;if(!r.buffer.hasScrollback)return function(g,E,T,B,O,D){return _(E,B,O,D).length===0?"":f(v(g,E,g,E-c(E,O),!1,O).length,C("D",D))}(d,S,0,n,r,s)+_(S,n,r,s)+function(g,E,T,B,O,D){let P;P=_(E,B,O,D).length>0?B-c(B,O):E;const F=B,U=function(G,$,x,L,A,M){let N;return N=_(x,L,A,M).length>0?L-c(L,A):$,G<x&&N<=L||G>=x&&N<L?"C":"D"}(g,E,T,B,O,D);return f(v(g,P,T,F,U==="C",O).length,C(U,D))}(d,S,i,n,r,s);let b;if(S===n)return b=d>i?"D":"C",f(Math.abs(d-i),C(b,s));b=S>n?"D":"C";const w=Math.abs(S-n);return f(function(g,E){return E.cols-g}(S>n?i:d,r)+(w-1)*r.cols+1+((S>n?d:i)-1),C(b,s))}},1296:function(k,t,o){var l=this&&this.__decorate||function(D,P,F,U){var G,$=arguments.length,x=$<3?P:U===null?U=Object.getOwnPropertyDescriptor(P,F):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(D,P,F,U);else for(var L=D.length-1;L>=0;L--)(G=D[L])&&(x=($<3?G(x):$>3?G(P,F,x):G(P,F))||x);return $>3&&x&&Object.defineProperty(P,F,x),x},_=this&&this.__param||function(D,P){return function(F,U){P(F,U,D)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const c=o(3787),p=o(2550),v=o(2223),C=o(6171),f=o(6052),i=o(4725),n=o(8055),r=o(8460),s=o(844),d=o(2585),S="xterm-dom-renderer-owner-",b="xterm-rows",w="xterm-fg-",g="xterm-bg-",E="xterm-focus",T="xterm-selection";let B=1,O=t.DomRenderer=class extends s.Disposable{constructor(D,P,F,U,G,$,x,L,A,M,N,z,J){super(),this._terminal=D,this._document=P,this._element=F,this._screenElement=U,this._viewportElement=G,this._helperContainer=$,this._linkifier2=x,this._charSizeService=A,this._optionsService=M,this._bufferService=N,this._coreBrowserService=z,this._themeService=J,this._terminalClass=B++,this._rowElements=[],this._selectionRenderModel=(0,f.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new r.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(b),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(T),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,C.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(ee=>this._injectCss(ee))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(c.DomRendererRowFactory,document),this._element.classList.add(S+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(ee=>this._handleLinkHover(ee))),this.register(this._linkifier2.onHideLinkUnderline(ee=>this._handleLinkLeave(ee))),this.register((0,s.toDisposable)(()=>{this._element.classList.remove(S+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new p.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 P=`${this._terminalSelector} .${b} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=P,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 P=`${this._terminalSelector} .${b} { color: ${D.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;P+=`${this._terminalSelector} .${b} .xterm-dim { color: ${n.color.multiplyOpacity(D.foreground,.5).css};}`,P+=`${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}`,G=`blink_block_${this._terminalClass}`;P+=`@keyframes ${F} { 50% { border-bottom-style: hidden; }}`,P+=`@keyframes ${U} { 50% { box-shadow: none; }}`,P+=`@keyframes ${G} { 0% { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css}; } 50% { background-color: inherit; color: ${D.cursor.css}; }}`,P+=`${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${F} 1s step-end infinite;}${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${b}.${E} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${G} 1s step-end infinite;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block { background-color: ${D.cursor.css}; color: ${D.cursorAccent.css};}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${D.cursor.css} !important; color: ${D.cursorAccent.css} !important;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${D.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${D.cursor.css} inset;}${this._terminalSelector} .${b} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${D.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,P+=`${this._terminalSelector} .${T} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${T} div { position: absolute; background-color: ${D.selectionBackgroundOpaque.css};}${this._terminalSelector} .${T} div { position: absolute; background-color: ${D.selectionInactiveBackgroundOpaque.css};}`;for(const[$,x]of D.ansi.entries())P+=`${this._terminalSelector} .${w}${$} { color: ${x.css}; }${this._terminalSelector} .${w}${$}.xterm-dim { color: ${n.color.multiplyOpacity(x,.5).css}; }${this._terminalSelector} .${g}${$} { background-color: ${x.css}; }`;P+=`${this._terminalSelector} .${w}${v.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(D.background).css}; }${this._terminalSelector} .${w}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${n.color.multiplyOpacity(n.color.opaque(D.background),.5).css}; }${this._terminalSelector} .${g}${v.INVERTED_DEFAULT_COLOR} { background-color: ${D.foreground.css}; }`,this._themeStyleElement.textContent=P}_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,P){for(let F=this._rowElements.length;F<=P;F++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>P;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(D,P){this._refreshRowElements(D,P),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(E),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(E),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(D,P,F){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(D,P,F),this.renderRows(0,this._bufferService.rows-1),!D||!P)return;this._selectionRenderModel.update(this._terminal,D,P,F);const U=this._selectionRenderModel.viewportStartRow,G=this._selectionRenderModel.viewportEndRow,$=this._selectionRenderModel.viewportCappedStartRow,x=this._selectionRenderModel.viewportCappedEndRow;if($>=this._bufferService.rows||x<0)return;const L=this._document.createDocumentFragment();if(F){const A=D[0]>P[0];L.appendChild(this._createSelectionElement($,A?P[0]:D[0],A?D[0]:P[0],x-$+1))}else{const A=U===$?D[0]:0,M=$===G?P[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement($,A,M));const N=x-$-1;if(L.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,N)),$!==x){const z=G===x?P[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(x,0,z))}}this._selectionContainer.appendChild(L)}_createSelectionElement(D,P,F,U=1){const G=this._document.createElement("div"),$=P*this.dimensions.css.cell.width;let x=this.dimensions.css.cell.width*(F-P);return $+x>this.dimensions.css.canvas.width&&(x=this.dimensions.css.canvas.width-$),G.style.height=U*this.dimensions.css.cell.height+"px",G.style.top=D*this.dimensions.css.cell.height+"px",G.style.left=`${$}px`,G.style.width=`${x}px`,G}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,P){const F=this._bufferService.buffer,U=F.ybase+F.y,G=Math.min(F.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,x=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let A=D;A<=P;A++){const M=A+F.ydisp,N=this._rowElements[A],z=F.lines.get(M);if(!N||!z)break;N.replaceChildren(...this._rowFactory.createRow(z,M,M===U,x,L,G,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${S}${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,P,F,U,G,$){F<0&&(D=0),U<0&&(P=0);const x=this._bufferService.rows-1;F=Math.max(Math.min(F,x),0),U=Math.max(Math.min(U,x),0),G=Math.min(G,this._bufferService.cols);const L=this._bufferService.buffer,A=L.ybase+L.y,M=Math.min(L.x,G-1),N=this._optionsService.rawOptions.cursorBlink,z=this._optionsService.rawOptions.cursorStyle,J=this._optionsService.rawOptions.cursorInactiveStyle;for(let ee=F;ee<=U;++ee){const I=ee+L.ydisp,R=this._rowElements[ee],W=L.lines.get(I);if(!R||!W)break;R.replaceChildren(...this._rowFactory.createRow(W,I,I===A,z,J,M,N,this.dimensions.css.cell.width,this._widthCache,$?ee===F?D:0:-1,$?(ee===U?P:G)-1:-1))}}};t.DomRenderer=O=l([_(7,d.IInstantiationService),_(8,i.ICharSizeService),_(9,d.IOptionsService),_(10,d.IBufferService),_(11,i.ICoreBrowserService),_(12,i.IThemeService)],O)},3787:function(k,t,o){var l=this&&this.__decorate||function(b,w,g,E){var T,B=arguments.length,O=B<3?w:E===null?E=Object.getOwnPropertyDescriptor(w,g):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(b,w,g,E);else for(var D=b.length-1;D>=0;D--)(T=b[D])&&(O=(B<3?T(O):B>3?T(w,g,O):T(w,g))||O);return B>3&&O&&Object.defineProperty(w,g,O),O},_=this&&this.__param||function(b,w){return function(g,E){w(g,E,b)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const c=o(2223),p=o(643),v=o(511),C=o(2585),f=o(8055),i=o(4725),n=o(4269),r=o(6171),s=o(3734);let d=t.DomRendererRowFactory=class{constructor(b,w,g,E,T,B,O){this._document=b,this._characterJoinerService=w,this._optionsService=g,this._coreBrowserService=E,this._coreService=T,this._decorationService=B,this._themeService=O,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(b,w,g){this._selectionStart=b,this._selectionEnd=w,this._columnSelectMode=g}createRow(b,w,g,E,T,B,O,D,P,F,U){const G=[],$=this._characterJoinerService.getJoinedCharacters(w),x=this._themeService.colors;let L,A=b.getNoBgTrimmedLength();g&&A<B+1&&(A=B+1);let M=0,N="",z=0,J=0,ee=0,I=!1,R=0,W=!1,H=0;const Z=[],V=F!==-1&&U!==-1;for(let ie=0;ie<A;ie++){b.loadCell(ie,this._workCell);let ce=this._workCell.getWidth();if(ce===0)continue;let he=!1,ue=ie,te=this._workCell;if($.length>0&&ie===$[0][0]){he=!0;const oe=$.shift();te=new n.JoinedCellData(this._workCell,b.translateToString(!0,oe[0],oe[1]),oe[1]-oe[0]),ue=oe[1]-1,ce=te.getWidth()}const ze=this._isCellInSelection(ie,w),Rt=g&&ie===B,Lt=V&&ie>=F&&ie<=U;let Dt=!1;this._decorationService.forEachDecorationAtCell(ie,w,void 0,oe=>{Dt=!0});let ut=te.getChars()||p.WHITESPACE_CELL_CHAR;if(ut===" "&&(te.isUnderline()||te.isOverline())&&(ut=" "),H=ce*D-P.get(ut,te.isBold(),te.isItalic()),L){if(M&&(ze&&W||!ze&&!W&&te.bg===z)&&(ze&&W&&x.selectionForeground||te.fg===J)&&te.extended.ext===ee&&Lt===I&&H===R&&!Rt&&!he&&!Dt){te.isInvisible()?N+=p.WHITESPACE_CELL_CHAR:N+=ut,M++;continue}M&&(L.textContent=N),L=this._document.createElement("span"),M=0,N=""}else L=this._document.createElement("span");if(z=te.bg,J=te.fg,ee=te.extended.ext,I=Lt,R=H,W=ze,he&&B>=ie&&B<=ue&&(B=ie),!this._coreService.isCursorHidden&&Rt&&this._coreService.isCursorInitialized){if(Z.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&Z.push("xterm-cursor-blink"),Z.push(E==="bar"?"xterm-cursor-bar":E==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(T)switch(T){case"outline":Z.push("xterm-cursor-outline");break;case"block":Z.push("xterm-cursor-block");break;case"bar":Z.push("xterm-cursor-bar");break;case"underline":Z.push("xterm-cursor-underline")}}if(te.isBold()&&Z.push("xterm-bold"),te.isItalic()&&Z.push("xterm-italic"),te.isDim()&&Z.push("xterm-dim"),N=te.isInvisible()?p.WHITESPACE_CELL_CHAR:te.getChars()||p.WHITESPACE_CELL_CHAR,te.isUnderline()&&(Z.push(`xterm-underline-${te.extended.underlineStyle}`),N===" "&&(N=" "),!te.isUnderlineColorDefault()))if(te.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(te.getUnderlineColor()).join(",")})`;else{let oe=te.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&te.isBold()&&oe<8&&(oe+=8),L.style.textDecorationColor=x.ansi[oe].css}te.isOverline()&&(Z.push("xterm-overline"),N===" "&&(N=" ")),te.isStrikethrough()&&Z.push("xterm-strikethrough"),Lt&&(L.style.textDecoration="underline");let _e=te.getFgColor(),qe=te.getFgColorMode(),be=te.getBgColor(),Ve=te.getBgColorMode();const Tt=!!te.isInverse();if(Tt){const oe=_e;_e=be,be=oe;const Tr=qe;qe=Ve,Ve=Tr}let Re,ft,Le,Ze=!1;switch(this._decorationService.forEachDecorationAtCell(ie,w,void 0,oe=>{oe.options.layer!=="top"&&Ze||(oe.backgroundColorRGB&&(Ve=50331648,be=oe.backgroundColorRGB.rgba>>8&16777215,Re=oe.backgroundColorRGB),oe.foregroundColorRGB&&(qe=50331648,_e=oe.foregroundColorRGB.rgba>>8&16777215,ft=oe.foregroundColorRGB),Ze=oe.options.layer==="top")}),!Ze&&ze&&(Re=this._coreBrowserService.isFocused?x.selectionBackgroundOpaque:x.selectionInactiveBackgroundOpaque,be=Re.rgba>>8&16777215,Ve=50331648,Ze=!0,x.selectionForeground&&(qe=50331648,_e=x.selectionForeground.rgba>>8&16777215,ft=x.selectionForeground)),Ze&&Z.push("xterm-decoration-top"),Ve){case 16777216:case 33554432:Le=x.ansi[be],Z.push(`xterm-bg-${be}`);break;case 50331648:Le=f.channels.toColor(be>>16,be>>8&255,255&be),this._addStyle(L,`background-color:#${S((be>>>0).toString(16),"0",6)}`);break;default:Tt?(Le=x.foreground,Z.push(`xterm-bg-${c.INVERTED_DEFAULT_COLOR}`)):Le=x.background}switch(Re||te.isDim()&&(Re=f.color.multiplyOpacity(Le,.5)),qe){case 16777216:case 33554432:te.isBold()&&_e<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(_e+=8),this._applyMinimumContrast(L,Le,x.ansi[_e],te,Re,void 0)||Z.push(`xterm-fg-${_e}`);break;case 50331648:const oe=f.channels.toColor(_e>>16&255,_e>>8&255,255&_e);this._applyMinimumContrast(L,Le,oe,te,Re,ft)||this._addStyle(L,`color:#${S(_e.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Le,x.foreground,te,Re,ft)||Tt&&Z.push(`xterm-fg-${c.INVERTED_DEFAULT_COLOR}`)}Z.length&&(L.className=Z.join(" "),Z.length=0),Rt||he||Dt?L.textContent=N:M++,H!==this.defaultSpacing&&(L.style.letterSpacing=`${H}px`),G.push(L),ie=ue}return L&&M&&(L.textContent=N),G}_applyMinimumContrast(b,w,g,E,T,B){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,r.treatGlyphAsBackgroundColor)(E.getCode()))return!1;const O=this._getContrastCache(E);let D;if(T||B||(D=O.getColor(w.rgba,g.rgba)),D===void 0){const P=this._optionsService.rawOptions.minimumContrastRatio/(E.isDim()?2:1);D=f.color.ensureContrastRatio(T||w,B||g,P),O.setColor((T||w).rgba,(B||g).rgba,D??null)}return!!D&&(this._addStyle(b,`color:${D.css}`),!0)}_getContrastCache(b){return b.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(b,w){b.setAttribute("style",`${b.getAttribute("style")||""}${w};`)}_isCellInSelection(b,w){const g=this._selectionStart,E=this._selectionEnd;return!(!g||!E)&&(this._columnSelectMode?g[0]<=E[0]?b>=g[0]&&w>=g[1]&&b<E[0]&&w<=E[1]:b<g[0]&&w>=g[1]&&b>=E[0]&&w<=E[1]:w>g[1]&&w<E[1]||g[1]===E[1]&&w===g[1]&&b>=g[0]&&b<E[0]||g[1]<E[1]&&w===E[1]&&b<E[0]||g[1]<E[1]&&w===g[1]&&b>=g[0])}};function S(b,w,g){for(;b.length<g;)b=w+b;return b}t.DomRendererRowFactory=d=l([_(1,i.ICharacterJoinerService),_(2,C.IOptionsService),_(3,i.ICoreBrowserService),_(4,C.ICoreService),_(5,C.IDecorationService),_(6,i.IThemeService)],d)},2550:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(o,l){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=o.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 _=o.createElement("span");_.classList.add("xterm-char-measure-element");const c=o.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold";const p=o.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontStyle="italic";const v=o.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[_,c,p,v],this._container.appendChild(_),this._container.appendChild(c),this._container.appendChild(p),this._container.appendChild(v),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(o,l,_,c){o===this._font&&l===this._fontSize&&_===this._weight&&c===this._weightBold||(this._font=o,this._fontSize=l,this._weight=_,this._weightBold=c,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${_}`,this._measureElements[1].style.fontWeight=`${c}`,this._measureElements[2].style.fontWeight=`${_}`,this._measureElements[3].style.fontWeight=`${c}`,this.clear())}get(o,l,_){let c=0;if(!l&&!_&&o.length===1&&(c=o.charCodeAt(0))<256){if(this._flat[c]!==-9999)return this._flat[c];const C=this._measure(o,0);return C>0&&(this._flat[c]=C),C}let p=o;l&&(p+="B"),_&&(p+="I");let v=this._holey.get(p);if(v===void 0){let C=0;l&&(C|=1),_&&(C|=2),v=this._measure(o,C),v>0&&this._holey.set(p,v)}return v}_measure(o,l){const _=this._measureElements[l];return _.textContent=o.repeat(32),_.offsetWidth/32}}},2223:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const l=o(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},6171:(k,t)=>{function o(_){return 57508<=_&&_<=57558}function l(_){return _>=128512&&_<=128591||_>=127744&&_<=128511||_>=128640&&_<=128767||_>=9728&&_<=9983||_>=9984&&_<=10175||_>=65024&&_<=65039||_>=129280&&_<=129535||_>=127462&&_<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(_){if(!_)throw new Error("value must not be falsy");return _},t.isPowerlineGlyph=o,t.isRestrictedPowerlineGlyph=function(_){return 57520<=_&&_<=57527},t.isEmoji=l,t.allowRescaling=function(_,c,p,v){return c===1&&p>Math.ceil(1.5*v)&&_!==void 0&&_>255&&!l(_)&&!o(_)&&!function(C){return 57344<=C&&C<=63743}(_)},t.treatGlyphAsBackgroundColor=function(_){return o(_)||function(c){return 9472<=c&&c<=9631}(_)},t.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}}}},t.computeNextVariantOffset=function(_,c,p=0){return(_-(2*Math.round(c)-p))%(2*Math.round(c))}},6052:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class o{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(_,c,p,v=!1){if(this.selectionStart=c,this.selectionEnd=p,!c||!p||c[0]===p[0]&&c[1]===p[1])return void this.clear();const C=_.buffers.active.ydisp,f=c[1]-C,i=p[1]-C,n=Math.max(f,0),r=Math.min(i,_.rows-1);n>=_.rows||r<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=f,this.viewportEndRow=i,this.viewportCappedStartRow=n,this.viewportCappedEndRow=r,this.startCol=c[0],this.endCol=p[0])}isCellSelected(_,c,p){return!!this.hasSelection&&(p-=_.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?c>=this.startCol&&p>=this.viewportCappedStartRow&&c<this.endCol&&p<=this.viewportCappedEndRow:c<this.startCol&&p>=this.viewportCappedStartRow&&c>=this.endCol&&p<=this.viewportCappedEndRow:p>this.viewportStartRow&&p<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&p===this.viewportStartRow&&c>=this.startCol&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportEndRow&&c<this.endCol||this.viewportStartRow<this.viewportEndRow&&p===this.viewportStartRow&&c>=this.startCol)}}t.createSelectionRenderModel=function(){return new o}},456:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=class{constructor(o){this._bufferService=o,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 o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?o%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)-1]:[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[o,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const o=this.selectionStart[0]+this.selectionStartLength;return o>this._bufferService.cols?[o%this._bufferService.cols,this.selectionStart[1]+Math.floor(o/this._bufferService.cols)]:[Math.max(o,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const o=this.selectionStart,l=this.selectionEnd;return!(!o||!l)&&(o[1]>l[1]||o[1]===l[1]&&o[0]>l[0])}handleTrim(o){return this.selectionStart&&(this.selectionStart[1]-=o),this.selectionEnd&&(this.selectionEnd[1]-=o),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(k,t,o){var l=this&&this.__decorate||function(r,s,d,S){var b,w=arguments.length,g=w<3?s:S===null?S=Object.getOwnPropertyDescriptor(s,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,s,d,S);else for(var E=r.length-1;E>=0;E--)(b=r[E])&&(g=(w<3?b(g):w>3?b(s,d,g):b(s,d))||g);return w>3&&g&&Object.defineProperty(s,d,g),g},_=this&&this.__param||function(r,s){return function(d,S){s(d,S,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const c=o(2585),p=o(8460),v=o(844);let C=t.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(r,s,d){super(),this._optionsService=d,this.width=0,this.height=0,this._onCharSizeChange=this.register(new p.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new n(this._optionsService))}catch{this._measureStrategy=this.register(new i(r,s,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())}};t.CharSizeService=C=l([_(2,c.IOptionsService)],C);class f extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(s,d){s!==void 0&&s>0&&d!==void 0&&d>0&&(this._result.width=s,this._result.height=d)}}class i extends f{constructor(s,d,S){super(),this._document=s,this._parentElement=d,this._optionsService=S,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 n extends f{constructor(s){super(),this._optionsService=s,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const d=this._ctx.measureText("W");if(!("width"in d&&"fontBoundingBoxAscent"in d&&"fontBoundingBoxDescent"in d))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const s=this._ctx.measureText("W");return this._validateAndSet(s.width,s.fontBoundingBoxAscent+s.fontBoundingBoxDescent),this._result}}},4269:function(k,t,o){var l=this&&this.__decorate||function(n,r,s,d){var S,b=arguments.length,w=b<3?r:d===null?d=Object.getOwnPropertyDescriptor(r,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(n,r,s,d);else for(var g=n.length-1;g>=0;g--)(S=n[g])&&(w=(b<3?S(w):b>3?S(r,s,w):S(r,s))||w);return b>3&&w&&Object.defineProperty(r,s,w),w},_=this&&this.__param||function(n,r){return function(s,d){r(s,d,n)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const c=o(3734),p=o(643),v=o(511),C=o(2585);class f extends c.AttributeData{constructor(r,s,d){super(),this.content=0,this.combinedData="",this.fg=r.fg,this.bg=r.bg,this.combinedData=s,this._width=d}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()]}}t.JoinedCellData=f;let i=t.CharacterJoinerService=class mr{constructor(r){this._bufferService=r,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.CellData}register(r){const s={id:this._nextCharacterJoinerId++,handler:r};return this._characterJoiners.push(s),s.id}deregister(r){for(let s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===r)return this._characterJoiners.splice(s,1),!0;return!1}getJoinedCharacters(r){if(this._characterJoiners.length===0)return[];const s=this._bufferService.buffer.lines.get(r);if(!s||s.length===0)return[];const d=[],S=s.translateToString(!0);let b=0,w=0,g=0,E=s.getFg(0),T=s.getBg(0);for(let B=0;B<s.getTrimmedLength();B++)if(s.loadCell(B,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==E||this._workCell.bg!==T){if(B-b>1){const O=this._getJoinedRanges(S,g,w,s,b);for(let D=0;D<O.length;D++)d.push(O[D])}b=B,g=w,E=this._workCell.fg,T=this._workCell.bg}w+=this._workCell.getChars().length||p.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-b>1){const B=this._getJoinedRanges(S,g,w,s,b);for(let O=0;O<B.length;O++)d.push(B[O])}return d}_getJoinedRanges(r,s,d,S,b){const w=r.substring(s,d);let g=[];try{g=this._characterJoiners[0].handler(w)}catch(E){console.error(E)}for(let E=1;E<this._characterJoiners.length;E++)try{const T=this._characterJoiners[E].handler(w);for(let B=0;B<T.length;B++)mr._mergeRanges(g,T[B])}catch(T){console.error(T)}return this._stringRangesToCellRanges(g,S,b),g}_stringRangesToCellRanges(r,s,d){let S=0,b=!1,w=0,g=r[S];if(g){for(let E=d;E<this._bufferService.cols;E++){const T=s.getWidth(E),B=s.getString(E).length||p.WHITESPACE_CELL_CHAR.length;if(T!==0){if(!b&&g[0]<=w&&(g[0]=E,b=!0),g[1]<=w){if(g[1]=E,g=r[++S],!g)break;g[0]<=w?(g[0]=E,b=!0):b=!1}w+=B}}g&&(g[1]=this._bufferService.cols)}}static _mergeRanges(r,s){let d=!1;for(let S=0;S<r.length;S++){const b=r[S];if(d){if(s[1]<=b[0])return r[S-1][1]=s[1],r;if(s[1]<=b[1])return r[S-1][1]=Math.max(s[1],b[1]),r.splice(S,1),r;r.splice(S,1),S--}else{if(s[1]<=b[0])return r.splice(S,0,s),r;if(s[1]<=b[1])return b[0]=Math.min(s[0],b[0]),r;s[0]<b[1]&&(b[0]=Math.min(s[0],b[0]),d=!0)}}return d?r[r.length-1][1]=s[1]:r.push(s),r}};t.CharacterJoinerService=i=l([_(0,C.IBufferService)],i)},5114:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;const l=o(844),_=o(8460),c=o(3656);class p extends l.Disposable{constructor(f,i,n){super(),this._textarea=f,this._window=i,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(this._window),this._onDprChange=this.register(new _.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new _.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this.register((0,_.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(f){this._window!==f&&(this._window=f,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}}t.CoreBrowserService=p;class v extends l.Disposable{constructor(f){super(),this._parentWindow=f,this._windowResizeListener=this.register(new l.MutableDisposable),this._onDprChange=this.register(new _.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(f){this._parentWindow=f,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,c.addDisposableDomListener)(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var f;this._outerListener&&((f=this._resolutionMediaMatchList)==null||f.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:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkProviderService=void 0;const l=o(844);class _ extends l.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,l.toDisposable)(()=>this.linkProviders.length=0))}registerLinkProvider(p){return this.linkProviders.push(p),{dispose:()=>{const v=this.linkProviders.indexOf(p);v!==-1&&this.linkProviders.splice(v,1)}}}}t.LinkProviderService=_},8934:function(k,t,o){var l=this&&this.__decorate||function(C,f,i,n){var r,s=arguments.length,d=s<3?f:n===null?n=Object.getOwnPropertyDescriptor(f,i):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(C,f,i,n);else for(var S=C.length-1;S>=0;S--)(r=C[S])&&(d=(s<3?r(d):s>3?r(f,i,d):r(f,i))||d);return s>3&&d&&Object.defineProperty(f,i,d),d},_=this&&this.__param||function(C,f){return function(i,n){f(i,n,C)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const c=o(4725),p=o(9806);let v=t.MouseService=class{constructor(C,f){this._renderService=C,this._charSizeService=f}getCoords(C,f,i,n,r){return(0,p.getCoords)(window,C,f,i,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(C,f){const i=(0,p.getCoordsRelativeToElement)(window,C,f);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};t.MouseService=v=l([_(0,c.IRenderService),_(1,c.ICharSizeService)],v)},3230:function(k,t,o){var l=this&&this.__decorate||function(r,s,d,S){var b,w=arguments.length,g=w<3?s:S===null?S=Object.getOwnPropertyDescriptor(s,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,s,d,S);else for(var E=r.length-1;E>=0;E--)(b=r[E])&&(g=(w<3?b(g):w>3?b(s,d,g):b(s,d))||g);return w>3&&g&&Object.defineProperty(s,d,g),g},_=this&&this.__param||function(r,s){return function(d,S){s(d,S,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const c=o(6193),p=o(4725),v=o(8460),C=o(844),f=o(7226),i=o(2585);let n=t.RenderService=class extends C.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(r,s,d,S,b,w,g,E){super(),this._rowCount=r,this._charSizeService=S,this._renderer=this.register(new C.MutableDisposable),this._pausedResizeTask=new f.DebouncedIdleTask,this._observerDisposable=this.register(new C.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 v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new c.RenderDebouncer((T,B)=>this._renderRows(T,B),g),this.register(this._renderDebouncer),this.register(g.onDprChange(()=>this.handleDevicePixelRatioChange())),this.register(w.onResize(()=>this._fullRefresh())),this.register(w.buffers.onBufferActivate(()=>{var T;return(T=this._renderer.value)==null?void 0:T.clear()})),this.register(d.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(b.onDecorationRegistered(()=>this._fullRefresh())),this.register(b.onDecorationRemoved(()=>this._fullRefresh())),this.register(d.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(w.cols,w.rows),this._fullRefresh()})),this.register(d.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(w.buffer.y,w.buffer.y,!0))),this.register(E.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(g.window,s),this.register(g.onWindowChange(T=>this._registerIntersectionObserver(T,s)))}_registerIntersectionObserver(r,s){if("IntersectionObserver"in r){const d=new r.IntersectionObserver(S=>this._handleIntersectionChange(S[S.length-1]),{threshold:0});d.observe(s),this._observerDisposable.value=(0,C.toDisposable)(()=>d.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,s,d=!1){this._isPaused?this._needsFullRefresh=!0:(d||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(r,s,this._rowCount))}_renderRows(r,s){this._renderer.value&&(r=Math.min(r,this._rowCount-1),s=Math.min(s,this._rowCount-1),this._renderer.value.renderRows(r,s),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:s}),this._onRender.fire({start:r,end:s}),this._isNextRenderRedrawOnly=!0)}resize(r,s){this._rowCount=s,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(s=>this.refreshRows(s.start,s.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,s;this._renderer.value&&((s=(r=this._renderer.value).clearTextureAtlas)==null||s.call(r),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(r,s){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var d;return(d=this._renderer.value)==null?void 0:d.handleResize(r,s)}):this._renderer.value.handleResize(r,s),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,s,d){var S;this._selectionState.start=r,this._selectionState.end=s,this._selectionState.columnSelectMode=d,(S=this._renderer.value)==null||S.handleSelectionChanged(r,s,d)}handleCursorMove(){var r;(r=this._renderer.value)==null||r.handleCursorMove()}clear(){var r;(r=this._renderer.value)==null||r.clear()}};t.RenderService=n=l([_(2,i.IOptionsService),_(3,p.ICharSizeService),_(4,i.IDecorationService),_(5,i.IBufferService),_(6,p.ICoreBrowserService),_(7,p.IThemeService)],n)},9312:function(k,t,o){var l=this&&this.__decorate||function(g,E,T,B){var O,D=arguments.length,P=D<3?E:B===null?B=Object.getOwnPropertyDescriptor(E,T):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(g,E,T,B);else for(var F=g.length-1;F>=0;F--)(O=g[F])&&(P=(D<3?O(P):D>3?O(E,T,P):O(E,T))||P);return D>3&&P&&Object.defineProperty(E,T,P),P},_=this&&this.__param||function(g,E){return function(T,B){E(T,B,g)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const c=o(9806),p=o(9504),v=o(456),C=o(4725),f=o(8460),i=o(844),n=o(6114),r=o(4841),s=o(511),d=o(2585),S=" ",b=new RegExp(S,"g");let w=t.SelectionService=class extends i.Disposable{constructor(g,E,T,B,O,D,P,F,U){super(),this._element=g,this._screenElement=E,this._linkifier=T,this._bufferService=B,this._coreService=O,this._mouseService=D,this._optionsService=P,this._renderService=F,this._coreBrowserService=U,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new s.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new f.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new f.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new f.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new f.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=G=>this._handleMouseMove(G),this._mouseUpListener=G=>this._handleMouseUp(G),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(G=>this._handleTrim(G)),this.register(this._bufferService.buffers.onBufferActivate(G=>this._handleBufferActivate(G))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,i.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 g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;return!(!g||!E||g[0]===E[0]&&g[1]===E[1])}get selectionText(){const g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd;if(!g||!E)return"";const T=this._bufferService.buffer,B=[];if(this._activeSelectionMode===3){if(g[0]===E[0])return"";const O=g[0]<E[0]?g[0]:E[0],D=g[0]<E[0]?E[0]:g[0];for(let P=g[1];P<=E[1];P++){const F=T.translateBufferLineToString(P,!0,O,D);B.push(F)}}else{const O=g[1]===E[1]?E[0]:void 0;B.push(T.translateBufferLineToString(g[1],!0,g[0],O));for(let D=g[1]+1;D<=E[1]-1;D++){const P=T.lines.get(D),F=T.translateBufferLineToString(D,!0);P!=null&&P.isWrapped?B[B.length-1]+=F:B.push(F)}if(g[1]!==E[1]){const D=T.lines.get(E[1]),P=T.translateBufferLineToString(E[1],!0,0,E[0]);D&&D.isWrapped?B[B.length-1]+=P:B.push(P)}}return B.map(O=>O.replace(b," ")).join(n.isWindows?`\r
6
6
  `:`
7
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(g){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),n.isLinux&&g&&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(g){const E=this._getMouseBufferCoords(g),T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(T&&B&&E)&&this._areCoordsInSelection(E,T,B)}isCellInSelection(g,E){const T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!T||!B)&&this._areCoordsInSelection([g,E],T,B)}_areCoordsInSelection(g,E,T){return g[1]>E[1]&&g[1]<T[1]||E[1]===T[1]&&g[1]===E[1]&&g[0]>=E[0]&&g[0]<T[0]||E[1]<T[1]&&g[1]===T[1]&&g[0]<T[0]||E[1]<T[1]&&g[1]===E[1]&&g[0]>=E[0]}_selectWordAtCursor(g,E){var O,D;const T=(D=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:D.range;if(T)return this._model.selectionStart=[T.start.x-1,T.start.y-1],this._model.selectionStartLength=(0,r.getRangeLength)(T,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(g);return!!B&&(this._selectWordAt(B,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(g,E){this._model.clearSelection(),g=Math.max(g,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,g],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(g){this._model.handleTrim(g)&&this.refresh()}_getMouseBufferCoords(g){const E=this._mouseService.getCoords(g,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(g){let E=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,g,this._screenElement)[1];const T=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=T?0:(E>T&&(E-=T),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(g){return n.isMac?g.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:g.shiftKey}handleMouseDown(g){if(this._mouseDownTimeStamp=g.timeStamp,(g.button!==2||!this.hasSelection)&&g.button===0){if(!this._enabled){if(!this.shouldForceSelection(g))return;g.stopPropagation()}g.preventDefault(),this._dragScrollAmount=0,this._enabled&&g.shiftKey?this._handleIncrementalClick(g):g.detail===1?this._handleSingleClick(g):g.detail===2?this._handleDoubleClick(g):g.detail===3&&this._handleTripleClick(g),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(g){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(g))}_handleSingleClick(g){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(g)?3:0,this._model.selectionStart=this._getMouseBufferCoords(g),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(g){this._selectWordAtCursor(g,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(g){const E=this._getMouseBufferCoords(g);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(g){return g.altKey&&!(n.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(g){if(g.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(g),!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(g),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const T=this._bufferService.buffer;if(this._model.selectionEnd[1]<T.lines.length){const B=T.lines.get(this._model.selectionEnd[1]);B&&B.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[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 g=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(g.ydisp+this._bufferService.rows,g.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=g.ydisp),this.refresh()}}_handleMouseUp(g){const E=g.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&g.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const T=this._mouseService.getCoords(g,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){const B=(0,p.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,T=!(!g||!E||g[0]===E[0]&&g[1]===E[1]);T?g&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&g[0]===this._oldSelectionStart[0]&&g[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(g,E,T)):this._oldHasSelection&&this._fireOnSelectionChange(g,E,T)}_fireOnSelectionChange(g,E,T){this._oldSelectionStart=g,this._oldSelectionEnd=E,this._oldHasSelection=T,this._onSelectionChange.fire()}_handleBufferActivate(g){this.clearSelection(),this._trimListener.dispose(),this._trimListener=g.activeBuffer.lines.onTrim(E=>this._handleTrim(E))}_convertViewportColToCharacterIndex(g,E){let T=E;for(let B=0;E>=B;B++){const O=g.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:O>1&&E!==B&&(T+=O-1)}return T}setSelection(g,E,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[g,E],this._model.selectionStartLength=T,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(g){this._isClickInSelection(g)||(this._selectWordAtCursor(g,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(g,E,T=!0,B=!0){if(g[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,D=O.lines.get(g[1]);if(!D)return;const P=O.translateBufferLineToString(g[1],!1);let F=this._convertViewportColToCharacterIndex(D,g[0]),U=F;const G=g[0]-F;let $=0,x=0,L=0,A=0;if(P.charAt(F)===" "){for(;F>0&&P.charAt(F-1)===" ";)F--;for(;U<P.length&&P.charAt(U+1)===" ";)U++}else{let z=g[0],J=g[0];D.getWidth(z)===0&&($++,z--),D.getWidth(J)===2&&(x++,J++);const ee=D.getString(J).length;for(ee>1&&(A+=ee-1,U+=ee-1);z>0&&F>0&&!this._isCharWordSeparator(D.loadCell(z-1,this._workCell));){D.loadCell(z-1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===0?($++,z--):I>1&&(L+=I-1,F-=I-1),F--,z--}for(;J<D.length&&U+1<P.length&&!this._isCharWordSeparator(D.loadCell(J+1,this._workCell));){D.loadCell(J+1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===2?(x++,J++):I>1&&(A+=I-1,U+=I-1),U++,J++}}U++;let M=F+G-$+L,N=Math.min(this._bufferService.cols,U-F+$+x-L-A);if(E||P.slice(F,U).trim()!==""){if(T&&M===0&&D.getCodePoint(0)!==32){const z=O.lines.get(g[1]-1);if(z&&D.isWrapped&&z.getCodePoint(this._bufferService.cols-1)!==32){const J=this._getWordAt([this._bufferService.cols-1,g[1]-1],!1,!0,!1);if(J){const ee=this._bufferService.cols-J.start;M-=ee,N+=ee}}}if(B&&M+N===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){const z=O.lines.get(g[1]+1);if(z!=null&&z.isWrapped&&z.getCodePoint(0)!==32){const J=this._getWordAt([0,g[1]+1],!1,!1,!0);J&&(N+=J.length)}}return{start:M,length:N}}}_selectWordAt(g,E){const T=this._getWordAt(g,E);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,g[1]--;this._model.selectionStart=[T.start,g[1]],this._model.selectionStartLength=T.length}}_selectToWordAt(g){const E=this._getWordAt(g,!0);if(E){let T=g[1];for(;E.start<0;)E.start+=this._bufferService.cols,T--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,T++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,T]}}_isCharWordSeparator(g){return g.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(g.getChars())>=0}_selectLineAt(g){const E=this._bufferService.buffer.getWrappedRangeForLine(g),T={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,r.getRangeLength)(T,this._bufferService.cols)}};t.SelectionService=w=l([_(3,d.IBufferService),_(4,d.ICoreService),_(5,C.IMouseService),_(6,d.IOptionsService),_(7,C.IRenderService),_(8,C.ICoreBrowserService)],w)},4725:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const l=o(8343);t.ICharSizeService=(0,l.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,l.createDecorator)("CoreBrowserService"),t.IMouseService=(0,l.createDecorator)("MouseService"),t.IRenderService=(0,l.createDecorator)("RenderService"),t.ISelectionService=(0,l.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,l.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,l.createDecorator)("ThemeService"),t.ILinkProviderService=(0,l.createDecorator)("LinkProviderService")},6731:function(k,t,o){var l=this&&this.__decorate||function(w,g,E,T){var B,O=arguments.length,D=O<3?g:T===null?T=Object.getOwnPropertyDescriptor(g,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(w,g,E,T);else for(var P=w.length-1;P>=0;P--)(B=w[P])&&(D=(O<3?B(D):O>3?B(g,E,D):B(g,E))||D);return O>3&&D&&Object.defineProperty(g,E,D),D},_=this&&this.__param||function(w,g){return function(E,T){g(E,T,w)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const h=o(7239),p=o(8055),v=o(8460),C=o(844),f=o(2585),i=p.css.toColor("#ffffff"),n=p.css.toColor("#000000"),r=p.css.toColor("#ffffff"),s=p.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const w=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],g=[0,95,135,175,215,255];for(let E=0;E<216;E++){const T=g[E/36%6|0],B=g[E/6%6|0],O=g[E%6];w.push({css:p.channels.toCss(T,B,O),rgba:p.channels.toRgba(T,B,O)})}for(let E=0;E<24;E++){const T=8+10*E;w.push({css:p.channels.toCss(T,T,T),rgba:p.channels.toRgba(T,T,T)})}return w})());let S=t.ThemeService=class extends C.Disposable{get colors(){return this._colors}constructor(w){super(),this._optionsService=w,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:n,cursor:r,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:p.color.blend(n,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:p.color.blend(n,d),ansi:t.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(w={}){const g=this._colors;if(g.foreground=b(w.foreground,i),g.background=b(w.background,n),g.cursor=b(w.cursor,r),g.cursorAccent=b(w.cursorAccent,s),g.selectionBackgroundTransparent=b(w.selectionBackground,d),g.selectionBackgroundOpaque=p.color.blend(g.background,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundTransparent=b(w.selectionInactiveBackground,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundOpaque=p.color.blend(g.background,g.selectionInactiveBackgroundTransparent),g.selectionForeground=w.selectionForeground?b(w.selectionForeground,p.NULL_COLOR):void 0,g.selectionForeground===p.NULL_COLOR&&(g.selectionForeground=void 0),p.color.isOpaque(g.selectionBackgroundTransparent)&&(g.selectionBackgroundTransparent=p.color.opacity(g.selectionBackgroundTransparent,.3)),p.color.isOpaque(g.selectionInactiveBackgroundTransparent)&&(g.selectionInactiveBackgroundTransparent=p.color.opacity(g.selectionInactiveBackgroundTransparent,.3)),g.ansi=t.DEFAULT_ANSI_COLORS.slice(),g.ansi[0]=b(w.black,t.DEFAULT_ANSI_COLORS[0]),g.ansi[1]=b(w.red,t.DEFAULT_ANSI_COLORS[1]),g.ansi[2]=b(w.green,t.DEFAULT_ANSI_COLORS[2]),g.ansi[3]=b(w.yellow,t.DEFAULT_ANSI_COLORS[3]),g.ansi[4]=b(w.blue,t.DEFAULT_ANSI_COLORS[4]),g.ansi[5]=b(w.magenta,t.DEFAULT_ANSI_COLORS[5]),g.ansi[6]=b(w.cyan,t.DEFAULT_ANSI_COLORS[6]),g.ansi[7]=b(w.white,t.DEFAULT_ANSI_COLORS[7]),g.ansi[8]=b(w.brightBlack,t.DEFAULT_ANSI_COLORS[8]),g.ansi[9]=b(w.brightRed,t.DEFAULT_ANSI_COLORS[9]),g.ansi[10]=b(w.brightGreen,t.DEFAULT_ANSI_COLORS[10]),g.ansi[11]=b(w.brightYellow,t.DEFAULT_ANSI_COLORS[11]),g.ansi[12]=b(w.brightBlue,t.DEFAULT_ANSI_COLORS[12]),g.ansi[13]=b(w.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),g.ansi[14]=b(w.brightCyan,t.DEFAULT_ANSI_COLORS[14]),g.ansi[15]=b(w.brightWhite,t.DEFAULT_ANSI_COLORS[15]),w.extendedAnsi){const E=Math.min(g.ansi.length-16,w.extendedAnsi.length);for(let T=0;T<E;T++)g.ansi[T+16]=b(w.extendedAnsi[T],t.DEFAULT_ANSI_COLORS[T+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(w){this._restoreColor(w),this._onChangeColors.fire(this.colors)}_restoreColor(w){if(w!==void 0)switch(w){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[w]=this._restoreColors.ansi[w]}else for(let g=0;g<this._restoreColors.ansi.length;++g)this._colors.ansi[g]=this._restoreColors.ansi[g]}modifyColors(w){w(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 b(w,g){if(w!==void 0)try{return p.css.toColor(w)}catch{}return g}t.ThemeService=S=l([_(0,f.IOptionsService)],S)},6349:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const l=o(8460),_=o(844);class h extends _.Disposable{constructor(v){super(),this._maxLength=v,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(v){if(this._maxLength===v)return;const C=new Array(v);for(let f=0;f<Math.min(v,this.length);f++)C[f]=this._array[this._getCyclicIndex(f)];this._array=C,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let C=this._length;C<v;C++)this._array[C]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,C){this._array[this._getCyclicIndex(v)]=C}push(v){this._array[this._getCyclicIndex(this._length)]=v,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(v,C,...f){if(C){for(let i=v;i<this._length-C;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+C)];this._length-=C,this.onDeleteEmitter.fire({index:v,amount:C})}for(let i=this._length-1;i>=v;i--)this._array[this._getCyclicIndex(i+f.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<f.length;i++)this._array[this._getCyclicIndex(v+i)]=f[i];if(f.length&&this.onInsertEmitter.fire({index:v,amount:f.length}),this._length+f.length>this._maxLength){const i=this._length+f.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=f.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,C,f){if(!(C<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+f<0)throw new Error("Cannot shift elements in list beyond index 0");if(f>0){for(let n=C-1;n>=0;n--)this.set(v+n+f,this.get(v+n));const i=v+C+f-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<C;i++)this.set(v+i+f,this.get(v+i))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}t.CircularList=h},1439:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function o(l,_=5){if(typeof l!="object")return l;const h=Array.isArray(l)?[]:{};for(const p in l)h[p]=_<=1?l[p]:l[p]&&o(l[p],_-1);return h}},8055:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let o=0,l=0,_=0,h=0;var p,v,C,f,i;function n(s){const d=s.toString(16);return d.length<2?"0"+d:d}function r(s,d){return s<d?(d+.05)/(s+.05):(s+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(s){s.toCss=function(d,S,b,w){return w!==void 0?`#${n(d)}${n(S)}${n(b)}${n(w)}`:`#${n(d)}${n(S)}${n(b)}`},s.toRgba=function(d,S,b,w=255){return(d<<24|S<<16|b<<8|w)>>>0},s.toColor=function(d,S,b,w){return{css:s.toCss(d,S,b,w),rgba:s.toRgba(d,S,b,w)}}}(p||(t.channels=p={})),function(s){function d(S,b){return h=Math.round(255*b),[o,l,_]=i.toChannels(S.rgba),{css:p.toCss(o,l,_,h),rgba:p.toRgba(o,l,_,h)}}s.blend=function(S,b){if(h=(255&b.rgba)/255,h===1)return{css:b.css,rgba:b.rgba};const w=b.rgba>>24&255,g=b.rgba>>16&255,E=b.rgba>>8&255,T=S.rgba>>24&255,B=S.rgba>>16&255,O=S.rgba>>8&255;return o=T+Math.round((w-T)*h),l=B+Math.round((g-B)*h),_=O+Math.round((E-O)*h),{css:p.toCss(o,l,_),rgba:p.toRgba(o,l,_)}},s.isOpaque=function(S){return(255&S.rgba)==255},s.ensureContrastRatio=function(S,b,w){const g=i.ensureContrastRatio(S.rgba,b.rgba,w);if(g)return p.toColor(g>>24&255,g>>16&255,g>>8&255)},s.opaque=function(S){const b=(255|S.rgba)>>>0;return[o,l,_]=i.toChannels(b),{css:p.toCss(o,l,_),rgba:b}},s.opacity=d,s.multiplyOpacity=function(S,b){return h=255&S.rgba,d(S,h*b/255)},s.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}}(v||(t.color=v={})),function(s){let d,S;try{const b=document.createElement("canvas");b.width=1,b.height=1;const w=b.getContext("2d",{willReadFrequently:!0});w&&(d=w,d.globalCompositeOperation="copy",S=d.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(b){if(b.match(/#[\da-f]{3,8}/i))switch(b.length){case 4:return o=parseInt(b.slice(1,2).repeat(2),16),l=parseInt(b.slice(2,3).repeat(2),16),_=parseInt(b.slice(3,4).repeat(2),16),p.toColor(o,l,_);case 5:return o=parseInt(b.slice(1,2).repeat(2),16),l=parseInt(b.slice(2,3).repeat(2),16),_=parseInt(b.slice(3,4).repeat(2),16),h=parseInt(b.slice(4,5).repeat(2),16),p.toColor(o,l,_,h);case 7:return{css:b,rgba:(parseInt(b.slice(1),16)<<8|255)>>>0};case 9:return{css:b,rgba:parseInt(b.slice(1),16)>>>0}}const w=b.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(w)return o=parseInt(w[1]),l=parseInt(w[2]),_=parseInt(w[3]),h=Math.round(255*(w[5]===void 0?1:parseFloat(w[5]))),p.toColor(o,l,_,h);if(!d||!S)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=S,d.fillStyle=b,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[o,l,_,h]=d.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:p.toRgba(o,l,_,h),css:b}}}(C||(t.css=C={})),function(s){function d(S,b,w){const g=S/255,E=b/255,T=w/255;return .2126*(g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))}s.relativeLuminance=function(S){return d(S>>16&255,S>>8&255,255&S)},s.relativeLuminance2=d}(f||(t.rgb=f={})),function(s){function d(b,w,g){const E=b>>24&255,T=b>>16&255,B=b>>8&255;let O=w>>24&255,D=w>>16&255,P=w>>8&255,F=r(f.relativeLuminance2(O,D,P),f.relativeLuminance2(E,T,B));for(;F<g&&(O>0||D>0||P>0);)O-=Math.max(0,Math.ceil(.1*O)),D-=Math.max(0,Math.ceil(.1*D)),P-=Math.max(0,Math.ceil(.1*P)),F=r(f.relativeLuminance2(O,D,P),f.relativeLuminance2(E,T,B));return(O<<24|D<<16|P<<8|255)>>>0}function S(b,w,g){const E=b>>24&255,T=b>>16&255,B=b>>8&255;let O=w>>24&255,D=w>>16&255,P=w>>8&255,F=r(f.relativeLuminance2(O,D,P),f.relativeLuminance2(E,T,B));for(;F<g&&(O<255||D<255||P<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),D=Math.min(255,D+Math.ceil(.1*(255-D))),P=Math.min(255,P+Math.ceil(.1*(255-P))),F=r(f.relativeLuminance2(O,D,P),f.relativeLuminance2(E,T,B));return(O<<24|D<<16|P<<8|255)>>>0}s.blend=function(b,w){if(h=(255&w)/255,h===1)return w;const g=w>>24&255,E=w>>16&255,T=w>>8&255,B=b>>24&255,O=b>>16&255,D=b>>8&255;return o=B+Math.round((g-B)*h),l=O+Math.round((E-O)*h),_=D+Math.round((T-D)*h),p.toRgba(o,l,_)},s.ensureContrastRatio=function(b,w,g){const E=f.relativeLuminance(b>>8),T=f.relativeLuminance(w>>8);if(r(E,T)<g){if(T<E){const D=d(b,w,g),P=r(E,f.relativeLuminance(D>>8));if(P<g){const F=S(b,w,g);return P>r(E,f.relativeLuminance(F>>8))?D:F}return D}const B=S(b,w,g),O=r(E,f.relativeLuminance(B>>8));if(O<g){const D=d(b,w,g);return O>r(E,f.relativeLuminance(D>>8))?B:D}return B}},s.reduceLuminance=d,s.increaseLuminance=S,s.toChannels=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]}}(i||(t.rgba=i={})),t.toPaddedHex=n,t.contrastRatio=r},8969:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const l=o(844),_=o(2585),h=o(4348),p=o(7866),v=o(744),C=o(7302),f=o(6975),i=o(8460),n=o(1753),r=o(1480),s=o(7994),d=o(9282),S=o(5435),b=o(5981),w=o(2660);let g=!1;class E extends l.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event(B=>{var O;(O=this._onScrollApi)==null||O.fire(B.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(B){for(const O in B)this.optionsService.options[O]=B[O]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new l.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new C.OptionsService(B)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(f.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(n.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(r.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(w.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new S.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.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 b.WriteBuffer((O,D)=>this._inputHandler.parse(O,D))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,O){this._writeBuffer.write(B,O)}writeSync(B,O){this._logService.logLevel<=_.LogLevelEnum.WARN&&!g&&(this._logService.warn("writeSync is unreliable and will be removed soon."),g=!0),this._writeBuffer.writeSync(B,O)}input(B,O=!0){this.coreService.triggerDataEvent(B,O)}resize(B,O){isNaN(B)||isNaN(O)||(B=Math.max(B,v.MINIMUM_COLS),O=Math.max(O,v.MINIMUM_ROWS),this._bufferService.resize(B,O))}scroll(B,O=!1){this._bufferService.scroll(B,O)}scrollLines(B,O,D){this._bufferService.scrollLines(B,O,D)}scrollPages(B){this.scrollLines(B*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(B){const O=B-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(B,O){return this._inputHandler.registerEscHandler(B,O)}registerDcsHandler(B,O){return this._inputHandler.registerDcsHandler(B,O)}registerCsiHandler(B,O){return this._inputHandler.registerCsiHandler(B,O)}registerOscHandler(B,O){return this._inputHandler.registerOscHandler(B,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?B=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(B=!0),B?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const B=[];B.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,l.toDisposable)(()=>{for(const O of B)O.dispose()})}}}t.CoreTerminal=E},8460:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let l=0;l<this._listeners.length;l++)if(this._listeners[l]===o)return void this._listeners.splice(l,1)}}})),this._event}fire(o,l){const _=[];for(let h=0;h<this._listeners.length;h++)_.push(this._listeners[h]);for(let h=0;h<_.length;h++)_[h].call(void 0,o,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(o,l){return o(_=>l.fire(_))},t.runAndSubscribe=function(o,l){return l(void 0),o(_=>l(_))}},5435:function(k,t,o){var l=this&&this.__decorate||function($,x,L,A){var M,N=arguments.length,z=N<3?x:A===null?A=Object.getOwnPropertyDescriptor(x,L):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate($,x,L,A);else for(var J=$.length-1;J>=0;J--)(M=$[J])&&(z=(N<3?M(z):N>3?M(x,L,z):M(x,L))||z);return N>3&&z&&Object.defineProperty(x,L,z),z},_=this&&this.__param||function($,x){return function(L,A){x(L,A,$)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const h=o(2584),p=o(7116),v=o(2015),C=o(844),f=o(482),i=o(8437),n=o(8460),r=o(643),s=o(511),d=o(3734),S=o(2585),b=o(1480),w=o(6242),g=o(6351),E=o(5941),T={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function O($,x){if($>24)return x.setWinLines||!1;switch($){case 1:return!!x.restoreWin;case 2:return!!x.minimizeWin;case 3:return!!x.setWinPosition;case 4:return!!x.setWinSizePixels;case 5:return!!x.raiseWin;case 6:return!!x.lowerWin;case 7:return!!x.refreshWin;case 8:return!!x.setWinSizeChars;case 9:return!!x.maximizeWin;case 10:return!!x.fullscreenWin;case 11:return!!x.getWinState;case 13:return!!x.getWinPosition;case 14:return!!x.getWinSizePixels;case 15:return!!x.getScreenSizePixels;case 16:return!!x.getCellSizePixels;case 18:return!!x.getWinSizeChars;case 19:return!!x.getScreenSizeChars;case 20:return!!x.getIconTitle;case 21:return!!x.getWinTitle;case 22:return!!x.pushTitle;case 23:return!!x.popTitle;case 24:return!!x.setWinLines}return!1}var D;(function($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(t.WindowsOptionsReportType=D={}));let P=0;class F extends C.Disposable{getAttrData(){return this._curAttrData}constructor(x,L,A,M,N,z,J,ee,I=new v.EscapeSequenceParser){super(),this._bufferService=x,this._charsetService=L,this._coreService=A,this._logService=M,this._optionsService=N,this._oscLinkService=z,this._coreMouseService=J,this._unicodeService=ee,this._parser=I,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new f.StringToUtf32,this._utf8Decoder=new f.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new n.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new n.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new n.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new n.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new n.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new n.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new n.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new n.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new n.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new n.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new n.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new n.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(R=>this._activeBuffer=R.activeBuffer)),this._parser.setCsiHandlerFallback((R,W)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(R),params:W.toArray()})}),this._parser.setEscHandlerFallback(R=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(R)})}),this._parser.setExecuteHandlerFallback(R=>{this._logService.debug("Unknown EXECUTE code: ",{code:R})}),this._parser.setOscHandlerFallback((R,W,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:R,action:W,data:H})}),this._parser.setDcsHandlerFallback((R,W,H)=>{W==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(R),action:W,payload:H})}),this._parser.setPrintHandler((R,W,H)=>this.print(R,W,H)),this._parser.registerCsiHandler({final:"@"},R=>this.insertChars(R)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},R=>this.scrollLeft(R)),this._parser.registerCsiHandler({final:"A"},R=>this.cursorUp(R)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},R=>this.scrollRight(R)),this._parser.registerCsiHandler({final:"B"},R=>this.cursorDown(R)),this._parser.registerCsiHandler({final:"C"},R=>this.cursorForward(R)),this._parser.registerCsiHandler({final:"D"},R=>this.cursorBackward(R)),this._parser.registerCsiHandler({final:"E"},R=>this.cursorNextLine(R)),this._parser.registerCsiHandler({final:"F"},R=>this.cursorPrecedingLine(R)),this._parser.registerCsiHandler({final:"G"},R=>this.cursorCharAbsolute(R)),this._parser.registerCsiHandler({final:"H"},R=>this.cursorPosition(R)),this._parser.registerCsiHandler({final:"I"},R=>this.cursorForwardTab(R)),this._parser.registerCsiHandler({final:"J"},R=>this.eraseInDisplay(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},R=>this.eraseInDisplay(R,!0)),this._parser.registerCsiHandler({final:"K"},R=>this.eraseInLine(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},R=>this.eraseInLine(R,!0)),this._parser.registerCsiHandler({final:"L"},R=>this.insertLines(R)),this._parser.registerCsiHandler({final:"M"},R=>this.deleteLines(R)),this._parser.registerCsiHandler({final:"P"},R=>this.deleteChars(R)),this._parser.registerCsiHandler({final:"S"},R=>this.scrollUp(R)),this._parser.registerCsiHandler({final:"T"},R=>this.scrollDown(R)),this._parser.registerCsiHandler({final:"X"},R=>this.eraseChars(R)),this._parser.registerCsiHandler({final:"Z"},R=>this.cursorBackwardTab(R)),this._parser.registerCsiHandler({final:"`"},R=>this.charPosAbsolute(R)),this._parser.registerCsiHandler({final:"a"},R=>this.hPositionRelative(R)),this._parser.registerCsiHandler({final:"b"},R=>this.repeatPrecedingCharacter(R)),this._parser.registerCsiHandler({final:"c"},R=>this.sendDeviceAttributesPrimary(R)),this._parser.registerCsiHandler({prefix:">",final:"c"},R=>this.sendDeviceAttributesSecondary(R)),this._parser.registerCsiHandler({final:"d"},R=>this.linePosAbsolute(R)),this._parser.registerCsiHandler({final:"e"},R=>this.vPositionRelative(R)),this._parser.registerCsiHandler({final:"f"},R=>this.hVPosition(R)),this._parser.registerCsiHandler({final:"g"},R=>this.tabClear(R)),this._parser.registerCsiHandler({final:"h"},R=>this.setMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"h"},R=>this.setModePrivate(R)),this._parser.registerCsiHandler({final:"l"},R=>this.resetMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"l"},R=>this.resetModePrivate(R)),this._parser.registerCsiHandler({final:"m"},R=>this.charAttributes(R)),this._parser.registerCsiHandler({final:"n"},R=>this.deviceStatus(R)),this._parser.registerCsiHandler({prefix:"?",final:"n"},R=>this.deviceStatusPrivate(R)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},R=>this.softReset(R)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},R=>this.setCursorStyle(R)),this._parser.registerCsiHandler({final:"r"},R=>this.setScrollRegion(R)),this._parser.registerCsiHandler({final:"s"},R=>this.saveCursor(R)),this._parser.registerCsiHandler({final:"t"},R=>this.windowOptions(R)),this._parser.registerCsiHandler({final:"u"},R=>this.restoreCursor(R)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},R=>this.insertColumns(R)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},R=>this.deleteColumns(R)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},R=>this.selectProtected(R)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},R=>this.requestMode(R,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},R=>this.requestMode(R,!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 w.OscHandler(R=>(this.setTitle(R),this.setIconName(R),!0))),this._parser.registerOscHandler(1,new w.OscHandler(R=>this.setIconName(R))),this._parser.registerOscHandler(2,new w.OscHandler(R=>this.setTitle(R))),this._parser.registerOscHandler(4,new w.OscHandler(R=>this.setOrReportIndexedColor(R))),this._parser.registerOscHandler(8,new w.OscHandler(R=>this.setHyperlink(R))),this._parser.registerOscHandler(10,new w.OscHandler(R=>this.setOrReportFgColor(R))),this._parser.registerOscHandler(11,new w.OscHandler(R=>this.setOrReportBgColor(R))),this._parser.registerOscHandler(12,new w.OscHandler(R=>this.setOrReportCursorColor(R))),this._parser.registerOscHandler(104,new w.OscHandler(R=>this.restoreIndexedColor(R))),this._parser.registerOscHandler(110,new w.OscHandler(R=>this.restoreFgColor(R))),this._parser.registerOscHandler(111,new w.OscHandler(R=>this.restoreBgColor(R))),this._parser.registerOscHandler(112,new w.OscHandler(R=>this.restoreCursorColor(R))),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 R in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:R},()=>this.selectCharset("("+R)),this._parser.registerEscHandler({intermediates:")",final:R},()=>this.selectCharset(")"+R)),this._parser.registerEscHandler({intermediates:"*",final:R},()=>this.selectCharset("*"+R)),this._parser.registerEscHandler({intermediates:"+",final:R},()=>this.selectCharset("+"+R)),this._parser.registerEscHandler({intermediates:"-",final:R},()=>this.selectCharset("-"+R)),this._parser.registerEscHandler({intermediates:".",final:R},()=>this.selectCharset("."+R)),this._parser.registerEscHandler({intermediates:"/",final:R},()=>this.selectCharset("/"+R));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(R=>(this._logService.error("Parsing error: ",R),R)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new g.DcsHandler((R,W)=>this.requestStatusString(R,W)))}_preserveStack(x,L,A,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=x,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=A,this._parseStack.position=M}_logSlowResolvingAsync(x){this._logService.logLevel<=S.LogLevelEnum.WARN&&Promise.race([x,new Promise((L,A)=>setTimeout(()=>A("#SLOW_TIMEOUT"),5e3))]).catch(L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(x,L){let A,M=this._activeBuffer.x,N=this._activeBuffer.y,z=0;const J=this._parseStack.paused;if(J){if(A=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(A),A;M=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,x.length>B&&(z=this._parseStack.position+B)}if(this._logService.logLevel<=S.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof x=="string"?` "${x}"`:` "${Array.prototype.map.call(x,R=>String.fromCharCode(R)).join("")}"`),typeof x=="string"?x.split("").map(R=>R.charCodeAt(0)):x),this._parseBuffer.length<x.length&&this._parseBuffer.length<B&&(this._parseBuffer=new Uint32Array(Math.min(x.length,B))),J||this._dirtyRowTracker.clearRange(),x.length>B)for(let R=z;R<x.length;R+=B){const W=R+B<x.length?R+B:x.length,H=typeof x=="string"?this._stringDecoder.decode(x.substring(R,W),this._parseBuffer):this._utf8Decoder.decode(x.subarray(R,W),this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,H))return this._preserveStack(M,N,H,R),this._logSlowResolvingAsync(A),A}else if(!J){const R=typeof x=="string"?this._stringDecoder.decode(x,this._parseBuffer):this._utf8Decoder.decode(x,this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,R))return this._preserveStack(M,N,R,0),this._logSlowResolvingAsync(A),A}this._activeBuffer.x===M&&this._activeBuffer.y===N||this._onCursorMove.fire();const ee=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),I=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);I<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(I,this._bufferService.rows-1),Math.min(ee,this._bufferService.rows-1))}print(x,L,A){let M,N;const z=this._charsetService.charset,J=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,I=this._coreService.decPrivateModes.wraparound,R=this._coreService.modes.insertMode,W=this._curAttrData;let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&A-L>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,W);let Z=this._parser.precedingJoinState;for(let V=L;V<A;++V){if(M=x[V],M<127&&z){const ue=z[String.fromCharCode(M)];ue&&(M=ue.charCodeAt(0))}const ie=this._unicodeService.charProperties(M,Z);N=b.UnicodeService.extractWidth(ie);const ce=b.UnicodeService.extractShouldJoin(ie),he=ce?b.UnicodeService.extractWidth(Z):0;if(Z=ie,J&&this._onA11yChar.fire((0,f.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-he>ee){if(I){const ue=H;let te=this._activeBuffer.x-he;for(this._activeBuffer.x=he,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),he>0&&H instanceof i.BufferLine&&H.copyCellsFrom(ue,te,0,he,!1);te<ee;)ue.setCellFromCodepoint(te++,0,1,W)}else if(this._activeBuffer.x=ee-1,N===2)continue}if(ce&&this._activeBuffer.x){const ue=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-ue,M,N);for(let te=N-he;--te>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}else if(R&&(H.insertCells(this._activeBuffer.x,N-he,this._activeBuffer.getNullCell(W)),H.getWidth(ee-1)===2&&H.setCellFromCodepoint(ee-1,r.NULL_CELL_CODE,r.NULL_CELL_WIDTH,W)),H.setCellFromCodepoint(this._activeBuffer.x++,M,N,W),N>0)for(;--N;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}this._parser.precedingJoinState=Z,this._activeBuffer.x<ee&&A-L>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,W),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(x,L){return x.final!=="t"||x.prefix||x.intermediates?this._parser.registerCsiHandler(x,L):this._parser.registerCsiHandler(x,A=>!O(A.params[0],this._optionsService.rawOptions.windowOptions)||L(A))}registerDcsHandler(x,L){return this._parser.registerDcsHandler(x,new g.DcsHandler(L))}registerEscHandler(x,L){return this._parser.registerEscHandler(x,L)}registerOscHandler(x,L){return this._parser.registerOscHandler(x,new w.OscHandler(L))}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 x;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&&((x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&x.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const x=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-x),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(x=this._bufferService.cols-1){this._activeBuffer.x=Math.min(x,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(x,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=x,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=x,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(x,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+x,this._activeBuffer.y+L)}cursorUp(x){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,x.params[0]||1)):this._moveCursor(0,-(x.params[0]||1)),!0}cursorDown(x){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,x.params[0]||1)):this._moveCursor(0,x.params[0]||1),!0}cursorForward(x){return this._moveCursor(x.params[0]||1,0),!0}cursorBackward(x){return this._moveCursor(-(x.params[0]||1),0),!0}cursorNextLine(x){return this.cursorDown(x),this._activeBuffer.x=0,!0}cursorPrecedingLine(x){return this.cursorUp(x),this._activeBuffer.x=0,!0}cursorCharAbsolute(x){return this._setCursor((x.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(x){return this._setCursor(x.length>=2?(x.params[1]||1)-1:0,(x.params[0]||1)-1),!0}charPosAbsolute(x){return this._setCursor((x.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(x){return this._moveCursor(x.params[0]||1,0),!0}linePosAbsolute(x){return this._setCursor(this._activeBuffer.x,(x.params[0]||1)-1),!0}vPositionRelative(x){return this._moveCursor(0,x.params[0]||1),!0}hVPosition(x){return this.cursorPosition(x),!0}tabClear(x){const L=x.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=x.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=x.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(x){const L=x.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(x,L,A,M=!1,N=!1){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);z.replaceCells(L,A,this._activeBuffer.getNullCell(this._eraseAttrData()),N),M&&(z.isWrapped=!1)}_resetBufferLine(x,L=!1){const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);A&&(A.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+x),A.isWrapped=!1)}eraseInDisplay(x,L=!1){let A;switch(this._restrictCursor(this._bufferService.cols),x.params[0]){case 0:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);A<this._bufferService.rows;A++)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(A);break;case 1:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(A+1).isWrapped=!1);A--;)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(A=this._bufferService.rows,this._dirtyRowTracker.markDirty(A-1);A--;)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(0);break;case 3:const M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(x,L=!1){switch(this._restrictCursor(this._bufferService.cols),x.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(x){this._restrictCursor();let L=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;L--;)this._activeBuffer.lines.splice(N-1,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(x){this._restrictCursor();let L=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y;let M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;L--;)this._activeBuffer.lines.splice(A,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,x.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,x.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(x){let L=x.params[0]||1;for(;L--;)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(x){let L=x.params[0]||1;for(;L--;)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(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(x.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(x){const L=this._parser.precedingJoinState;if(!L)return!0;const A=x.params[0]||1,M=b.UnicodeService.extractWidth(L),N=this._activeBuffer.x-M,z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),J=new Uint32Array(z.length*A);let ee=0;for(let R=0;R<z.length;){const W=z.codePointAt(R)||0;J[ee++]=W,R+=W>65535?2:1}let I=ee;for(let R=1;R<A;++R)J.copyWithin(I,0,ee),I+=ee;return this.print(J,0,I),!0}sendDeviceAttributesPrimary(x){return x.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(x){return x.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(x.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(x){return(this._optionsService.rawOptions.termName+"").indexOf(x)===0}setMode(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.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(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(x){for(let L=0;L<x.length;L++)switch(x.params[L]){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(),x.params[L]===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(x,L){const A=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:N}=this._coreMouseService,z=this._coreService,{buffers:J,cols:ee}=this._bufferService,{active:I,alt:R}=J,W=this._optionsService.rawOptions,H=ce=>ce?1:2,Z=x.params[0];return V=Z,ie=L?Z===2?4:Z===4?H(z.modes.insertMode):Z===12?3:Z===20?H(W.convertEol):0:Z===1?H(A.applicationCursorKeys):Z===3?W.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:Z===6?H(A.origin):Z===7?H(A.wraparound):Z===8?3:Z===9?H(M==="X10"):Z===12?H(W.cursorBlink):Z===25?H(!z.isCursorHidden):Z===45?H(A.reverseWraparound):Z===66?H(A.applicationKeypad):Z===67?4:Z===1e3?H(M==="VT200"):Z===1002?H(M==="DRAG"):Z===1003?H(M==="ANY"):Z===1004?H(A.sendFocus):Z===1005?4:Z===1006?H(N==="SGR"):Z===1015?4:Z===1016?H(N==="SGR_PIXELS"):Z===1048?1:Z===47||Z===1047||Z===1049?H(I===R):Z===2004?H(A.bracketedPasteMode):0,z.triggerDataEvent(`${h.C0.ESC}[${L?"":"?"}${V};${ie}$y`),!0;var V,ie}_updateAttrColor(x,L,A,M,N){return L===2?(x|=50331648,x&=-16777216,x|=d.AttributeData.fromColorRGB([A,M,N])):L===5&&(x&=-50331904,x|=33554432|255&A),x}_extractColor(x,L,A){const M=[0,0,-1,0,0,0];let N=0,z=0;do{if(M[z+N]=x.params[L+z],x.hasSubParams(L+z)){const J=x.getSubParams(L+z);let ee=0;do M[1]===5&&(N=1),M[z+ee+1+N]=J[ee];while(++ee<J.length&&ee+z+1+N<M.length);break}if(M[1]===5&&z+N>=2||M[1]===2&&z+N>=5)break;M[1]&&(N=1)}while(++z+L<x.length&&z+N<M.length);for(let J=2;J<M.length;++J)M[J]===-1&&(M[J]=0);switch(M[0]){case 38:A.fg=this._updateAttrColor(A.fg,M[1],M[3],M[4],M[5]);break;case 48:A.bg=this._updateAttrColor(A.bg,M[1],M[3],M[4],M[5]);break;case 58:A.extended=A.extended.clone(),A.extended.underlineColor=this._updateAttrColor(A.extended.underlineColor,M[1],M[3],M[4],M[5])}return z}_processUnderline(x,L){L.extended=L.extended.clone(),(!~x||x>5)&&(x=1),L.extended.underlineStyle=x,L.fg|=268435456,x===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(x){x.fg=i.DEFAULT_ATTR_DATA.fg,x.bg=i.DEFAULT_ATTR_DATA.bg,x.extended=x.extended.clone(),x.extended.underlineStyle=0,x.extended.underlineColor&=-67108864,x.updateExtended()}charAttributes(x){if(x.length===1&&x.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=x.length;let A;const M=this._curAttrData;for(let N=0;N<L;N++)A=x.params[N],A>=30&&A<=37?(M.fg&=-50331904,M.fg|=16777216|A-30):A>=40&&A<=47?(M.bg&=-50331904,M.bg|=16777216|A-40):A>=90&&A<=97?(M.fg&=-50331904,M.fg|=16777224|A-90):A>=100&&A<=107?(M.bg&=-50331904,M.bg|=16777224|A-100):A===0?this._processSGR0(M):A===1?M.fg|=134217728:A===3?M.bg|=67108864:A===4?(M.fg|=268435456,this._processUnderline(x.hasSubParams(N)?x.getSubParams(N)[0]:1,M)):A===5?M.fg|=536870912:A===7?M.fg|=67108864:A===8?M.fg|=1073741824:A===9?M.fg|=2147483648:A===2?M.bg|=134217728:A===21?this._processUnderline(2,M):A===22?(M.fg&=-134217729,M.bg&=-134217729):A===23?M.bg&=-67108865:A===24?(M.fg&=-268435457,this._processUnderline(0,M)):A===25?M.fg&=-536870913:A===27?M.fg&=-67108865:A===28?M.fg&=-1073741825:A===29?M.fg&=2147483647:A===39?(M.fg&=-67108864,M.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):A===49?(M.bg&=-67108864,M.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):A===38||A===48||A===58?N+=this._extractColor(x,N,M):A===53?M.bg|=1073741824:A===55?M.bg&=-1073741825:A===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):A===100?(M.fg&=-67108864,M.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",A);return!0}deviceStatus(x){switch(x.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${L};${A}R`)}return!0}deviceStatusPrivate(x){if(x.params[0]===6){const L=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${L};${A}R`)}return!0}softReset(x){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.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(x){const L=x.params[0]||1;switch(L){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 A=L%2==1;return this._optionsService.options.cursorBlink=A,!0}setScrollRegion(x){const L=x.params[0]||1;let A;return(x.length<2||(A=x.params[1])>this._bufferService.rows||A===0)&&(A=this._bufferService.rows),A>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=A-1,this._setCursor(0,0)),!0}windowOptions(x){if(!O(x.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=x.length>1?x.params[1]:0;switch(x.params[0]){case 14:L!==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:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(x){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(x){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(x){return this._windowTitle=x,this._onTitleChange.fire(x),!0}setIconName(x){return this._iconName=x,!0}setOrReportIndexedColor(x){const L=[],A=x.split(";");for(;A.length>1;){const M=A.shift(),N=A.shift();if(/^\d+$/.exec(M)){const z=parseInt(M);if(G(z))if(N==="?")L.push({type:0,index:z});else{const J=(0,E.parseColor)(N);J&&L.push({type:1,index:z,color:J})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(x){const L=x.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(x,L){this._getCurrentLinkId()&&this._finishHyperlink();const A=x.split(":");let M;const N=A.findIndex(z=>z.startsWith("id="));return N!==-1&&(M=A[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(x,L){const A=x.split(";");for(let M=0;M<A.length&&!(L>=this._specialColors.length);++M,++L)if(A[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const N=(0,E.parseColor)(A[M]);N&&this._onColor.fire([{type:1,index:this._specialColors[L],color:N}])}return!0}setOrReportFgColor(x){return this._setOrReportSpecialColor(x,0)}setOrReportBgColor(x){return this._setOrReportSpecialColor(x,1)}setOrReportCursorColor(x){return this._setOrReportSpecialColor(x,2)}restoreIndexedColor(x){if(!x)return this._onColor.fire([{type:2}]),!0;const L=[],A=x.split(";");for(let M=0;M<A.length;++M)if(/^\d+$/.exec(A[M])){const N=parseInt(A[M]);G(N)&&L.push({type:2,index:N})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(x){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(x){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(x){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,p.DEFAULT_CHARSET),!0}selectCharset(x){return x.length!==2?(this.selectDefaultCharset(),!0):(x[0]==="/"||this._charsetService.setgCharset(T[x[0]],p.CHARSETS[x[1]]||p.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 x=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,x,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=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(x){return this._charsetService.setgLevel(x),!0}screenAlignmentPattern(){const x=new s.CellData;x.content=4194373,x.fg=this._curAttrData.fg,x.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){const A=this._activeBuffer.ybase+this._activeBuffer.y+L,M=this._activeBuffer.lines.get(A);M&&(M.fill(x),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(x,L){const A=this._bufferService.buffer,M=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${N}${h.C0.ESC}\\`),!0))(x==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:x==='"p'?'P1$r61;1"p':x==="r"?`P1$r${A.scrollTop+1};${A.scrollBottom+1}r`:x==="m"?"P1$r0m":x===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(x,L){this._dirtyRowTracker.markRangeDirty(x,L)}}t.InputHandler=F;let U=class{constructor($){this._bufferService=$,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty($){$<this.start?this.start=$:$>this.end&&(this.end=$)}markRangeDirty($,x){$>x&&(P=$,$=x,x=P),$<this.start&&(this.start=$),x>this.end&&(this.end=x)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function G($){return 0<=$&&$<256}U=l([_(0,S.IBufferService)],U)},844:(k,t)=>{function o(l){for(const _ of l)_.dispose();l.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.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 _=this._disposables.indexOf(l);_!==-1&&this._disposables.splice(_,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){var _;this._isDisposed||l===this._value||((_=this._value)==null||_.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}},t.toDisposable=function(l){return{dispose:l}},t.disposeArray=o,t.getDisposeArrayDisposable=function(l){return{dispose:()=>o(l)}}},1505:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(_,h,p){this._data[_]||(this._data[_]={}),this._data[_][h]=p}get(_,h){return this._data[_]?this._data[_][h]:void 0}clear(){this._data={}}}t.TwoKeyMap=o,t.FourKeyMap=class{constructor(){this._data=new o}set(l,_,h,p,v){this._data.get(l,_)||this._data.set(l,_,new o),this._data.get(l,_).set(h,p,v)}get(l,_,h,p){var v;return(v=this._data.get(l,_))==null?void 0:v.get(h,p)}clear(){this._data.clear()}}},6114:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const o=t.isNode?"node":navigator.userAgent,l=t.isNode?"node":navigator.platform;t.isFirefox=o.includes("Firefox"),t.isLegacyEdge=o.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(o),t.getSafariVersion=function(){if(!t.isSafari)return 0;const _=o.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),t.isIpad=l==="iPad",t.isIphone=l==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),t.isLinux=l.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(o)},6106:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let o=0;t.SortedList=class{constructor(l){this._getKey=l,this._array=[]}clear(){this._array.length=0}insert(l){this._array.length!==0?(o=this._search(this._getKey(l)),this._array.splice(o,0,l)):this._array.push(l)}delete(l){if(this._array.length===0)return!1;const _=this._getKey(l);if(_===void 0||(o=this._search(_),o===-1)||this._getKey(this._array[o])!==_)return!1;do if(this._array[o]===l)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===_);return!1}*getKeyIterator(l){if(this._array.length!==0&&(o=this._search(l),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===l))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===l)}forEachByKey(l,_){if(this._array.length!==0&&(o=this._search(l),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===l))do _(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===l)}values(){return[...this._array].values()}_search(l){let _=0,h=this._array.length-1;for(;h>=_;){let p=_+h>>1;const v=this._getKey(this._array[p]);if(v>l)h=p-1;else{if(!(v<l)){for(;p>0&&this._getKey(this._array[p-1])===l;)p--;return p}_=p+1}}return _}}},7226:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const l=o(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),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(v){this._idleCallback=void 0;let C=0,f=0,i=v.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(C=Date.now(),this._tasks[this._i]()||this._i++,C=Math.max(1,Date.now()-C),f=Math.max(C,f),n=v.timeRemaining(),1.5*f>n)return i-C<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-C))}ms`),void this._start();i=n}this.clear()}}class h extends _{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const C=Date.now()+v;return{timeRemaining:()=>Math.max(0,C-Date.now())}}}t.PriorityTaskQueue=h,t.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:h,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const l=o(643);t.updateWindowsModeWrappedState=function(_){const h=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),p=h==null?void 0:h.get(_.cols-1),v=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);v&&p&&(v.isWrapped=p[l.CHAR_DATA_CODE_INDEX]!==l.NULL_CELL_CODE&&p[l.CHAR_DATA_CODE_INDEX]!==l.WHITESPACE_CELL_CODE)}},3734:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class o{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 o;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}}t.AttributeData=o;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,p=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=p}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=l},9092:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const l=o(6349),_=o(7226),h=o(3734),p=o(8437),v=o(4634),C=o(511),f=o(643),i=o(4863),n=o(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(r,s,d){this._hasScrollback=r,this._optionsService=s,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=n.DEFAULT_CHARSET,this.markers=[],this._nullCell=C.CellData.fromCharData([0,f.NULL_CELL_CHAR,f.NULL_CELL_WIDTH,f.NULL_CELL_CODE]),this._whitespaceCell=C.CellData.fromCharData([0,f.WHITESPACE_CELL_CHAR,f.WHITESPACE_CELL_WIDTH,f.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.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,s){return new p.BufferLine(this._bufferService.cols,this.getNullCell(r),s)}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 s=r+this._optionsService.rawOptions.scrollback;return s>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:s}fillViewportRows(r){if(this.lines.length===0){r===void 0&&(r=p.DEFAULT_ATTR_DATA);let s=this._rows;for(;s--;)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,s){const d=this.getNullCell(p.DEFAULT_ATTR_DATA);let S=0;const b=this._getCorrectBufferLength(s);if(b>this.lines.maxLength&&(this.lines.maxLength=b),this.lines.length>0){if(this._cols<r)for(let g=0;g<this.lines.length;g++)S+=+this.lines.get(g).resize(r,d);let w=0;if(this._rows<s)for(let g=this._rows;g<s;g++)this.lines.length<s+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(r,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+w+1?(this.ybase--,w++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(r,d)));else for(let g=this._rows;g>s;g--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(b<this.lines.maxLength){const g=this.lines.length-b;g>0&&(this.lines.trimStart(g),this.ybase=Math.max(this.ybase-g,0),this.ydisp=Math.max(this.ydisp-g,0),this.savedY=Math.max(this.savedY-g,0)),this.lines.maxLength=b}this.x=Math.min(this.x,r-1),this.y=Math.min(this.y,s-1),w&&(this.y+=w),this.savedX=Math.min(this.savedX,r-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(r,s),this._cols>r))for(let w=0;w<this.lines.length;w++)S+=+this.lines.get(w).resize(r,d);this._cols=r,this._rows=s,this._memoryCleanupQueue.clear(),S>.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 s=0;for(;this._memoryCleanupPosition<this.lines.length;)if(s+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),s>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,s){this._cols!==r&&(r>this._cols?this._reflowLarger(r,s):this._reflowSmaller(r,s))}_reflowLarger(r,s){const d=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,r,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(d.length>0){const S=(0,v.reflowLargerCreateNewLayout)(this.lines,d);(0,v.reflowLargerApplyNewLayout)(this.lines,S.layout),this._reflowLargerAdjustViewport(r,s,S.countRemoved)}}_reflowLargerAdjustViewport(r,s,d){const S=this.getNullCell(p.DEFAULT_ATTR_DATA);let b=d;for(;b-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new p.BufferLine(r,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(r,s){const d=this.getNullCell(p.DEFAULT_ATTR_DATA),S=[];let b=0;for(let w=this.lines.length-1;w>=0;w--){let g=this.lines.get(w);if(!g||!g.isWrapped&&g.getTrimmedLength()<=r)continue;const E=[g];for(;g.isWrapped&&w>0;)g=this.lines.get(--w),E.unshift(g);const T=this.ybase+this.y;if(T>=w&&T<w+E.length)continue;const B=E[E.length-1].getTrimmedLength(),O=(0,v.reflowSmallerGetNewLineLengths)(E,this._cols,r),D=O.length-E.length;let P;P=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 A=0;A<D;A++){const M=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);F.push(M)}F.length>0&&(S.push({start:w+E.length+b,newLines:F}),b+=F.length),E.push(...F);let U=O.length-1,G=O[U];G===0&&(U--,G=O[U]);let $=E.length-D-1,x=B;for(;$>=0;){const A=Math.min(x,G);if(E[U]===void 0)break;if(E[U].copyCellsFrom(E[$],x-A,G-A,A,!0),G-=A,G===0&&(U--,G=O[U]),x-=A,x===0){$--;const M=Math.max($,0);x=(0,v.getWrappedLineTrimmedLength)(E,M,this._cols)}}for(let A=0;A<E.length;A++)O[A]<r&&E[A].setCell(O[A],d);let L=D-P;for(;L-- >0;)this.ybase===0?this.y<s-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+b)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+s-1)}if(S.length>0){const w=[],g=[];for(let U=0;U<this.lines.length;U++)g.push(this.lines.get(U));const E=this.lines.length;let T=E-1,B=0,O=S[B];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+b);let D=0;for(let U=Math.min(this.lines.maxLength-1,E+b-1);U>=0;U--)if(O&&O.start>T+D){for(let G=O.newLines.length-1;G>=0;G--)this.lines.set(U--,O.newLines[G]);U++,w.push({index:T+1,amount:O.newLines.length}),D+=O.newLines.length,O=S[++B]}else this.lines.set(U,g[T--]);let P=0;for(let U=w.length-1;U>=0;U--)w[U].index+=P,this.lines.onInsertEmitter.fire(w[U]),P+=w[U].amount;const F=Math.max(0,E+b-this.lines.maxLength);F>0&&this.lines.onTrimEmitter.fire(F)}}translateBufferLineToString(r,s,d=0,S){const b=this.lines.get(r);return b?b.translateToString(s,d,S):""}getWrappedRangeForLine(r){let s=r,d=r;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:s,last:d}}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 s=0;s<this.markers.length;s++)this.markers[s].line===r&&(this.markers[s].dispose(),this.markers.splice(s--,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 s=new i.Marker(r);return this.markers.push(s),s.register(this.lines.onTrim(d=>{s.line-=d,s.line<0&&s.dispose()})),s.register(this.lines.onInsert(d=>{s.line>=d.index&&(s.line+=d.amount)})),s.register(this.lines.onDelete(d=>{s.line>=d.index&&s.line<d.index+d.amount&&s.dispose(),s.line>d.index&&(s.line-=d.amount)})),s.register(s.onDispose(()=>this._removeMarker(s))),s}_removeMarker(r){this._isClearing||this.markers.splice(this.markers.indexOf(r),1)}}},8437:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const l=o(3734),_=o(511),h=o(643),p=o(482);t.DEFAULT_ATTR_DATA=Object.freeze(new l.AttributeData);let v=0;class C{constructor(i,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);const s=n||_.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let d=0;d<i;++d)this.setCell(d,s);this.length=i}get(i){const n=this._data[3*i+0],r=2097151&n;return[this._data[3*i+1],2097152&n?this._combined[i]:r?(0,p.stringFromCodePoint)(r):"",n>>22,2097152&n?this._combined[i].charCodeAt(this._combined[i].length-1):r]}set(i,n){this._data[3*i+1]=n[h.CHAR_DATA_ATTR_INDEX],n[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=n[1],this._data[3*i+0]=2097152|i|n[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=n[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|n[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){const n=this._data[3*i+0];return 2097152&n?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&n}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){const n=this._data[3*i+0];return 2097152&n?this._combined[i]:2097151&n?(0,p.stringFromCodePoint)(2097151&n):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,n){return v=3*i,n.content=this._data[v+0],n.fg=this._data[v+1],n.bg=this._data[v+2],2097152&n.content&&(n.combinedData=this._combined[i]),268435456&n.bg&&(n.extended=this._extendedAttrs[i]),n}setCell(i,n){2097152&n.content&&(this._combined[i]=n.combinedData),268435456&n.bg&&(this._extendedAttrs[i]=n.extended),this._data[3*i+0]=n.content,this._data[3*i+1]=n.fg,this._data[3*i+2]=n.bg}setCellFromCodepoint(i,n,r,s){268435456&s.bg&&(this._extendedAttrs[i]=s.extended),this._data[3*i+0]=n|r<<22,this._data[3*i+1]=s.fg,this._data[3*i+2]=s.bg}addCodepointToCell(i,n,r){let s=this._data[3*i+0];2097152&s?this._combined[i]+=(0,p.stringFromCodePoint)(n):2097151&s?(this._combined[i]=(0,p.stringFromCodePoint)(2097151&s)+(0,p.stringFromCodePoint)(n),s&=-2097152,s|=2097152):s=n|4194304,r&&(s&=-12582913,s|=r<<22),this._data[3*i+0]=s}insertCells(i,n,r){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,r),n<this.length-i){const s=new _.CellData;for(let d=this.length-i-n-1;d>=0;--d)this.setCell(i+n+d,this.loadCell(i+d,s));for(let d=0;d<n;++d)this.setCell(i+d,r)}else for(let s=i;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(i,n,r){if(i%=this.length,n<this.length-i){const s=new _.CellData;for(let d=0;d<this.length-i-n;++d)this.setCell(i+d,this.loadCell(i+n+d,s));for(let d=this.length-n;d<this.length;++d)this.setCell(d,r)}else for(let s=i;s<this.length;++s)this.setCell(s,r);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,r),this.getWidth(i)!==0||this.hasContent(i)||this.setCellFromCodepoint(i,0,1,r)}replaceCells(i,n,r,s=!1){if(s)for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);i<n&&i<this.length;)this.isProtected(i)||this.setCell(i,r),i++;else for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);i<n&&i<this.length;)this.setCell(i++,r)}resize(i,n){if(i===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const r=3*i;if(i>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{const s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<i;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,r);const s=Object.keys(this._combined);for(let S=0;S<s.length;S++){const b=parseInt(s[S],10);b>=i&&delete this._combined[b]}const d=Object.keys(this._extendedAttrs);for(let S=0;S<d.length;S++){const b=parseInt(d[S],10);b>=i&&delete this._extendedAttrs[b]}}return this.length=i,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,n=!1){if(n)for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,i);else{this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,i)}}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(const n in i._combined)this._combined[n]=i._combined[n];this._extendedAttrs={};for(const n in i._extendedAttrs)this._extendedAttrs[n]=i._extendedAttrs[n];this.isWrapped=i.isWrapped}clone(){const i=new C(0);i._data=new Uint32Array(this._data),i.length=this.length;for(const n in this._combined)i._combined[n]=this._combined[n];for(const n in this._extendedAttrs)i._extendedAttrs[n]=this._extendedAttrs[n];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,n,r,s,d){const S=i._data;if(d)for(let w=s-1;w>=0;w--){for(let g=0;g<3;g++)this._data[3*(r+w)+g]=S[3*(n+w)+g];268435456&S[3*(n+w)+2]&&(this._extendedAttrs[r+w]=i._extendedAttrs[n+w])}else for(let w=0;w<s;w++){for(let g=0;g<3;g++)this._data[3*(r+w)+g]=S[3*(n+w)+g];268435456&S[3*(n+w)+2]&&(this._extendedAttrs[r+w]=i._extendedAttrs[n+w])}const b=Object.keys(i._combined);for(let w=0;w<b.length;w++){const g=parseInt(b[w],10);g>=n&&(this._combined[g-n+r]=i._combined[g])}}translateToString(i,n,r,s){n=n??0,r=r??this.length,i&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let d="";for(;n<r;){const S=this._data[3*n+0],b=2097151&S,w=2097152&S?this._combined[n]:b?(0,p.stringFromCodePoint)(b):h.WHITESPACE_CELL_CHAR;if(d+=w,s)for(let g=0;g<w.length;++g)s.push(n);n+=S>>22||1}return s&&s.push(n),d}}t.BufferLine=C},4841:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(o,l){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return l*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(k,t)=>{function o(l,_,h){if(_===l.length-1)return l[_].getTrimmedLength();const p=!l[_].hasContent(h-1)&&l[_].getWidth(h-1)===1,v=l[_+1].getWidth(0)===2;return p&&v?h-1:h}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(l,_,h,p,v){const C=[];for(let f=0;f<l.length-1;f++){let i=f,n=l.get(++i);if(!n.isWrapped)continue;const r=[l.get(f)];for(;i<l.length&&n.isWrapped;)r.push(n),n=l.get(++i);if(p>=f&&p<i){f+=r.length-1;continue}let s=0,d=o(r,s,_),S=1,b=0;for(;S<r.length;){const g=o(r,S,_),E=g-b,T=h-d,B=Math.min(E,T);r[s].copyCellsFrom(r[S],b,d,B,!1),d+=B,d===h&&(s++,d=0),b+=B,b===g&&(S++,b=0),d===0&&s!==0&&r[s-1].getWidth(h-1)===2&&(r[s].copyCellsFrom(r[s-1],h-1,d++,1,!1),r[s-1].setCell(h-1,v))}r[s].replaceCells(d,h,v);let w=0;for(let g=r.length-1;g>0&&(g>s||r[g].getTrimmedLength()===0);g--)w++;w>0&&(C.push(f+r.length-w),C.push(w)),f+=r.length-1}return C},t.reflowLargerCreateNewLayout=function(l,_){const h=[];let p=0,v=_[p],C=0;for(let f=0;f<l.length;f++)if(v===f){const i=_[++p];l.onDeleteEmitter.fire({index:f-C,amount:i}),f+=i-1,C+=i,v=_[++p]}else h.push(f);return{layout:h,countRemoved:C}},t.reflowLargerApplyNewLayout=function(l,_){const h=[];for(let p=0;p<_.length;p++)h.push(l.get(_[p]));for(let p=0;p<h.length;p++)l.set(p,h[p]);l.length=_.length},t.reflowSmallerGetNewLineLengths=function(l,_,h){const p=[],v=l.map((n,r)=>o(l,r,_)).reduce((n,r)=>n+r);let C=0,f=0,i=0;for(;i<v;){if(v-i<h){p.push(v-i);break}C+=h;const n=o(l,f,_);C>n&&(C-=n,f++);const r=l[f].getWidth(C-1)===2;r&&C--;const s=r?h-1:h;p.push(s),i+=s}return p},t.getWrappedLineTrimmedLength=o},5295:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const l=o(8460),_=o(844),h=o(9092);class p extends _.Disposable{constructor(C,f){super(),this._optionsService=C,this._bufferService=f,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(C){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(C),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(C,f){this._normal.resize(C,f),this._alt.resize(C,f),this.setupTabStops(C)}setupTabStops(C){this._normal.setupTabStops(C),this._alt.setupTabStops(C)}}t.BufferSet=p},511:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const l=o(482),_=o(643),h=o(3734);class p extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(C){const f=new p;return f.setFromCharData(C),f}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(C){this.fg=C[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let f=!1;if(C[_.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(C[_.CHAR_DATA_CHAR_INDEX].length===2){const i=C[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){const n=C[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(i-55296)+n-56320+65536|C[_.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=C[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|C[_.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=C[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|C[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=p},643:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const l=o(8460),_=o(844);class h{get id(){return this._id}constructor(v){this.line=v,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,_.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}t.Marker=h,h._nextId=1},7116:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.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:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(k,t)=>{var o,l,_;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.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=""}(o||(t.C0=o={})),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||(t.C1=l={})),function(h){h.ST=`${o.ESC}\\`}(_||(t.C1_ESCAPED=_={}))},7399:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const l=o(2584),_={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:["'",'"']};t.evaluateKeyboardEvent=function(h,p,v,C){const f={type:0,cancel:!1,key:void 0},i=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?f.key=p?l.C0.ESC+"OA":l.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?f.key=p?l.C0.ESC+"OD":l.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?f.key=p?l.C0.ESC+"OC":l.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(f.key=p?l.C0.ESC+"OB":l.C0.ESC+"[B");break;case 8:f.key=h.ctrlKey?"\b":l.C0.DEL,h.altKey&&(f.key=l.C0.ESC+f.key);break;case 9:if(h.shiftKey){f.key=l.C0.ESC+"[Z";break}f.key=l.C0.HT,f.cancel=!0;break;case 13:f.key=h.altKey?l.C0.ESC+l.C0.CR:l.C0.CR,f.cancel=!0;break;case 27:f.key=l.C0.ESC,h.altKey&&(f.key=l.C0.ESC+l.C0.ESC),f.cancel=!0;break;case 37:if(h.metaKey)break;i?(f.key=l.C0.ESC+"[1;"+(i+1)+"D",f.key===l.C0.ESC+"[1;3D"&&(f.key=l.C0.ESC+(v?"b":"[1;5D"))):f.key=p?l.C0.ESC+"OD":l.C0.ESC+"[D";break;case 39:if(h.metaKey)break;i?(f.key=l.C0.ESC+"[1;"+(i+1)+"C",f.key===l.C0.ESC+"[1;3C"&&(f.key=l.C0.ESC+(v?"f":"[1;5C"))):f.key=p?l.C0.ESC+"OC":l.C0.ESC+"[C";break;case 38:if(h.metaKey)break;i?(f.key=l.C0.ESC+"[1;"+(i+1)+"A",v||f.key!==l.C0.ESC+"[1;3A"||(f.key=l.C0.ESC+"[1;5A")):f.key=p?l.C0.ESC+"OA":l.C0.ESC+"[A";break;case 40:if(h.metaKey)break;i?(f.key=l.C0.ESC+"[1;"+(i+1)+"B",v||f.key!==l.C0.ESC+"[1;3B"||(f.key=l.C0.ESC+"[1;5B")):f.key=p?l.C0.ESC+"OB":l.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(f.key=l.C0.ESC+"[2~");break;case 46:f.key=i?l.C0.ESC+"[3;"+(i+1)+"~":l.C0.ESC+"[3~";break;case 36:f.key=i?l.C0.ESC+"[1;"+(i+1)+"H":p?l.C0.ESC+"OH":l.C0.ESC+"[H";break;case 35:f.key=i?l.C0.ESC+"[1;"+(i+1)+"F":p?l.C0.ESC+"OF":l.C0.ESC+"[F";break;case 33:h.shiftKey?f.type=2:h.ctrlKey?f.key=l.C0.ESC+"[5;"+(i+1)+"~":f.key=l.C0.ESC+"[5~";break;case 34:h.shiftKey?f.type=3:h.ctrlKey?f.key=l.C0.ESC+"[6;"+(i+1)+"~":f.key=l.C0.ESC+"[6~";break;case 112:f.key=i?l.C0.ESC+"[1;"+(i+1)+"P":l.C0.ESC+"OP";break;case 113:f.key=i?l.C0.ESC+"[1;"+(i+1)+"Q":l.C0.ESC+"OQ";break;case 114:f.key=i?l.C0.ESC+"[1;"+(i+1)+"R":l.C0.ESC+"OR";break;case 115:f.key=i?l.C0.ESC+"[1;"+(i+1)+"S":l.C0.ESC+"OS";break;case 116:f.key=i?l.C0.ESC+"[15;"+(i+1)+"~":l.C0.ESC+"[15~";break;case 117:f.key=i?l.C0.ESC+"[17;"+(i+1)+"~":l.C0.ESC+"[17~";break;case 118:f.key=i?l.C0.ESC+"[18;"+(i+1)+"~":l.C0.ESC+"[18~";break;case 119:f.key=i?l.C0.ESC+"[19;"+(i+1)+"~":l.C0.ESC+"[19~";break;case 120:f.key=i?l.C0.ESC+"[20;"+(i+1)+"~":l.C0.ESC+"[20~";break;case 121:f.key=i?l.C0.ESC+"[21;"+(i+1)+"~":l.C0.ESC+"[21~";break;case 122:f.key=i?l.C0.ESC+"[23;"+(i+1)+"~":l.C0.ESC+"[23~";break;case 123:f.key=i?l.C0.ESC+"[24;"+(i+1)+"~":l.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(v&&!C||!h.altKey||h.metaKey)!v||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?f.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(f.key=l.C0.US),h.key==="@"&&(f.key=l.C0.NUL)):h.keyCode===65&&(f.type=1);else{const n=_[h.keyCode],r=n==null?void 0:n[h.shiftKey?1:0];if(r)f.key=l.C0.ESC+r;else if(h.keyCode>=65&&h.keyCode<=90){const s=h.ctrlKey?h.keyCode-64:h.keyCode+32;let d=String.fromCharCode(s);h.shiftKey&&(d=d.toUpperCase()),f.key=l.C0.ESC+d}else if(h.keyCode===32)f.key=l.C0.ESC+(h.ctrlKey?l.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let s=h.code.slice(3,4);h.shiftKey||(s=s.toLowerCase()),f.key=l.C0.ESC+s,f.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?f.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?f.key=l.C0.NUL:h.keyCode>=51&&h.keyCode<=55?f.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?f.key=l.C0.DEL:h.keyCode===219?f.key=l.C0.ESC:h.keyCode===220?f.key=l.C0.FS:h.keyCode===221&&(f.key=l.C0.GS)}return f}},482:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},t.utf32ToString=function(o,l=0,_=o.length){let h="";for(let p=l;p<_;++p){let v=o[p];v>65535?(v-=65536,h+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):h+=String.fromCharCode(v)}return h},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,l){const _=o.length;if(!_)return 0;let h=0,p=0;if(this._interim){const v=o.charCodeAt(p++);56320<=v&&v<=57343?l[h++]=1024*(this._interim-55296)+v-56320+65536:(l[h++]=this._interim,l[h++]=v),this._interim=0}for(let v=p;v<_;++v){const C=o.charCodeAt(v);if(55296<=C&&C<=56319){if(++v>=_)return this._interim=C,h;const f=o.charCodeAt(v);56320<=f&&f<=57343?l[h++]=1024*(C-55296)+f-56320+65536:(l[h++]=C,l[h++]=f)}else C!==65279&&(l[h++]=C)}return h}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,l){const _=o.length;if(!_)return 0;let h,p,v,C,f=0,i=0,n=0;if(this.interim[0]){let d=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let b,w=0;for(;(b=63&this.interim[++w])&&w<4;)S<<=6,S|=b;const g=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=g-w;for(;n<E;){if(n>=_)return 0;if(b=o[n++],(192&b)!=128){n--,d=!0;break}this.interim[w++]=b,S<<=6,S|=63&b}d||(g===2?S<128?n--:l[f++]=S:g===3?S<2048||S>=55296&&S<=57343||S===65279||(l[f++]=S):S<65536||S>1114111||(l[f++]=S)),this.interim.fill(0)}const r=_-4;let s=n;for(;s<_;){for(;!(!(s<r)||128&(h=o[s])||128&(p=o[s+1])||128&(v=o[s+2])||128&(C=o[s+3]));)l[f++]=h,l[f++]=p,l[f++]=v,l[f++]=C,s+=4;if(h=o[s++],h<128)l[f++]=h;else if((224&h)==192){if(s>=_)return this.interim[0]=h,f;if(p=o[s++],(192&p)!=128){s--;continue}if(i=(31&h)<<6|63&p,i<128){s--;continue}l[f++]=i}else if((240&h)==224){if(s>=_)return this.interim[0]=h,f;if(p=o[s++],(192&p)!=128){s--;continue}if(s>=_)return this.interim[0]=h,this.interim[1]=p,f;if(v=o[s++],(192&v)!=128){s--;continue}if(i=(15&h)<<12|(63&p)<<6|63&v,i<2048||i>=55296&&i<=57343||i===65279)continue;l[f++]=i}else if((248&h)==240){if(s>=_)return this.interim[0]=h,f;if(p=o[s++],(192&p)!=128){s--;continue}if(s>=_)return this.interim[0]=h,this.interim[1]=p,f;if(v=o[s++],(192&v)!=128){s--;continue}if(s>=_)return this.interim[0]=h,this.interim[1]=p,this.interim[2]=v,f;if(C=o[s++],(192&C)!=128){s--;continue}if(i=(7&h)<<18|(63&p)<<12|(63&v)<<6|63&C,i<65536||i>1114111)continue;l[f++]=i}}return f}}},225:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const l=o(1480),_=[[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 p;t.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let v=0;v<_.length;++v)p.fill(0,_[v][0],_[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?p[v]:function(C,f){let i,n=0,r=f.length-1;if(C<f[0][0]||C>f[r][1])return!1;for(;r>=n;)if(i=n+r>>1,C>f[i][1])n=i+1;else{if(!(C<f[i][0]))return!0;r=i-1}return!1}(v,h)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,C){let f=this.wcwidth(v),i=f===0&&C!==0;if(i){const n=l.UnicodeService.extractWidth(C);n===0?i=!1:n>f&&(f=n)}return l.UnicodeService.createPropertyValue(0,f,i)}}},5981:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const l=o(8460),_=o(844);class h extends _.Disposable{constructor(v){super(),this._action=v,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(v,C){if(C!==void 0&&this._syncCalls>C)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let f;for(this._isSyncWriting=!0;f=this._writeBuffer.shift();){this._action(f);const i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,C){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+=v.length,this._writeBuffer.push(v),this._callbacks.push(C),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(C)}_innerWrite(v=0,C=!0){const f=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const i=this._writeBuffer[this._bufferOffset],n=this._action(i,C);if(n){const s=d=>Date.now()-f>=12?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(f,d);return void n.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(s)}const r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-f>=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()}}t.WriteBuffer=h},5941:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const o=/^([\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 _(h,p){const v=h.toString(16),C=v.length<2?"0"+v:v;switch(p){case 4:return v[0];case 8:return C;case 12:return(C+C).slice(0,3);default:return C+C}}t.parseColor=function(h){if(!h)return;let p=h.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const v=o.exec(p);if(v){const C=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/C*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/C*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/C*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),l.exec(p)&&[3,6,9,12].includes(p.length))){const v=p.length/3,C=[0,0,0];for(let f=0;f<3;++f){const i=parseInt(p.slice(v*f,v*f+v),16);C[f]=v===1?i<<4:v===2?i:v===3?i>>4:i>>8}return C}},t.toRgbString=function(h,p=16){const[v,C,f]=h;return`rgb:${_(v,p)}/${_(C,p)}/${_(f,p)}`}},5770:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const l=o(482),_=o(8742),h=o(5770),p=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(C,f){this._handlers[C]===void 0&&(this._handlers[C]=[]);const i=this._handlers[C];return i.push(f),{dispose:()=>{const n=i.indexOf(f);n!==-1&&i.splice(n,1)}}}clearHandler(C){this._handlers[C]&&delete this._handlers[C]}setHandlerFallback(C){this._handlerFb=C}reset(){if(this._active.length)for(let C=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;C>=0;--C)this._active[C].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(C,f){if(this.reset(),this._ident=C,this._active=this._handlers[C]||p,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(f);else this._handlerFb(this._ident,"HOOK",f)}put(C,f,i){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(C,f,i);else this._handlerFb(this._ident,"PUT",(0,l.utf32ToString)(C,f,i))}unhook(C,f=!0){if(this._active.length){let i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=f,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].unhook(C),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",C);this._active=p,this._ident=0}};const v=new _.Params;v.addParam(0),t.DcsHandler=class{constructor(C){this._handler=C,this._data="",this._params=v,this._hitLimit=!1}hook(C){this._params=C.length>1||C.params[0]?C.clone():v,this._data="",this._hitLimit=!1}put(C,f,i){this._hitLimit||(this._data+=(0,l.utf32ToString)(C,f,i),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(C){let f=!1;if(this._hitLimit)f=!1;else if(C&&(f=this._handler(this._data,this._params),f instanceof Promise))return f.then(i=>(this._params=v,this._data="",this._hitLimit=!1,i));return this._params=v,this._data="",this._hitLimit=!1,f}}},2015:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const l=o(844),_=o(8742),h=o(6242),p=o(6351);class v{constructor(n){this.table=new Uint8Array(n)}setDefault(n,r){this.table.fill(n<<4|r)}add(n,r,s,d){this.table[r<<8|n]=s<<4|d}addMany(n,r,s,d){for(let S=0;S<n.length;S++)this.table[r<<8|n[S]]=s<<4|d}}t.TransitionTable=v;const C=160;t.VT500_TRANSITION_TABLE=function(){const i=new v(4095),n=Array.apply(null,Array(256)).map((w,g)=>g),r=(w,g)=>n.slice(w,g),s=r(32,127),d=r(0,24);d.push(25),d.push.apply(d,r(28,32));const S=r(0,14);let b;for(b in i.setDefault(1,0),i.addMany(s,0,2,0),S)i.addMany([24,26,153,154],b,3,0),i.addMany(r(128,144),b,3,0),i.addMany(r(144,152),b,3,0),i.add(156,b,0,0),i.add(27,b,11,1),i.add(157,b,4,8),i.addMany([152,158,159],b,0,7),i.add(155,b,11,3),i.add(144,b,11,9);return i.addMany(d,0,3,0),i.addMany(d,1,3,1),i.add(127,1,0,1),i.addMany(d,8,0,8),i.addMany(d,3,3,3),i.add(127,3,0,3),i.addMany(d,4,3,4),i.add(127,4,0,4),i.addMany(d,6,3,6),i.addMany(d,5,3,5),i.add(127,5,0,5),i.addMany(d,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(s,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(r(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(s,7,0,7),i.addMany(d,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(r(64,127),3,7,0),i.addMany(r(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(r(48,60),4,8,4),i.addMany(r(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(r(32,64),6,0,6),i.add(127,6,0,6),i.addMany(r(64,127),6,0,0),i.addMany(r(32,48),3,9,5),i.addMany(r(32,48),5,9,5),i.addMany(r(48,64),5,0,6),i.addMany(r(64,127),5,7,0),i.addMany(r(32,48),4,9,5),i.addMany(r(32,48),1,9,2),i.addMany(r(32,48),2,9,2),i.addMany(r(48,127),2,10,0),i.addMany(r(48,80),1,10,0),i.addMany(r(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(r(96,127),1,10,0),i.add(80,1,11,9),i.addMany(d,9,0,9),i.add(127,9,0,9),i.addMany(r(28,32),9,0,9),i.addMany(r(32,48),9,9,12),i.addMany(r(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(d,11,0,11),i.addMany(r(32,128),11,0,11),i.addMany(r(28,32),11,0,11),i.addMany(d,10,0,10),i.add(127,10,0,10),i.addMany(r(28,32),10,0,10),i.addMany(r(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(r(32,48),10,9,12),i.addMany(d,12,0,12),i.add(127,12,0,12),i.addMany(r(28,32),12,0,12),i.addMany(r(32,48),12,9,12),i.addMany(r(48,64),12,0,11),i.addMany(r(64,127),12,12,13),i.addMany(r(64,127),10,12,13),i.addMany(r(64,127),9,12,13),i.addMany(d,13,13,13),i.addMany(s,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(C,0,2,0),i.add(C,8,5,8),i.add(C,6,0,6),i.add(C,11,0,11),i.add(C,13,13,13),i}();class f extends l.Disposable{constructor(n=t.VT500_TRANSITION_TABLE){super(),this._transitions=n,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(r,s,d)=>{},this._executeHandlerFb=r=>{},this._csiHandlerFb=(r,s)=>{},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 p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(n,r=[64,126]){let s=0;if(n.prefix){if(n.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=n.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(n.intermediates){if(n.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let S=0;S<n.intermediates.length;++S){const b=n.intermediates.charCodeAt(S);if(32>b||b>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=b}}if(n.final.length!==1)throw new Error("final must be a single byte");const d=n.final.charCodeAt(0);if(r[0]>d||d>r[1])throw new Error(`final must be in range ${r[0]} .. ${r[1]}`);return s<<=8,s|=d,s}identToString(n){const r=[];for(;n;)r.push(String.fromCharCode(255&n)),n>>=8;return r.reverse().join("")}setPrintHandler(n){this._printHandler=n}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(n,r){const s=this._identifier(n,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);const d=this._escHandlers[s];return d.push(r),{dispose:()=>{const S=d.indexOf(r);S!==-1&&d.splice(S,1)}}}clearEscHandler(n){this._escHandlers[this._identifier(n,[48,126])]&&delete this._escHandlers[this._identifier(n,[48,126])]}setEscHandlerFallback(n){this._escHandlerFb=n}setExecuteHandler(n,r){this._executeHandlers[n.charCodeAt(0)]=r}clearExecuteHandler(n){this._executeHandlers[n.charCodeAt(0)]&&delete this._executeHandlers[n.charCodeAt(0)]}setExecuteHandlerFallback(n){this._executeHandlerFb=n}registerCsiHandler(n,r){const s=this._identifier(n);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);const d=this._csiHandlers[s];return d.push(r),{dispose:()=>{const S=d.indexOf(r);S!==-1&&d.splice(S,1)}}}clearCsiHandler(n){this._csiHandlers[this._identifier(n)]&&delete this._csiHandlers[this._identifier(n)]}setCsiHandlerFallback(n){this._csiHandlerFb=n}registerDcsHandler(n,r){return this._dcsParser.registerHandler(this._identifier(n),r)}clearDcsHandler(n){this._dcsParser.clearHandler(this._identifier(n))}setDcsHandlerFallback(n){this._dcsParser.setHandlerFallback(n)}registerOscHandler(n,r){return this._oscParser.registerHandler(n,r)}clearOscHandler(n){this._oscParser.clearHandler(n)}setOscHandlerFallback(n){this._oscParser.setHandlerFallback(n)}setErrorHandler(n){this._errorHandler=n}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(n,r,s,d,S){this._parseStack.state=n,this._parseStack.handlers=r,this._parseStack.handlerPos=s,this._parseStack.transition=d,this._parseStack.chunkPos=S}parse(n,r,s){let d,S=0,b=0,w=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,w=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const g=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&E>-1){for(;E>=0&&(d=g[E](this._params),d!==!0);E--)if(d instanceof Promise)return this._parseStack.handlerPos=E,d}this._parseStack.handlers=[];break;case 4:if(s===!1&&E>-1){for(;E>=0&&(d=g[E](),d!==!0);E--)if(d instanceof Promise)return this._parseStack.handlerPos=E,d}this._parseStack.handlers=[];break;case 6:if(S=n[this._parseStack.chunkPos],d=this._dcsParser.unhook(S!==24&&S!==26,s),d)return d;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=n[this._parseStack.chunkPos],d=this._oscParser.end(S!==24&&S!==26,s),d)return d;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,w=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let g=w;g<r;++g){switch(S=n[g],b=this._transitions.table[this.currentState<<8|(S<160?S:C)],b>>4){case 2:for(let D=g+1;;++D){if(D>=r||(S=n[D])<32||S>126&&S<C){this._printHandler(n,g,D),g=D-1;break}if(++D>=r||(S=n[D])<32||S>126&&S<C){this._printHandler(n,g,D),g=D-1;break}if(++D>=r||(S=n[D])<32||S>126&&S<C){this._printHandler(n,g,D),g=D-1;break}if(++D>=r||(S=n[D])<32||S>126&&S<C){this._printHandler(n,g,D),g=D-1;break}}break;case 3:this._executeHandlers[S]?this._executeHandlers[S]():this._executeHandlerFb(S),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:g,code:S,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|S];let T=E?E.length-1:-1;for(;T>=0&&(d=E[T](this._params),d!==!0);T--)if(d instanceof Promise)return this._preserveStack(3,E,T,b,g),d;T<0&&this._csiHandlerFb(this._collect<<8|S,this._params),this.precedingJoinState=0;break;case 8:do switch(S){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(S-48)}while(++g<r&&(S=n[g])>47&&S<60);g--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:const B=this._escHandlers[this._collect<<8|S];let O=B?B.length-1:-1;for(;O>=0&&(d=B[O](),d!==!0);O--)if(d instanceof Promise)return this._preserveStack(4,B,O,b,g),d;O<0&&this._escHandlerFb(this._collect<<8|S),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|S,this._params);break;case 13:for(let D=g+1;;++D)if(D>=r||(S=n[D])===24||S===26||S===27||S>127&&S<C){this._dcsParser.put(n,g,D),g=D-1;break}break;case 14:if(d=this._dcsParser.unhook(S!==24&&S!==26),d)return this._preserveStack(6,[],0,b,g),d;S===27&&(b|=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=g+1;;D++)if(D>=r||(S=n[D])<32||S>127&&S<C){this._oscParser.put(n,g,D),g=D-1;break}break;case 6:if(d=this._oscParser.end(S!==24&&S!==26),d)return this._preserveStack(5,[],0,b,g),d;S===27&&(b|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&b}}}t.EscapeSequenceParser=f},6242:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const l=o(5770),_=o(482),h=[];t.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(p,v){this._handlers[p]===void 0&&(this._handlers[p]=[]);const C=this._handlers[p];return C.push(v),{dispose:()=>{const f=C.indexOf(v);f!==-1&&C.splice(f,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].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 p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,v,C){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(p,v,C);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(p,v,C))}start(){this.reset(),this._state=1}put(p,v,C){if(this._state!==3){if(this._state===1)for(;v<C;){const f=p[v++];if(f===59){this._state=2,this._start();break}if(f<48||57<f)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+f-48}this._state===2&&C-v>0&&this._put(p,v,C)}}end(p,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let C=!1,f=this._active.length-1,i=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,C=v,i=this._stack.fallThrough,this._stack.paused=!1),!i&&C===!1){for(;f>=0&&(C=this._active[f].end(p),C!==!0);f--)if(C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,C;f--}for(;f>=0;f--)if(C=this._active[f].end(!1),C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,C}else this._handlerFb(this._id,"END",p);this._active=h,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,v,C){this._hitLimit||(this._data+=(0,_.utf32ToString)(p,v,C),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let v=!1;if(this._hitLimit)v=!1;else if(p&&(v=this._handler(this._data),v instanceof Promise))return v.then(C=>(this._data="",this._hitLimit=!1,C));return this._data="",this._hitLimit=!1,v}}},8742:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const o=2147483647;class l{static fromArray(h){const p=new l;if(!h.length)return p;for(let v=Array.isArray(h[0])?1:0;v<h.length;++v){const C=h[v];if(Array.isArray(C))for(let f=0;f<C.length;++f)p.addSubParam(C[f]);else p.addParam(C)}return p}constructor(h=32,p=32){if(this.maxLength=h,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(p),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 p=0;p<this.length;++p){h.push(this.params[p]);const v=this._subParamsIdx[p]>>8,C=255&this._subParamsIdx[p];C-v>0&&h.push(Array.prototype.slice.call(this._subParams,v,C))}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>o?o: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>o?o:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const p=this._subParamsIdx[h]>>8,v=255&this._subParamsIdx[h];return v-p>0?this._subParams.subarray(p,v):null}getSubParamsAll(){const h={};for(let p=0;p<this.length;++p){const v=this._subParamsIdx[p]>>8,C=255&this._subParamsIdx[p];C-v>0&&(h[p]=this._subParams.slice(v,C))}return h}addDigit(h){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,C=v[p-1];v[p-1]=~C?Math.min(10*C+h,o):h}}t.Params=l},5741:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,l){const _={instance:l,dispose:l.dispose,isDisposed:!1};this._addons.push(_),l.dispose=()=>this._wrappedAddonDispose(_),l.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let l=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===o){l=_;break}if(l===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(l,1)}}},8771:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const l=o(3785),_=o(511);t.BufferApiView=class{constructor(h,p){this._buffer=h,this.type=p}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 p=this._buffer.lines.get(h);if(p)return new l.BufferLineApiView(p)}getNullCell(){return new _.CellData}}},3785:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const l=o(511);t.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,h){if(!(_<0||_>=this._line.length))return h?(this._line.loadCell(_,h),h):this._line.loadCell(_,new l.CellData)}translateToString(_,h,p){return this._line.translateToString(_,h,p)}}},8285:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const l=o(8771),_=o(8460),h=o(844);class p extends h.Disposable{constructor(C){super(),this._core=C,this._onBufferChange=this.register(new _.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)}}t.BufferNamespaceApi=p},7975:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,l){return this._core.registerCsiHandler(o,_=>l(_.toArray()))}addCsiHandler(o,l){return this.registerCsiHandler(o,l)}registerDcsHandler(o,l){return this._core.registerDcsHandler(o,(_,h)=>l(_,h.toArray()))}addDcsHandler(o,l){return this.registerDcsHandler(o,l)}registerEscHandler(o,l){return this._core.registerEscHandler(o,l)}addEscHandler(o,l){return this.registerEscHandler(o,l)}registerOscHandler(o,l){return this._core.registerOscHandler(o,l)}addOscHandler(o,l){return this.registerOscHandler(o,l)}}},7090:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(k,t,o){var l=this&&this.__decorate||function(i,n,r,s){var d,S=arguments.length,b=S<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,r):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(i,n,r,s);else for(var w=i.length-1;w>=0;w--)(d=i[w])&&(b=(S<3?d(b):S>3?d(n,r,b):d(n,r))||b);return S>3&&b&&Object.defineProperty(n,r,b),b},_=this&&this.__param||function(i,n){return function(r,s){n(r,s,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const h=o(8460),p=o(844),v=o(5295),C=o(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let f=t.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(i){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(i.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(i,this))}resize(i,n){this.cols=i,this.rows=n,this.buffers.resize(i,n),this._onResize.fire({cols:i,rows:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,n=!1){const r=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===i.fg&&s.getBg(0)===i.bg||(s=r.getBlankLine(i,n),this._cachedBlankLine=s),s.isWrapped=n;const d=r.ybase+r.scrollTop,S=r.ybase+r.scrollBottom;if(r.scrollTop===0){const b=r.lines.isFull;S===r.lines.length-1?b?r.lines.recycle().copyFrom(s):r.lines.push(s.clone()):r.lines.splice(S+1,0,s.clone()),b?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{const b=S-d+1;r.lines.shiftElements(d+1,b-1,-1),r.lines.set(S,s.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(i,n,r){const s=this.buffer;if(i<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else i+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const d=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+i,s.ybase),0),d!==s.ydisp&&(n||this._onScroll.fire(s.ydisp))}};t.BufferService=f=l([_(0,C.IOptionsService)],f)},7994:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,l){this._charsets[o]=l,this.glevel===o&&(this.charset=l)}}},1753:function(k,t,o){var l=this&&this.__decorate||function(s,d,S,b){var w,g=arguments.length,E=g<3?d:b===null?b=Object.getOwnPropertyDescriptor(d,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(s,d,S,b);else for(var T=s.length-1;T>=0;T--)(w=s[T])&&(E=(g<3?w(E):g>3?w(d,S,E):w(d,S))||E);return g>3&&E&&Object.defineProperty(d,S,E),E},_=this&&this.__param||function(s,d){return function(S,b){d(S,b,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const h=o(2585),p=o(8460),v=o(844),C={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:s=>s.button!==4&&s.action===1&&(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)},VT200:{events:19,restrict:s=>s.action!==32},DRAG:{events:23,restrict:s=>s.action!==32||s.button!==3},ANY:{events:31,restrict:s=>!0}};function f(s,d){let S=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(S|=64,S|=s.action):(S|=3&s.button,4&s.button&&(S|=64),8&s.button&&(S|=128),s.action===32?S|=32:s.action!==0||d||(S|=3)),S}const i=String.fromCharCode,n={DEFAULT:s=>{const d=[f(s,!1)+32,s.col+32,s.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${i(d[0])}${i(d[1])}${i(d[2])}`},SGR:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${f(s,!0)};${s.col};${s.row}${d}`},SGR_PIXELS:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${f(s,!0)};${s.x};${s.y}${d}`}};let r=t.CoreMouseService=class extends v.Disposable{constructor(s,d){super(),this._bufferService=s,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const S of Object.keys(C))this.addProtocol(S,C[S]);for(const S of Object.keys(n))this.addEncoding(S,n[S]);this.reset()}addProtocol(s,d){this._protocols[s]=d}addEncoding(s,d){this._encodings[s]=d}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(s){if(!this._protocols[s])throw new Error(`unknown protocol "${s}"`);this._activeProtocol=s,this._onProtocolChange.fire(this._protocols[s].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(s){if(!this._encodings[s])throw new Error(`unknown encoding "${s}"`);this._activeEncoding=s}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(s){if(s.col<0||s.col>=this._bufferService.cols||s.row<0||s.row>=this._bufferService.rows||s.button===4&&s.action===32||s.button===3&&s.action!==32||s.button!==4&&(s.action===2||s.action===3)||(s.col++,s.row++,s.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,s,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(s))return!1;const d=this._encodings[this._activeEncoding](s);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!0)),this._lastEvent=s,!0}explainEvents(s){return{down:!!(1&s),up:!!(2&s),drag:!!(4&s),move:!!(8&s),wheel:!!(16&s)}}_equalEvents(s,d,S){if(S){if(s.x!==d.x||s.y!==d.y)return!1}else if(s.col!==d.col||s.row!==d.row)return!1;return s.button===d.button&&s.action===d.action&&s.ctrl===d.ctrl&&s.alt===d.alt&&s.shift===d.shift}};t.CoreMouseService=r=l([_(0,h.IBufferService),_(1,h.ICoreService)],r)},6975:function(k,t,o){var l=this&&this.__decorate||function(r,s,d,S){var b,w=arguments.length,g=w<3?s:S===null?S=Object.getOwnPropertyDescriptor(s,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,s,d,S);else for(var E=r.length-1;E>=0;E--)(b=r[E])&&(g=(w<3?b(g):w>3?b(s,d,g):b(s,d))||g);return w>3&&g&&Object.defineProperty(s,d,g),g},_=this&&this.__param||function(r,s){return function(d,S){s(d,S,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const h=o(1439),p=o(8460),v=o(844),C=o(2585),f=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let n=t.CoreService=class extends v.Disposable{constructor(r,s,d){super(),this._bufferService=r,this._logService=s,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(f),this.decPrivateModes=(0,h.clone)(i)}reset(){this.modes=(0,h.clone)(f),this.decPrivateModes=(0,h.clone)(i)}triggerDataEvent(r,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const d=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${r}"`,()=>r.split("").map(S=>S.charCodeAt(0))),this._onData.fire(r)}triggerBinaryEvent(r){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${r}"`,()=>r.split("").map(s=>s.charCodeAt(0))),this._onBinary.fire(r))}};t.CoreService=n=l([_(0,C.IBufferService),_(1,C.ILogService),_(2,C.IOptionsService)],n)},9074:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const l=o(8055),_=o(8460),h=o(844),p=o(6106);let v=0,C=0;class f extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList(r=>r==null?void 0:r.marker.line),this._onDecorationRegistered=this.register(new _.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new _.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)(()=>this.reset()))}registerDecoration(r){if(r.marker.isDisposed)return;const s=new i(r);if(s){const d=s.marker.onDispose(()=>s.dispose());s.onDispose(()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),d.dispose())}),this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(const r of this._decorations.values())r.dispose();this._decorations.clear()}*getDecorationsAtCell(r,s,d){let S=0,b=0;for(const w of this._decorations.getKeyIterator(s))S=w.options.x??0,b=S+(w.options.width??1),r>=S&&r<b&&(!d||(w.options.layer??"bottom")===d)&&(yield w)}forEachDecorationAtCell(r,s,d,S){this._decorations.forEachByKey(s,b=>{v=b.options.x??0,C=v+(b.options.width??1),r>=v&&r<C&&(!d||(b.options.layer??"bottom")===d)&&S(b)})}}t.DecorationService=f;class i 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 _.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new _.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:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const l=o(2585),_=o(8343);class h{constructor(...v){this._entries=new Map;for(const[C,f]of v)this.set(C,f)}set(v,C){const f=this._entries.get(v);return this._entries.set(v,C),f}forEach(v){for(const[C,f]of this._entries.entries())v(C,f)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}t.ServiceCollection=h,t.InstantiationService=class{constructor(){this._services=new h,this._services.set(l.IInstantiationService,this)}setService(p,v){this._services.set(p,v)}getService(p){return this._services.get(p)}createInstance(p,...v){const C=(0,_.getServiceDependencies)(p).sort((n,r)=>n.index-r.index),f=[];for(const n of C){const r=this._services.get(n.id);if(!r)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${n.id}.`);f.push(r)}const i=C.length>0?C[0].index:v.length;if(v.length!==i)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${i+1} conflicts with ${v.length} static arguments`);return new p(...v,...f)}}},7866:function(k,t,o){var l=this&&this.__decorate||function(i,n,r,s){var d,S=arguments.length,b=S<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,r):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(i,n,r,s);else for(var w=i.length-1;w>=0;w--)(d=i[w])&&(b=(S<3?d(b):S>3?d(n,r,b):d(n,r))||b);return S>3&&b&&Object.defineProperty(n,r,b),b},_=this&&this.__param||function(i,n){return function(r,s){n(r,s,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const h=o(844),p=o(2585),v={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let C,f=t.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),C=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let n=0;n<i.length;n++)typeof i[n]=="function"&&(i[n]=i[n]())}_log(i,n,r){this._evalLazyOptionalParams(r),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+n,...r)}trace(i,...n){var r;this._logLevel<=p.LogLevelEnum.TRACE&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,i,n)}debug(i,...n){var r;this._logLevel<=p.LogLevelEnum.DEBUG&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,i,n)}info(i,...n){var r;this._logLevel<=p.LogLevelEnum.INFO&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,i,n)}warn(i,...n){var r;this._logLevel<=p.LogLevelEnum.WARN&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,i,n)}error(i,...n){var r;this._logLevel<=p.LogLevelEnum.ERROR&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,i,n)}};t.LogService=f=l([_(0,p.IOptionsService)],f),t.setTraceLogger=function(i){C=i},t.traceCall=function(i,n,r){if(typeof r.value!="function")throw new Error("not supported");const s=r.value;r.value=function(...d){if(C.logLevel!==p.LogLevelEnum.TRACE)return s.apply(this,d);C.trace(`GlyphRenderer#${s.name}(${d.map(b=>JSON.stringify(b)).join(", ")})`);const S=s.apply(this,d);return C.trace(`GlyphRenderer#${s.name} return`,S),S}}},7302:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const l=o(8460),_=o(844),h=o(6114);t.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 p=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends _.Disposable{constructor(f){super(),this._onOptionChange=this.register(new l.EventEmitter),this.onOptionChange=this._onOptionChange.event;const i={...t.DEFAULT_OPTIONS};for(const n in f)if(n in i)try{const r=f[n];i[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,_.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(f,i){return this.onOptionChange(n=>{n===f&&i(this.rawOptions[f])})}onMultipleOptionChange(f,i){return this.onOptionChange(n=>{f.indexOf(n)!==-1&&i()})}_setupOptions(){const f=n=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},i=(n,r)=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(const n in this.rawOptions){const r={get:f.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(f,i){switch(f){case"cursorStyle":if(i||(i=t.DEFAULT_OPTIONS[f]),!function(n){return n==="block"||n==="underline"||n==="bar"}(i))throw new Error(`"${i}" is not a valid value for ${f}`);break;case"wordSeparator":i||(i=t.DEFAULT_OPTIONS[f]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=p.includes(i)?i:t.DEFAULT_OPTIONS[f];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${f} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${f} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${f} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${f} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}t.OptionsService=v},2660:function(k,t,o){var l=this&&this.__decorate||function(v,C,f,i){var n,r=arguments.length,s=r<3?C:i===null?i=Object.getOwnPropertyDescriptor(C,f):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(v,C,f,i);else for(var d=v.length-1;d>=0;d--)(n=v[d])&&(s=(r<3?n(s):r>3?n(C,f,s):n(C,f))||s);return r>3&&s&&Object.defineProperty(C,f,s),s},_=this&&this.__param||function(v,C){return function(f,i){C(f,i,v)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const h=o(2585);let p=t.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const C=this._bufferService.buffer;if(v.id===void 0){const d=C.addMarker(C.ybase+C.y),S={data:v,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(S,d)),this._dataByLinkId.set(S.id,S),S.id}const f=v,i=this._getEntryIdKey(f),n=this._entriesWithId.get(i);if(n)return this.addLineToLink(n.id,C.ybase+C.y),n.id;const r=C.addMarker(C.ybase+C.y),s={id:this._nextId++,key:this._getEntryIdKey(f),data:f,lines:[r]};return r.onDispose(()=>this._removeMarkerFromLink(s,r)),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(v,C){const f=this._dataByLinkId.get(v);if(f&&f.lines.every(i=>i.line!==C)){const i=this._bufferService.buffer.addMarker(C);f.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(f,i))}}getLinkData(v){var C;return(C=this._dataByLinkId.get(v))==null?void 0:C.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,C){const f=v.lines.indexOf(C);f!==-1&&(v.lines.splice(f,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};t.OscLinkService=p=l([_(0,h.IBufferService)],p)},8343:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const o="di$target",l="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(_){return _[l]||[]},t.createDecorator=function(_){if(t.serviceRegistry.has(_))return t.serviceRegistry.get(_);const h=function(p,v,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(f,i,n){i[o]===i?i[l].push({id:f,index:n}):(i[l]=[{id:f,index:n}],i[o]=i)})(h,p,C)};return h.toString=()=>_,t.serviceRegistry.set(_,h),h}},2585:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const l=o(8343);var _;t.IBufferService=(0,l.createDecorator)("BufferService"),t.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),t.ICoreService=(0,l.createDecorator)("CoreService"),t.ICharsetService=(0,l.createDecorator)("CharsetService"),t.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"}(_||(t.LogLevelEnum=_={})),t.ILogService=(0,l.createDecorator)("LogService"),t.IOptionsService=(0,l.createDecorator)("OptionsService"),t.IOscLinkService=(0,l.createDecorator)("OscLinkService"),t.IUnicodeService=(0,l.createDecorator)("UnicodeService"),t.IDecorationService=(0,l.createDecorator)("DecorationService")},1480:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const l=o(8460),_=o(225);class h{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,C,f=!1){return(16777215&v)<<3|(3&C)<<1|(f?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new l.EventEmitter,this.onChange=this._onChange.event;const v=new _.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let C=0,f=0;const i=v.length;for(let n=0;n<i;++n){let r=v.charCodeAt(n);if(55296<=r&&r<=56319){if(++n>=i)return C+this.wcwidth(r);const S=v.charCodeAt(n);56320<=S&&S<=57343?r=1024*(r-55296)+S-56320+65536:C+=this.wcwidth(S)}const s=this.charProperties(r,f);let d=h.extractWidth(s);h.extractShouldJoin(s)&&(d-=h.extractWidth(f)),C+=d,f=s}return C}charProperties(v,C){return this._activeProvider.charProperties(v,C)}}t.UnicodeService=h}},u={};function m(k){var t=u[k];if(t!==void 0)return t.exports;var o=u[k]={exports:{}};return a[k].call(o.exports,o,o.exports,m),o.exports}var y={};return(()=>{var k=y;Object.defineProperty(k,"__esModule",{value:!0}),k.Terminal=void 0;const t=m(9042),o=m(3236),l=m(844),_=m(5741),h=m(8285),p=m(7975),v=m(7090),C=["cols","rows"];class f extends l.Disposable{constructor(n){super(),this._core=this.register(new o.Terminal(n)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const r=d=>this._core.options[d],s=(d,S)=>{this._checkReadonlyOptions(d),this._core.options[d]=S};for(const d in this._core.options){const S={get:r.bind(this,d),set:s.bind(this,d)};Object.defineProperty(this._publicOptions,d,S)}}_checkReadonlyOptions(n){if(C.includes(n))throw new Error(`Option "${n}" 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 p.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.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 n=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:n.applicationCursorKeys,applicationKeypadMode:n.applicationKeypad,bracketedPasteMode:n.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:r,originMode:n.origin,reverseWraparoundMode:n.reverseWraparound,sendFocusMode:n.sendFocus,wraparoundMode:n.wraparound}}get options(){return this._publicOptions}set options(n){for(const r in n)this._publicOptions[r]=n[r]}blur(){this._core.blur()}focus(){this._core.focus()}input(n,r=!0){this._core.input(n,r)}resize(n,r){this._verifyIntegers(n,r),this._core.resize(n,r)}open(n){this._core.open(n)}attachCustomKeyEventHandler(n){this._core.attachCustomKeyEventHandler(n)}attachCustomWheelEventHandler(n){this._core.attachCustomWheelEventHandler(n)}registerLinkProvider(n){return this._core.registerLinkProvider(n)}registerCharacterJoiner(n){return this._checkProposedApi(),this._core.registerCharacterJoiner(n)}deregisterCharacterJoiner(n){this._checkProposedApi(),this._core.deregisterCharacterJoiner(n)}registerMarker(n=0){return this._verifyIntegers(n),this._core.registerMarker(n)}registerDecoration(n){return this._checkProposedApi(),this._verifyPositiveIntegers(n.x??0,n.width??0,n.height??0),this._core.registerDecoration(n)}hasSelection(){return this._core.hasSelection()}select(n,r,s){this._verifyIntegers(n,r,s),this._core.select(n,r,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(n,r){this._verifyIntegers(n,r),this._core.selectLines(n,r)}dispose(){super.dispose()}scrollLines(n){this._verifyIntegers(n),this._core.scrollLines(n)}scrollPages(n){this._verifyIntegers(n),this._core.scrollPages(n)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(n){this._verifyIntegers(n),this._core.scrollToLine(n)}clear(){this._core.clear()}write(n,r){this._core.write(n,r)}writeln(n,r){this._core.write(n),this._core.write(`\r
9
- `,r)}paste(n){this._core.paste(n)}refresh(n,r){this._verifyIntegers(n,r),this._core.refresh(n,r)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(n){this._addonManager.loadAddon(this,n)}static get strings(){return t}_verifyIntegers(...n){for(const r of n)if(r===1/0||isNaN(r)||r%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...n){for(const r of n)if(r&&(r===1/0||isNaN(r)||r%1!=0||r<0))throw new Error("This API only accepts positive integers")}}k.Terminal=f})(),y})())}(It)),It.exports}var Os=Bs(),ne;(function(c){c.assertEqual=m=>m;function e(m){}c.assertIs=e;function a(m){throw new Error}c.assertNever=a,c.arrayToEnum=m=>{const y={};for(const k of m)y[k]=k;return y},c.getValidEnumValues=m=>{const y=c.objectKeys(m).filter(t=>typeof m[m[t]]!="number"),k={};for(const t of y)k[t]=m[t];return c.objectValues(k)},c.objectValues=m=>c.objectKeys(m).map(function(y){return m[y]}),c.objectKeys=typeof Object.keys=="function"?m=>Object.keys(m):m=>{const y=[];for(const k in m)Object.prototype.hasOwnProperty.call(m,k)&&y.push(k);return y},c.find=(m,y)=>{for(const k of m)if(y(k))return k},c.isInteger=typeof Number.isInteger=="function"?m=>Number.isInteger(m):m=>typeof m=="number"&&isFinite(m)&&Math.floor(m)===m;function u(m,y=" | "){return m.map(k=>typeof k=="string"?`'${k}'`:k).join(y)}c.joinValues=u,c.jsonStringifyReplacer=(m,y)=>typeof y=="bigint"?y.toString():y})(ne||(ne={}));var Ft;(function(c){c.mergeShapes=(e,a)=>({...e,...a})})(Ft||(Ft={}));const K=ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xe=c=>{switch(typeof c){case"undefined":return K.undefined;case"string":return K.string;case"number":return isNaN(c)?K.nan:K.number;case"boolean":return K.boolean;case"function":return K.function;case"bigint":return K.bigint;case"symbol":return K.symbol;case"object":return Array.isArray(c)?K.array:c===null?K.null:c.then&&typeof c.then=="function"&&c.catch&&typeof c.catch=="function"?K.promise:typeof Map<"u"&&c instanceof Map?K.map:typeof Set<"u"&&c instanceof Set?K.set:typeof Date<"u"&&c instanceof Date?K.date:K.object;default:return K.unknown}},j=ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ms=c=>JSON.stringify(c,null,2).replace(/"([^"]+)":/g,"$1:");class fe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=u=>{this.issues=[...this.issues,u]},this.addIssues=(u=[])=>{this.issues=[...this.issues,...u]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(y){return y.message},u={_errors:[]},m=y=>{for(const k of y.issues)if(k.code==="invalid_union")k.unionErrors.map(m);else if(k.code==="invalid_return_type")m(k.returnTypeError);else if(k.code==="invalid_arguments")m(k.argumentsError);else if(k.path.length===0)u._errors.push(a(k));else{let t=u,o=0;for(;o<k.path.length;){const l=k.path[o];o===k.path.length-1?(t[l]=t[l]||{_errors:[]},t[l]._errors.push(a(k))):t[l]=t[l]||{_errors:[]},t=t[l],o++}}};return m(this),u}static assert(e){if(!(e instanceof fe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a={},u=[];for(const m of this.issues)m.path.length>0?(a[m.path[0]]=a[m.path[0]]||[],a[m.path[0]].push(e(m))):u.push(e(m));return{formErrors:u,fieldErrors:a}}get formErrors(){return this.flatten()}}fe.create=c=>new fe(c);const We=(c,e)=>{let a;switch(c.code){case j.invalid_type:c.received===K.undefined?a="Required":a=`Expected ${c.expected}, received ${c.received}`;break;case j.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(c.expected,ne.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:a=`Unrecognized key(s) in object: ${ne.joinValues(c.keys,", ")}`;break;case j.invalid_union:a="Invalid input";break;case j.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${ne.joinValues(c.options)}`;break;case j.invalid_enum_value:a=`Invalid enum value. Expected ${ne.joinValues(c.options)}, received '${c.received}'`;break;case j.invalid_arguments:a="Invalid function arguments";break;case j.invalid_return_type:a="Invalid function return type";break;case j.invalid_date:a="Invalid date";break;case j.invalid_string:typeof c.validation=="object"?"includes"in c.validation?(a=`Invalid input: must include "${c.validation.includes}"`,typeof c.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${c.validation.position}`)):"startsWith"in c.validation?a=`Invalid input: must start with "${c.validation.startsWith}"`:"endsWith"in c.validation?a=`Invalid input: must end with "${c.validation.endsWith}"`:ne.assertNever(c.validation):c.validation!=="regex"?a=`Invalid ${c.validation}`:a="Invalid";break;case j.too_small:c.type==="array"?a=`Array must contain ${c.exact?"exactly":c.inclusive?"at least":"more than"} ${c.minimum} element(s)`:c.type==="string"?a=`String must contain ${c.exact?"exactly":c.inclusive?"at least":"over"} ${c.minimum} character(s)`:c.type==="number"?a=`Number must be ${c.exact?"exactly equal to ":c.inclusive?"greater than or equal to ":"greater than "}${c.minimum}`:c.type==="date"?a=`Date must be ${c.exact?"exactly equal to ":c.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(c.minimum))}`:a="Invalid input";break;case j.too_big:c.type==="array"?a=`Array must contain ${c.exact?"exactly":c.inclusive?"at most":"less than"} ${c.maximum} element(s)`:c.type==="string"?a=`String must contain ${c.exact?"exactly":c.inclusive?"at most":"under"} ${c.maximum} character(s)`:c.type==="number"?a=`Number must be ${c.exact?"exactly":c.inclusive?"less than or equal to":"less than"} ${c.maximum}`:c.type==="bigint"?a=`BigInt must be ${c.exact?"exactly":c.inclusive?"less than or equal to":"less than"} ${c.maximum}`:c.type==="date"?a=`Date must be ${c.exact?"exactly":c.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(c.maximum))}`:a="Invalid input";break;case j.custom:a="Invalid input";break;case j.invalid_intersection_types:a="Intersection results could not be merged";break;case j.not_multiple_of:a=`Number must be a multiple of ${c.multipleOf}`;break;case j.not_finite:a="Number must be finite";break;default:a=e.defaultError,ne.assertNever(c)}return{message:a}};let br=We;function Is(c){br=c}function mt(){return br}const bt=c=>{const{data:e,path:a,errorMaps:u,issueData:m}=c,y=[...a,...m.path||[]],k={...m,path:y};if(m.message!==void 0)return{...m,path:y,message:m.message};let t="";const o=u.filter(l=>!!l).slice().reverse();for(const l of o)t=l(k,{data:e,defaultError:t}).message;return{...m,path:y,message:t}},Ps=[];function q(c,e){const a=mt(),u=bt({issueData:e,data:c.data,path:c.path,errorMaps:[c.common.contextualErrorMap,c.schemaErrorMap,a,a===We?void 0:We].filter(m=>!!m)});c.common.issues.push(u)}class le{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){const u=[];for(const m of a){if(m.status==="aborted")return Q;m.status==="dirty"&&e.dirty(),u.push(m.value)}return{status:e.value,value:u}}static async mergeObjectAsync(e,a){const u=[];for(const m of a){const y=await m.key,k=await m.value;u.push({key:y,value:k})}return le.mergeObjectSync(e,u)}static mergeObjectSync(e,a){const u={};for(const m of a){const{key:y,value:k}=m;if(y.status==="aborted"||k.status==="aborted")return Q;y.status==="dirty"&&e.dirty(),k.status==="dirty"&&e.dirty(),y.value!=="__proto__"&&(typeof k.value<"u"||m.alwaysSet)&&(u[y.value]=k.value)}return{status:e.value,value:u}}}const Q=Object.freeze({status:"aborted"}),Fe=c=>({status:"dirty",value:c}),de=c=>({status:"valid",value:c}),Nt=c=>c.status==="aborted",Wt=c=>c.status==="dirty",Me=c=>c.status==="valid",Xe=c=>typeof Promise<"u"&&c instanceof Promise;function St(c,e,a,u){if(typeof e=="function"?c!==e||!u:!e.has(c))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(c)}function Sr(c,e,a,u,m){if(typeof e=="function"?c!==e||!m:!e.has(c))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(c,a),a}var Y;(function(c){c.errToObj=e=>typeof e=="string"?{message:e}:e||{},c.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Y||(Y={}));var Ge,Ye;class ye{constructor(e,a,u,m){this._cachedPath=[],this.parent=e,this.data=a,this._path=u,this._key=m}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const er=(c,e)=>{if(Me(e))return{success:!0,data:e.value};if(!c.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new fe(c.common.issues);return this._error=a,this._error}}};function re(c){if(!c)return{};const{errorMap:e,invalid_type_error:a,required_error:u,description:m}=c;if(e&&(a||u))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:m}:{errorMap:(k,t)=>{var o,l;const{message:_}=c;return k.code==="invalid_enum_value"?{message:_??t.defaultError}:typeof t.data>"u"?{message:(o=_??u)!==null&&o!==void 0?o:t.defaultError}:k.code!=="invalid_type"?{message:t.defaultError}:{message:(l=_??a)!==null&&l!==void 0?l:t.defaultError}},description:m}}class se{get description(){return this._def.description}_getType(e){return xe(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new le,ctx:{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(Xe(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){const a=this._parse(e);return Promise.resolve(a)}parse(e,a){const u=this.safeParse(e,a);if(u.success)return u.data;throw u.error}safeParse(e,a){var u;const m={common:{issues:[],async:(u=a==null?void 0:a.async)!==null&&u!==void 0?u:!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},y=this._parseSync({data:e,path:m.path,parent:m});return er(m,y)}"~validate"(e){var a,u;const m={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)};if(!this["~standard"].async)try{const y=this._parseSync({data:e,path:[],parent:m});return Me(y)?{value:y.value}:{issues:m.common.issues}}catch(y){!((u=(a=y==null?void 0:y.message)===null||a===void 0?void 0:a.toLowerCase())===null||u===void 0)&&u.includes("encountered")&&(this["~standard"].async=!0),m.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:m}).then(y=>Me(y)?{value:y.value}:{issues:m.common.issues})}async parseAsync(e,a){const u=await this.safeParseAsync(e,a);if(u.success)return u.data;throw u.error}async safeParseAsync(e,a){const u={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},m=this._parse({data:e,path:u.path,parent:u}),y=await(Xe(m)?m:Promise.resolve(m));return er(u,y)}refine(e,a){const u=m=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(m):a;return this._refinement((m,y)=>{const k=e(m),t=()=>y.addIssue({code:j.custom,...u(m)});return typeof Promise<"u"&&k instanceof Promise?k.then(o=>o?!0:(t(),!1)):k?!0:(t(),!1)})}refinement(e,a){return this._refinement((u,m)=>e(u)?!0:(m.addIssue(typeof a=="function"?a(u,m):a),!1))}_refinement(e){return new me({schema:this,typeName:X.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return Se.create(this,this._def)}nullable(){return Be.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ve.create(this)}promise(){return Ue.create(this,this._def)}or(e){return rt.create([this,e],this._def)}and(e){return st.create(this,e,this._def)}transform(e){return new me({...re(this._def),schema:this,typeName:X.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a=typeof e=="function"?e:()=>e;return new ct({...re(this._def),innerType:this,defaultValue:a,typeName:X.ZodDefault})}brand(){return new zt({typeName:X.ZodBranded,type:this,...re(this._def)})}catch(e){const a=typeof e=="function"?e:()=>e;return new ht({...re(this._def),innerType:this,catchValue:a,typeName:X.ZodCatch})}describe(e){const a=this.constructor;return new a({...this._def,description:e})}pipe(e){return dt.create(this,e)}readonly(){return lt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Hs=/^c[^\s-]{8,}$/i,Fs=/^[0-9a-z]+$/,Ns=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ws=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,js=/^[a-z0-9_-]{21}$/i,Us=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$s=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,zs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Pt;const Vs=/^(?:(?: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])$/,Zs=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Ks=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Gs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ys=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Js=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,yr="((\\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])))",Xs=new RegExp(`^${yr}$`);function Cr(c){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return c.precision?e=`${e}\\.\\d{${c.precision}}`:c.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Qs(c){return new RegExp(`^${Cr(c)}$`)}function wr(c){let e=`${yr}T${Cr(c)}`;const a=[];return a.push(c.local?"Z?":"Z"),c.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,new RegExp(`^${e}$`)}function ei(c,e){return!!((e==="v4"||!e)&&Vs.test(c)||(e==="v6"||!e)&&Ks.test(c))}function ti(c,e){if(!Us.test(c))return!1;try{const[a]=c.split("."),u=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),m=JSON.parse(atob(u));return!(typeof m!="object"||m===null||!m.typ||!m.alg||e&&m.alg!==e)}catch{return!1}}function ri(c,e){return!!((e==="v4"||!e)&&Zs.test(c)||(e==="v6"||!e)&&Gs.test(c))}class ge extends se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==K.string){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_type,expected:K.string,received:y.parsedType}),Q}const u=new le;let m;for(const y of this._def.checks)if(y.kind==="min")e.data.length<y.value&&(m=this._getOrReturnCtx(e,m),q(m,{code:j.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),u.dirty());else if(y.kind==="max")e.data.length>y.value&&(m=this._getOrReturnCtx(e,m),q(m,{code:j.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),u.dirty());else if(y.kind==="length"){const k=e.data.length>y.value,t=e.data.length<y.value;(k||t)&&(m=this._getOrReturnCtx(e,m),k?q(m,{code:j.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}):t&&q(m,{code:j.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}),u.dirty())}else if(y.kind==="email")zs.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"email",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="emoji")Pt||(Pt=new RegExp(qs,"u")),Pt.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"emoji",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="uuid")Ws.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"uuid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="nanoid")js.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"nanoid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="cuid")Hs.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"cuid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="cuid2")Fs.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"cuid2",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="ulid")Ns.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"ulid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="url")try{new URL(e.data)}catch{m=this._getOrReturnCtx(e,m),q(m,{validation:"url",code:j.invalid_string,message:y.message}),u.dirty()}else y.kind==="regex"?(y.regex.lastIndex=0,y.regex.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"regex",code:j.invalid_string,message:y.message}),u.dirty())):y.kind==="trim"?e.data=e.data.trim():y.kind==="includes"?e.data.includes(y.value,y.position)||(m=this._getOrReturnCtx(e,m),q(m,{code:j.invalid_string,validation:{includes:y.value,position:y.position},message:y.message}),u.dirty()):y.kind==="toLowerCase"?e.data=e.data.toLowerCase():y.kind==="toUpperCase"?e.data=e.data.toUpperCase():y.kind==="startsWith"?e.data.startsWith(y.value)||(m=this._getOrReturnCtx(e,m),q(m,{code:j.invalid_string,validation:{startsWith:y.value},message:y.message}),u.dirty()):y.kind==="endsWith"?e.data.endsWith(y.value)||(m=this._getOrReturnCtx(e,m),q(m,{code:j.invalid_string,validation:{endsWith:y.value},message:y.message}),u.dirty()):y.kind==="datetime"?wr(y).test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{code:j.invalid_string,validation:"datetime",message:y.message}),u.dirty()):y.kind==="date"?Xs.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{code:j.invalid_string,validation:"date",message:y.message}),u.dirty()):y.kind==="time"?Qs(y).test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{code:j.invalid_string,validation:"time",message:y.message}),u.dirty()):y.kind==="duration"?$s.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"duration",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="ip"?ei(e.data,y.version)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"ip",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="jwt"?ti(e.data,y.alg)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"jwt",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="cidr"?ri(e.data,y.version)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"cidr",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="base64"?Ys.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"base64",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="base64url"?Js.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"base64url",code:j.invalid_string,message:y.message}),u.dirty()):ne.assertNever(y);return{status:u.value,value:e.data}}_regex(e,a,u){return this.refinement(m=>e.test(m),{validation:a,code:j.invalid_string,...Y.errToObj(u)})}_addCheck(e){return new ge({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Y.errToObj(e)})}datetime(e){var a,u;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(a=e==null?void 0:e.offset)!==null&&a!==void 0?a:!1,local:(u=e==null?void 0:e.local)!==null&&u!==void 0?u:!1,...Y.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Y.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Y.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...Y.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...Y.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...Y.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...Y.errToObj(a)})}nonempty(e){return this.min(1,Y.errToObj(e))}trim(){return new ge({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}ge.create=c=>{var e;return new ge({checks:[],typeName:X.ZodString,coerce:(e=c==null?void 0:c.coerce)!==null&&e!==void 0?e:!1,...re(c)})};function si(c,e){const a=(c.toString().split(".")[1]||"").length,u=(e.toString().split(".")[1]||"").length,m=a>u?a:u,y=parseInt(c.toFixed(m).replace(".","")),k=parseInt(e.toFixed(m).replace(".",""));return y%k/Math.pow(10,m)}class De extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==K.number){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_type,expected:K.number,received:y.parsedType}),Q}let u;const m=new le;for(const y of this._def.checks)y.kind==="int"?ne.isInteger(e.data)||(u=this._getOrReturnCtx(e,u),q(u,{code:j.invalid_type,expected:"integer",received:"float",message:y.message}),m.dirty()):y.kind==="min"?(y.inclusive?e.data<y.value:e.data<=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_small,minimum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),m.dirty()):y.kind==="max"?(y.inclusive?e.data>y.value:e.data>=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_big,maximum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),m.dirty()):y.kind==="multipleOf"?si(e.data,y.value)!==0&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.not_multiple_of,multipleOf:y.value,message:y.message}),m.dirty()):y.kind==="finite"?Number.isFinite(e.data)||(u=this._getOrReturnCtx(e,u),q(u,{code:j.not_finite,message:y.message}),m.dirty()):ne.assertNever(y);return{status:m.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,Y.toString(a))}gt(e,a){return this.setLimit("min",e,!1,Y.toString(a))}lte(e,a){return this.setLimit("max",e,!0,Y.toString(a))}lt(e,a){return this.setLimit("max",e,!1,Y.toString(a))}setLimit(e,a,u,m){return new De({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:u,message:Y.toString(m)}]})}_addCheck(e){return new De({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ne.isInteger(e.value))}get isFinite(){let e=null,a=null;for(const u of this._def.checks){if(u.kind==="finite"||u.kind==="int"||u.kind==="multipleOf")return!0;u.kind==="min"?(a===null||u.value>a)&&(a=u.value):u.kind==="max"&&(e===null||u.value<e)&&(e=u.value)}return Number.isFinite(a)&&Number.isFinite(e)}}De.create=c=>new De({checks:[],typeName:X.ZodNumber,coerce:(c==null?void 0:c.coerce)||!1,...re(c)});class Te extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==K.bigint)return this._getInvalidInput(e);let u;const m=new le;for(const y of this._def.checks)y.kind==="min"?(y.inclusive?e.data<y.value:e.data<=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_small,type:"bigint",minimum:y.value,inclusive:y.inclusive,message:y.message}),m.dirty()):y.kind==="max"?(y.inclusive?e.data>y.value:e.data>=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_big,type:"bigint",maximum:y.value,inclusive:y.inclusive,message:y.message}),m.dirty()):y.kind==="multipleOf"?e.data%y.value!==BigInt(0)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.not_multiple_of,multipleOf:y.value,message:y.message}),m.dirty()):ne.assertNever(y);return{status:m.value,value:e.data}}_getInvalidInput(e){const a=this._getOrReturnCtx(e);return q(a,{code:j.invalid_type,expected:K.bigint,received:a.parsedType}),Q}gte(e,a){return this.setLimit("min",e,!0,Y.toString(a))}gt(e,a){return this.setLimit("min",e,!1,Y.toString(a))}lte(e,a){return this.setLimit("max",e,!0,Y.toString(a))}lt(e,a){return this.setLimit("max",e,!1,Y.toString(a))}setLimit(e,a,u,m){return new Te({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:u,message:Y.toString(m)}]})}_addCheck(e){return new Te({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(a)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}Te.create=c=>{var e;return new Te({checks:[],typeName:X.ZodBigInt,coerce:(e=c==null?void 0:c.coerce)!==null&&e!==void 0?e:!1,...re(c)})};class Qe extends se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==K.boolean){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.boolean,received:u.parsedType}),Q}return de(e.data)}}Qe.create=c=>new Qe({typeName:X.ZodBoolean,coerce:(c==null?void 0:c.coerce)||!1,...re(c)});class Ie extends se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==K.date){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_type,expected:K.date,received:y.parsedType}),Q}if(isNaN(e.data.getTime())){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_date}),Q}const u=new le;let m;for(const y of this._def.checks)y.kind==="min"?e.data.getTime()<y.value&&(m=this._getOrReturnCtx(e,m),q(m,{code:j.too_small,message:y.message,inclusive:!0,exact:!1,minimum:y.value,type:"date"}),u.dirty()):y.kind==="max"?e.data.getTime()>y.value&&(m=this._getOrReturnCtx(e,m),q(m,{code:j.too_big,message:y.message,inclusive:!0,exact:!1,maximum:y.value,type:"date"}),u.dirty()):ne.assertNever(y);return{status:u.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(a)})}get minDate(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e!=null?new Date(e):null}}Ie.create=c=>new Ie({checks:[],coerce:(c==null?void 0:c.coerce)||!1,typeName:X.ZodDate,...re(c)});class yt extends se{_parse(e){if(this._getType(e)!==K.symbol){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.symbol,received:u.parsedType}),Q}return de(e.data)}}yt.create=c=>new yt({typeName:X.ZodSymbol,...re(c)});class et extends se{_parse(e){if(this._getType(e)!==K.undefined){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.undefined,received:u.parsedType}),Q}return de(e.data)}}et.create=c=>new et({typeName:X.ZodUndefined,...re(c)});class tt extends se{_parse(e){if(this._getType(e)!==K.null){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.null,received:u.parsedType}),Q}return de(e.data)}}tt.create=c=>new tt({typeName:X.ZodNull,...re(c)});class je extends se{constructor(){super(...arguments),this._any=!0}_parse(e){return de(e.data)}}je.create=c=>new je({typeName:X.ZodAny,...re(c)});class Oe extends se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return de(e.data)}}Oe.create=c=>new Oe({typeName:X.ZodUnknown,...re(c)});class ke extends se{_parse(e){const a=this._getOrReturnCtx(e);return q(a,{code:j.invalid_type,expected:K.never,received:a.parsedType}),Q}}ke.create=c=>new ke({typeName:X.ZodNever,...re(c)});class Ct extends se{_parse(e){if(this._getType(e)!==K.undefined){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.void,received:u.parsedType}),Q}return de(e.data)}}Ct.create=c=>new Ct({typeName:X.ZodVoid,...re(c)});class ve extends se{_parse(e){const{ctx:a,status:u}=this._processInputParams(e),m=this._def;if(a.parsedType!==K.array)return q(a,{code:j.invalid_type,expected:K.array,received:a.parsedType}),Q;if(m.exactLength!==null){const k=a.data.length>m.exactLength.value,t=a.data.length<m.exactLength.value;(k||t)&&(q(a,{code:k?j.too_big:j.too_small,minimum:t?m.exactLength.value:void 0,maximum:k?m.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:m.exactLength.message}),u.dirty())}if(m.minLength!==null&&a.data.length<m.minLength.value&&(q(a,{code:j.too_small,minimum:m.minLength.value,type:"array",inclusive:!0,exact:!1,message:m.minLength.message}),u.dirty()),m.maxLength!==null&&a.data.length>m.maxLength.value&&(q(a,{code:j.too_big,maximum:m.maxLength.value,type:"array",inclusive:!0,exact:!1,message:m.maxLength.message}),u.dirty()),a.common.async)return Promise.all([...a.data].map((k,t)=>m.type._parseAsync(new ye(a,k,a.path,t)))).then(k=>le.mergeArray(u,k));const y=[...a.data].map((k,t)=>m.type._parseSync(new ye(a,k,a.path,t)));return le.mergeArray(u,y)}get element(){return this._def.type}min(e,a){return new ve({...this._def,minLength:{value:e,message:Y.toString(a)}})}max(e,a){return new ve({...this._def,maxLength:{value:e,message:Y.toString(a)}})}length(e,a){return new ve({...this._def,exactLength:{value:e,message:Y.toString(a)}})}nonempty(e){return this.min(1,e)}}ve.create=(c,e)=>new ve({type:c,minLength:null,maxLength:null,exactLength:null,typeName:X.ZodArray,...re(e)});function He(c){if(c instanceof ae){const e={};for(const a in c.shape){const u=c.shape[a];e[a]=Se.create(He(u))}return new ae({...c._def,shape:()=>e})}else return c instanceof ve?new ve({...c._def,type:He(c.element)}):c instanceof Se?Se.create(He(c.unwrap())):c instanceof Be?Be.create(He(c.unwrap())):c instanceof Ce?Ce.create(c.items.map(e=>He(e))):c}class ae extends se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),a=ne.objectKeys(e);return this._cached={shape:e,keys:a}}_parse(e){if(this._getType(e)!==K.object){const l=this._getOrReturnCtx(e);return q(l,{code:j.invalid_type,expected:K.object,received:l.parsedType}),Q}const{status:u,ctx:m}=this._processInputParams(e),{shape:y,keys:k}=this._getCached(),t=[];if(!(this._def.catchall instanceof ke&&this._def.unknownKeys==="strip"))for(const l in m.data)k.includes(l)||t.push(l);const o=[];for(const l of k){const _=y[l],h=m.data[l];o.push({key:{status:"valid",value:l},value:_._parse(new ye(m,h,m.path,l)),alwaysSet:l in m.data})}if(this._def.catchall instanceof ke){const l=this._def.unknownKeys;if(l==="passthrough")for(const _ of t)o.push({key:{status:"valid",value:_},value:{status:"valid",value:m.data[_]}});else if(l==="strict")t.length>0&&(q(m,{code:j.unrecognized_keys,keys:t}),u.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const _ of t){const h=m.data[_];o.push({key:{status:"valid",value:_},value:l._parse(new ye(m,h,m.path,_)),alwaysSet:_ in m.data})}}return m.common.async?Promise.resolve().then(async()=>{const l=[];for(const _ of o){const h=await _.key,p=await _.value;l.push({key:h,value:p,alwaysSet:_.alwaysSet})}return l}).then(l=>le.mergeObjectSync(u,l)):le.mergeObjectSync(u,o)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new ae({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,u)=>{var m,y,k,t;const o=(k=(y=(m=this._def).errorMap)===null||y===void 0?void 0:y.call(m,a,u).message)!==null&&k!==void 0?k:u.defaultError;return a.code==="unrecognized_keys"?{message:(t=Y.errToObj(e).message)!==null&&t!==void 0?t:o}:{message:o}}}:{}})}strip(){return new ae({...this._def,unknownKeys:"strip"})}passthrough(){return new ae({...this._def,unknownKeys:"passthrough"})}extend(e){return new ae({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ae({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:X.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new ae({...this._def,catchall:e})}pick(e){const a={};return ne.objectKeys(e).forEach(u=>{e[u]&&this.shape[u]&&(a[u]=this.shape[u])}),new ae({...this._def,shape:()=>a})}omit(e){const a={};return ne.objectKeys(this.shape).forEach(u=>{e[u]||(a[u]=this.shape[u])}),new ae({...this._def,shape:()=>a})}deepPartial(){return He(this)}partial(e){const a={};return ne.objectKeys(this.shape).forEach(u=>{const m=this.shape[u];e&&!e[u]?a[u]=m:a[u]=m.optional()}),new ae({...this._def,shape:()=>a})}required(e){const a={};return ne.objectKeys(this.shape).forEach(u=>{if(e&&!e[u])a[u]=this.shape[u];else{let y=this.shape[u];for(;y instanceof Se;)y=y._def.innerType;a[u]=y}}),new ae({...this._def,shape:()=>a})}keyof(){return Er(ne.objectKeys(this.shape))}}ae.create=(c,e)=>new ae({shape:()=>c,unknownKeys:"strip",catchall:ke.create(),typeName:X.ZodObject,...re(e)});ae.strictCreate=(c,e)=>new ae({shape:()=>c,unknownKeys:"strict",catchall:ke.create(),typeName:X.ZodObject,...re(e)});ae.lazycreate=(c,e)=>new ae({shape:c,unknownKeys:"strip",catchall:ke.create(),typeName:X.ZodObject,...re(e)});class rt extends se{_parse(e){const{ctx:a}=this._processInputParams(e),u=this._def.options;function m(y){for(const t of y)if(t.result.status==="valid")return t.result;for(const t of y)if(t.result.status==="dirty")return a.common.issues.push(...t.ctx.common.issues),t.result;const k=y.map(t=>new fe(t.ctx.common.issues));return q(a,{code:j.invalid_union,unionErrors:k}),Q}if(a.common.async)return Promise.all(u.map(async y=>{const k={...a,common:{...a.common,issues:[]},parent:null};return{result:await y._parseAsync({data:a.data,path:a.path,parent:k}),ctx:k}})).then(m);{let y;const k=[];for(const o of u){const l={...a,common:{...a.common,issues:[]},parent:null},_=o._parseSync({data:a.data,path:a.path,parent:l});if(_.status==="valid")return _;_.status==="dirty"&&!y&&(y={result:_,ctx:l}),l.common.issues.length&&k.push(l.common.issues)}if(y)return a.common.issues.push(...y.ctx.common.issues),y.result;const t=k.map(o=>new fe(o));return q(a,{code:j.invalid_union,unionErrors:t}),Q}}get options(){return this._def.options}}rt.create=(c,e)=>new rt({options:c,typeName:X.ZodUnion,...re(e)});const we=c=>c instanceof nt?we(c.schema):c instanceof me?we(c.innerType()):c instanceof ot?[c.value]:c instanceof Ae?c.options:c instanceof at?ne.objectValues(c.enum):c instanceof ct?we(c._def.innerType):c instanceof et?[void 0]:c instanceof tt?[null]:c instanceof Se?[void 0,...we(c.unwrap())]:c instanceof Be?[null,...we(c.unwrap())]:c instanceof zt||c instanceof lt?we(c.unwrap()):c instanceof ht?we(c._def.innerType):[];class xt extends se{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.object)return q(a,{code:j.invalid_type,expected:K.object,received:a.parsedType}),Q;const u=this.discriminator,m=a.data[u],y=this.optionsMap.get(m);return y?a.common.async?y._parseAsync({data:a.data,path:a.path,parent:a}):y._parseSync({data:a.data,path:a.path,parent:a}):(q(a,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[u]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,u){const m=new Map;for(const y of a){const k=we(y.shape[e]);if(!k.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const t of k){if(m.has(t))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(t)}`);m.set(t,y)}}return new xt({typeName:X.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:m,...re(u)})}}function jt(c,e){const a=xe(c),u=xe(e);if(c===e)return{valid:!0,data:c};if(a===K.object&&u===K.object){const m=ne.objectKeys(e),y=ne.objectKeys(c).filter(t=>m.indexOf(t)!==-1),k={...c,...e};for(const t of y){const o=jt(c[t],e[t]);if(!o.valid)return{valid:!1};k[t]=o.data}return{valid:!0,data:k}}else if(a===K.array&&u===K.array){if(c.length!==e.length)return{valid:!1};const m=[];for(let y=0;y<c.length;y++){const k=c[y],t=e[y],o=jt(k,t);if(!o.valid)return{valid:!1};m.push(o.data)}return{valid:!0,data:m}}else return a===K.date&&u===K.date&&+c==+e?{valid:!0,data:c}:{valid:!1}}class st extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e),m=(y,k)=>{if(Nt(y)||Nt(k))return Q;const t=jt(y.value,k.value);return t.valid?((Wt(y)||Wt(k))&&a.dirty(),{status:a.value,value:t.data}):(q(u,{code:j.invalid_intersection_types}),Q)};return u.common.async?Promise.all([this._def.left._parseAsync({data:u.data,path:u.path,parent:u}),this._def.right._parseAsync({data:u.data,path:u.path,parent:u})]).then(([y,k])=>m(y,k)):m(this._def.left._parseSync({data:u.data,path:u.path,parent:u}),this._def.right._parseSync({data:u.data,path:u.path,parent:u}))}}st.create=(c,e,a)=>new st({left:c,right:e,typeName:X.ZodIntersection,...re(a)});class Ce extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.array)return q(u,{code:j.invalid_type,expected:K.array,received:u.parsedType}),Q;if(u.data.length<this._def.items.length)return q(u,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&u.data.length>this._def.items.length&&(q(u,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const y=[...u.data].map((k,t)=>{const o=this._def.items[t]||this._def.rest;return o?o._parse(new ye(u,k,u.path,t)):null}).filter(k=>!!k);return u.common.async?Promise.all(y).then(k=>le.mergeArray(a,k)):le.mergeArray(a,y)}get items(){return this._def.items}rest(e){return new Ce({...this._def,rest:e})}}Ce.create=(c,e)=>{if(!Array.isArray(c))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ce({items:c,typeName:X.ZodTuple,rest:null,...re(e)})};class it extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.object)return q(u,{code:j.invalid_type,expected:K.object,received:u.parsedType}),Q;const m=[],y=this._def.keyType,k=this._def.valueType;for(const t in u.data)m.push({key:y._parse(new ye(u,t,u.path,t)),value:k._parse(new ye(u,u.data[t],u.path,t)),alwaysSet:t in u.data});return u.common.async?le.mergeObjectAsync(a,m):le.mergeObjectSync(a,m)}get element(){return this._def.valueType}static create(e,a,u){return a instanceof se?new it({keyType:e,valueType:a,typeName:X.ZodRecord,...re(u)}):new it({keyType:ge.create(),valueType:e,typeName:X.ZodRecord,...re(a)})}}class wt extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.map)return q(u,{code:j.invalid_type,expected:K.map,received:u.parsedType}),Q;const m=this._def.keyType,y=this._def.valueType,k=[...u.data.entries()].map(([t,o],l)=>({key:m._parse(new ye(u,t,u.path,[l,"key"])),value:y._parse(new ye(u,o,u.path,[l,"value"]))}));if(u.common.async){const t=new Map;return Promise.resolve().then(async()=>{for(const o of k){const l=await o.key,_=await o.value;if(l.status==="aborted"||_.status==="aborted")return Q;(l.status==="dirty"||_.status==="dirty")&&a.dirty(),t.set(l.value,_.value)}return{status:a.value,value:t}})}else{const t=new Map;for(const o of k){const l=o.key,_=o.value;if(l.status==="aborted"||_.status==="aborted")return Q;(l.status==="dirty"||_.status==="dirty")&&a.dirty(),t.set(l.value,_.value)}return{status:a.value,value:t}}}}wt.create=(c,e,a)=>new wt({valueType:e,keyType:c,typeName:X.ZodMap,...re(a)});class Pe extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.set)return q(u,{code:j.invalid_type,expected:K.set,received:u.parsedType}),Q;const m=this._def;m.minSize!==null&&u.data.size<m.minSize.value&&(q(u,{code:j.too_small,minimum:m.minSize.value,type:"set",inclusive:!0,exact:!1,message:m.minSize.message}),a.dirty()),m.maxSize!==null&&u.data.size>m.maxSize.value&&(q(u,{code:j.too_big,maximum:m.maxSize.value,type:"set",inclusive:!0,exact:!1,message:m.maxSize.message}),a.dirty());const y=this._def.valueType;function k(o){const l=new Set;for(const _ of o){if(_.status==="aborted")return Q;_.status==="dirty"&&a.dirty(),l.add(_.value)}return{status:a.value,value:l}}const t=[...u.data.values()].map((o,l)=>y._parse(new ye(u,o,u.path,l)));return u.common.async?Promise.all(t).then(o=>k(o)):k(t)}min(e,a){return new Pe({...this._def,minSize:{value:e,message:Y.toString(a)}})}max(e,a){return new Pe({...this._def,maxSize:{value:e,message:Y.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}Pe.create=(c,e)=>new Pe({valueType:c,minSize:null,maxSize:null,typeName:X.ZodSet,...re(e)});class Ne extends se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.function)return q(a,{code:j.invalid_type,expected:K.function,received:a.parsedType}),Q;function u(t,o){return bt({data:t,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,mt(),We].filter(l=>!!l),issueData:{code:j.invalid_arguments,argumentsError:o}})}function m(t,o){return bt({data:t,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,mt(),We].filter(l=>!!l),issueData:{code:j.invalid_return_type,returnTypeError:o}})}const y={errorMap:a.common.contextualErrorMap},k=a.data;if(this._def.returns instanceof Ue){const t=this;return de(async function(...o){const l=new fe([]),_=await t._def.args.parseAsync(o,y).catch(v=>{throw l.addIssue(u(o,v)),l}),h=await Reflect.apply(k,this,_);return await t._def.returns._def.type.parseAsync(h,y).catch(v=>{throw l.addIssue(m(h,v)),l})})}else{const t=this;return de(function(...o){const l=t._def.args.safeParse(o,y);if(!l.success)throw new fe([u(o,l.error)]);const _=Reflect.apply(k,this,l.data),h=t._def.returns.safeParse(_,y);if(!h.success)throw new fe([m(_,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ne({...this._def,args:Ce.create(e).rest(Oe.create())})}returns(e){return new Ne({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,u){return new Ne({args:e||Ce.create([]).rest(Oe.create()),returns:a||Oe.create(),typeName:X.ZodFunction,...re(u)})}}class nt extends se{get schema(){return this._def.getter()}_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}nt.create=(c,e)=>new nt({getter:c,typeName:X.ZodLazy,...re(e)});class ot extends se{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return q(a,{received:a.data,code:j.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}}ot.create=(c,e)=>new ot({value:c,typeName:X.ZodLiteral,...re(e)});function Er(c,e){return new Ae({values:c,typeName:X.ZodEnum,...re(e)})}class Ae extends se{constructor(){super(...arguments),Ge.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const a=this._getOrReturnCtx(e),u=this._def.values;return q(a,{expected:ne.joinValues(u),received:a.parsedType,code:j.invalid_type}),Q}if(St(this,Ge)||Sr(this,Ge,new Set(this._def.values)),!St(this,Ge).has(e.data)){const a=this._getOrReturnCtx(e),u=this._def.values;return q(a,{received:a.data,code:j.invalid_enum_value,options:u}),Q}return de(e.data)}get options(){return this._def.values}get enum(){const e={};for(const a of this._def.values)e[a]=a;return e}get Values(){const e={};for(const a of this._def.values)e[a]=a;return e}get Enum(){const e={};for(const a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return Ae.create(e,{...this._def,...a})}exclude(e,a=this._def){return Ae.create(this.options.filter(u=>!e.includes(u)),{...this._def,...a})}}Ge=new WeakMap;Ae.create=Er;class at extends se{constructor(){super(...arguments),Ye.set(this,void 0)}_parse(e){const a=ne.getValidEnumValues(this._def.values),u=this._getOrReturnCtx(e);if(u.parsedType!==K.string&&u.parsedType!==K.number){const m=ne.objectValues(a);return q(u,{expected:ne.joinValues(m),received:u.parsedType,code:j.invalid_type}),Q}if(St(this,Ye)||Sr(this,Ye,new Set(ne.getValidEnumValues(this._def.values))),!St(this,Ye).has(e.data)){const m=ne.objectValues(a);return q(u,{received:u.data,code:j.invalid_enum_value,options:m}),Q}return de(e.data)}get enum(){return this._def.values}}Ye=new WeakMap;at.create=(c,e)=>new at({values:c,typeName:X.ZodNativeEnum,...re(e)});class Ue extends se{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.promise&&a.common.async===!1)return q(a,{code:j.invalid_type,expected:K.promise,received:a.parsedType}),Q;const u=a.parsedType===K.promise?a.data:Promise.resolve(a.data);return de(u.then(m=>this._def.type.parseAsync(m,{path:a.path,errorMap:a.common.contextualErrorMap})))}}Ue.create=(c,e)=>new Ue({type:c,typeName:X.ZodPromise,...re(e)});class me extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===X.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:a,ctx:u}=this._processInputParams(e),m=this._def.effect||null,y={addIssue:k=>{q(u,k),k.fatal?a.abort():a.dirty()},get path(){return u.path}};if(y.addIssue=y.addIssue.bind(y),m.type==="preprocess"){const k=m.transform(u.data,y);if(u.common.async)return Promise.resolve(k).then(async t=>{if(a.value==="aborted")return Q;const o=await this._def.schema._parseAsync({data:t,path:u.path,parent:u});return o.status==="aborted"?Q:o.status==="dirty"||a.value==="dirty"?Fe(o.value):o});{if(a.value==="aborted")return Q;const t=this._def.schema._parseSync({data:k,path:u.path,parent:u});return t.status==="aborted"?Q:t.status==="dirty"||a.value==="dirty"?Fe(t.value):t}}if(m.type==="refinement"){const k=t=>{const o=m.refinement(t,y);if(u.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return t};if(u.common.async===!1){const t=this._def.schema._parseSync({data:u.data,path:u.path,parent:u});return t.status==="aborted"?Q:(t.status==="dirty"&&a.dirty(),k(t.value),{status:a.value,value:t.value})}else return this._def.schema._parseAsync({data:u.data,path:u.path,parent:u}).then(t=>t.status==="aborted"?Q:(t.status==="dirty"&&a.dirty(),k(t.value).then(()=>({status:a.value,value:t.value}))))}if(m.type==="transform")if(u.common.async===!1){const k=this._def.schema._parseSync({data:u.data,path:u.path,parent:u});if(!Me(k))return k;const t=m.transform(k.value,y);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:t}}else return this._def.schema._parseAsync({data:u.data,path:u.path,parent:u}).then(k=>Me(k)?Promise.resolve(m.transform(k.value,y)).then(t=>({status:a.value,value:t})):k);ne.assertNever(m)}}me.create=(c,e,a)=>new me({schema:c,typeName:X.ZodEffects,effect:e,...re(a)});me.createWithPreprocess=(c,e,a)=>new me({schema:e,effect:{type:"preprocess",transform:c},typeName:X.ZodEffects,...re(a)});class Se extends se{_parse(e){return this._getType(e)===K.undefined?de(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Se.create=(c,e)=>new Se({innerType:c,typeName:X.ZodOptional,...re(e)});class Be extends se{_parse(e){return this._getType(e)===K.null?de(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Be.create=(c,e)=>new Be({innerType:c,typeName:X.ZodNullable,...re(e)});class ct extends se{_parse(e){const{ctx:a}=this._processInputParams(e);let u=a.data;return a.parsedType===K.undefined&&(u=this._def.defaultValue()),this._def.innerType._parse({data:u,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}ct.create=(c,e)=>new ct({innerType:c,typeName:X.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...re(e)});class ht extends se{_parse(e){const{ctx:a}=this._processInputParams(e),u={...a,common:{...a.common,issues:[]}},m=this._def.innerType._parse({data:u.data,path:u.path,parent:{...u}});return Xe(m)?m.then(y=>({status:"valid",value:y.status==="valid"?y.value:this._def.catchValue({get error(){return new fe(u.common.issues)},input:u.data})})):{status:"valid",value:m.status==="valid"?m.value:this._def.catchValue({get error(){return new fe(u.common.issues)},input:u.data})}}removeCatch(){return this._def.innerType}}ht.create=(c,e)=>new ht({innerType:c,typeName:X.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...re(e)});class Et extends se{_parse(e){if(this._getType(e)!==K.nan){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.nan,received:u.parsedType}),Q}return{status:"valid",value:e.data}}}Et.create=c=>new Et({typeName:X.ZodNaN,...re(c)});const ii=Symbol("zod_brand");class zt extends se{_parse(e){const{ctx:a}=this._processInputParams(e),u=a.data;return this._def.type._parse({data:u,path:a.path,parent:a})}unwrap(){return this._def.type}}class dt extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.common.async)return(async()=>{const y=await this._def.in._parseAsync({data:u.data,path:u.path,parent:u});return y.status==="aborted"?Q:y.status==="dirty"?(a.dirty(),Fe(y.value)):this._def.out._parseAsync({data:y.value,path:u.path,parent:u})})();{const m=this._def.in._parseSync({data:u.data,path:u.path,parent:u});return m.status==="aborted"?Q:m.status==="dirty"?(a.dirty(),{status:"dirty",value:m.value}):this._def.out._parseSync({data:m.value,path:u.path,parent:u})}}static create(e,a){return new dt({in:e,out:a,typeName:X.ZodPipeline})}}class lt extends se{_parse(e){const a=this._def.innerType._parse(e),u=m=>(Me(m)&&(m.value=Object.freeze(m.value)),m);return Xe(a)?a.then(m=>u(m)):u(a)}unwrap(){return this._def.innerType}}lt.create=(c,e)=>new lt({innerType:c,typeName:X.ZodReadonly,...re(e)});function xr(c,e={},a){return c?je.create().superRefine((u,m)=>{var y,k;if(!c(u)){const t=typeof e=="function"?e(u):typeof e=="string"?{message:e}:e,o=(k=(y=t.fatal)!==null&&y!==void 0?y:a)!==null&&k!==void 0?k:!0,l=typeof t=="string"?{message:t}:t;m.addIssue({code:"custom",...l,fatal:o})}}):je.create()}const ni={object:ae.lazycreate};var X;(function(c){c.ZodString="ZodString",c.ZodNumber="ZodNumber",c.ZodNaN="ZodNaN",c.ZodBigInt="ZodBigInt",c.ZodBoolean="ZodBoolean",c.ZodDate="ZodDate",c.ZodSymbol="ZodSymbol",c.ZodUndefined="ZodUndefined",c.ZodNull="ZodNull",c.ZodAny="ZodAny",c.ZodUnknown="ZodUnknown",c.ZodNever="ZodNever",c.ZodVoid="ZodVoid",c.ZodArray="ZodArray",c.ZodObject="ZodObject",c.ZodUnion="ZodUnion",c.ZodDiscriminatedUnion="ZodDiscriminatedUnion",c.ZodIntersection="ZodIntersection",c.ZodTuple="ZodTuple",c.ZodRecord="ZodRecord",c.ZodMap="ZodMap",c.ZodSet="ZodSet",c.ZodFunction="ZodFunction",c.ZodLazy="ZodLazy",c.ZodLiteral="ZodLiteral",c.ZodEnum="ZodEnum",c.ZodEffects="ZodEffects",c.ZodNativeEnum="ZodNativeEnum",c.ZodOptional="ZodOptional",c.ZodNullable="ZodNullable",c.ZodDefault="ZodDefault",c.ZodCatch="ZodCatch",c.ZodPromise="ZodPromise",c.ZodBranded="ZodBranded",c.ZodPipeline="ZodPipeline",c.ZodReadonly="ZodReadonly"})(X||(X={}));const oi=(c,e={message:`Input not instance of ${c.name}`})=>xr(a=>a instanceof c,e),kr=ge.create,Rr=De.create,ai=Et.create,ci=Te.create,Lr=Qe.create,hi=Ie.create,li=yt.create,di=et.create,ui=tt.create,fi=je.create,_i=Oe.create,pi=ke.create,gi=Ct.create,vi=ve.create,mi=ae.create,bi=ae.strictCreate,Si=rt.create,yi=xt.create,Ci=st.create,wi=Ce.create,Ei=it.create,xi=wt.create,ki=Pe.create,Ri=Ne.create,Li=nt.create,Di=ot.create,Ti=Ae.create,Ai=at.create,Bi=Ue.create,tr=me.create,Oi=Se.create,Mi=Be.create,Ii=me.createWithPreprocess,Pi=dt.create,Hi=()=>kr().optional(),Fi=()=>Rr().optional(),Ni=()=>Lr().optional(),Wi={string:c=>ge.create({...c,coerce:!0}),number:c=>De.create({...c,coerce:!0}),boolean:c=>Qe.create({...c,coerce:!0}),bigint:c=>Te.create({...c,coerce:!0}),date:c=>Ie.create({...c,coerce:!0})},ji=Q;var Ui=Object.freeze({__proto__:null,defaultErrorMap:We,setErrorMap:Is,getErrorMap:mt,makeIssue:bt,EMPTY_PATH:Ps,addIssueToContext:q,ParseStatus:le,INVALID:Q,DIRTY:Fe,OK:de,isAborted:Nt,isDirty:Wt,isValid:Me,isAsync:Xe,get util(){return ne},get objectUtil(){return Ft},ZodParsedType:K,getParsedType:xe,ZodType:se,datetimeRegex:wr,ZodString:ge,ZodNumber:De,ZodBigInt:Te,ZodBoolean:Qe,ZodDate:Ie,ZodSymbol:yt,ZodUndefined:et,ZodNull:tt,ZodAny:je,ZodUnknown:Oe,ZodNever:ke,ZodVoid:Ct,ZodArray:ve,ZodObject:ae,ZodUnion:rt,ZodDiscriminatedUnion:xt,ZodIntersection:st,ZodTuple:Ce,ZodRecord:it,ZodMap:wt,ZodSet:Pe,ZodFunction:Ne,ZodLazy:nt,ZodLiteral:ot,ZodEnum:Ae,ZodNativeEnum:at,ZodPromise:Ue,ZodEffects:me,ZodTransformer:me,ZodOptional:Se,ZodNullable:Be,ZodDefault:ct,ZodCatch:ht,ZodNaN:Et,BRAND:ii,ZodBranded:zt,ZodPipeline:dt,ZodReadonly:lt,custom:xr,Schema:se,ZodSchema:se,late:ni,get ZodFirstPartyTypeKind(){return X},coerce:Wi,any:fi,array:vi,bigint:ci,boolean:Lr,date:hi,discriminatedUnion:yi,effect:tr,enum:Ti,function:Ri,instanceof:oi,intersection:Ci,lazy:Li,literal:Di,map:xi,nan:ai,nativeEnum:Ai,never:pi,null:ui,nullable:Mi,number:Rr,object:mi,oboolean:Ni,onumber:Fi,optional:Oi,ostring:Hi,pipeline:Pi,preprocess:Ii,promise:Bi,record:Ei,set:ki,strictObject:bi,string:kr,symbol:li,transformer:tr,tuple:wi,undefined:di,union:Si,unknown:_i,void:gi,NEVER:ji,ZodIssueCode:j,quotelessJson:Ms,ZodError:fe});function $i(c){const e=/\x1b\[<(\d+);(\d+);(\d+)([mM])/.exec(c);if(!e)return;if(!e[1]||!e[2]||!e[3]||!e[4])throw new Error(`Mouse event: Invalid match for data ${c}`);const a=parseInt(e[1],10),u=parseInt(e[2],10),m=parseInt(e[3],10),y=e[4]==="m";return console.log(`Mouse event: buttonCode=${a}, column=${u}, row=${m}, isRelease=${y}`),c}function zi(c,e){const a=new Os.Terminal({cursorBlink:!1,convertEol:!0,fontSize:13}),u=vr.macchiato.colors;a.options.theme={background:u.base.hex,black:u.crust.hex,brightBlack:u.surface2.hex,blue:u.blue.hex,brightBlue:u.blue.hex,brightCyan:u.sky.hex,brightRed:u.maroon.hex,brightYellow:u.yellow.hex,cursor:u.text.hex,cyan:u.sky.hex,foreground:u.text.hex,green:u.green.hex,magenta:u.lavender.hex,red:u.red.hex,white:u.text.hex,yellow:u.yellow.hex};const m=new As.FitAddon;return a.loadAddon(m),a.open(c),m.fit(),window.addEventListener("resize",()=>{m.fit()}),a.onData(y=>{if(typeof y!="string")throw new Error(`unexpected onData message type: '${JSON.stringify(y)}'`);const k=$i(y);k&&e.onMouseEvent(k)}),a.onKey(y=>{e.onKeyPress(y)}),a}function qi(){let c=Ui.string().safeParse(sessionStorage.getItem("tabId")).data;return c||(c=Math.random().toString(36),sessionStorage.setItem("tabId",c)),{tabId:c}}class Vi{constructor(e){Ke(this,"ready");Ke(this,"tabId");Ke(this,"terminal");Ke(this,"trpc");const a=hs({links:[ws({condition:y=>y.type==="subscription",true:Rs({url:"/trpc"}),false:Cs({url:"/trpc"})})]});this.trpc=a,this.tabId=qi();const u=this.tabId,m=zi(e,{onMouseEvent(y){a.neovim.sendStdin.mutate({tabId:u,data:y}).catch(k=>{console.error("Error sending mouse event",k)})},onKeyPress(y){a.neovim.sendStdin.mutate({tabId:u,data:y.key})}});this.terminal=m,this.ready=new Promise(y=>{console.log("Subscribing to Neovim stdout"),a.neovim.onStdout.subscribe({client:u},{onStarted(){y()},onData(k){m.write(k)},onError(k){console.error("Error from Neovim",k)}})})}async startNeovim(e){return await this.ready,await this.trpc.neovim.start.mutate({startNeovimArguments:{filename:e.filename,additionalEnvironmentVariables:e.additionalEnvironmentVariables,startupScriptModifications:e.startupScriptModifications,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}},tabId:this.tabId})}async runBlockingShellCommand(e){return await this.ready,this.trpc.neovim.runBlockingShellCommand.mutate({...e,tabId:this.tabId})}async runLuaCode(e){return await this.ready,this.trpc.neovim.runLuaCode.mutate({...e,tabId:this.tabId})}async runExCommand(e){return await this.ready,this.trpc.neovim.runExCommand.mutate({...e,tabId:this.tabId})}}const Dr=document.querySelector("#app");if(!Dr)throw new Error("No app element found");const kt=new Vi(Dr);window.startNeovim=async function(c){return await kt.startNeovim({additionalEnvironmentVariables:c==null?void 0:c.additionalEnvironmentVariables,filename:(c==null?void 0:c.filename)??"initial-file.txt",startupScriptModifications:(c==null?void 0:c.startupScriptModifications)??[]})};window.runBlockingShellCommand=async function(c){return kt.runBlockingShellCommand(c)};window.runLuaCode=async function(c){return kt.runLuaCode(c)};window.runExCommand=async function(c){return kt.runExCommand(c)};
7
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(g){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),n.isLinux&&g&&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(g){const E=this._getMouseBufferCoords(g),T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!!(T&&B&&E)&&this._areCoordsInSelection(E,T,B)}isCellInSelection(g,E){const T=this._model.finalSelectionStart,B=this._model.finalSelectionEnd;return!(!T||!B)&&this._areCoordsInSelection([g,E],T,B)}_areCoordsInSelection(g,E,T){return g[1]>E[1]&&g[1]<T[1]||E[1]===T[1]&&g[1]===E[1]&&g[0]>=E[0]&&g[0]<T[0]||E[1]<T[1]&&g[1]===T[1]&&g[0]<T[0]||E[1]<T[1]&&g[1]===E[1]&&g[0]>=E[0]}_selectWordAtCursor(g,E){var O,D;const T=(D=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:D.range;if(T)return this._model.selectionStart=[T.start.x-1,T.start.y-1],this._model.selectionStartLength=(0,r.getRangeLength)(T,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const B=this._getMouseBufferCoords(g);return!!B&&(this._selectWordAt(B,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(g,E){this._model.clearSelection(),g=Math.max(g,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,g],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(g){this._model.handleTrim(g)&&this.refresh()}_getMouseBufferCoords(g){const E=this._mouseService.getCoords(g,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(g){let E=(0,c.getCoordsRelativeToElement)(this._coreBrowserService.window,g,this._screenElement)[1];const T=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=T?0:(E>T&&(E-=T),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(g){return n.isMac?g.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:g.shiftKey}handleMouseDown(g){if(this._mouseDownTimeStamp=g.timeStamp,(g.button!==2||!this.hasSelection)&&g.button===0){if(!this._enabled){if(!this.shouldForceSelection(g))return;g.stopPropagation()}g.preventDefault(),this._dragScrollAmount=0,this._enabled&&g.shiftKey?this._handleIncrementalClick(g):g.detail===1?this._handleSingleClick(g):g.detail===2?this._handleDoubleClick(g):g.detail===3&&this._handleTripleClick(g),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(g){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(g))}_handleSingleClick(g){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(g)?3:0,this._model.selectionStart=this._getMouseBufferCoords(g),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(g){this._selectWordAtCursor(g,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(g){const E=this._getMouseBufferCoords(g);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(g){return g.altKey&&!(n.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(g){if(g.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(g),!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(g),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const T=this._bufferService.buffer;if(this._model.selectionEnd[1]<T.lines.length){const B=T.lines.get(this._model.selectionEnd[1]);B&&B.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[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 g=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(g.ydisp+this._bufferService.rows,g.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=g.ydisp),this.refresh()}}_handleMouseUp(g){const E=g.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&g.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const T=this._mouseService.getCoords(g,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){const B=(0,p.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(B,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,T=!(!g||!E||g[0]===E[0]&&g[1]===E[1]);T?g&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&g[0]===this._oldSelectionStart[0]&&g[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(g,E,T)):this._oldHasSelection&&this._fireOnSelectionChange(g,E,T)}_fireOnSelectionChange(g,E,T){this._oldSelectionStart=g,this._oldSelectionEnd=E,this._oldHasSelection=T,this._onSelectionChange.fire()}_handleBufferActivate(g){this.clearSelection(),this._trimListener.dispose(),this._trimListener=g.activeBuffer.lines.onTrim(E=>this._handleTrim(E))}_convertViewportColToCharacterIndex(g,E){let T=E;for(let B=0;E>=B;B++){const O=g.loadCell(B,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:O>1&&E!==B&&(T+=O-1)}return T}setSelection(g,E,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[g,E],this._model.selectionStartLength=T,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(g){this._isClickInSelection(g)||(this._selectWordAtCursor(g,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(g,E,T=!0,B=!0){if(g[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,D=O.lines.get(g[1]);if(!D)return;const P=O.translateBufferLineToString(g[1],!1);let F=this._convertViewportColToCharacterIndex(D,g[0]),U=F;const G=g[0]-F;let $=0,x=0,L=0,A=0;if(P.charAt(F)===" "){for(;F>0&&P.charAt(F-1)===" ";)F--;for(;U<P.length&&P.charAt(U+1)===" ";)U++}else{let z=g[0],J=g[0];D.getWidth(z)===0&&($++,z--),D.getWidth(J)===2&&(x++,J++);const ee=D.getString(J).length;for(ee>1&&(A+=ee-1,U+=ee-1);z>0&&F>0&&!this._isCharWordSeparator(D.loadCell(z-1,this._workCell));){D.loadCell(z-1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===0?($++,z--):I>1&&(L+=I-1,F-=I-1),F--,z--}for(;J<D.length&&U+1<P.length&&!this._isCharWordSeparator(D.loadCell(J+1,this._workCell));){D.loadCell(J+1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===2?(x++,J++):I>1&&(A+=I-1,U+=I-1),U++,J++}}U++;let M=F+G-$+L,N=Math.min(this._bufferService.cols,U-F+$+x-L-A);if(E||P.slice(F,U).trim()!==""){if(T&&M===0&&D.getCodePoint(0)!==32){const z=O.lines.get(g[1]-1);if(z&&D.isWrapped&&z.getCodePoint(this._bufferService.cols-1)!==32){const J=this._getWordAt([this._bufferService.cols-1,g[1]-1],!1,!0,!1);if(J){const ee=this._bufferService.cols-J.start;M-=ee,N+=ee}}}if(B&&M+N===this._bufferService.cols&&D.getCodePoint(this._bufferService.cols-1)!==32){const z=O.lines.get(g[1]+1);if(z!=null&&z.isWrapped&&z.getCodePoint(0)!==32){const J=this._getWordAt([0,g[1]+1],!1,!1,!0);J&&(N+=J.length)}}return{start:M,length:N}}}_selectWordAt(g,E){const T=this._getWordAt(g,E);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,g[1]--;this._model.selectionStart=[T.start,g[1]],this._model.selectionStartLength=T.length}}_selectToWordAt(g){const E=this._getWordAt(g,!0);if(E){let T=g[1];for(;E.start<0;)E.start+=this._bufferService.cols,T--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,T++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,T]}}_isCharWordSeparator(g){return g.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(g.getChars())>=0}_selectLineAt(g){const E=this._bufferService.buffer.getWrappedRangeForLine(g),T={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,r.getRangeLength)(T,this._bufferService.cols)}};t.SelectionService=w=l([_(3,d.IBufferService),_(4,d.ICoreService),_(5,C.IMouseService),_(6,d.IOptionsService),_(7,C.IRenderService),_(8,C.ICoreBrowserService)],w)},4725:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ILinkProviderService=t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const l=o(8343);t.ICharSizeService=(0,l.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,l.createDecorator)("CoreBrowserService"),t.IMouseService=(0,l.createDecorator)("MouseService"),t.IRenderService=(0,l.createDecorator)("RenderService"),t.ISelectionService=(0,l.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,l.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,l.createDecorator)("ThemeService"),t.ILinkProviderService=(0,l.createDecorator)("LinkProviderService")},6731:function(k,t,o){var l=this&&this.__decorate||function(w,g,E,T){var B,O=arguments.length,D=O<3?g:T===null?T=Object.getOwnPropertyDescriptor(g,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(w,g,E,T);else for(var P=w.length-1;P>=0;P--)(B=w[P])&&(D=(O<3?B(D):O>3?B(g,E,D):B(g,E))||D);return O>3&&D&&Object.defineProperty(g,E,D),D},_=this&&this.__param||function(w,g){return function(E,T){g(E,T,w)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const c=o(7239),p=o(8055),v=o(8460),C=o(844),f=o(2585),i=p.css.toColor("#ffffff"),n=p.css.toColor("#000000"),r=p.css.toColor("#ffffff"),s=p.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const w=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],g=[0,95,135,175,215,255];for(let E=0;E<216;E++){const T=g[E/36%6|0],B=g[E/6%6|0],O=g[E%6];w.push({css:p.channels.toCss(T,B,O),rgba:p.channels.toRgba(T,B,O)})}for(let E=0;E<24;E++){const T=8+10*E;w.push({css:p.channels.toCss(T,T,T),rgba:p.channels.toRgba(T,T,T)})}return w})());let S=t.ThemeService=class extends C.Disposable{get colors(){return this._colors}constructor(w){super(),this._optionsService=w,this._contrastCache=new c.ColorContrastCache,this._halfContrastCache=new c.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:i,background:n,cursor:r,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:p.color.blend(n,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:p.color.blend(n,d),ansi:t.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(w={}){const g=this._colors;if(g.foreground=b(w.foreground,i),g.background=b(w.background,n),g.cursor=b(w.cursor,r),g.cursorAccent=b(w.cursorAccent,s),g.selectionBackgroundTransparent=b(w.selectionBackground,d),g.selectionBackgroundOpaque=p.color.blend(g.background,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundTransparent=b(w.selectionInactiveBackground,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundOpaque=p.color.blend(g.background,g.selectionInactiveBackgroundTransparent),g.selectionForeground=w.selectionForeground?b(w.selectionForeground,p.NULL_COLOR):void 0,g.selectionForeground===p.NULL_COLOR&&(g.selectionForeground=void 0),p.color.isOpaque(g.selectionBackgroundTransparent)&&(g.selectionBackgroundTransparent=p.color.opacity(g.selectionBackgroundTransparent,.3)),p.color.isOpaque(g.selectionInactiveBackgroundTransparent)&&(g.selectionInactiveBackgroundTransparent=p.color.opacity(g.selectionInactiveBackgroundTransparent,.3)),g.ansi=t.DEFAULT_ANSI_COLORS.slice(),g.ansi[0]=b(w.black,t.DEFAULT_ANSI_COLORS[0]),g.ansi[1]=b(w.red,t.DEFAULT_ANSI_COLORS[1]),g.ansi[2]=b(w.green,t.DEFAULT_ANSI_COLORS[2]),g.ansi[3]=b(w.yellow,t.DEFAULT_ANSI_COLORS[3]),g.ansi[4]=b(w.blue,t.DEFAULT_ANSI_COLORS[4]),g.ansi[5]=b(w.magenta,t.DEFAULT_ANSI_COLORS[5]),g.ansi[6]=b(w.cyan,t.DEFAULT_ANSI_COLORS[6]),g.ansi[7]=b(w.white,t.DEFAULT_ANSI_COLORS[7]),g.ansi[8]=b(w.brightBlack,t.DEFAULT_ANSI_COLORS[8]),g.ansi[9]=b(w.brightRed,t.DEFAULT_ANSI_COLORS[9]),g.ansi[10]=b(w.brightGreen,t.DEFAULT_ANSI_COLORS[10]),g.ansi[11]=b(w.brightYellow,t.DEFAULT_ANSI_COLORS[11]),g.ansi[12]=b(w.brightBlue,t.DEFAULT_ANSI_COLORS[12]),g.ansi[13]=b(w.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),g.ansi[14]=b(w.brightCyan,t.DEFAULT_ANSI_COLORS[14]),g.ansi[15]=b(w.brightWhite,t.DEFAULT_ANSI_COLORS[15]),w.extendedAnsi){const E=Math.min(g.ansi.length-16,w.extendedAnsi.length);for(let T=0;T<E;T++)g.ansi[T+16]=b(w.extendedAnsi[T],t.DEFAULT_ANSI_COLORS[T+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(w){this._restoreColor(w),this._onChangeColors.fire(this.colors)}_restoreColor(w){if(w!==void 0)switch(w){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[w]=this._restoreColors.ansi[w]}else for(let g=0;g<this._restoreColors.ansi.length;++g)this._colors.ansi[g]=this._restoreColors.ansi[g]}modifyColors(w){w(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 b(w,g){if(w!==void 0)try{return p.css.toColor(w)}catch{}return g}t.ThemeService=S=l([_(0,f.IOptionsService)],S)},6349:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const l=o(8460),_=o(844);class c extends _.Disposable{constructor(v){super(),this._maxLength=v,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(v){if(this._maxLength===v)return;const C=new Array(v);for(let f=0;f<Math.min(v,this.length);f++)C[f]=this._array[this._getCyclicIndex(f)];this._array=C,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let C=this._length;C<v;C++)this._array[C]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,C){this._array[this._getCyclicIndex(v)]=C}push(v){this._array[this._getCyclicIndex(this._length)]=v,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(v,C,...f){if(C){for(let i=v;i<this._length-C;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+C)];this._length-=C,this.onDeleteEmitter.fire({index:v,amount:C})}for(let i=this._length-1;i>=v;i--)this._array[this._getCyclicIndex(i+f.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<f.length;i++)this._array[this._getCyclicIndex(v+i)]=f[i];if(f.length&&this.onInsertEmitter.fire({index:v,amount:f.length}),this._length+f.length>this._maxLength){const i=this._length+f.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=f.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,C,f){if(!(C<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+f<0)throw new Error("Cannot shift elements in list beyond index 0");if(f>0){for(let n=C-1;n>=0;n--)this.set(v+n+f,this.get(v+n));const i=v+C+f-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<C;i++)this.set(v+i+f,this.get(v+i))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}t.CircularList=c},1439:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function o(l,_=5){if(typeof l!="object")return l;const c=Array.isArray(l)?[]:{};for(const p in l)c[p]=_<=1?l[p]:l[p]&&o(l[p],_-1);return c}},8055:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let o=0,l=0,_=0,c=0;var p,v,C,f,i;function n(s){const d=s.toString(16);return d.length<2?"0"+d:d}function r(s,d){return s<d?(d+.05)/(s+.05):(s+.05)/(d+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(s){s.toCss=function(d,S,b,w){return w!==void 0?`#${n(d)}${n(S)}${n(b)}${n(w)}`:`#${n(d)}${n(S)}${n(b)}`},s.toRgba=function(d,S,b,w=255){return(d<<24|S<<16|b<<8|w)>>>0},s.toColor=function(d,S,b,w){return{css:s.toCss(d,S,b,w),rgba:s.toRgba(d,S,b,w)}}}(p||(t.channels=p={})),function(s){function d(S,b){return c=Math.round(255*b),[o,l,_]=i.toChannels(S.rgba),{css:p.toCss(o,l,_,c),rgba:p.toRgba(o,l,_,c)}}s.blend=function(S,b){if(c=(255&b.rgba)/255,c===1)return{css:b.css,rgba:b.rgba};const w=b.rgba>>24&255,g=b.rgba>>16&255,E=b.rgba>>8&255,T=S.rgba>>24&255,B=S.rgba>>16&255,O=S.rgba>>8&255;return o=T+Math.round((w-T)*c),l=B+Math.round((g-B)*c),_=O+Math.round((E-O)*c),{css:p.toCss(o,l,_),rgba:p.toRgba(o,l,_)}},s.isOpaque=function(S){return(255&S.rgba)==255},s.ensureContrastRatio=function(S,b,w){const g=i.ensureContrastRatio(S.rgba,b.rgba,w);if(g)return p.toColor(g>>24&255,g>>16&255,g>>8&255)},s.opaque=function(S){const b=(255|S.rgba)>>>0;return[o,l,_]=i.toChannels(b),{css:p.toCss(o,l,_),rgba:b}},s.opacity=d,s.multiplyOpacity=function(S,b){return c=255&S.rgba,d(S,c*b/255)},s.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}}(v||(t.color=v={})),function(s){let d,S;try{const b=document.createElement("canvas");b.width=1,b.height=1;const w=b.getContext("2d",{willReadFrequently:!0});w&&(d=w,d.globalCompositeOperation="copy",S=d.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(b){if(b.match(/#[\da-f]{3,8}/i))switch(b.length){case 4:return o=parseInt(b.slice(1,2).repeat(2),16),l=parseInt(b.slice(2,3).repeat(2),16),_=parseInt(b.slice(3,4).repeat(2),16),p.toColor(o,l,_);case 5:return o=parseInt(b.slice(1,2).repeat(2),16),l=parseInt(b.slice(2,3).repeat(2),16),_=parseInt(b.slice(3,4).repeat(2),16),c=parseInt(b.slice(4,5).repeat(2),16),p.toColor(o,l,_,c);case 7:return{css:b,rgba:(parseInt(b.slice(1),16)<<8|255)>>>0};case 9:return{css:b,rgba:parseInt(b.slice(1),16)>>>0}}const w=b.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(w)return o=parseInt(w[1]),l=parseInt(w[2]),_=parseInt(w[3]),c=Math.round(255*(w[5]===void 0?1:parseFloat(w[5]))),p.toColor(o,l,_,c);if(!d||!S)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=S,d.fillStyle=b,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[o,l,_,c]=d.getImageData(0,0,1,1).data,c!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:p.toRgba(o,l,_,c),css:b}}}(C||(t.css=C={})),function(s){function d(S,b,w){const g=S/255,E=b/255,T=w/255;return .2126*(g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))}s.relativeLuminance=function(S){return d(S>>16&255,S>>8&255,255&S)},s.relativeLuminance2=d}(f||(t.rgb=f={})),function(s){function d(b,w,g){const E=b>>24&255,T=b>>16&255,B=b>>8&255;let O=w>>24&255,D=w>>16&255,P=w>>8&255,F=r(f.relativeLuminance2(O,D,P),f.relativeLuminance2(E,T,B));for(;F<g&&(O>0||D>0||P>0);)O-=Math.max(0,Math.ceil(.1*O)),D-=Math.max(0,Math.ceil(.1*D)),P-=Math.max(0,Math.ceil(.1*P)),F=r(f.relativeLuminance2(O,D,P),f.relativeLuminance2(E,T,B));return(O<<24|D<<16|P<<8|255)>>>0}function S(b,w,g){const E=b>>24&255,T=b>>16&255,B=b>>8&255;let O=w>>24&255,D=w>>16&255,P=w>>8&255,F=r(f.relativeLuminance2(O,D,P),f.relativeLuminance2(E,T,B));for(;F<g&&(O<255||D<255||P<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),D=Math.min(255,D+Math.ceil(.1*(255-D))),P=Math.min(255,P+Math.ceil(.1*(255-P))),F=r(f.relativeLuminance2(O,D,P),f.relativeLuminance2(E,T,B));return(O<<24|D<<16|P<<8|255)>>>0}s.blend=function(b,w){if(c=(255&w)/255,c===1)return w;const g=w>>24&255,E=w>>16&255,T=w>>8&255,B=b>>24&255,O=b>>16&255,D=b>>8&255;return o=B+Math.round((g-B)*c),l=O+Math.round((E-O)*c),_=D+Math.round((T-D)*c),p.toRgba(o,l,_)},s.ensureContrastRatio=function(b,w,g){const E=f.relativeLuminance(b>>8),T=f.relativeLuminance(w>>8);if(r(E,T)<g){if(T<E){const D=d(b,w,g),P=r(E,f.relativeLuminance(D>>8));if(P<g){const F=S(b,w,g);return P>r(E,f.relativeLuminance(F>>8))?D:F}return D}const B=S(b,w,g),O=r(E,f.relativeLuminance(B>>8));if(O<g){const D=d(b,w,g);return O>r(E,f.relativeLuminance(D>>8))?B:D}return B}},s.reduceLuminance=d,s.increaseLuminance=S,s.toChannels=function(b){return[b>>24&255,b>>16&255,b>>8&255,255&b]}}(i||(t.rgba=i={})),t.toPaddedHex=n,t.contrastRatio=r},8969:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const l=o(844),_=o(2585),c=o(4348),p=o(7866),v=o(744),C=o(7302),f=o(6975),i=o(8460),n=o(1753),r=o(1480),s=o(7994),d=o(9282),S=o(5435),b=o(5981),w=o(2660);let g=!1;class E extends l.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new i.EventEmitter),this._onScroll.event(B=>{var O;(O=this._onScrollApi)==null||O.fire(B.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(B){for(const O in B)this.optionsService.options[O]=B[O]}constructor(B){super(),this._windowsWrappingHeuristics=this.register(new l.MutableDisposable),this._onBinary=this.register(new i.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new i.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new i.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new i.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new i.EventEmitter),this._instantiationService=new c.InstantiationService,this.optionsService=this.register(new C.OptionsService(B)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(f.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(n.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(r.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(w.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new S.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,i.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,i.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,i.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,i.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 b.WriteBuffer((O,D)=>this._inputHandler.parse(O,D))),this.register((0,i.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(B,O){this._writeBuffer.write(B,O)}writeSync(B,O){this._logService.logLevel<=_.LogLevelEnum.WARN&&!g&&(this._logService.warn("writeSync is unreliable and will be removed soon."),g=!0),this._writeBuffer.writeSync(B,O)}input(B,O=!0){this.coreService.triggerDataEvent(B,O)}resize(B,O){isNaN(B)||isNaN(O)||(B=Math.max(B,v.MINIMUM_COLS),O=Math.max(O,v.MINIMUM_ROWS),this._bufferService.resize(B,O))}scroll(B,O=!1){this._bufferService.scroll(B,O)}scrollLines(B,O,D){this._bufferService.scrollLines(B,O,D)}scrollPages(B){this.scrollLines(B*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(B){const O=B-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(B,O){return this._inputHandler.registerEscHandler(B,O)}registerDcsHandler(B,O){return this._inputHandler.registerDcsHandler(B,O)}registerCsiHandler(B,O){return this._inputHandler.registerCsiHandler(B,O)}registerOscHandler(B,O){return this._inputHandler.registerOscHandler(B,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let B=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?B=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(B=!0),B?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const B=[];B.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),B.push(this.registerCsiHandler({final:"H"},()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,l.toDisposable)(()=>{for(const O of B)O.dispose()})}}}t.CoreTerminal=E},8460:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let l=0;l<this._listeners.length;l++)if(this._listeners[l]===o)return void this._listeners.splice(l,1)}}})),this._event}fire(o,l){const _=[];for(let c=0;c<this._listeners.length;c++)_.push(this._listeners[c]);for(let c=0;c<_.length;c++)_[c].call(void 0,o,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(o,l){return o(_=>l.fire(_))},t.runAndSubscribe=function(o,l){return l(void 0),o(_=>l(_))}},5435:function(k,t,o){var l=this&&this.__decorate||function($,x,L,A){var M,N=arguments.length,z=N<3?x:A===null?A=Object.getOwnPropertyDescriptor(x,L):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate($,x,L,A);else for(var J=$.length-1;J>=0;J--)(M=$[J])&&(z=(N<3?M(z):N>3?M(x,L,z):M(x,L))||z);return N>3&&z&&Object.defineProperty(x,L,z),z},_=this&&this.__param||function($,x){return function(L,A){x(L,A,$)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const c=o(2584),p=o(7116),v=o(2015),C=o(844),f=o(482),i=o(8437),n=o(8460),r=o(643),s=o(511),d=o(3734),S=o(2585),b=o(1480),w=o(6242),g=o(6351),E=o(5941),T={"(":0,")":1,"*":2,"+":3,"-":1,".":2},B=131072;function O($,x){if($>24)return x.setWinLines||!1;switch($){case 1:return!!x.restoreWin;case 2:return!!x.minimizeWin;case 3:return!!x.setWinPosition;case 4:return!!x.setWinSizePixels;case 5:return!!x.raiseWin;case 6:return!!x.lowerWin;case 7:return!!x.refreshWin;case 8:return!!x.setWinSizeChars;case 9:return!!x.maximizeWin;case 10:return!!x.fullscreenWin;case 11:return!!x.getWinState;case 13:return!!x.getWinPosition;case 14:return!!x.getWinSizePixels;case 15:return!!x.getScreenSizePixels;case 16:return!!x.getCellSizePixels;case 18:return!!x.getWinSizeChars;case 19:return!!x.getScreenSizeChars;case 20:return!!x.getIconTitle;case 21:return!!x.getWinTitle;case 22:return!!x.pushTitle;case 23:return!!x.popTitle;case 24:return!!x.setWinLines}return!1}var D;(function($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(D||(t.WindowsOptionsReportType=D={}));let P=0;class F extends C.Disposable{getAttrData(){return this._curAttrData}constructor(x,L,A,M,N,z,J,ee,I=new v.EscapeSequenceParser){super(),this._bufferService=x,this._charsetService=L,this._coreService=A,this._logService=M,this._optionsService=N,this._oscLinkService=z,this._coreMouseService=J,this._unicodeService=ee,this._parser=I,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new f.StringToUtf32,this._utf8Decoder=new f.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new n.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new n.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new n.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new n.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new n.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new n.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new n.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new n.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new n.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new n.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new n.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new n.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new n.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(R=>this._activeBuffer=R.activeBuffer)),this._parser.setCsiHandlerFallback((R,W)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(R),params:W.toArray()})}),this._parser.setEscHandlerFallback(R=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(R)})}),this._parser.setExecuteHandlerFallback(R=>{this._logService.debug("Unknown EXECUTE code: ",{code:R})}),this._parser.setOscHandlerFallback((R,W,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:R,action:W,data:H})}),this._parser.setDcsHandlerFallback((R,W,H)=>{W==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(R),action:W,payload:H})}),this._parser.setPrintHandler((R,W,H)=>this.print(R,W,H)),this._parser.registerCsiHandler({final:"@"},R=>this.insertChars(R)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},R=>this.scrollLeft(R)),this._parser.registerCsiHandler({final:"A"},R=>this.cursorUp(R)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},R=>this.scrollRight(R)),this._parser.registerCsiHandler({final:"B"},R=>this.cursorDown(R)),this._parser.registerCsiHandler({final:"C"},R=>this.cursorForward(R)),this._parser.registerCsiHandler({final:"D"},R=>this.cursorBackward(R)),this._parser.registerCsiHandler({final:"E"},R=>this.cursorNextLine(R)),this._parser.registerCsiHandler({final:"F"},R=>this.cursorPrecedingLine(R)),this._parser.registerCsiHandler({final:"G"},R=>this.cursorCharAbsolute(R)),this._parser.registerCsiHandler({final:"H"},R=>this.cursorPosition(R)),this._parser.registerCsiHandler({final:"I"},R=>this.cursorForwardTab(R)),this._parser.registerCsiHandler({final:"J"},R=>this.eraseInDisplay(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},R=>this.eraseInDisplay(R,!0)),this._parser.registerCsiHandler({final:"K"},R=>this.eraseInLine(R,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},R=>this.eraseInLine(R,!0)),this._parser.registerCsiHandler({final:"L"},R=>this.insertLines(R)),this._parser.registerCsiHandler({final:"M"},R=>this.deleteLines(R)),this._parser.registerCsiHandler({final:"P"},R=>this.deleteChars(R)),this._parser.registerCsiHandler({final:"S"},R=>this.scrollUp(R)),this._parser.registerCsiHandler({final:"T"},R=>this.scrollDown(R)),this._parser.registerCsiHandler({final:"X"},R=>this.eraseChars(R)),this._parser.registerCsiHandler({final:"Z"},R=>this.cursorBackwardTab(R)),this._parser.registerCsiHandler({final:"`"},R=>this.charPosAbsolute(R)),this._parser.registerCsiHandler({final:"a"},R=>this.hPositionRelative(R)),this._parser.registerCsiHandler({final:"b"},R=>this.repeatPrecedingCharacter(R)),this._parser.registerCsiHandler({final:"c"},R=>this.sendDeviceAttributesPrimary(R)),this._parser.registerCsiHandler({prefix:">",final:"c"},R=>this.sendDeviceAttributesSecondary(R)),this._parser.registerCsiHandler({final:"d"},R=>this.linePosAbsolute(R)),this._parser.registerCsiHandler({final:"e"},R=>this.vPositionRelative(R)),this._parser.registerCsiHandler({final:"f"},R=>this.hVPosition(R)),this._parser.registerCsiHandler({final:"g"},R=>this.tabClear(R)),this._parser.registerCsiHandler({final:"h"},R=>this.setMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"h"},R=>this.setModePrivate(R)),this._parser.registerCsiHandler({final:"l"},R=>this.resetMode(R)),this._parser.registerCsiHandler({prefix:"?",final:"l"},R=>this.resetModePrivate(R)),this._parser.registerCsiHandler({final:"m"},R=>this.charAttributes(R)),this._parser.registerCsiHandler({final:"n"},R=>this.deviceStatus(R)),this._parser.registerCsiHandler({prefix:"?",final:"n"},R=>this.deviceStatusPrivate(R)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},R=>this.softReset(R)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},R=>this.setCursorStyle(R)),this._parser.registerCsiHandler({final:"r"},R=>this.setScrollRegion(R)),this._parser.registerCsiHandler({final:"s"},R=>this.saveCursor(R)),this._parser.registerCsiHandler({final:"t"},R=>this.windowOptions(R)),this._parser.registerCsiHandler({final:"u"},R=>this.restoreCursor(R)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},R=>this.insertColumns(R)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},R=>this.deleteColumns(R)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},R=>this.selectProtected(R)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},R=>this.requestMode(R,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},R=>this.requestMode(R,!1)),this._parser.setExecuteHandler(c.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(c.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(c.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(c.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(c.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(c.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(c.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(c.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(c.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(c.C1.IND,()=>this.index()),this._parser.setExecuteHandler(c.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(c.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new w.OscHandler(R=>(this.setTitle(R),this.setIconName(R),!0))),this._parser.registerOscHandler(1,new w.OscHandler(R=>this.setIconName(R))),this._parser.registerOscHandler(2,new w.OscHandler(R=>this.setTitle(R))),this._parser.registerOscHandler(4,new w.OscHandler(R=>this.setOrReportIndexedColor(R))),this._parser.registerOscHandler(8,new w.OscHandler(R=>this.setHyperlink(R))),this._parser.registerOscHandler(10,new w.OscHandler(R=>this.setOrReportFgColor(R))),this._parser.registerOscHandler(11,new w.OscHandler(R=>this.setOrReportBgColor(R))),this._parser.registerOscHandler(12,new w.OscHandler(R=>this.setOrReportCursorColor(R))),this._parser.registerOscHandler(104,new w.OscHandler(R=>this.restoreIndexedColor(R))),this._parser.registerOscHandler(110,new w.OscHandler(R=>this.restoreFgColor(R))),this._parser.registerOscHandler(111,new w.OscHandler(R=>this.restoreBgColor(R))),this._parser.registerOscHandler(112,new w.OscHandler(R=>this.restoreCursorColor(R))),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 R in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:R},()=>this.selectCharset("("+R)),this._parser.registerEscHandler({intermediates:")",final:R},()=>this.selectCharset(")"+R)),this._parser.registerEscHandler({intermediates:"*",final:R},()=>this.selectCharset("*"+R)),this._parser.registerEscHandler({intermediates:"+",final:R},()=>this.selectCharset("+"+R)),this._parser.registerEscHandler({intermediates:"-",final:R},()=>this.selectCharset("-"+R)),this._parser.registerEscHandler({intermediates:".",final:R},()=>this.selectCharset("."+R)),this._parser.registerEscHandler({intermediates:"/",final:R},()=>this.selectCharset("/"+R));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(R=>(this._logService.error("Parsing error: ",R),R)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new g.DcsHandler((R,W)=>this.requestStatusString(R,W)))}_preserveStack(x,L,A,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=x,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=A,this._parseStack.position=M}_logSlowResolvingAsync(x){this._logService.logLevel<=S.LogLevelEnum.WARN&&Promise.race([x,new Promise((L,A)=>setTimeout(()=>A("#SLOW_TIMEOUT"),5e3))]).catch(L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(x,L){let A,M=this._activeBuffer.x,N=this._activeBuffer.y,z=0;const J=this._parseStack.paused;if(J){if(A=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(A),A;M=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,x.length>B&&(z=this._parseStack.position+B)}if(this._logService.logLevel<=S.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof x=="string"?` "${x}"`:` "${Array.prototype.map.call(x,R=>String.fromCharCode(R)).join("")}"`),typeof x=="string"?x.split("").map(R=>R.charCodeAt(0)):x),this._parseBuffer.length<x.length&&this._parseBuffer.length<B&&(this._parseBuffer=new Uint32Array(Math.min(x.length,B))),J||this._dirtyRowTracker.clearRange(),x.length>B)for(let R=z;R<x.length;R+=B){const W=R+B<x.length?R+B:x.length,H=typeof x=="string"?this._stringDecoder.decode(x.substring(R,W),this._parseBuffer):this._utf8Decoder.decode(x.subarray(R,W),this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,H))return this._preserveStack(M,N,H,R),this._logSlowResolvingAsync(A),A}else if(!J){const R=typeof x=="string"?this._stringDecoder.decode(x,this._parseBuffer):this._utf8Decoder.decode(x,this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,R))return this._preserveStack(M,N,R,0),this._logSlowResolvingAsync(A),A}this._activeBuffer.x===M&&this._activeBuffer.y===N||this._onCursorMove.fire();const ee=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),I=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);I<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(I,this._bufferService.rows-1),Math.min(ee,this._bufferService.rows-1))}print(x,L,A){let M,N;const z=this._charsetService.charset,J=this._optionsService.rawOptions.screenReaderMode,ee=this._bufferService.cols,I=this._coreService.decPrivateModes.wraparound,R=this._coreService.modes.insertMode,W=this._curAttrData;let H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&A-L>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,W);let Z=this._parser.precedingJoinState;for(let V=L;V<A;++V){if(M=x[V],M<127&&z){const ue=z[String.fromCharCode(M)];ue&&(M=ue.charCodeAt(0))}const ie=this._unicodeService.charProperties(M,Z);N=b.UnicodeService.extractWidth(ie);const ce=b.UnicodeService.extractShouldJoin(ie),he=ce?b.UnicodeService.extractWidth(Z):0;if(Z=ie,J&&this._onA11yChar.fire((0,f.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-he>ee){if(I){const ue=H;let te=this._activeBuffer.x-he;for(this._activeBuffer.x=he,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),he>0&&H instanceof i.BufferLine&&H.copyCellsFrom(ue,te,0,he,!1);te<ee;)ue.setCellFromCodepoint(te++,0,1,W)}else if(this._activeBuffer.x=ee-1,N===2)continue}if(ce&&this._activeBuffer.x){const ue=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-ue,M,N);for(let te=N-he;--te>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}else if(R&&(H.insertCells(this._activeBuffer.x,N-he,this._activeBuffer.getNullCell(W)),H.getWidth(ee-1)===2&&H.setCellFromCodepoint(ee-1,r.NULL_CELL_CODE,r.NULL_CELL_WIDTH,W)),H.setCellFromCodepoint(this._activeBuffer.x++,M,N,W),N>0)for(;--N;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,W)}this._parser.precedingJoinState=Z,this._activeBuffer.x<ee&&A-L>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,W),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(x,L){return x.final!=="t"||x.prefix||x.intermediates?this._parser.registerCsiHandler(x,L):this._parser.registerCsiHandler(x,A=>!O(A.params[0],this._optionsService.rawOptions.windowOptions)||L(A))}registerDcsHandler(x,L){return this._parser.registerDcsHandler(x,new g.DcsHandler(L))}registerEscHandler(x,L){return this._parser.registerEscHandler(x,L)}registerOscHandler(x,L){return this._parser.registerOscHandler(x,new w.OscHandler(L))}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 x;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&&((x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&x.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const x=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-x),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(x=this._bufferService.cols-1){this._activeBuffer.x=Math.min(x,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(x,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=x,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=x,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(x,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+x,this._activeBuffer.y+L)}cursorUp(x){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,x.params[0]||1)):this._moveCursor(0,-(x.params[0]||1)),!0}cursorDown(x){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,x.params[0]||1)):this._moveCursor(0,x.params[0]||1),!0}cursorForward(x){return this._moveCursor(x.params[0]||1,0),!0}cursorBackward(x){return this._moveCursor(-(x.params[0]||1),0),!0}cursorNextLine(x){return this.cursorDown(x),this._activeBuffer.x=0,!0}cursorPrecedingLine(x){return this.cursorUp(x),this._activeBuffer.x=0,!0}cursorCharAbsolute(x){return this._setCursor((x.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(x){return this._setCursor(x.length>=2?(x.params[1]||1)-1:0,(x.params[0]||1)-1),!0}charPosAbsolute(x){return this._setCursor((x.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(x){return this._moveCursor(x.params[0]||1,0),!0}linePosAbsolute(x){return this._setCursor(this._activeBuffer.x,(x.params[0]||1)-1),!0}vPositionRelative(x){return this._moveCursor(0,x.params[0]||1),!0}hVPosition(x){return this.cursorPosition(x),!0}tabClear(x){const L=x.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=x.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=x.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(x){const L=x.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(x,L,A,M=!1,N=!1){const z=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);z.replaceCells(L,A,this._activeBuffer.getNullCell(this._eraseAttrData()),N),M&&(z.isWrapped=!1)}_resetBufferLine(x,L=!1){const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);A&&(A.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+x),A.isWrapped=!1)}eraseInDisplay(x,L=!1){let A;switch(this._restrictCursor(this._bufferService.cols),x.params[0]){case 0:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);A<this._bufferService.rows;A++)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(A);break;case 1:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(A+1).isWrapped=!1);A--;)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(A=this._bufferService.rows,this._dirtyRowTracker.markDirty(A-1);A--;)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(0);break;case 3:const M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(x,L=!1){switch(this._restrictCursor(this._bufferService.cols),x.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(x){this._restrictCursor();let L=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;L--;)this._activeBuffer.lines.splice(N-1,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(x){this._restrictCursor();let L=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y;let M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;L--;)this._activeBuffer.lines.splice(A,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,x.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,x.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(x){let L=x.params[0]||1;for(;L--;)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(x){let L=x.params[0]||1;for(;L--;)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(i.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);M.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(x.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(x){const L=this._parser.precedingJoinState;if(!L)return!0;const A=x.params[0]||1,M=b.UnicodeService.extractWidth(L),N=this._activeBuffer.x-M,z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),J=new Uint32Array(z.length*A);let ee=0;for(let R=0;R<z.length;){const W=z.codePointAt(R)||0;J[ee++]=W,R+=W>65535?2:1}let I=ee;for(let R=1;R<A;++R)J.copyWithin(I,0,ee),I+=ee;return this.print(J,0,I),!0}sendDeviceAttributesPrimary(x){return x.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(c.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(c.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(x){return x.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(c.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(c.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(x.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(c.C0.ESC+"[>83;40003;0c")),!0}_is(x){return(this._optionsService.rawOptions.termName+"").indexOf(x)===0}setMode(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.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(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(x){for(let L=0;L<x.length;L++)switch(x.params[L]){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(),x.params[L]===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(x,L){const A=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:N}=this._coreMouseService,z=this._coreService,{buffers:J,cols:ee}=this._bufferService,{active:I,alt:R}=J,W=this._optionsService.rawOptions,H=ce=>ce?1:2,Z=x.params[0];return V=Z,ie=L?Z===2?4:Z===4?H(z.modes.insertMode):Z===12?3:Z===20?H(W.convertEol):0:Z===1?H(A.applicationCursorKeys):Z===3?W.windowOptions.setWinLines?ee===80?2:ee===132?1:0:0:Z===6?H(A.origin):Z===7?H(A.wraparound):Z===8?3:Z===9?H(M==="X10"):Z===12?H(W.cursorBlink):Z===25?H(!z.isCursorHidden):Z===45?H(A.reverseWraparound):Z===66?H(A.applicationKeypad):Z===67?4:Z===1e3?H(M==="VT200"):Z===1002?H(M==="DRAG"):Z===1003?H(M==="ANY"):Z===1004?H(A.sendFocus):Z===1005?4:Z===1006?H(N==="SGR"):Z===1015?4:Z===1016?H(N==="SGR_PIXELS"):Z===1048?1:Z===47||Z===1047||Z===1049?H(I===R):Z===2004?H(A.bracketedPasteMode):0,z.triggerDataEvent(`${c.C0.ESC}[${L?"":"?"}${V};${ie}$y`),!0;var V,ie}_updateAttrColor(x,L,A,M,N){return L===2?(x|=50331648,x&=-16777216,x|=d.AttributeData.fromColorRGB([A,M,N])):L===5&&(x&=-50331904,x|=33554432|255&A),x}_extractColor(x,L,A){const M=[0,0,-1,0,0,0];let N=0,z=0;do{if(M[z+N]=x.params[L+z],x.hasSubParams(L+z)){const J=x.getSubParams(L+z);let ee=0;do M[1]===5&&(N=1),M[z+ee+1+N]=J[ee];while(++ee<J.length&&ee+z+1+N<M.length);break}if(M[1]===5&&z+N>=2||M[1]===2&&z+N>=5)break;M[1]&&(N=1)}while(++z+L<x.length&&z+N<M.length);for(let J=2;J<M.length;++J)M[J]===-1&&(M[J]=0);switch(M[0]){case 38:A.fg=this._updateAttrColor(A.fg,M[1],M[3],M[4],M[5]);break;case 48:A.bg=this._updateAttrColor(A.bg,M[1],M[3],M[4],M[5]);break;case 58:A.extended=A.extended.clone(),A.extended.underlineColor=this._updateAttrColor(A.extended.underlineColor,M[1],M[3],M[4],M[5])}return z}_processUnderline(x,L){L.extended=L.extended.clone(),(!~x||x>5)&&(x=1),L.extended.underlineStyle=x,L.fg|=268435456,x===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(x){x.fg=i.DEFAULT_ATTR_DATA.fg,x.bg=i.DEFAULT_ATTR_DATA.bg,x.extended=x.extended.clone(),x.extended.underlineStyle=0,x.extended.underlineColor&=-67108864,x.updateExtended()}charAttributes(x){if(x.length===1&&x.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=x.length;let A;const M=this._curAttrData;for(let N=0;N<L;N++)A=x.params[N],A>=30&&A<=37?(M.fg&=-50331904,M.fg|=16777216|A-30):A>=40&&A<=47?(M.bg&=-50331904,M.bg|=16777216|A-40):A>=90&&A<=97?(M.fg&=-50331904,M.fg|=16777224|A-90):A>=100&&A<=107?(M.bg&=-50331904,M.bg|=16777224|A-100):A===0?this._processSGR0(M):A===1?M.fg|=134217728:A===3?M.bg|=67108864:A===4?(M.fg|=268435456,this._processUnderline(x.hasSubParams(N)?x.getSubParams(N)[0]:1,M)):A===5?M.fg|=536870912:A===7?M.fg|=67108864:A===8?M.fg|=1073741824:A===9?M.fg|=2147483648:A===2?M.bg|=134217728:A===21?this._processUnderline(2,M):A===22?(M.fg&=-134217729,M.bg&=-134217729):A===23?M.bg&=-67108865:A===24?(M.fg&=-268435457,this._processUnderline(0,M)):A===25?M.fg&=-536870913:A===27?M.fg&=-67108865:A===28?M.fg&=-1073741825:A===29?M.fg&=2147483647:A===39?(M.fg&=-67108864,M.fg|=16777215&i.DEFAULT_ATTR_DATA.fg):A===49?(M.bg&=-67108864,M.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):A===38||A===48||A===58?N+=this._extractColor(x,N,M):A===53?M.bg|=1073741824:A===55?M.bg&=-1073741825:A===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):A===100?(M.fg&=-67108864,M.fg|=16777215&i.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&i.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",A);return!0}deviceStatus(x){switch(x.params[0]){case 5:this._coreService.triggerDataEvent(`${c.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[${L};${A}R`)}return!0}deviceStatusPrivate(x){if(x.params[0]===6){const L=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[?${L};${A}R`)}return!0}softReset(x){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=i.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(x){const L=x.params[0]||1;switch(L){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 A=L%2==1;return this._optionsService.options.cursorBlink=A,!0}setScrollRegion(x){const L=x.params[0]||1;let A;return(x.length<2||(A=x.params[1])>this._bufferService.rows||A===0)&&(A=this._bufferService.rows),A>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=A-1,this._setCursor(0,0)),!0}windowOptions(x){if(!O(x.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=x.length>1?x.params[1]:0;switch(x.params[0]){case 14:L!==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(`${c.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(x){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(x){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(x){return this._windowTitle=x,this._onTitleChange.fire(x),!0}setIconName(x){return this._iconName=x,!0}setOrReportIndexedColor(x){const L=[],A=x.split(";");for(;A.length>1;){const M=A.shift(),N=A.shift();if(/^\d+$/.exec(M)){const z=parseInt(M);if(G(z))if(N==="?")L.push({type:0,index:z});else{const J=(0,E.parseColor)(N);J&&L.push({type:1,index:z,color:J})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(x){const L=x.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(x,L){this._getCurrentLinkId()&&this._finishHyperlink();const A=x.split(":");let M;const N=A.findIndex(z=>z.startsWith("id="));return N!==-1&&(M=A[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(x,L){const A=x.split(";");for(let M=0;M<A.length&&!(L>=this._specialColors.length);++M,++L)if(A[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const N=(0,E.parseColor)(A[M]);N&&this._onColor.fire([{type:1,index:this._specialColors[L],color:N}])}return!0}setOrReportFgColor(x){return this._setOrReportSpecialColor(x,0)}setOrReportBgColor(x){return this._setOrReportSpecialColor(x,1)}setOrReportCursorColor(x){return this._setOrReportSpecialColor(x,2)}restoreIndexedColor(x){if(!x)return this._onColor.fire([{type:2}]),!0;const L=[],A=x.split(";");for(let M=0;M<A.length;++M)if(/^\d+$/.exec(A[M])){const N=parseInt(A[M]);G(N)&&L.push({type:2,index:N})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(x){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(x){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(x){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,p.DEFAULT_CHARSET),!0}selectCharset(x){return x.length!==2?(this.selectDefaultCharset(),!0):(x[0]==="/"||this._charsetService.setgCharset(T[x[0]],p.CHARSETS[x[1]]||p.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 x=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,x,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=i.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=i.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(x){return this._charsetService.setgLevel(x),!0}screenAlignmentPattern(){const x=new s.CellData;x.content=4194373,x.fg=this._curAttrData.fg,x.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){const A=this._activeBuffer.ybase+this._activeBuffer.y+L,M=this._activeBuffer.lines.get(A);M&&(M.fill(x),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(x,L){const A=this._bufferService.buffer,M=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${c.C0.ESC}${N}${c.C0.ESC}\\`),!0))(x==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:x==='"p'?'P1$r61;1"p':x==="r"?`P1$r${A.scrollTop+1};${A.scrollBottom+1}r`:x==="m"?"P1$r0m":x===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(x,L){this._dirtyRowTracker.markRangeDirty(x,L)}}t.InputHandler=F;let U=class{constructor($){this._bufferService=$,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty($){$<this.start?this.start=$:$>this.end&&(this.end=$)}markRangeDirty($,x){$>x&&(P=$,$=x,x=P),$<this.start&&(this.start=$),x>this.end&&(this.end=x)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function G($){return 0<=$&&$<256}U=l([_(0,S.IBufferService)],U)},844:(k,t)=>{function o(l){for(const _ of l)_.dispose();l.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.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 _=this._disposables.indexOf(l);_!==-1&&this._disposables.splice(_,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){var _;this._isDisposed||l===this._value||((_=this._value)==null||_.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}},t.toDisposable=function(l){return{dispose:l}},t.disposeArray=o,t.getDisposeArrayDisposable=function(l){return{dispose:()=>o(l)}}},1505:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(_,c,p){this._data[_]||(this._data[_]={}),this._data[_][c]=p}get(_,c){return this._data[_]?this._data[_][c]:void 0}clear(){this._data={}}}t.TwoKeyMap=o,t.FourKeyMap=class{constructor(){this._data=new o}set(l,_,c,p,v){this._data.get(l,_)||this._data.set(l,_,new o),this._data.get(l,_).set(c,p,v)}get(l,_,c,p){var v;return(v=this._data.get(l,_))==null?void 0:v.get(c,p)}clear(){this._data.clear()}}},6114:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const o=t.isNode?"node":navigator.userAgent,l=t.isNode?"node":navigator.platform;t.isFirefox=o.includes("Firefox"),t.isLegacyEdge=o.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(o),t.getSafariVersion=function(){if(!t.isSafari)return 0;const _=o.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),t.isIpad=l==="iPad",t.isIphone=l==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),t.isLinux=l.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(o)},6106:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let o=0;t.SortedList=class{constructor(l){this._getKey=l,this._array=[]}clear(){this._array.length=0}insert(l){this._array.length!==0?(o=this._search(this._getKey(l)),this._array.splice(o,0,l)):this._array.push(l)}delete(l){if(this._array.length===0)return!1;const _=this._getKey(l);if(_===void 0||(o=this._search(_),o===-1)||this._getKey(this._array[o])!==_)return!1;do if(this._array[o]===l)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===_);return!1}*getKeyIterator(l){if(this._array.length!==0&&(o=this._search(l),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===l))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===l)}forEachByKey(l,_){if(this._array.length!==0&&(o=this._search(l),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===l))do _(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===l)}values(){return[...this._array].values()}_search(l){let _=0,c=this._array.length-1;for(;c>=_;){let p=_+c>>1;const v=this._getKey(this._array[p]);if(v>l)c=p-1;else{if(!(v<l)){for(;p>0&&this._getKey(this._array[p-1])===l;)p--;return p}_=p+1}}return _}}},7226:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const l=o(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),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(v){this._idleCallback=void 0;let C=0,f=0,i=v.timeRemaining(),n=0;for(;this._i<this._tasks.length;){if(C=Date.now(),this._tasks[this._i]()||this._i++,C=Math.max(1,Date.now()-C),f=Math.max(C,f),n=v.timeRemaining(),1.5*f>n)return i-C<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-C))}ms`),void this._start();i=n}this.clear()}}class c extends _{_requestCallback(v){return setTimeout(()=>v(this._createDeadline(16)))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const C=Date.now()+v;return{timeRemaining:()=>Math.max(0,C-Date.now())}}}t.PriorityTaskQueue=c,t.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:c,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const l=o(643);t.updateWindowsModeWrappedState=function(_){const c=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),p=c==null?void 0:c.get(_.cols-1),v=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);v&&p&&(v.isWrapped=p[l.CHAR_DATA_CODE_INDEX]!==l.NULL_CELL_CODE&&p[l.CHAR_DATA_CODE_INDEX]!==l.WHITESPACE_CELL_CODE)}},3734:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new l}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){const c=new o;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}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}}t.AttributeData=o;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){const c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,p=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=p}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=l},9092:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const l=o(6349),_=o(7226),c=o(3734),p=o(8437),v=o(4634),C=o(511),f=o(643),i=o(4863),n=o(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(r,s,d){this._hasScrollback=r,this._optionsService=s,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=n.DEFAULT_CHARSET,this.markers=[],this._nullCell=C.CellData.fromCharData([0,f.NULL_CELL_CHAR,f.NULL_CELL_WIDTH,f.NULL_CELL_CODE]),this._whitespaceCell=C.CellData.fromCharData([0,f.WHITESPACE_CELL_CHAR,f.WHITESPACE_CELL_WIDTH,f.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.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 c.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 c.ExtendedAttrs),this._whitespaceCell}getBlankLine(r,s){return new p.BufferLine(this._bufferService.cols,this.getNullCell(r),s)}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 s=r+this._optionsService.rawOptions.scrollback;return s>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:s}fillViewportRows(r){if(this.lines.length===0){r===void 0&&(r=p.DEFAULT_ATTR_DATA);let s=this._rows;for(;s--;)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,s){const d=this.getNullCell(p.DEFAULT_ATTR_DATA);let S=0;const b=this._getCorrectBufferLength(s);if(b>this.lines.maxLength&&(this.lines.maxLength=b),this.lines.length>0){if(this._cols<r)for(let g=0;g<this.lines.length;g++)S+=+this.lines.get(g).resize(r,d);let w=0;if(this._rows<s)for(let g=this._rows;g<s;g++)this.lines.length<s+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(r,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+w+1?(this.ybase--,w++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(r,d)));else for(let g=this._rows;g>s;g--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(b<this.lines.maxLength){const g=this.lines.length-b;g>0&&(this.lines.trimStart(g),this.ybase=Math.max(this.ybase-g,0),this.ydisp=Math.max(this.ydisp-g,0),this.savedY=Math.max(this.savedY-g,0)),this.lines.maxLength=b}this.x=Math.min(this.x,r-1),this.y=Math.min(this.y,s-1),w&&(this.y+=w),this.savedX=Math.min(this.savedX,r-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(r,s),this._cols>r))for(let w=0;w<this.lines.length;w++)S+=+this.lines.get(w).resize(r,d);this._cols=r,this._rows=s,this._memoryCleanupQueue.clear(),S>.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 s=0;for(;this._memoryCleanupPosition<this.lines.length;)if(s+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),s>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,s){this._cols!==r&&(r>this._cols?this._reflowLarger(r,s):this._reflowSmaller(r,s))}_reflowLarger(r,s){const d=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,r,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(d.length>0){const S=(0,v.reflowLargerCreateNewLayout)(this.lines,d);(0,v.reflowLargerApplyNewLayout)(this.lines,S.layout),this._reflowLargerAdjustViewport(r,s,S.countRemoved)}}_reflowLargerAdjustViewport(r,s,d){const S=this.getNullCell(p.DEFAULT_ATTR_DATA);let b=d;for(;b-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new p.BufferLine(r,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(r,s){const d=this.getNullCell(p.DEFAULT_ATTR_DATA),S=[];let b=0;for(let w=this.lines.length-1;w>=0;w--){let g=this.lines.get(w);if(!g||!g.isWrapped&&g.getTrimmedLength()<=r)continue;const E=[g];for(;g.isWrapped&&w>0;)g=this.lines.get(--w),E.unshift(g);const T=this.ybase+this.y;if(T>=w&&T<w+E.length)continue;const B=E[E.length-1].getTrimmedLength(),O=(0,v.reflowSmallerGetNewLineLengths)(E,this._cols,r),D=O.length-E.length;let P;P=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 A=0;A<D;A++){const M=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);F.push(M)}F.length>0&&(S.push({start:w+E.length+b,newLines:F}),b+=F.length),E.push(...F);let U=O.length-1,G=O[U];G===0&&(U--,G=O[U]);let $=E.length-D-1,x=B;for(;$>=0;){const A=Math.min(x,G);if(E[U]===void 0)break;if(E[U].copyCellsFrom(E[$],x-A,G-A,A,!0),G-=A,G===0&&(U--,G=O[U]),x-=A,x===0){$--;const M=Math.max($,0);x=(0,v.getWrappedLineTrimmedLength)(E,M,this._cols)}}for(let A=0;A<E.length;A++)O[A]<r&&E[A].setCell(O[A],d);let L=D-P;for(;L-- >0;)this.ybase===0?this.y<s-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+b)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+D,this.ybase+s-1)}if(S.length>0){const w=[],g=[];for(let U=0;U<this.lines.length;U++)g.push(this.lines.get(U));const E=this.lines.length;let T=E-1,B=0,O=S[B];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+b);let D=0;for(let U=Math.min(this.lines.maxLength-1,E+b-1);U>=0;U--)if(O&&O.start>T+D){for(let G=O.newLines.length-1;G>=0;G--)this.lines.set(U--,O.newLines[G]);U++,w.push({index:T+1,amount:O.newLines.length}),D+=O.newLines.length,O=S[++B]}else this.lines.set(U,g[T--]);let P=0;for(let U=w.length-1;U>=0;U--)w[U].index+=P,this.lines.onInsertEmitter.fire(w[U]),P+=w[U].amount;const F=Math.max(0,E+b-this.lines.maxLength);F>0&&this.lines.onTrimEmitter.fire(F)}}translateBufferLineToString(r,s,d=0,S){const b=this.lines.get(r);return b?b.translateToString(s,d,S):""}getWrappedRangeForLine(r){let s=r,d=r;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:s,last:d}}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 s=0;s<this.markers.length;s++)this.markers[s].line===r&&(this.markers[s].dispose(),this.markers.splice(s--,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 s=new i.Marker(r);return this.markers.push(s),s.register(this.lines.onTrim(d=>{s.line-=d,s.line<0&&s.dispose()})),s.register(this.lines.onInsert(d=>{s.line>=d.index&&(s.line+=d.amount)})),s.register(this.lines.onDelete(d=>{s.line>=d.index&&s.line<d.index+d.amount&&s.dispose(),s.line>d.index&&(s.line-=d.amount)})),s.register(s.onDispose(()=>this._removeMarker(s))),s}_removeMarker(r){this._isClearing||this.markers.splice(this.markers.indexOf(r),1)}}},8437:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const l=o(3734),_=o(511),c=o(643),p=o(482);t.DEFAULT_ATTR_DATA=Object.freeze(new l.AttributeData);let v=0;class C{constructor(i,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*i);const s=n||_.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]);for(let d=0;d<i;++d)this.setCell(d,s);this.length=i}get(i){const n=this._data[3*i+0],r=2097151&n;return[this._data[3*i+1],2097152&n?this._combined[i]:r?(0,p.stringFromCodePoint)(r):"",n>>22,2097152&n?this._combined[i].charCodeAt(this._combined[i].length-1):r]}set(i,n){this._data[3*i+1]=n[c.CHAR_DATA_ATTR_INDEX],n[c.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[i]=n[1],this._data[3*i+0]=2097152|i|n[c.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*i+0]=n[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|n[c.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(i){return this._data[3*i+0]>>22}hasWidth(i){return 12582912&this._data[3*i+0]}getFg(i){return this._data[3*i+1]}getBg(i){return this._data[3*i+2]}hasContent(i){return 4194303&this._data[3*i+0]}getCodePoint(i){const n=this._data[3*i+0];return 2097152&n?this._combined[i].charCodeAt(this._combined[i].length-1):2097151&n}isCombined(i){return 2097152&this._data[3*i+0]}getString(i){const n=this._data[3*i+0];return 2097152&n?this._combined[i]:2097151&n?(0,p.stringFromCodePoint)(2097151&n):""}isProtected(i){return 536870912&this._data[3*i+2]}loadCell(i,n){return v=3*i,n.content=this._data[v+0],n.fg=this._data[v+1],n.bg=this._data[v+2],2097152&n.content&&(n.combinedData=this._combined[i]),268435456&n.bg&&(n.extended=this._extendedAttrs[i]),n}setCell(i,n){2097152&n.content&&(this._combined[i]=n.combinedData),268435456&n.bg&&(this._extendedAttrs[i]=n.extended),this._data[3*i+0]=n.content,this._data[3*i+1]=n.fg,this._data[3*i+2]=n.bg}setCellFromCodepoint(i,n,r,s){268435456&s.bg&&(this._extendedAttrs[i]=s.extended),this._data[3*i+0]=n|r<<22,this._data[3*i+1]=s.fg,this._data[3*i+2]=s.bg}addCodepointToCell(i,n,r){let s=this._data[3*i+0];2097152&s?this._combined[i]+=(0,p.stringFromCodePoint)(n):2097151&s?(this._combined[i]=(0,p.stringFromCodePoint)(2097151&s)+(0,p.stringFromCodePoint)(n),s&=-2097152,s|=2097152):s=n|4194304,r&&(s&=-12582913,s|=r<<22),this._data[3*i+0]=s}insertCells(i,n,r){if((i%=this.length)&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,r),n<this.length-i){const s=new _.CellData;for(let d=this.length-i-n-1;d>=0;--d)this.setCell(i+n+d,this.loadCell(i+d,s));for(let d=0;d<n;++d)this.setCell(i+d,r)}else for(let s=i;s<this.length;++s)this.setCell(s,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(i,n,r){if(i%=this.length,n<this.length-i){const s=new _.CellData;for(let d=0;d<this.length-i-n;++d)this.setCell(i+d,this.loadCell(i+n+d,s));for(let d=this.length-n;d<this.length;++d)this.setCell(d,r)}else for(let s=i;s<this.length;++s)this.setCell(s,r);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,r),this.getWidth(i)!==0||this.hasContent(i)||this.setCellFromCodepoint(i,0,1,r)}replaceCells(i,n,r,s=!1){if(s)for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);i<n&&i<this.length;)this.isProtected(i)||this.setCell(i,r),i++;else for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);i<n&&i<this.length;)this.setCell(i++,r)}resize(i,n){if(i===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const r=3*i;if(i>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{const s=new Uint32Array(r);s.set(this._data),this._data=s}for(let s=this.length;s<i;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,r);const s=Object.keys(this._combined);for(let S=0;S<s.length;S++){const b=parseInt(s[S],10);b>=i&&delete this._combined[b]}const d=Object.keys(this._extendedAttrs);for(let S=0;S<d.length;S++){const b=parseInt(d[S],10);b>=i&&delete this._extendedAttrs[b]}}return this.length=i,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,n=!1){if(n)for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,i);else{this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,i)}}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(const n in i._combined)this._combined[n]=i._combined[n];this._extendedAttrs={};for(const n in i._extendedAttrs)this._extendedAttrs[n]=i._extendedAttrs[n];this.isWrapped=i.isWrapped}clone(){const i=new C(0);i._data=new Uint32Array(this._data),i.length=this.length;for(const n in this._combined)i._combined[n]=this._combined[n];for(const n in this._extendedAttrs)i._extendedAttrs[n]=this._extendedAttrs[n];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0])return i+(this._data[3*i+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(4194303&this._data[3*i+0]||50331648&this._data[3*i+2])return i+(this._data[3*i+0]>>22);return 0}copyCellsFrom(i,n,r,s,d){const S=i._data;if(d)for(let w=s-1;w>=0;w--){for(let g=0;g<3;g++)this._data[3*(r+w)+g]=S[3*(n+w)+g];268435456&S[3*(n+w)+2]&&(this._extendedAttrs[r+w]=i._extendedAttrs[n+w])}else for(let w=0;w<s;w++){for(let g=0;g<3;g++)this._data[3*(r+w)+g]=S[3*(n+w)+g];268435456&S[3*(n+w)+2]&&(this._extendedAttrs[r+w]=i._extendedAttrs[n+w])}const b=Object.keys(i._combined);for(let w=0;w<b.length;w++){const g=parseInt(b[w],10);g>=n&&(this._combined[g-n+r]=i._combined[g])}}translateToString(i,n,r,s){n=n??0,r=r??this.length,i&&(r=Math.min(r,this.getTrimmedLength())),s&&(s.length=0);let d="";for(;n<r;){const S=this._data[3*n+0],b=2097151&S,w=2097152&S?this._combined[n]:b?(0,p.stringFromCodePoint)(b):c.WHITESPACE_CELL_CHAR;if(d+=w,s)for(let g=0;g<w.length;++g)s.push(n);n+=S>>22||1}return s&&s.push(n),d}}t.BufferLine=C},4841:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(o,l){if(o.start.y>o.end.y)throw new Error(`Buffer range end (${o.end.x}, ${o.end.y}) cannot be before start (${o.start.x}, ${o.start.y})`);return l*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(k,t)=>{function o(l,_,c){if(_===l.length-1)return l[_].getTrimmedLength();const p=!l[_].hasContent(c-1)&&l[_].getWidth(c-1)===1,v=l[_+1].getWidth(0)===2;return p&&v?c-1:c}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(l,_,c,p,v){const C=[];for(let f=0;f<l.length-1;f++){let i=f,n=l.get(++i);if(!n.isWrapped)continue;const r=[l.get(f)];for(;i<l.length&&n.isWrapped;)r.push(n),n=l.get(++i);if(p>=f&&p<i){f+=r.length-1;continue}let s=0,d=o(r,s,_),S=1,b=0;for(;S<r.length;){const g=o(r,S,_),E=g-b,T=c-d,B=Math.min(E,T);r[s].copyCellsFrom(r[S],b,d,B,!1),d+=B,d===c&&(s++,d=0),b+=B,b===g&&(S++,b=0),d===0&&s!==0&&r[s-1].getWidth(c-1)===2&&(r[s].copyCellsFrom(r[s-1],c-1,d++,1,!1),r[s-1].setCell(c-1,v))}r[s].replaceCells(d,c,v);let w=0;for(let g=r.length-1;g>0&&(g>s||r[g].getTrimmedLength()===0);g--)w++;w>0&&(C.push(f+r.length-w),C.push(w)),f+=r.length-1}return C},t.reflowLargerCreateNewLayout=function(l,_){const c=[];let p=0,v=_[p],C=0;for(let f=0;f<l.length;f++)if(v===f){const i=_[++p];l.onDeleteEmitter.fire({index:f-C,amount:i}),f+=i-1,C+=i,v=_[++p]}else c.push(f);return{layout:c,countRemoved:C}},t.reflowLargerApplyNewLayout=function(l,_){const c=[];for(let p=0;p<_.length;p++)c.push(l.get(_[p]));for(let p=0;p<c.length;p++)l.set(p,c[p]);l.length=_.length},t.reflowSmallerGetNewLineLengths=function(l,_,c){const p=[],v=l.map((n,r)=>o(l,r,_)).reduce((n,r)=>n+r);let C=0,f=0,i=0;for(;i<v;){if(v-i<c){p.push(v-i);break}C+=c;const n=o(l,f,_);C>n&&(C-=n,f++);const r=l[f].getWidth(C-1)===2;r&&C--;const s=r?c-1:c;p.push(s),i+=s}return p},t.getWrappedLineTrimmedLength=o},5295:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const l=o(8460),_=o(844),c=o(9092);class p extends _.Disposable{constructor(C,f){super(),this._optionsService=C,this._bufferService=f,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 c.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c.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(C){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(C),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(C,f){this._normal.resize(C,f),this._alt.resize(C,f),this.setupTabStops(C)}setupTabStops(C){this._normal.setupTabStops(C),this._alt.setupTabStops(C)}}t.BufferSet=p},511:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const l=o(482),_=o(643),c=o(3734);class p extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(C){const f=new p;return f.setFromCharData(C),f}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(C){this.fg=C[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let f=!1;if(C[_.CHAR_DATA_CHAR_INDEX].length>2)f=!0;else if(C[_.CHAR_DATA_CHAR_INDEX].length===2){const i=C[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=i&&i<=56319){const n=C[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(i-55296)+n-56320+65536|C[_.CHAR_DATA_WIDTH_INDEX]<<22:f=!0}else f=!0}else this.content=C[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|C[_.CHAR_DATA_WIDTH_INDEX]<<22;f&&(this.combinedData=C[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|C[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=p},643:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const l=o(8460),_=o(844);class c{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=c._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,_.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}t.Marker=c,c._nextId=1},7116:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.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:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(k,t)=>{var o,l,_;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,function(c){c.NUL="\0",c.SOH="",c.STX="",c.ETX="",c.EOT="",c.ENQ="",c.ACK="",c.BEL="\x07",c.BS="\b",c.HT=" ",c.LF=`
8
+ `,c.VT="\v",c.FF="\f",c.CR="\r",c.SO="",c.SI="",c.DLE="",c.DC1="",c.DC2="",c.DC3="",c.DC4="",c.NAK="",c.SYN="",c.ETB="",c.CAN="",c.EM="",c.SUB="",c.ESC="\x1B",c.FS="",c.GS="",c.RS="",c.US="",c.SP=" ",c.DEL=""}(o||(t.C0=o={})),function(c){c.PAD="€",c.HOP="",c.BPH="‚",c.NBH="ƒ",c.IND="„",c.NEL="…",c.SSA="†",c.ESA="‡",c.HTS="ˆ",c.HTJ="‰",c.VTS="Š",c.PLD="‹",c.PLU="Œ",c.RI="",c.SS2="Ž",c.SS3="",c.DCS="",c.PU1="‘",c.PU2="’",c.STS="“",c.CCH="”",c.MW="•",c.SPA="–",c.EPA="—",c.SOS="˜",c.SGCI="™",c.SCI="š",c.CSI="›",c.ST="œ",c.OSC="",c.PM="ž",c.APC="Ÿ"}(l||(t.C1=l={})),function(c){c.ST=`${o.ESC}\\`}(_||(t.C1_ESCAPED=_={}))},7399:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const l=o(2584),_={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:["'",'"']};t.evaluateKeyboardEvent=function(c,p,v,C){const f={type:0,cancel:!1,key:void 0},i=(c.shiftKey?1:0)|(c.altKey?2:0)|(c.ctrlKey?4:0)|(c.metaKey?8:0);switch(c.keyCode){case 0:c.key==="UIKeyInputUpArrow"?f.key=p?l.C0.ESC+"OA":l.C0.ESC+"[A":c.key==="UIKeyInputLeftArrow"?f.key=p?l.C0.ESC+"OD":l.C0.ESC+"[D":c.key==="UIKeyInputRightArrow"?f.key=p?l.C0.ESC+"OC":l.C0.ESC+"[C":c.key==="UIKeyInputDownArrow"&&(f.key=p?l.C0.ESC+"OB":l.C0.ESC+"[B");break;case 8:f.key=c.ctrlKey?"\b":l.C0.DEL,c.altKey&&(f.key=l.C0.ESC+f.key);break;case 9:if(c.shiftKey){f.key=l.C0.ESC+"[Z";break}f.key=l.C0.HT,f.cancel=!0;break;case 13:f.key=c.altKey?l.C0.ESC+l.C0.CR:l.C0.CR,f.cancel=!0;break;case 27:f.key=l.C0.ESC,c.altKey&&(f.key=l.C0.ESC+l.C0.ESC),f.cancel=!0;break;case 37:if(c.metaKey)break;i?(f.key=l.C0.ESC+"[1;"+(i+1)+"D",f.key===l.C0.ESC+"[1;3D"&&(f.key=l.C0.ESC+(v?"b":"[1;5D"))):f.key=p?l.C0.ESC+"OD":l.C0.ESC+"[D";break;case 39:if(c.metaKey)break;i?(f.key=l.C0.ESC+"[1;"+(i+1)+"C",f.key===l.C0.ESC+"[1;3C"&&(f.key=l.C0.ESC+(v?"f":"[1;5C"))):f.key=p?l.C0.ESC+"OC":l.C0.ESC+"[C";break;case 38:if(c.metaKey)break;i?(f.key=l.C0.ESC+"[1;"+(i+1)+"A",v||f.key!==l.C0.ESC+"[1;3A"||(f.key=l.C0.ESC+"[1;5A")):f.key=p?l.C0.ESC+"OA":l.C0.ESC+"[A";break;case 40:if(c.metaKey)break;i?(f.key=l.C0.ESC+"[1;"+(i+1)+"B",v||f.key!==l.C0.ESC+"[1;3B"||(f.key=l.C0.ESC+"[1;5B")):f.key=p?l.C0.ESC+"OB":l.C0.ESC+"[B";break;case 45:c.shiftKey||c.ctrlKey||(f.key=l.C0.ESC+"[2~");break;case 46:f.key=i?l.C0.ESC+"[3;"+(i+1)+"~":l.C0.ESC+"[3~";break;case 36:f.key=i?l.C0.ESC+"[1;"+(i+1)+"H":p?l.C0.ESC+"OH":l.C0.ESC+"[H";break;case 35:f.key=i?l.C0.ESC+"[1;"+(i+1)+"F":p?l.C0.ESC+"OF":l.C0.ESC+"[F";break;case 33:c.shiftKey?f.type=2:c.ctrlKey?f.key=l.C0.ESC+"[5;"+(i+1)+"~":f.key=l.C0.ESC+"[5~";break;case 34:c.shiftKey?f.type=3:c.ctrlKey?f.key=l.C0.ESC+"[6;"+(i+1)+"~":f.key=l.C0.ESC+"[6~";break;case 112:f.key=i?l.C0.ESC+"[1;"+(i+1)+"P":l.C0.ESC+"OP";break;case 113:f.key=i?l.C0.ESC+"[1;"+(i+1)+"Q":l.C0.ESC+"OQ";break;case 114:f.key=i?l.C0.ESC+"[1;"+(i+1)+"R":l.C0.ESC+"OR";break;case 115:f.key=i?l.C0.ESC+"[1;"+(i+1)+"S":l.C0.ESC+"OS";break;case 116:f.key=i?l.C0.ESC+"[15;"+(i+1)+"~":l.C0.ESC+"[15~";break;case 117:f.key=i?l.C0.ESC+"[17;"+(i+1)+"~":l.C0.ESC+"[17~";break;case 118:f.key=i?l.C0.ESC+"[18;"+(i+1)+"~":l.C0.ESC+"[18~";break;case 119:f.key=i?l.C0.ESC+"[19;"+(i+1)+"~":l.C0.ESC+"[19~";break;case 120:f.key=i?l.C0.ESC+"[20;"+(i+1)+"~":l.C0.ESC+"[20~";break;case 121:f.key=i?l.C0.ESC+"[21;"+(i+1)+"~":l.C0.ESC+"[21~";break;case 122:f.key=i?l.C0.ESC+"[23;"+(i+1)+"~":l.C0.ESC+"[23~";break;case 123:f.key=i?l.C0.ESC+"[24;"+(i+1)+"~":l.C0.ESC+"[24~";break;default:if(!c.ctrlKey||c.shiftKey||c.altKey||c.metaKey)if(v&&!C||!c.altKey||c.metaKey)!v||c.altKey||c.ctrlKey||c.shiftKey||!c.metaKey?c.key&&!c.ctrlKey&&!c.altKey&&!c.metaKey&&c.keyCode>=48&&c.key.length===1?f.key=c.key:c.key&&c.ctrlKey&&(c.key==="_"&&(f.key=l.C0.US),c.key==="@"&&(f.key=l.C0.NUL)):c.keyCode===65&&(f.type=1);else{const n=_[c.keyCode],r=n==null?void 0:n[c.shiftKey?1:0];if(r)f.key=l.C0.ESC+r;else if(c.keyCode>=65&&c.keyCode<=90){const s=c.ctrlKey?c.keyCode-64:c.keyCode+32;let d=String.fromCharCode(s);c.shiftKey&&(d=d.toUpperCase()),f.key=l.C0.ESC+d}else if(c.keyCode===32)f.key=l.C0.ESC+(c.ctrlKey?l.C0.NUL:" ");else if(c.key==="Dead"&&c.code.startsWith("Key")){let s=c.code.slice(3,4);c.shiftKey||(s=s.toLowerCase()),f.key=l.C0.ESC+s,f.cancel=!0}}else c.keyCode>=65&&c.keyCode<=90?f.key=String.fromCharCode(c.keyCode-64):c.keyCode===32?f.key=l.C0.NUL:c.keyCode>=51&&c.keyCode<=55?f.key=String.fromCharCode(c.keyCode-51+27):c.keyCode===56?f.key=l.C0.DEL:c.keyCode===219?f.key=l.C0.ESC:c.keyCode===220?f.key=l.C0.FS:c.keyCode===221&&(f.key=l.C0.GS)}return f}},482:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},t.utf32ToString=function(o,l=0,_=o.length){let c="";for(let p=l;p<_;++p){let v=o[p];v>65535?(v-=65536,c+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):c+=String.fromCharCode(v)}return c},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,l){const _=o.length;if(!_)return 0;let c=0,p=0;if(this._interim){const v=o.charCodeAt(p++);56320<=v&&v<=57343?l[c++]=1024*(this._interim-55296)+v-56320+65536:(l[c++]=this._interim,l[c++]=v),this._interim=0}for(let v=p;v<_;++v){const C=o.charCodeAt(v);if(55296<=C&&C<=56319){if(++v>=_)return this._interim=C,c;const f=o.charCodeAt(v);56320<=f&&f<=57343?l[c++]=1024*(C-55296)+f-56320+65536:(l[c++]=C,l[c++]=f)}else C!==65279&&(l[c++]=C)}return c}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,l){const _=o.length;if(!_)return 0;let c,p,v,C,f=0,i=0,n=0;if(this.interim[0]){let d=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let b,w=0;for(;(b=63&this.interim[++w])&&w<4;)S<<=6,S|=b;const g=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=g-w;for(;n<E;){if(n>=_)return 0;if(b=o[n++],(192&b)!=128){n--,d=!0;break}this.interim[w++]=b,S<<=6,S|=63&b}d||(g===2?S<128?n--:l[f++]=S:g===3?S<2048||S>=55296&&S<=57343||S===65279||(l[f++]=S):S<65536||S>1114111||(l[f++]=S)),this.interim.fill(0)}const r=_-4;let s=n;for(;s<_;){for(;!(!(s<r)||128&(c=o[s])||128&(p=o[s+1])||128&(v=o[s+2])||128&(C=o[s+3]));)l[f++]=c,l[f++]=p,l[f++]=v,l[f++]=C,s+=4;if(c=o[s++],c<128)l[f++]=c;else if((224&c)==192){if(s>=_)return this.interim[0]=c,f;if(p=o[s++],(192&p)!=128){s--;continue}if(i=(31&c)<<6|63&p,i<128){s--;continue}l[f++]=i}else if((240&c)==224){if(s>=_)return this.interim[0]=c,f;if(p=o[s++],(192&p)!=128){s--;continue}if(s>=_)return this.interim[0]=c,this.interim[1]=p,f;if(v=o[s++],(192&v)!=128){s--;continue}if(i=(15&c)<<12|(63&p)<<6|63&v,i<2048||i>=55296&&i<=57343||i===65279)continue;l[f++]=i}else if((248&c)==240){if(s>=_)return this.interim[0]=c,f;if(p=o[s++],(192&p)!=128){s--;continue}if(s>=_)return this.interim[0]=c,this.interim[1]=p,f;if(v=o[s++],(192&v)!=128){s--;continue}if(s>=_)return this.interim[0]=c,this.interim[1]=p,this.interim[2]=v,f;if(C=o[s++],(192&C)!=128){s--;continue}if(i=(7&c)<<18|(63&p)<<12|(63&v)<<6|63&C,i<65536||i>1114111)continue;l[f++]=i}}return f}}},225:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const l=o(1480),_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],c=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let p;t.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let v=0;v<_.length;++v)p.fill(0,_[v][0],_[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?p[v]:function(C,f){let i,n=0,r=f.length-1;if(C<f[0][0]||C>f[r][1])return!1;for(;r>=n;)if(i=n+r>>1,C>f[i][1])n=i+1;else{if(!(C<f[i][0]))return!0;r=i-1}return!1}(v,c)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,C){let f=this.wcwidth(v),i=f===0&&C!==0;if(i){const n=l.UnicodeService.extractWidth(C);n===0?i=!1:n>f&&(f=n)}return l.UnicodeService.createPropertyValue(0,f,i)}}},5981:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const l=o(8460),_=o(844);class c extends _.Disposable{constructor(v){super(),this._action=v,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(v,C){if(C!==void 0&&this._syncCalls>C)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let f;for(this._isSyncWriting=!0;f=this._writeBuffer.shift();){this._action(f);const i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,C){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+=v.length,this._writeBuffer.push(v),this._callbacks.push(C),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(C)}_innerWrite(v=0,C=!0){const f=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const i=this._writeBuffer[this._bufferOffset],n=this._action(i,C);if(n){const s=d=>Date.now()-f>=12?setTimeout(()=>this._innerWrite(0,d)):this._innerWrite(f,d);return void n.catch(d=>(queueMicrotask(()=>{throw d}),Promise.resolve(!1))).then(s)}const r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-f>=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()}}t.WriteBuffer=c},5941:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const o=/^([\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 _(c,p){const v=c.toString(16),C=v.length<2?"0"+v:v;switch(p){case 4:return v[0];case 8:return C;case 12:return(C+C).slice(0,3);default:return C+C}}t.parseColor=function(c){if(!c)return;let p=c.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const v=o.exec(p);if(v){const C=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/C*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/C*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/C*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),l.exec(p)&&[3,6,9,12].includes(p.length))){const v=p.length/3,C=[0,0,0];for(let f=0;f<3;++f){const i=parseInt(p.slice(v*f,v*f+v),16);C[f]=v===1?i<<4:v===2?i:v===3?i>>4:i>>8}return C}},t.toRgbString=function(c,p=16){const[v,C,f]=c;return`rgb:${_(v,p)}/${_(C,p)}/${_(f,p)}`}},5770:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const l=o(482),_=o(8742),c=o(5770),p=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(C,f){this._handlers[C]===void 0&&(this._handlers[C]=[]);const i=this._handlers[C];return i.push(f),{dispose:()=>{const n=i.indexOf(f);n!==-1&&i.splice(n,1)}}}clearHandler(C){this._handlers[C]&&delete this._handlers[C]}setHandlerFallback(C){this._handlerFb=C}reset(){if(this._active.length)for(let C=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;C>=0;--C)this._active[C].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(C,f){if(this.reset(),this._ident=C,this._active=this._handlers[C]||p,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(f);else this._handlerFb(this._ident,"HOOK",f)}put(C,f,i){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(C,f,i);else this._handlerFb(this._ident,"PUT",(0,l.utf32ToString)(C,f,i))}unhook(C,f=!0){if(this._active.length){let i=!1,n=this._active.length-1,r=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,i=f,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;n>=0&&(i=this._active[n].unhook(C),i!==!0);n--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,i;n--}for(;n>=0;n--)if(i=this._active[n].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",C);this._active=p,this._ident=0}};const v=new _.Params;v.addParam(0),t.DcsHandler=class{constructor(C){this._handler=C,this._data="",this._params=v,this._hitLimit=!1}hook(C){this._params=C.length>1||C.params[0]?C.clone():v,this._data="",this._hitLimit=!1}put(C,f,i){this._hitLimit||(this._data+=(0,l.utf32ToString)(C,f,i),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(C){let f=!1;if(this._hitLimit)f=!1;else if(C&&(f=this._handler(this._data,this._params),f instanceof Promise))return f.then(i=>(this._params=v,this._data="",this._hitLimit=!1,i));return this._params=v,this._data="",this._hitLimit=!1,f}}},2015:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const l=o(844),_=o(8742),c=o(6242),p=o(6351);class v{constructor(n){this.table=new Uint8Array(n)}setDefault(n,r){this.table.fill(n<<4|r)}add(n,r,s,d){this.table[r<<8|n]=s<<4|d}addMany(n,r,s,d){for(let S=0;S<n.length;S++)this.table[r<<8|n[S]]=s<<4|d}}t.TransitionTable=v;const C=160;t.VT500_TRANSITION_TABLE=function(){const i=new v(4095),n=Array.apply(null,Array(256)).map((w,g)=>g),r=(w,g)=>n.slice(w,g),s=r(32,127),d=r(0,24);d.push(25),d.push.apply(d,r(28,32));const S=r(0,14);let b;for(b in i.setDefault(1,0),i.addMany(s,0,2,0),S)i.addMany([24,26,153,154],b,3,0),i.addMany(r(128,144),b,3,0),i.addMany(r(144,152),b,3,0),i.add(156,b,0,0),i.add(27,b,11,1),i.add(157,b,4,8),i.addMany([152,158,159],b,0,7),i.add(155,b,11,3),i.add(144,b,11,9);return i.addMany(d,0,3,0),i.addMany(d,1,3,1),i.add(127,1,0,1),i.addMany(d,8,0,8),i.addMany(d,3,3,3),i.add(127,3,0,3),i.addMany(d,4,3,4),i.add(127,4,0,4),i.addMany(d,6,3,6),i.addMany(d,5,3,5),i.add(127,5,0,5),i.addMany(d,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(s,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(r(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(s,7,0,7),i.addMany(d,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(r(64,127),3,7,0),i.addMany(r(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(r(48,60),4,8,4),i.addMany(r(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(r(32,64),6,0,6),i.add(127,6,0,6),i.addMany(r(64,127),6,0,0),i.addMany(r(32,48),3,9,5),i.addMany(r(32,48),5,9,5),i.addMany(r(48,64),5,0,6),i.addMany(r(64,127),5,7,0),i.addMany(r(32,48),4,9,5),i.addMany(r(32,48),1,9,2),i.addMany(r(32,48),2,9,2),i.addMany(r(48,127),2,10,0),i.addMany(r(48,80),1,10,0),i.addMany(r(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(r(96,127),1,10,0),i.add(80,1,11,9),i.addMany(d,9,0,9),i.add(127,9,0,9),i.addMany(r(28,32),9,0,9),i.addMany(r(32,48),9,9,12),i.addMany(r(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(d,11,0,11),i.addMany(r(32,128),11,0,11),i.addMany(r(28,32),11,0,11),i.addMany(d,10,0,10),i.add(127,10,0,10),i.addMany(r(28,32),10,0,10),i.addMany(r(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(r(32,48),10,9,12),i.addMany(d,12,0,12),i.add(127,12,0,12),i.addMany(r(28,32),12,0,12),i.addMany(r(32,48),12,9,12),i.addMany(r(48,64),12,0,11),i.addMany(r(64,127),12,12,13),i.addMany(r(64,127),10,12,13),i.addMany(r(64,127),9,12,13),i.addMany(d,13,13,13),i.addMany(s,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(C,0,2,0),i.add(C,8,5,8),i.add(C,6,0,6),i.add(C,11,0,11),i.add(C,13,13,13),i}();class f extends l.Disposable{constructor(n=t.VT500_TRANSITION_TABLE){super(),this._transitions=n,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(r,s,d)=>{},this._executeHandlerFb=r=>{},this._csiHandlerFb=(r,s)=>{},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 c.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(n,r=[64,126]){let s=0;if(n.prefix){if(n.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=n.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(n.intermediates){if(n.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let S=0;S<n.intermediates.length;++S){const b=n.intermediates.charCodeAt(S);if(32>b||b>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=b}}if(n.final.length!==1)throw new Error("final must be a single byte");const d=n.final.charCodeAt(0);if(r[0]>d||d>r[1])throw new Error(`final must be in range ${r[0]} .. ${r[1]}`);return s<<=8,s|=d,s}identToString(n){const r=[];for(;n;)r.push(String.fromCharCode(255&n)),n>>=8;return r.reverse().join("")}setPrintHandler(n){this._printHandler=n}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(n,r){const s=this._identifier(n,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);const d=this._escHandlers[s];return d.push(r),{dispose:()=>{const S=d.indexOf(r);S!==-1&&d.splice(S,1)}}}clearEscHandler(n){this._escHandlers[this._identifier(n,[48,126])]&&delete this._escHandlers[this._identifier(n,[48,126])]}setEscHandlerFallback(n){this._escHandlerFb=n}setExecuteHandler(n,r){this._executeHandlers[n.charCodeAt(0)]=r}clearExecuteHandler(n){this._executeHandlers[n.charCodeAt(0)]&&delete this._executeHandlers[n.charCodeAt(0)]}setExecuteHandlerFallback(n){this._executeHandlerFb=n}registerCsiHandler(n,r){const s=this._identifier(n);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);const d=this._csiHandlers[s];return d.push(r),{dispose:()=>{const S=d.indexOf(r);S!==-1&&d.splice(S,1)}}}clearCsiHandler(n){this._csiHandlers[this._identifier(n)]&&delete this._csiHandlers[this._identifier(n)]}setCsiHandlerFallback(n){this._csiHandlerFb=n}registerDcsHandler(n,r){return this._dcsParser.registerHandler(this._identifier(n),r)}clearDcsHandler(n){this._dcsParser.clearHandler(this._identifier(n))}setDcsHandlerFallback(n){this._dcsParser.setHandlerFallback(n)}registerOscHandler(n,r){return this._oscParser.registerHandler(n,r)}clearOscHandler(n){this._oscParser.clearHandler(n)}setOscHandlerFallback(n){this._oscParser.setHandlerFallback(n)}setErrorHandler(n){this._errorHandler=n}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(n,r,s,d,S){this._parseStack.state=n,this._parseStack.handlers=r,this._parseStack.handlerPos=s,this._parseStack.transition=d,this._parseStack.chunkPos=S}parse(n,r,s){let d,S=0,b=0,w=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,w=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const g=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&E>-1){for(;E>=0&&(d=g[E](this._params),d!==!0);E--)if(d instanceof Promise)return this._parseStack.handlerPos=E,d}this._parseStack.handlers=[];break;case 4:if(s===!1&&E>-1){for(;E>=0&&(d=g[E](),d!==!0);E--)if(d instanceof Promise)return this._parseStack.handlerPos=E,d}this._parseStack.handlers=[];break;case 6:if(S=n[this._parseStack.chunkPos],d=this._dcsParser.unhook(S!==24&&S!==26,s),d)return d;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=n[this._parseStack.chunkPos],d=this._oscParser.end(S!==24&&S!==26,s),d)return d;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,w=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let g=w;g<r;++g){switch(S=n[g],b=this._transitions.table[this.currentState<<8|(S<160?S:C)],b>>4){case 2:for(let D=g+1;;++D){if(D>=r||(S=n[D])<32||S>126&&S<C){this._printHandler(n,g,D),g=D-1;break}if(++D>=r||(S=n[D])<32||S>126&&S<C){this._printHandler(n,g,D),g=D-1;break}if(++D>=r||(S=n[D])<32||S>126&&S<C){this._printHandler(n,g,D),g=D-1;break}if(++D>=r||(S=n[D])<32||S>126&&S<C){this._printHandler(n,g,D),g=D-1;break}}break;case 3:this._executeHandlers[S]?this._executeHandlers[S]():this._executeHandlerFb(S),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:g,code:S,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|S];let T=E?E.length-1:-1;for(;T>=0&&(d=E[T](this._params),d!==!0);T--)if(d instanceof Promise)return this._preserveStack(3,E,T,b,g),d;T<0&&this._csiHandlerFb(this._collect<<8|S,this._params),this.precedingJoinState=0;break;case 8:do switch(S){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(S-48)}while(++g<r&&(S=n[g])>47&&S<60);g--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:const B=this._escHandlers[this._collect<<8|S];let O=B?B.length-1:-1;for(;O>=0&&(d=B[O](),d!==!0);O--)if(d instanceof Promise)return this._preserveStack(4,B,O,b,g),d;O<0&&this._escHandlerFb(this._collect<<8|S),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|S,this._params);break;case 13:for(let D=g+1;;++D)if(D>=r||(S=n[D])===24||S===26||S===27||S>127&&S<C){this._dcsParser.put(n,g,D),g=D-1;break}break;case 14:if(d=this._dcsParser.unhook(S!==24&&S!==26),d)return this._preserveStack(6,[],0,b,g),d;S===27&&(b|=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=g+1;;D++)if(D>=r||(S=n[D])<32||S>127&&S<C){this._oscParser.put(n,g,D),g=D-1;break}break;case 6:if(d=this._oscParser.end(S!==24&&S!==26),d)return this._preserveStack(5,[],0,b,g),d;S===27&&(b|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&b}}}t.EscapeSequenceParser=f},6242:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const l=o(5770),_=o(482),c=[];t.OscParser=class{constructor(){this._state=0,this._active=c,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,v){this._handlers[p]===void 0&&(this._handlers[p]=[]);const C=this._handlers[p];return C.push(v),{dispose:()=>{const f=C.indexOf(v);f!==-1&&C.splice(f,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=c,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||c,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,v,C){if(this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].put(p,v,C);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(p,v,C))}start(){this.reset(),this._state=1}put(p,v,C){if(this._state!==3){if(this._state===1)for(;v<C;){const f=p[v++];if(f===59){this._state=2,this._start();break}if(f<48||57<f)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+f-48}this._state===2&&C-v>0&&this._put(p,v,C)}}end(p,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let C=!1,f=this._active.length-1,i=!1;if(this._stack.paused&&(f=this._stack.loopPosition-1,C=v,i=this._stack.fallThrough,this._stack.paused=!1),!i&&C===!1){for(;f>=0&&(C=this._active[f].end(p),C!==!0);f--)if(C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!1,C;f--}for(;f>=0;f--)if(C=this._active[f].end(!1),C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=f,this._stack.fallThrough=!0,C}else this._handlerFb(this._id,"END",p);this._active=c,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,v,C){this._hitLimit||(this._data+=(0,_.utf32ToString)(p,v,C),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let v=!1;if(this._hitLimit)v=!1;else if(p&&(v=this._handler(this._data),v instanceof Promise))return v.then(C=>(this._data="",this._hitLimit=!1,C));return this._data="",this._hitLimit=!1,v}}},8742:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const o=2147483647;class l{static fromArray(c){const p=new l;if(!c.length)return p;for(let v=Array.isArray(c[0])?1:0;v<c.length;++v){const C=c[v];if(Array.isArray(C))for(let f=0;f<C.length;++f)p.addSubParam(C[f]);else p.addParam(C)}return p}constructor(c=32,p=32){if(this.maxLength=c,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(c),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(c),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const c=new l(this.maxLength,this.maxSubParamsLength);return c.params.set(this.params),c.length=this.length,c._subParams.set(this._subParams),c._subParamsLength=this._subParamsLength,c._subParamsIdx.set(this._subParamsIdx),c._rejectDigits=this._rejectDigits,c._rejectSubDigits=this._rejectSubDigits,c._digitIsSub=this._digitIsSub,c}toArray(){const c=[];for(let p=0;p<this.length;++p){c.push(this.params[p]);const v=this._subParamsIdx[p]>>8,C=255&this._subParamsIdx[p];C-v>0&&c.push(Array.prototype.slice.call(this._subParams,v,C))}return c}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(c){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=c>o?o:c}}addSubParam(c){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=c>o?o:c,this._subParamsIdx[this.length-1]++}}hasSubParams(c){return(255&this._subParamsIdx[c])-(this._subParamsIdx[c]>>8)>0}getSubParams(c){const p=this._subParamsIdx[c]>>8,v=255&this._subParamsIdx[c];return v-p>0?this._subParams.subarray(p,v):null}getSubParamsAll(){const c={};for(let p=0;p<this.length;++p){const v=this._subParamsIdx[p]>>8,C=255&this._subParamsIdx[p];C-v>0&&(c[p]=this._subParams.slice(v,C))}return c}addDigit(c){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,C=v[p-1];v[p-1]=~C?Math.min(10*C+c,o):c}}t.Params=l},5741:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,l){const _={instance:l,dispose:l.dispose,isDisposed:!1};this._addons.push(_),l.dispose=()=>this._wrappedAddonDispose(_),l.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let l=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===o){l=_;break}if(l===-1)throw new Error("Could not dispose an addon that has not been loaded");o.isDisposed=!0,o.dispose.apply(o.instance),this._addons.splice(l,1)}}},8771:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const l=o(3785),_=o(511);t.BufferApiView=class{constructor(c,p){this._buffer=c,this.type=p}init(c){return this._buffer=c,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(c){const p=this._buffer.lines.get(c);if(p)return new l.BufferLineApiView(p)}getNullCell(){return new _.CellData}}},3785:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const l=o(511);t.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,c){if(!(_<0||_>=this._line.length))return c?(this._line.loadCell(_,c),c):this._line.loadCell(_,new l.CellData)}translateToString(_,c,p){return this._line.translateToString(_,c,p)}}},8285:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const l=o(8771),_=o(8460),c=o(844);class p extends c.Disposable{constructor(C){super(),this._core=C,this._onBufferChange=this.register(new _.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)}}t.BufferNamespaceApi=p},7975:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,l){return this._core.registerCsiHandler(o,_=>l(_.toArray()))}addCsiHandler(o,l){return this.registerCsiHandler(o,l)}registerDcsHandler(o,l){return this._core.registerDcsHandler(o,(_,c)=>l(_,c.toArray()))}addDcsHandler(o,l){return this.registerDcsHandler(o,l)}registerEscHandler(o,l){return this._core.registerEscHandler(o,l)}addEscHandler(o,l){return this.registerEscHandler(o,l)}registerOscHandler(o,l){return this._core.registerOscHandler(o,l)}addOscHandler(o,l){return this.registerOscHandler(o,l)}}},7090:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(o){this._core=o}register(o){this._core.unicodeService.register(o)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(o){this._core.unicodeService.activeVersion=o}}},744:function(k,t,o){var l=this&&this.__decorate||function(i,n,r,s){var d,S=arguments.length,b=S<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,r):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(i,n,r,s);else for(var w=i.length-1;w>=0;w--)(d=i[w])&&(b=(S<3?d(b):S>3?d(n,r,b):d(n,r))||b);return S>3&&b&&Object.defineProperty(n,r,b),b},_=this&&this.__param||function(i,n){return function(r,s){n(r,s,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const c=o(8460),p=o(844),v=o(5295),C=o(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let f=t.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new c.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(i,this))}resize(i,n){this.cols=i,this.rows=n,this.buffers.resize(i,n),this._onResize.fire({cols:i,rows:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,n=!1){const r=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===i.fg&&s.getBg(0)===i.bg||(s=r.getBlankLine(i,n),this._cachedBlankLine=s),s.isWrapped=n;const d=r.ybase+r.scrollTop,S=r.ybase+r.scrollBottom;if(r.scrollTop===0){const b=r.lines.isFull;S===r.lines.length-1?b?r.lines.recycle().copyFrom(s):r.lines.push(s.clone()):r.lines.splice(S+1,0,s.clone()),b?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{const b=S-d+1;r.lines.shiftElements(d+1,b-1,-1),r.lines.set(S,s.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(i,n,r){const s=this.buffer;if(i<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else i+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const d=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+i,s.ybase),0),d!==s.ydisp&&(n||this._onScroll.fire(s.ydisp))}};t.BufferService=f=l([_(0,C.IOptionsService)],f)},7994:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,l){this._charsets[o]=l,this.glevel===o&&(this.charset=l)}}},1753:function(k,t,o){var l=this&&this.__decorate||function(s,d,S,b){var w,g=arguments.length,E=g<3?d:b===null?b=Object.getOwnPropertyDescriptor(d,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(s,d,S,b);else for(var T=s.length-1;T>=0;T--)(w=s[T])&&(E=(g<3?w(E):g>3?w(d,S,E):w(d,S))||E);return g>3&&E&&Object.defineProperty(d,S,E),E},_=this&&this.__param||function(s,d){return function(S,b){d(S,b,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const c=o(2585),p=o(8460),v=o(844),C={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:s=>s.button!==4&&s.action===1&&(s.ctrl=!1,s.alt=!1,s.shift=!1,!0)},VT200:{events:19,restrict:s=>s.action!==32},DRAG:{events:23,restrict:s=>s.action!==32||s.button!==3},ANY:{events:31,restrict:s=>!0}};function f(s,d){let S=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(S|=64,S|=s.action):(S|=3&s.button,4&s.button&&(S|=64),8&s.button&&(S|=128),s.action===32?S|=32:s.action!==0||d||(S|=3)),S}const i=String.fromCharCode,n={DEFAULT:s=>{const d=[f(s,!1)+32,s.col+32,s.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${i(d[0])}${i(d[1])}${i(d[2])}`},SGR:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${f(s,!0)};${s.col};${s.row}${d}`},SGR_PIXELS:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${f(s,!0)};${s.x};${s.y}${d}`}};let r=t.CoreMouseService=class extends v.Disposable{constructor(s,d){super(),this._bufferService=s,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const S of Object.keys(C))this.addProtocol(S,C[S]);for(const S of Object.keys(n))this.addEncoding(S,n[S]);this.reset()}addProtocol(s,d){this._protocols[s]=d}addEncoding(s,d){this._encodings[s]=d}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(s){if(!this._protocols[s])throw new Error(`unknown protocol "${s}"`);this._activeProtocol=s,this._onProtocolChange.fire(this._protocols[s].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(s){if(!this._encodings[s])throw new Error(`unknown encoding "${s}"`);this._activeEncoding=s}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(s){if(s.col<0||s.col>=this._bufferService.cols||s.row<0||s.row>=this._bufferService.rows||s.button===4&&s.action===32||s.button===3&&s.action!==32||s.button!==4&&(s.action===2||s.action===3)||(s.col++,s.row++,s.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,s,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(s))return!1;const d=this._encodings[this._activeEncoding](s);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!0)),this._lastEvent=s,!0}explainEvents(s){return{down:!!(1&s),up:!!(2&s),drag:!!(4&s),move:!!(8&s),wheel:!!(16&s)}}_equalEvents(s,d,S){if(S){if(s.x!==d.x||s.y!==d.y)return!1}else if(s.col!==d.col||s.row!==d.row)return!1;return s.button===d.button&&s.action===d.action&&s.ctrl===d.ctrl&&s.alt===d.alt&&s.shift===d.shift}};t.CoreMouseService=r=l([_(0,c.IBufferService),_(1,c.ICoreService)],r)},6975:function(k,t,o){var l=this&&this.__decorate||function(r,s,d,S){var b,w=arguments.length,g=w<3?s:S===null?S=Object.getOwnPropertyDescriptor(s,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(r,s,d,S);else for(var E=r.length-1;E>=0;E--)(b=r[E])&&(g=(w<3?b(g):w>3?b(s,d,g):b(s,d))||g);return w>3&&g&&Object.defineProperty(s,d,g),g},_=this&&this.__param||function(r,s){return function(d,S){s(d,S,r)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const c=o(1439),p=o(8460),v=o(844),C=o(2585),f=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let n=t.CoreService=class extends v.Disposable{constructor(r,s,d){super(),this._bufferService=r,this._logService=s,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,c.clone)(f),this.decPrivateModes=(0,c.clone)(i)}reset(){this.modes=(0,c.clone)(f),this.decPrivateModes=(0,c.clone)(i)}triggerDataEvent(r,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const d=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${r}"`,()=>r.split("").map(S=>S.charCodeAt(0))),this._onData.fire(r)}triggerBinaryEvent(r){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${r}"`,()=>r.split("").map(s=>s.charCodeAt(0))),this._onBinary.fire(r))}};t.CoreService=n=l([_(0,C.IBufferService),_(1,C.ILogService),_(2,C.IOptionsService)],n)},9074:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const l=o(8055),_=o(8460),c=o(844),p=o(6106);let v=0,C=0;class f extends c.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList(r=>r==null?void 0:r.marker.line),this._onDecorationRegistered=this.register(new _.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new _.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,c.toDisposable)(()=>this.reset()))}registerDecoration(r){if(r.marker.isDisposed)return;const s=new i(r);if(s){const d=s.marker.onDispose(()=>s.dispose());s.onDispose(()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),d.dispose())}),this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(const r of this._decorations.values())r.dispose();this._decorations.clear()}*getDecorationsAtCell(r,s,d){let S=0,b=0;for(const w of this._decorations.getKeyIterator(s))S=w.options.x??0,b=S+(w.options.width??1),r>=S&&r<b&&(!d||(w.options.layer??"bottom")===d)&&(yield w)}forEachDecorationAtCell(r,s,d,S){this._decorations.forEachByKey(s,b=>{v=b.options.x??0,C=v+(b.options.width??1),r>=v&&r<C&&(!d||(b.options.layer??"bottom")===d)&&S(b)})}}t.DecorationService=f;class i extends c.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 _.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new _.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:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const l=o(2585),_=o(8343);class c{constructor(...v){this._entries=new Map;for(const[C,f]of v)this.set(C,f)}set(v,C){const f=this._entries.get(v);return this._entries.set(v,C),f}forEach(v){for(const[C,f]of this._entries.entries())v(C,f)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}t.ServiceCollection=c,t.InstantiationService=class{constructor(){this._services=new c,this._services.set(l.IInstantiationService,this)}setService(p,v){this._services.set(p,v)}getService(p){return this._services.get(p)}createInstance(p,...v){const C=(0,_.getServiceDependencies)(p).sort((n,r)=>n.index-r.index),f=[];for(const n of C){const r=this._services.get(n.id);if(!r)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${n.id}.`);f.push(r)}const i=C.length>0?C[0].index:v.length;if(v.length!==i)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${i+1} conflicts with ${v.length} static arguments`);return new p(...v,...f)}}},7866:function(k,t,o){var l=this&&this.__decorate||function(i,n,r,s){var d,S=arguments.length,b=S<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,r):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(i,n,r,s);else for(var w=i.length-1;w>=0;w--)(d=i[w])&&(b=(S<3?d(b):S>3?d(n,r,b):d(n,r))||b);return S>3&&b&&Object.defineProperty(n,r,b),b},_=this&&this.__param||function(i,n){return function(r,s){n(r,s,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const c=o(844),p=o(2585),v={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let C,f=t.LogService=class extends c.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),C=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let n=0;n<i.length;n++)typeof i[n]=="function"&&(i[n]=i[n]())}_log(i,n,r){this._evalLazyOptionalParams(r),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+n,...r)}trace(i,...n){var r;this._logLevel<=p.LogLevelEnum.TRACE&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.trace.bind(this._optionsService.options.logger))??console.log,i,n)}debug(i,...n){var r;this._logLevel<=p.LogLevelEnum.DEBUG&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.debug.bind(this._optionsService.options.logger))??console.log,i,n)}info(i,...n){var r;this._logLevel<=p.LogLevelEnum.INFO&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.info.bind(this._optionsService.options.logger))??console.info,i,n)}warn(i,...n){var r;this._logLevel<=p.LogLevelEnum.WARN&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.warn.bind(this._optionsService.options.logger))??console.warn,i,n)}error(i,...n){var r;this._logLevel<=p.LogLevelEnum.ERROR&&this._log(((r=this._optionsService.options.logger)==null?void 0:r.error.bind(this._optionsService.options.logger))??console.error,i,n)}};t.LogService=f=l([_(0,p.IOptionsService)],f),t.setTraceLogger=function(i){C=i},t.traceCall=function(i,n,r){if(typeof r.value!="function")throw new Error("not supported");const s=r.value;r.value=function(...d){if(C.logLevel!==p.LogLevelEnum.TRACE)return s.apply(this,d);C.trace(`GlyphRenderer#${s.name}(${d.map(b=>JSON.stringify(b)).join(", ")})`);const S=s.apply(this,d);return C.trace(`GlyphRenderer#${s.name} return`,S),S}}},7302:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const l=o(8460),_=o(844),c=o(6114);t.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:c.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const p=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends _.Disposable{constructor(f){super(),this._onOptionChange=this.register(new l.EventEmitter),this.onOptionChange=this._onOptionChange.event;const i={...t.DEFAULT_OPTIONS};for(const n in f)if(n in i)try{const r=f[n];i[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,_.toDisposable)(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(f,i){return this.onOptionChange(n=>{n===f&&i(this.rawOptions[f])})}onMultipleOptionChange(f,i){return this.onOptionChange(n=>{f.indexOf(n)!==-1&&i()})}_setupOptions(){const f=n=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},i=(n,r)=>{if(!(n in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(const n in this.rawOptions){const r={get:f.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(f,i){switch(f){case"cursorStyle":if(i||(i=t.DEFAULT_OPTIONS[f]),!function(n){return n==="block"||n==="underline"||n==="bar"}(i))throw new Error(`"${i}" is not a valid value for ${f}`);break;case"wordSeparator":i||(i=t.DEFAULT_OPTIONS[f]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=p.includes(i)?i:t.DEFAULT_OPTIONS[f];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${f} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${f} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${f} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${f} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}t.OptionsService=v},2660:function(k,t,o){var l=this&&this.__decorate||function(v,C,f,i){var n,r=arguments.length,s=r<3?C:i===null?i=Object.getOwnPropertyDescriptor(C,f):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(v,C,f,i);else for(var d=v.length-1;d>=0;d--)(n=v[d])&&(s=(r<3?n(s):r>3?n(C,f,s):n(C,f))||s);return r>3&&s&&Object.defineProperty(C,f,s),s},_=this&&this.__param||function(v,C){return function(f,i){C(f,i,v)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const c=o(2585);let p=t.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const C=this._bufferService.buffer;if(v.id===void 0){const d=C.addMarker(C.ybase+C.y),S={data:v,id:this._nextId++,lines:[d]};return d.onDispose(()=>this._removeMarkerFromLink(S,d)),this._dataByLinkId.set(S.id,S),S.id}const f=v,i=this._getEntryIdKey(f),n=this._entriesWithId.get(i);if(n)return this.addLineToLink(n.id,C.ybase+C.y),n.id;const r=C.addMarker(C.ybase+C.y),s={id:this._nextId++,key:this._getEntryIdKey(f),data:f,lines:[r]};return r.onDispose(()=>this._removeMarkerFromLink(s,r)),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(v,C){const f=this._dataByLinkId.get(v);if(f&&f.lines.every(i=>i.line!==C)){const i=this._bufferService.buffer.addMarker(C);f.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(f,i))}}getLinkData(v){var C;return(C=this._dataByLinkId.get(v))==null?void 0:C.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,C){const f=v.lines.indexOf(C);f!==-1&&(v.lines.splice(f,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};t.OscLinkService=p=l([_(0,c.IBufferService)],p)},8343:(k,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const o="di$target",l="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(_){return _[l]||[]},t.createDecorator=function(_){if(t.serviceRegistry.has(_))return t.serviceRegistry.get(_);const c=function(p,v,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(f,i,n){i[o]===i?i[l].push({id:f,index:n}):(i[l]=[{id:f,index:n}],i[o]=i)})(c,p,C)};return c.toString=()=>_,t.serviceRegistry.set(_,c),c}},2585:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const l=o(8343);var _;t.IBufferService=(0,l.createDecorator)("BufferService"),t.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),t.ICoreService=(0,l.createDecorator)("CoreService"),t.ICharsetService=(0,l.createDecorator)("CharsetService"),t.IInstantiationService=(0,l.createDecorator)("InstantiationService"),function(c){c[c.TRACE=0]="TRACE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARN=3]="WARN",c[c.ERROR=4]="ERROR",c[c.OFF=5]="OFF"}(_||(t.LogLevelEnum=_={})),t.ILogService=(0,l.createDecorator)("LogService"),t.IOptionsService=(0,l.createDecorator)("OptionsService"),t.IOscLinkService=(0,l.createDecorator)("OscLinkService"),t.IUnicodeService=(0,l.createDecorator)("UnicodeService"),t.IDecorationService=(0,l.createDecorator)("DecorationService")},1480:(k,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const l=o(8460),_=o(225);class c{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,C,f=!1){return(16777215&v)<<3|(3&C)<<1|(f?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new l.EventEmitter,this.onChange=this._onChange.event;const v=new _.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let C=0,f=0;const i=v.length;for(let n=0;n<i;++n){let r=v.charCodeAt(n);if(55296<=r&&r<=56319){if(++n>=i)return C+this.wcwidth(r);const S=v.charCodeAt(n);56320<=S&&S<=57343?r=1024*(r-55296)+S-56320+65536:C+=this.wcwidth(S)}const s=this.charProperties(r,f);let d=c.extractWidth(s);c.extractShouldJoin(s)&&(d-=c.extractWidth(f)),C+=d,f=s}return C}charProperties(v,C){return this._activeProvider.charProperties(v,C)}}t.UnicodeService=c}},u={};function m(k){var t=u[k];if(t!==void 0)return t.exports;var o=u[k]={exports:{}};return a[k].call(o.exports,o,o.exports,m),o.exports}var y={};return(()=>{var k=y;Object.defineProperty(k,"__esModule",{value:!0}),k.Terminal=void 0;const t=m(9042),o=m(3236),l=m(844),_=m(5741),c=m(8285),p=m(7975),v=m(7090),C=["cols","rows"];class f extends l.Disposable{constructor(n){super(),this._core=this.register(new o.Terminal(n)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const r=d=>this._core.options[d],s=(d,S)=>{this._checkReadonlyOptions(d),this._core.options[d]=S};for(const d in this._core.options){const S={get:r.bind(this,d),set:s.bind(this,d)};Object.defineProperty(this._publicOptions,d,S)}}_checkReadonlyOptions(n){if(C.includes(n))throw new Error(`Option "${n}" 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 p.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.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 c.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const n=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:n.applicationCursorKeys,applicationKeypadMode:n.applicationKeypad,bracketedPasteMode:n.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:r,originMode:n.origin,reverseWraparoundMode:n.reverseWraparound,sendFocusMode:n.sendFocus,wraparoundMode:n.wraparound}}get options(){return this._publicOptions}set options(n){for(const r in n)this._publicOptions[r]=n[r]}blur(){this._core.blur()}focus(){this._core.focus()}input(n,r=!0){this._core.input(n,r)}resize(n,r){this._verifyIntegers(n,r),this._core.resize(n,r)}open(n){this._core.open(n)}attachCustomKeyEventHandler(n){this._core.attachCustomKeyEventHandler(n)}attachCustomWheelEventHandler(n){this._core.attachCustomWheelEventHandler(n)}registerLinkProvider(n){return this._core.registerLinkProvider(n)}registerCharacterJoiner(n){return this._checkProposedApi(),this._core.registerCharacterJoiner(n)}deregisterCharacterJoiner(n){this._checkProposedApi(),this._core.deregisterCharacterJoiner(n)}registerMarker(n=0){return this._verifyIntegers(n),this._core.registerMarker(n)}registerDecoration(n){return this._checkProposedApi(),this._verifyPositiveIntegers(n.x??0,n.width??0,n.height??0),this._core.registerDecoration(n)}hasSelection(){return this._core.hasSelection()}select(n,r,s){this._verifyIntegers(n,r,s),this._core.select(n,r,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(n,r){this._verifyIntegers(n,r),this._core.selectLines(n,r)}dispose(){super.dispose()}scrollLines(n){this._verifyIntegers(n),this._core.scrollLines(n)}scrollPages(n){this._verifyIntegers(n),this._core.scrollPages(n)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(n){this._verifyIntegers(n),this._core.scrollToLine(n)}clear(){this._core.clear()}write(n,r){this._core.write(n,r)}writeln(n,r){this._core.write(n),this._core.write(`\r
9
+ `,r)}paste(n){this._core.paste(n)}refresh(n,r){this._verifyIntegers(n,r),this._core.refresh(n,r)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(n){this._addonManager.loadAddon(this,n)}static get strings(){return t}_verifyIntegers(...n){for(const r of n)if(r===1/0||isNaN(r)||r%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...n){for(const r of n)if(r&&(r===1/0||isNaN(r)||r%1!=0||r<0))throw new Error("This API only accepts positive integers")}}k.Terminal=f})(),y})())}(It)),It.exports}var Os=Bs(),ne;(function(h){h.assertEqual=m=>m;function e(m){}h.assertIs=e;function a(m){throw new Error}h.assertNever=a,h.arrayToEnum=m=>{const y={};for(const k of m)y[k]=k;return y},h.getValidEnumValues=m=>{const y=h.objectKeys(m).filter(t=>typeof m[m[t]]!="number"),k={};for(const t of y)k[t]=m[t];return h.objectValues(k)},h.objectValues=m=>h.objectKeys(m).map(function(y){return m[y]}),h.objectKeys=typeof Object.keys=="function"?m=>Object.keys(m):m=>{const y=[];for(const k in m)Object.prototype.hasOwnProperty.call(m,k)&&y.push(k);return y},h.find=(m,y)=>{for(const k of m)if(y(k))return k},h.isInteger=typeof Number.isInteger=="function"?m=>Number.isInteger(m):m=>typeof m=="number"&&isFinite(m)&&Math.floor(m)===m;function u(m,y=" | "){return m.map(k=>typeof k=="string"?`'${k}'`:k).join(y)}h.joinValues=u,h.jsonStringifyReplacer=(m,y)=>typeof y=="bigint"?y.toString():y})(ne||(ne={}));var Ft;(function(h){h.mergeShapes=(e,a)=>({...e,...a})})(Ft||(Ft={}));const K=ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xe=h=>{switch(typeof h){case"undefined":return K.undefined;case"string":return K.string;case"number":return isNaN(h)?K.nan:K.number;case"boolean":return K.boolean;case"function":return K.function;case"bigint":return K.bigint;case"symbol":return K.symbol;case"object":return Array.isArray(h)?K.array:h===null?K.null:h.then&&typeof h.then=="function"&&h.catch&&typeof h.catch=="function"?K.promise:typeof Map<"u"&&h instanceof Map?K.map:typeof Set<"u"&&h instanceof Set?K.set:typeof Date<"u"&&h instanceof Date?K.date:K.object;default:return K.unknown}},j=ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ms=h=>JSON.stringify(h,null,2).replace(/"([^"]+)":/g,"$1:");class fe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=u=>{this.issues=[...this.issues,u]},this.addIssues=(u=[])=>{this.issues=[...this.issues,...u]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(y){return y.message},u={_errors:[]},m=y=>{for(const k of y.issues)if(k.code==="invalid_union")k.unionErrors.map(m);else if(k.code==="invalid_return_type")m(k.returnTypeError);else if(k.code==="invalid_arguments")m(k.argumentsError);else if(k.path.length===0)u._errors.push(a(k));else{let t=u,o=0;for(;o<k.path.length;){const l=k.path[o];o===k.path.length-1?(t[l]=t[l]||{_errors:[]},t[l]._errors.push(a(k))):t[l]=t[l]||{_errors:[]},t=t[l],o++}}};return m(this),u}static assert(e){if(!(e instanceof fe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a={},u=[];for(const m of this.issues)m.path.length>0?(a[m.path[0]]=a[m.path[0]]||[],a[m.path[0]].push(e(m))):u.push(e(m));return{formErrors:u,fieldErrors:a}}get formErrors(){return this.flatten()}}fe.create=h=>new fe(h);const We=(h,e)=>{let a;switch(h.code){case j.invalid_type:h.received===K.undefined?a="Required":a=`Expected ${h.expected}, received ${h.received}`;break;case j.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(h.expected,ne.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:a=`Unrecognized key(s) in object: ${ne.joinValues(h.keys,", ")}`;break;case j.invalid_union:a="Invalid input";break;case j.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${ne.joinValues(h.options)}`;break;case j.invalid_enum_value:a=`Invalid enum value. Expected ${ne.joinValues(h.options)}, received '${h.received}'`;break;case j.invalid_arguments:a="Invalid function arguments";break;case j.invalid_return_type:a="Invalid function return type";break;case j.invalid_date:a="Invalid date";break;case j.invalid_string:typeof h.validation=="object"?"includes"in h.validation?(a=`Invalid input: must include "${h.validation.includes}"`,typeof h.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${h.validation.position}`)):"startsWith"in h.validation?a=`Invalid input: must start with "${h.validation.startsWith}"`:"endsWith"in h.validation?a=`Invalid input: must end with "${h.validation.endsWith}"`:ne.assertNever(h.validation):h.validation!=="regex"?a=`Invalid ${h.validation}`:a="Invalid";break;case j.too_small:h.type==="array"?a=`Array must contain ${h.exact?"exactly":h.inclusive?"at least":"more than"} ${h.minimum} element(s)`:h.type==="string"?a=`String must contain ${h.exact?"exactly":h.inclusive?"at least":"over"} ${h.minimum} character(s)`:h.type==="number"?a=`Number must be ${h.exact?"exactly equal to ":h.inclusive?"greater than or equal to ":"greater than "}${h.minimum}`:h.type==="date"?a=`Date must be ${h.exact?"exactly equal to ":h.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(h.minimum))}`:a="Invalid input";break;case j.too_big:h.type==="array"?a=`Array must contain ${h.exact?"exactly":h.inclusive?"at most":"less than"} ${h.maximum} element(s)`:h.type==="string"?a=`String must contain ${h.exact?"exactly":h.inclusive?"at most":"under"} ${h.maximum} character(s)`:h.type==="number"?a=`Number must be ${h.exact?"exactly":h.inclusive?"less than or equal to":"less than"} ${h.maximum}`:h.type==="bigint"?a=`BigInt must be ${h.exact?"exactly":h.inclusive?"less than or equal to":"less than"} ${h.maximum}`:h.type==="date"?a=`Date must be ${h.exact?"exactly":h.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(h.maximum))}`:a="Invalid input";break;case j.custom:a="Invalid input";break;case j.invalid_intersection_types:a="Intersection results could not be merged";break;case j.not_multiple_of:a=`Number must be a multiple of ${h.multipleOf}`;break;case j.not_finite:a="Number must be finite";break;default:a=e.defaultError,ne.assertNever(h)}return{message:a}};let br=We;function Is(h){br=h}function bt(){return br}const St=h=>{const{data:e,path:a,errorMaps:u,issueData:m}=h,y=[...a,...m.path||[]],k={...m,path:y};if(m.message!==void 0)return{...m,path:y,message:m.message};let t="";const o=u.filter(l=>!!l).slice().reverse();for(const l of o)t=l(k,{data:e,defaultError:t}).message;return{...m,path:y,message:t}},Ps=[];function q(h,e){const a=bt(),u=St({issueData:e,data:h.data,path:h.path,errorMaps:[h.common.contextualErrorMap,h.schemaErrorMap,a,a===We?void 0:We].filter(m=>!!m)});h.common.issues.push(u)}class le{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){const u=[];for(const m of a){if(m.status==="aborted")return Q;m.status==="dirty"&&e.dirty(),u.push(m.value)}return{status:e.value,value:u}}static async mergeObjectAsync(e,a){const u=[];for(const m of a){const y=await m.key,k=await m.value;u.push({key:y,value:k})}return le.mergeObjectSync(e,u)}static mergeObjectSync(e,a){const u={};for(const m of a){const{key:y,value:k}=m;if(y.status==="aborted"||k.status==="aborted")return Q;y.status==="dirty"&&e.dirty(),k.status==="dirty"&&e.dirty(),y.value!=="__proto__"&&(typeof k.value<"u"||m.alwaysSet)&&(u[y.value]=k.value)}return{status:e.value,value:u}}}const Q=Object.freeze({status:"aborted"}),Fe=h=>({status:"dirty",value:h}),de=h=>({status:"valid",value:h}),Nt=h=>h.status==="aborted",Wt=h=>h.status==="dirty",Me=h=>h.status==="valid",Xe=h=>typeof Promise<"u"&&h instanceof Promise;function yt(h,e,a,u){if(typeof e=="function"?h!==e||!u:!e.has(h))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(h)}function Sr(h,e,a,u,m){if(typeof e=="function"?h!==e||!m:!e.has(h))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(h,a),a}var Y;(function(h){h.errToObj=e=>typeof e=="string"?{message:e}:e||{},h.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Y||(Y={}));var Ge,Ye;class ye{constructor(e,a,u,m){this._cachedPath=[],this.parent=e,this.data=a,this._path=u,this._key=m}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const er=(h,e)=>{if(Me(e))return{success:!0,data:e.value};if(!h.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new fe(h.common.issues);return this._error=a,this._error}}};function re(h){if(!h)return{};const{errorMap:e,invalid_type_error:a,required_error:u,description:m}=h;if(e&&(a||u))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:m}:{errorMap:(k,t)=>{var o,l;const{message:_}=h;return k.code==="invalid_enum_value"?{message:_??t.defaultError}:typeof t.data>"u"?{message:(o=_??u)!==null&&o!==void 0?o:t.defaultError}:k.code!=="invalid_type"?{message:t.defaultError}:{message:(l=_??a)!==null&&l!==void 0?l:t.defaultError}},description:m}}class se{get description(){return this._def.description}_getType(e){return xe(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new le,ctx:{common:e.parent.common,data:e.data,parsedType:xe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(Xe(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){const a=this._parse(e);return Promise.resolve(a)}parse(e,a){const u=this.safeParse(e,a);if(u.success)return u.data;throw u.error}safeParse(e,a){var u;const m={common:{issues:[],async:(u=a==null?void 0:a.async)!==null&&u!==void 0?u:!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},y=this._parseSync({data:e,path:m.path,parent:m});return er(m,y)}"~validate"(e){var a,u;const m={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)};if(!this["~standard"].async)try{const y=this._parseSync({data:e,path:[],parent:m});return Me(y)?{value:y.value}:{issues:m.common.issues}}catch(y){!((u=(a=y==null?void 0:y.message)===null||a===void 0?void 0:a.toLowerCase())===null||u===void 0)&&u.includes("encountered")&&(this["~standard"].async=!0),m.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:m}).then(y=>Me(y)?{value:y.value}:{issues:m.common.issues})}async parseAsync(e,a){const u=await this.safeParseAsync(e,a);if(u.success)return u.data;throw u.error}async safeParseAsync(e,a){const u={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:xe(e)},m=this._parse({data:e,path:u.path,parent:u}),y=await(Xe(m)?m:Promise.resolve(m));return er(u,y)}refine(e,a){const u=m=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(m):a;return this._refinement((m,y)=>{const k=e(m),t=()=>y.addIssue({code:j.custom,...u(m)});return typeof Promise<"u"&&k instanceof Promise?k.then(o=>o?!0:(t(),!1)):k?!0:(t(),!1)})}refinement(e,a){return this._refinement((u,m)=>e(u)?!0:(m.addIssue(typeof a=="function"?a(u,m):a),!1))}_refinement(e){return new me({schema:this,typeName:X.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return Se.create(this,this._def)}nullable(){return Be.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ve.create(this)}promise(){return Ue.create(this,this._def)}or(e){return rt.create([this,e],this._def)}and(e){return st.create(this,e,this._def)}transform(e){return new me({...re(this._def),schema:this,typeName:X.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a=typeof e=="function"?e:()=>e;return new ct({...re(this._def),innerType:this,defaultValue:a,typeName:X.ZodDefault})}brand(){return new zt({typeName:X.ZodBranded,type:this,...re(this._def)})}catch(e){const a=typeof e=="function"?e:()=>e;return new ht({...re(this._def),innerType:this,catchValue:a,typeName:X.ZodCatch})}describe(e){const a=this.constructor;return new a({...this._def,description:e})}pipe(e){return dt.create(this,e)}readonly(){return lt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Hs=/^c[^\s-]{8,}$/i,Fs=/^[0-9a-z]+$/,Ns=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ws=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,js=/^[a-z0-9_-]{21}$/i,Us=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$s=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,zs=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Pt;const Vs=/^(?:(?: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])$/,Zs=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Ks=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Gs=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ys=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Js=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,yr="((\\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])))",Xs=new RegExp(`^${yr}$`);function Cr(h){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return h.precision?e=`${e}\\.\\d{${h.precision}}`:h.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Qs(h){return new RegExp(`^${Cr(h)}$`)}function wr(h){let e=`${yr}T${Cr(h)}`;const a=[];return a.push(h.local?"Z?":"Z"),h.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,new RegExp(`^${e}$`)}function ei(h,e){return!!((e==="v4"||!e)&&Vs.test(h)||(e==="v6"||!e)&&Ks.test(h))}function ti(h,e){if(!Us.test(h))return!1;try{const[a]=h.split("."),u=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),m=JSON.parse(atob(u));return!(typeof m!="object"||m===null||!m.typ||!m.alg||e&&m.alg!==e)}catch{return!1}}function ri(h,e){return!!((e==="v4"||!e)&&Zs.test(h)||(e==="v6"||!e)&&Gs.test(h))}class ge extends se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==K.string){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_type,expected:K.string,received:y.parsedType}),Q}const u=new le;let m;for(const y of this._def.checks)if(y.kind==="min")e.data.length<y.value&&(m=this._getOrReturnCtx(e,m),q(m,{code:j.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),u.dirty());else if(y.kind==="max")e.data.length>y.value&&(m=this._getOrReturnCtx(e,m),q(m,{code:j.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!1,message:y.message}),u.dirty());else if(y.kind==="length"){const k=e.data.length>y.value,t=e.data.length<y.value;(k||t)&&(m=this._getOrReturnCtx(e,m),k?q(m,{code:j.too_big,maximum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}):t&&q(m,{code:j.too_small,minimum:y.value,type:"string",inclusive:!0,exact:!0,message:y.message}),u.dirty())}else if(y.kind==="email")zs.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"email",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="emoji")Pt||(Pt=new RegExp(qs,"u")),Pt.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"emoji",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="uuid")Ws.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"uuid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="nanoid")js.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"nanoid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="cuid")Hs.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"cuid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="cuid2")Fs.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"cuid2",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="ulid")Ns.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"ulid",code:j.invalid_string,message:y.message}),u.dirty());else if(y.kind==="url")try{new URL(e.data)}catch{m=this._getOrReturnCtx(e,m),q(m,{validation:"url",code:j.invalid_string,message:y.message}),u.dirty()}else y.kind==="regex"?(y.regex.lastIndex=0,y.regex.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"regex",code:j.invalid_string,message:y.message}),u.dirty())):y.kind==="trim"?e.data=e.data.trim():y.kind==="includes"?e.data.includes(y.value,y.position)||(m=this._getOrReturnCtx(e,m),q(m,{code:j.invalid_string,validation:{includes:y.value,position:y.position},message:y.message}),u.dirty()):y.kind==="toLowerCase"?e.data=e.data.toLowerCase():y.kind==="toUpperCase"?e.data=e.data.toUpperCase():y.kind==="startsWith"?e.data.startsWith(y.value)||(m=this._getOrReturnCtx(e,m),q(m,{code:j.invalid_string,validation:{startsWith:y.value},message:y.message}),u.dirty()):y.kind==="endsWith"?e.data.endsWith(y.value)||(m=this._getOrReturnCtx(e,m),q(m,{code:j.invalid_string,validation:{endsWith:y.value},message:y.message}),u.dirty()):y.kind==="datetime"?wr(y).test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{code:j.invalid_string,validation:"datetime",message:y.message}),u.dirty()):y.kind==="date"?Xs.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{code:j.invalid_string,validation:"date",message:y.message}),u.dirty()):y.kind==="time"?Qs(y).test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{code:j.invalid_string,validation:"time",message:y.message}),u.dirty()):y.kind==="duration"?$s.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"duration",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="ip"?ei(e.data,y.version)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"ip",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="jwt"?ti(e.data,y.alg)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"jwt",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="cidr"?ri(e.data,y.version)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"cidr",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="base64"?Ys.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"base64",code:j.invalid_string,message:y.message}),u.dirty()):y.kind==="base64url"?Js.test(e.data)||(m=this._getOrReturnCtx(e,m),q(m,{validation:"base64url",code:j.invalid_string,message:y.message}),u.dirty()):ne.assertNever(y);return{status:u.value,value:e.data}}_regex(e,a,u){return this.refinement(m=>e.test(m),{validation:a,code:j.invalid_string,...Y.errToObj(u)})}_addCheck(e){return new ge({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Y.errToObj(e)})}datetime(e){var a,u;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(a=e==null?void 0:e.offset)!==null&&a!==void 0?a:!1,local:(u=e==null?void 0:e.local)!==null&&u!==void 0?u:!1,...Y.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Y.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Y.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...Y.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a==null?void 0:a.position,...Y.errToObj(a==null?void 0:a.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...Y.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...Y.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...Y.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...Y.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...Y.errToObj(a)})}nonempty(e){return this.min(1,Y.errToObj(e))}trim(){return new ge({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ge({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}ge.create=h=>{var e;return new ge({checks:[],typeName:X.ZodString,coerce:(e=h==null?void 0:h.coerce)!==null&&e!==void 0?e:!1,...re(h)})};function si(h,e){const a=(h.toString().split(".")[1]||"").length,u=(e.toString().split(".")[1]||"").length,m=a>u?a:u,y=parseInt(h.toFixed(m).replace(".","")),k=parseInt(e.toFixed(m).replace(".",""));return y%k/Math.pow(10,m)}class De extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==K.number){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_type,expected:K.number,received:y.parsedType}),Q}let u;const m=new le;for(const y of this._def.checks)y.kind==="int"?ne.isInteger(e.data)||(u=this._getOrReturnCtx(e,u),q(u,{code:j.invalid_type,expected:"integer",received:"float",message:y.message}),m.dirty()):y.kind==="min"?(y.inclusive?e.data<y.value:e.data<=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_small,minimum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),m.dirty()):y.kind==="max"?(y.inclusive?e.data>y.value:e.data>=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_big,maximum:y.value,type:"number",inclusive:y.inclusive,exact:!1,message:y.message}),m.dirty()):y.kind==="multipleOf"?si(e.data,y.value)!==0&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.not_multiple_of,multipleOf:y.value,message:y.message}),m.dirty()):y.kind==="finite"?Number.isFinite(e.data)||(u=this._getOrReturnCtx(e,u),q(u,{code:j.not_finite,message:y.message}),m.dirty()):ne.assertNever(y);return{status:m.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,Y.toString(a))}gt(e,a){return this.setLimit("min",e,!1,Y.toString(a))}lte(e,a){return this.setLimit("max",e,!0,Y.toString(a))}lt(e,a){return this.setLimit("max",e,!1,Y.toString(a))}setLimit(e,a,u,m){return new De({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:u,message:Y.toString(m)}]})}_addCheck(e){return new De({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Y.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:Y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Y.toString(e)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ne.isInteger(e.value))}get isFinite(){let e=null,a=null;for(const u of this._def.checks){if(u.kind==="finite"||u.kind==="int"||u.kind==="multipleOf")return!0;u.kind==="min"?(a===null||u.value>a)&&(a=u.value):u.kind==="max"&&(e===null||u.value<e)&&(e=u.value)}return Number.isFinite(a)&&Number.isFinite(e)}}De.create=h=>new De({checks:[],typeName:X.ZodNumber,coerce:(h==null?void 0:h.coerce)||!1,...re(h)});class Te extends se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==K.bigint)return this._getInvalidInput(e);let u;const m=new le;for(const y of this._def.checks)y.kind==="min"?(y.inclusive?e.data<y.value:e.data<=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_small,type:"bigint",minimum:y.value,inclusive:y.inclusive,message:y.message}),m.dirty()):y.kind==="max"?(y.inclusive?e.data>y.value:e.data>=y.value)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.too_big,type:"bigint",maximum:y.value,inclusive:y.inclusive,message:y.message}),m.dirty()):y.kind==="multipleOf"?e.data%y.value!==BigInt(0)&&(u=this._getOrReturnCtx(e,u),q(u,{code:j.not_multiple_of,multipleOf:y.value,message:y.message}),m.dirty()):ne.assertNever(y);return{status:m.value,value:e.data}}_getInvalidInput(e){const a=this._getOrReturnCtx(e);return q(a,{code:j.invalid_type,expected:K.bigint,received:a.parsedType}),Q}gte(e,a){return this.setLimit("min",e,!0,Y.toString(a))}gt(e,a){return this.setLimit("min",e,!1,Y.toString(a))}lte(e,a){return this.setLimit("max",e,!0,Y.toString(a))}lt(e,a){return this.setLimit("max",e,!1,Y.toString(a))}setLimit(e,a,u,m){return new Te({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:u,message:Y.toString(m)}]})}_addCheck(e){return new Te({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Y.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:Y.toString(a)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}Te.create=h=>{var e;return new Te({checks:[],typeName:X.ZodBigInt,coerce:(e=h==null?void 0:h.coerce)!==null&&e!==void 0?e:!1,...re(h)})};class Qe extends se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==K.boolean){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.boolean,received:u.parsedType}),Q}return de(e.data)}}Qe.create=h=>new Qe({typeName:X.ZodBoolean,coerce:(h==null?void 0:h.coerce)||!1,...re(h)});class Ie extends se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==K.date){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_type,expected:K.date,received:y.parsedType}),Q}if(isNaN(e.data.getTime())){const y=this._getOrReturnCtx(e);return q(y,{code:j.invalid_date}),Q}const u=new le;let m;for(const y of this._def.checks)y.kind==="min"?e.data.getTime()<y.value&&(m=this._getOrReturnCtx(e,m),q(m,{code:j.too_small,message:y.message,inclusive:!0,exact:!1,minimum:y.value,type:"date"}),u.dirty()):y.kind==="max"?e.data.getTime()>y.value&&(m=this._getOrReturnCtx(e,m),q(m,{code:j.too_big,message:y.message,inclusive:!0,exact:!1,maximum:y.value,type:"date"}),u.dirty()):ne.assertNever(y);return{status:u.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:Y.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:Y.toString(a)})}get minDate(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e!=null?new Date(e):null}}Ie.create=h=>new Ie({checks:[],coerce:(h==null?void 0:h.coerce)||!1,typeName:X.ZodDate,...re(h)});class Ct extends se{_parse(e){if(this._getType(e)!==K.symbol){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.symbol,received:u.parsedType}),Q}return de(e.data)}}Ct.create=h=>new Ct({typeName:X.ZodSymbol,...re(h)});class et extends se{_parse(e){if(this._getType(e)!==K.undefined){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.undefined,received:u.parsedType}),Q}return de(e.data)}}et.create=h=>new et({typeName:X.ZodUndefined,...re(h)});class tt extends se{_parse(e){if(this._getType(e)!==K.null){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.null,received:u.parsedType}),Q}return de(e.data)}}tt.create=h=>new tt({typeName:X.ZodNull,...re(h)});class je extends se{constructor(){super(...arguments),this._any=!0}_parse(e){return de(e.data)}}je.create=h=>new je({typeName:X.ZodAny,...re(h)});class Oe extends se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return de(e.data)}}Oe.create=h=>new Oe({typeName:X.ZodUnknown,...re(h)});class ke extends se{_parse(e){const a=this._getOrReturnCtx(e);return q(a,{code:j.invalid_type,expected:K.never,received:a.parsedType}),Q}}ke.create=h=>new ke({typeName:X.ZodNever,...re(h)});class wt extends se{_parse(e){if(this._getType(e)!==K.undefined){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.void,received:u.parsedType}),Q}return de(e.data)}}wt.create=h=>new wt({typeName:X.ZodVoid,...re(h)});class ve extends se{_parse(e){const{ctx:a,status:u}=this._processInputParams(e),m=this._def;if(a.parsedType!==K.array)return q(a,{code:j.invalid_type,expected:K.array,received:a.parsedType}),Q;if(m.exactLength!==null){const k=a.data.length>m.exactLength.value,t=a.data.length<m.exactLength.value;(k||t)&&(q(a,{code:k?j.too_big:j.too_small,minimum:t?m.exactLength.value:void 0,maximum:k?m.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:m.exactLength.message}),u.dirty())}if(m.minLength!==null&&a.data.length<m.minLength.value&&(q(a,{code:j.too_small,minimum:m.minLength.value,type:"array",inclusive:!0,exact:!1,message:m.minLength.message}),u.dirty()),m.maxLength!==null&&a.data.length>m.maxLength.value&&(q(a,{code:j.too_big,maximum:m.maxLength.value,type:"array",inclusive:!0,exact:!1,message:m.maxLength.message}),u.dirty()),a.common.async)return Promise.all([...a.data].map((k,t)=>m.type._parseAsync(new ye(a,k,a.path,t)))).then(k=>le.mergeArray(u,k));const y=[...a.data].map((k,t)=>m.type._parseSync(new ye(a,k,a.path,t)));return le.mergeArray(u,y)}get element(){return this._def.type}min(e,a){return new ve({...this._def,minLength:{value:e,message:Y.toString(a)}})}max(e,a){return new ve({...this._def,maxLength:{value:e,message:Y.toString(a)}})}length(e,a){return new ve({...this._def,exactLength:{value:e,message:Y.toString(a)}})}nonempty(e){return this.min(1,e)}}ve.create=(h,e)=>new ve({type:h,minLength:null,maxLength:null,exactLength:null,typeName:X.ZodArray,...re(e)});function He(h){if(h instanceof ae){const e={};for(const a in h.shape){const u=h.shape[a];e[a]=Se.create(He(u))}return new ae({...h._def,shape:()=>e})}else return h instanceof ve?new ve({...h._def,type:He(h.element)}):h instanceof Se?Se.create(He(h.unwrap())):h instanceof Be?Be.create(He(h.unwrap())):h instanceof Ce?Ce.create(h.items.map(e=>He(e))):h}class ae extends se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),a=ne.objectKeys(e);return this._cached={shape:e,keys:a}}_parse(e){if(this._getType(e)!==K.object){const l=this._getOrReturnCtx(e);return q(l,{code:j.invalid_type,expected:K.object,received:l.parsedType}),Q}const{status:u,ctx:m}=this._processInputParams(e),{shape:y,keys:k}=this._getCached(),t=[];if(!(this._def.catchall instanceof ke&&this._def.unknownKeys==="strip"))for(const l in m.data)k.includes(l)||t.push(l);const o=[];for(const l of k){const _=y[l],c=m.data[l];o.push({key:{status:"valid",value:l},value:_._parse(new ye(m,c,m.path,l)),alwaysSet:l in m.data})}if(this._def.catchall instanceof ke){const l=this._def.unknownKeys;if(l==="passthrough")for(const _ of t)o.push({key:{status:"valid",value:_},value:{status:"valid",value:m.data[_]}});else if(l==="strict")t.length>0&&(q(m,{code:j.unrecognized_keys,keys:t}),u.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const _ of t){const c=m.data[_];o.push({key:{status:"valid",value:_},value:l._parse(new ye(m,c,m.path,_)),alwaysSet:_ in m.data})}}return m.common.async?Promise.resolve().then(async()=>{const l=[];for(const _ of o){const c=await _.key,p=await _.value;l.push({key:c,value:p,alwaysSet:_.alwaysSet})}return l}).then(l=>le.mergeObjectSync(u,l)):le.mergeObjectSync(u,o)}get shape(){return this._def.shape()}strict(e){return Y.errToObj,new ae({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,u)=>{var m,y,k,t;const o=(k=(y=(m=this._def).errorMap)===null||y===void 0?void 0:y.call(m,a,u).message)!==null&&k!==void 0?k:u.defaultError;return a.code==="unrecognized_keys"?{message:(t=Y.errToObj(e).message)!==null&&t!==void 0?t:o}:{message:o}}}:{}})}strip(){return new ae({...this._def,unknownKeys:"strip"})}passthrough(){return new ae({...this._def,unknownKeys:"passthrough"})}extend(e){return new ae({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ae({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:X.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new ae({...this._def,catchall:e})}pick(e){const a={};return ne.objectKeys(e).forEach(u=>{e[u]&&this.shape[u]&&(a[u]=this.shape[u])}),new ae({...this._def,shape:()=>a})}omit(e){const a={};return ne.objectKeys(this.shape).forEach(u=>{e[u]||(a[u]=this.shape[u])}),new ae({...this._def,shape:()=>a})}deepPartial(){return He(this)}partial(e){const a={};return ne.objectKeys(this.shape).forEach(u=>{const m=this.shape[u];e&&!e[u]?a[u]=m:a[u]=m.optional()}),new ae({...this._def,shape:()=>a})}required(e){const a={};return ne.objectKeys(this.shape).forEach(u=>{if(e&&!e[u])a[u]=this.shape[u];else{let y=this.shape[u];for(;y instanceof Se;)y=y._def.innerType;a[u]=y}}),new ae({...this._def,shape:()=>a})}keyof(){return Er(ne.objectKeys(this.shape))}}ae.create=(h,e)=>new ae({shape:()=>h,unknownKeys:"strip",catchall:ke.create(),typeName:X.ZodObject,...re(e)});ae.strictCreate=(h,e)=>new ae({shape:()=>h,unknownKeys:"strict",catchall:ke.create(),typeName:X.ZodObject,...re(e)});ae.lazycreate=(h,e)=>new ae({shape:h,unknownKeys:"strip",catchall:ke.create(),typeName:X.ZodObject,...re(e)});class rt extends se{_parse(e){const{ctx:a}=this._processInputParams(e),u=this._def.options;function m(y){for(const t of y)if(t.result.status==="valid")return t.result;for(const t of y)if(t.result.status==="dirty")return a.common.issues.push(...t.ctx.common.issues),t.result;const k=y.map(t=>new fe(t.ctx.common.issues));return q(a,{code:j.invalid_union,unionErrors:k}),Q}if(a.common.async)return Promise.all(u.map(async y=>{const k={...a,common:{...a.common,issues:[]},parent:null};return{result:await y._parseAsync({data:a.data,path:a.path,parent:k}),ctx:k}})).then(m);{let y;const k=[];for(const o of u){const l={...a,common:{...a.common,issues:[]},parent:null},_=o._parseSync({data:a.data,path:a.path,parent:l});if(_.status==="valid")return _;_.status==="dirty"&&!y&&(y={result:_,ctx:l}),l.common.issues.length&&k.push(l.common.issues)}if(y)return a.common.issues.push(...y.ctx.common.issues),y.result;const t=k.map(o=>new fe(o));return q(a,{code:j.invalid_union,unionErrors:t}),Q}}get options(){return this._def.options}}rt.create=(h,e)=>new rt({options:h,typeName:X.ZodUnion,...re(e)});const we=h=>h instanceof nt?we(h.schema):h instanceof me?we(h.innerType()):h instanceof ot?[h.value]:h instanceof Ae?h.options:h instanceof at?ne.objectValues(h.enum):h instanceof ct?we(h._def.innerType):h instanceof et?[void 0]:h instanceof tt?[null]:h instanceof Se?[void 0,...we(h.unwrap())]:h instanceof Be?[null,...we(h.unwrap())]:h instanceof zt||h instanceof lt?we(h.unwrap()):h instanceof ht?we(h._def.innerType):[];class kt extends se{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.object)return q(a,{code:j.invalid_type,expected:K.object,received:a.parsedType}),Q;const u=this.discriminator,m=a.data[u],y=this.optionsMap.get(m);return y?a.common.async?y._parseAsync({data:a.data,path:a.path,parent:a}):y._parseSync({data:a.data,path:a.path,parent:a}):(q(a,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[u]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,u){const m=new Map;for(const y of a){const k=we(y.shape[e]);if(!k.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const t of k){if(m.has(t))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(t)}`);m.set(t,y)}}return new kt({typeName:X.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:m,...re(u)})}}function jt(h,e){const a=xe(h),u=xe(e);if(h===e)return{valid:!0,data:h};if(a===K.object&&u===K.object){const m=ne.objectKeys(e),y=ne.objectKeys(h).filter(t=>m.indexOf(t)!==-1),k={...h,...e};for(const t of y){const o=jt(h[t],e[t]);if(!o.valid)return{valid:!1};k[t]=o.data}return{valid:!0,data:k}}else if(a===K.array&&u===K.array){if(h.length!==e.length)return{valid:!1};const m=[];for(let y=0;y<h.length;y++){const k=h[y],t=e[y],o=jt(k,t);if(!o.valid)return{valid:!1};m.push(o.data)}return{valid:!0,data:m}}else return a===K.date&&u===K.date&&+h==+e?{valid:!0,data:h}:{valid:!1}}class st extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e),m=(y,k)=>{if(Nt(y)||Nt(k))return Q;const t=jt(y.value,k.value);return t.valid?((Wt(y)||Wt(k))&&a.dirty(),{status:a.value,value:t.data}):(q(u,{code:j.invalid_intersection_types}),Q)};return u.common.async?Promise.all([this._def.left._parseAsync({data:u.data,path:u.path,parent:u}),this._def.right._parseAsync({data:u.data,path:u.path,parent:u})]).then(([y,k])=>m(y,k)):m(this._def.left._parseSync({data:u.data,path:u.path,parent:u}),this._def.right._parseSync({data:u.data,path:u.path,parent:u}))}}st.create=(h,e,a)=>new st({left:h,right:e,typeName:X.ZodIntersection,...re(a)});class Ce extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.array)return q(u,{code:j.invalid_type,expected:K.array,received:u.parsedType}),Q;if(u.data.length<this._def.items.length)return q(u,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&u.data.length>this._def.items.length&&(q(u,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const y=[...u.data].map((k,t)=>{const o=this._def.items[t]||this._def.rest;return o?o._parse(new ye(u,k,u.path,t)):null}).filter(k=>!!k);return u.common.async?Promise.all(y).then(k=>le.mergeArray(a,k)):le.mergeArray(a,y)}get items(){return this._def.items}rest(e){return new Ce({...this._def,rest:e})}}Ce.create=(h,e)=>{if(!Array.isArray(h))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ce({items:h,typeName:X.ZodTuple,rest:null,...re(e)})};class it extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.object)return q(u,{code:j.invalid_type,expected:K.object,received:u.parsedType}),Q;const m=[],y=this._def.keyType,k=this._def.valueType;for(const t in u.data)m.push({key:y._parse(new ye(u,t,u.path,t)),value:k._parse(new ye(u,u.data[t],u.path,t)),alwaysSet:t in u.data});return u.common.async?le.mergeObjectAsync(a,m):le.mergeObjectSync(a,m)}get element(){return this._def.valueType}static create(e,a,u){return a instanceof se?new it({keyType:e,valueType:a,typeName:X.ZodRecord,...re(u)}):new it({keyType:ge.create(),valueType:e,typeName:X.ZodRecord,...re(a)})}}class Et extends se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.map)return q(u,{code:j.invalid_type,expected:K.map,received:u.parsedType}),Q;const m=this._def.keyType,y=this._def.valueType,k=[...u.data.entries()].map(([t,o],l)=>({key:m._parse(new ye(u,t,u.path,[l,"key"])),value:y._parse(new ye(u,o,u.path,[l,"value"]))}));if(u.common.async){const t=new Map;return Promise.resolve().then(async()=>{for(const o of k){const l=await o.key,_=await o.value;if(l.status==="aborted"||_.status==="aborted")return Q;(l.status==="dirty"||_.status==="dirty")&&a.dirty(),t.set(l.value,_.value)}return{status:a.value,value:t}})}else{const t=new Map;for(const o of k){const l=o.key,_=o.value;if(l.status==="aborted"||_.status==="aborted")return Q;(l.status==="dirty"||_.status==="dirty")&&a.dirty(),t.set(l.value,_.value)}return{status:a.value,value:t}}}}Et.create=(h,e,a)=>new Et({valueType:e,keyType:h,typeName:X.ZodMap,...re(a)});class Pe extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.parsedType!==K.set)return q(u,{code:j.invalid_type,expected:K.set,received:u.parsedType}),Q;const m=this._def;m.minSize!==null&&u.data.size<m.minSize.value&&(q(u,{code:j.too_small,minimum:m.minSize.value,type:"set",inclusive:!0,exact:!1,message:m.minSize.message}),a.dirty()),m.maxSize!==null&&u.data.size>m.maxSize.value&&(q(u,{code:j.too_big,maximum:m.maxSize.value,type:"set",inclusive:!0,exact:!1,message:m.maxSize.message}),a.dirty());const y=this._def.valueType;function k(o){const l=new Set;for(const _ of o){if(_.status==="aborted")return Q;_.status==="dirty"&&a.dirty(),l.add(_.value)}return{status:a.value,value:l}}const t=[...u.data.values()].map((o,l)=>y._parse(new ye(u,o,u.path,l)));return u.common.async?Promise.all(t).then(o=>k(o)):k(t)}min(e,a){return new Pe({...this._def,minSize:{value:e,message:Y.toString(a)}})}max(e,a){return new Pe({...this._def,maxSize:{value:e,message:Y.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}Pe.create=(h,e)=>new Pe({valueType:h,minSize:null,maxSize:null,typeName:X.ZodSet,...re(e)});class Ne extends se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.function)return q(a,{code:j.invalid_type,expected:K.function,received:a.parsedType}),Q;function u(t,o){return St({data:t,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,bt(),We].filter(l=>!!l),issueData:{code:j.invalid_arguments,argumentsError:o}})}function m(t,o){return St({data:t,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,bt(),We].filter(l=>!!l),issueData:{code:j.invalid_return_type,returnTypeError:o}})}const y={errorMap:a.common.contextualErrorMap},k=a.data;if(this._def.returns instanceof Ue){const t=this;return de(async function(...o){const l=new fe([]),_=await t._def.args.parseAsync(o,y).catch(v=>{throw l.addIssue(u(o,v)),l}),c=await Reflect.apply(k,this,_);return await t._def.returns._def.type.parseAsync(c,y).catch(v=>{throw l.addIssue(m(c,v)),l})})}else{const t=this;return de(function(...o){const l=t._def.args.safeParse(o,y);if(!l.success)throw new fe([u(o,l.error)]);const _=Reflect.apply(k,this,l.data),c=t._def.returns.safeParse(_,y);if(!c.success)throw new fe([m(_,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ne({...this._def,args:Ce.create(e).rest(Oe.create())})}returns(e){return new Ne({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,a,u){return new Ne({args:e||Ce.create([]).rest(Oe.create()),returns:a||Oe.create(),typeName:X.ZodFunction,...re(u)})}}class nt extends se{get schema(){return this._def.getter()}_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}nt.create=(h,e)=>new nt({getter:h,typeName:X.ZodLazy,...re(e)});class ot extends se{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return q(a,{received:a.data,code:j.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}}ot.create=(h,e)=>new ot({value:h,typeName:X.ZodLiteral,...re(e)});function Er(h,e){return new Ae({values:h,typeName:X.ZodEnum,...re(e)})}class Ae extends se{constructor(){super(...arguments),Ge.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const a=this._getOrReturnCtx(e),u=this._def.values;return q(a,{expected:ne.joinValues(u),received:a.parsedType,code:j.invalid_type}),Q}if(yt(this,Ge)||Sr(this,Ge,new Set(this._def.values)),!yt(this,Ge).has(e.data)){const a=this._getOrReturnCtx(e),u=this._def.values;return q(a,{received:a.data,code:j.invalid_enum_value,options:u}),Q}return de(e.data)}get options(){return this._def.values}get enum(){const e={};for(const a of this._def.values)e[a]=a;return e}get Values(){const e={};for(const a of this._def.values)e[a]=a;return e}get Enum(){const e={};for(const a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return Ae.create(e,{...this._def,...a})}exclude(e,a=this._def){return Ae.create(this.options.filter(u=>!e.includes(u)),{...this._def,...a})}}Ge=new WeakMap;Ae.create=Er;class at extends se{constructor(){super(...arguments),Ye.set(this,void 0)}_parse(e){const a=ne.getValidEnumValues(this._def.values),u=this._getOrReturnCtx(e);if(u.parsedType!==K.string&&u.parsedType!==K.number){const m=ne.objectValues(a);return q(u,{expected:ne.joinValues(m),received:u.parsedType,code:j.invalid_type}),Q}if(yt(this,Ye)||Sr(this,Ye,new Set(ne.getValidEnumValues(this._def.values))),!yt(this,Ye).has(e.data)){const m=ne.objectValues(a);return q(u,{received:u.data,code:j.invalid_enum_value,options:m}),Q}return de(e.data)}get enum(){return this._def.values}}Ye=new WeakMap;at.create=(h,e)=>new at({values:h,typeName:X.ZodNativeEnum,...re(e)});class Ue extends se{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==K.promise&&a.common.async===!1)return q(a,{code:j.invalid_type,expected:K.promise,received:a.parsedType}),Q;const u=a.parsedType===K.promise?a.data:Promise.resolve(a.data);return de(u.then(m=>this._def.type.parseAsync(m,{path:a.path,errorMap:a.common.contextualErrorMap})))}}Ue.create=(h,e)=>new Ue({type:h,typeName:X.ZodPromise,...re(e)});class me extends se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===X.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:a,ctx:u}=this._processInputParams(e),m=this._def.effect||null,y={addIssue:k=>{q(u,k),k.fatal?a.abort():a.dirty()},get path(){return u.path}};if(y.addIssue=y.addIssue.bind(y),m.type==="preprocess"){const k=m.transform(u.data,y);if(u.common.async)return Promise.resolve(k).then(async t=>{if(a.value==="aborted")return Q;const o=await this._def.schema._parseAsync({data:t,path:u.path,parent:u});return o.status==="aborted"?Q:o.status==="dirty"||a.value==="dirty"?Fe(o.value):o});{if(a.value==="aborted")return Q;const t=this._def.schema._parseSync({data:k,path:u.path,parent:u});return t.status==="aborted"?Q:t.status==="dirty"||a.value==="dirty"?Fe(t.value):t}}if(m.type==="refinement"){const k=t=>{const o=m.refinement(t,y);if(u.common.async)return Promise.resolve(o);if(o instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return t};if(u.common.async===!1){const t=this._def.schema._parseSync({data:u.data,path:u.path,parent:u});return t.status==="aborted"?Q:(t.status==="dirty"&&a.dirty(),k(t.value),{status:a.value,value:t.value})}else return this._def.schema._parseAsync({data:u.data,path:u.path,parent:u}).then(t=>t.status==="aborted"?Q:(t.status==="dirty"&&a.dirty(),k(t.value).then(()=>({status:a.value,value:t.value}))))}if(m.type==="transform")if(u.common.async===!1){const k=this._def.schema._parseSync({data:u.data,path:u.path,parent:u});if(!Me(k))return k;const t=m.transform(k.value,y);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:t}}else return this._def.schema._parseAsync({data:u.data,path:u.path,parent:u}).then(k=>Me(k)?Promise.resolve(m.transform(k.value,y)).then(t=>({status:a.value,value:t})):k);ne.assertNever(m)}}me.create=(h,e,a)=>new me({schema:h,typeName:X.ZodEffects,effect:e,...re(a)});me.createWithPreprocess=(h,e,a)=>new me({schema:e,effect:{type:"preprocess",transform:h},typeName:X.ZodEffects,...re(a)});class Se extends se{_parse(e){return this._getType(e)===K.undefined?de(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Se.create=(h,e)=>new Se({innerType:h,typeName:X.ZodOptional,...re(e)});class Be extends se{_parse(e){return this._getType(e)===K.null?de(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Be.create=(h,e)=>new Be({innerType:h,typeName:X.ZodNullable,...re(e)});class ct extends se{_parse(e){const{ctx:a}=this._processInputParams(e);let u=a.data;return a.parsedType===K.undefined&&(u=this._def.defaultValue()),this._def.innerType._parse({data:u,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}ct.create=(h,e)=>new ct({innerType:h,typeName:X.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...re(e)});class ht extends se{_parse(e){const{ctx:a}=this._processInputParams(e),u={...a,common:{...a.common,issues:[]}},m=this._def.innerType._parse({data:u.data,path:u.path,parent:{...u}});return Xe(m)?m.then(y=>({status:"valid",value:y.status==="valid"?y.value:this._def.catchValue({get error(){return new fe(u.common.issues)},input:u.data})})):{status:"valid",value:m.status==="valid"?m.value:this._def.catchValue({get error(){return new fe(u.common.issues)},input:u.data})}}removeCatch(){return this._def.innerType}}ht.create=(h,e)=>new ht({innerType:h,typeName:X.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...re(e)});class xt extends se{_parse(e){if(this._getType(e)!==K.nan){const u=this._getOrReturnCtx(e);return q(u,{code:j.invalid_type,expected:K.nan,received:u.parsedType}),Q}return{status:"valid",value:e.data}}}xt.create=h=>new xt({typeName:X.ZodNaN,...re(h)});const ii=Symbol("zod_brand");class zt extends se{_parse(e){const{ctx:a}=this._processInputParams(e),u=a.data;return this._def.type._parse({data:u,path:a.path,parent:a})}unwrap(){return this._def.type}}class dt extends se{_parse(e){const{status:a,ctx:u}=this._processInputParams(e);if(u.common.async)return(async()=>{const y=await this._def.in._parseAsync({data:u.data,path:u.path,parent:u});return y.status==="aborted"?Q:y.status==="dirty"?(a.dirty(),Fe(y.value)):this._def.out._parseAsync({data:y.value,path:u.path,parent:u})})();{const m=this._def.in._parseSync({data:u.data,path:u.path,parent:u});return m.status==="aborted"?Q:m.status==="dirty"?(a.dirty(),{status:"dirty",value:m.value}):this._def.out._parseSync({data:m.value,path:u.path,parent:u})}}static create(e,a){return new dt({in:e,out:a,typeName:X.ZodPipeline})}}class lt extends se{_parse(e){const a=this._def.innerType._parse(e),u=m=>(Me(m)&&(m.value=Object.freeze(m.value)),m);return Xe(a)?a.then(m=>u(m)):u(a)}unwrap(){return this._def.innerType}}lt.create=(h,e)=>new lt({innerType:h,typeName:X.ZodReadonly,...re(e)});function xr(h,e={},a){return h?je.create().superRefine((u,m)=>{var y,k;if(!h(u)){const t=typeof e=="function"?e(u):typeof e=="string"?{message:e}:e,o=(k=(y=t.fatal)!==null&&y!==void 0?y:a)!==null&&k!==void 0?k:!0,l=typeof t=="string"?{message:t}:t;m.addIssue({code:"custom",...l,fatal:o})}}):je.create()}const ni={object:ae.lazycreate};var X;(function(h){h.ZodString="ZodString",h.ZodNumber="ZodNumber",h.ZodNaN="ZodNaN",h.ZodBigInt="ZodBigInt",h.ZodBoolean="ZodBoolean",h.ZodDate="ZodDate",h.ZodSymbol="ZodSymbol",h.ZodUndefined="ZodUndefined",h.ZodNull="ZodNull",h.ZodAny="ZodAny",h.ZodUnknown="ZodUnknown",h.ZodNever="ZodNever",h.ZodVoid="ZodVoid",h.ZodArray="ZodArray",h.ZodObject="ZodObject",h.ZodUnion="ZodUnion",h.ZodDiscriminatedUnion="ZodDiscriminatedUnion",h.ZodIntersection="ZodIntersection",h.ZodTuple="ZodTuple",h.ZodRecord="ZodRecord",h.ZodMap="ZodMap",h.ZodSet="ZodSet",h.ZodFunction="ZodFunction",h.ZodLazy="ZodLazy",h.ZodLiteral="ZodLiteral",h.ZodEnum="ZodEnum",h.ZodEffects="ZodEffects",h.ZodNativeEnum="ZodNativeEnum",h.ZodOptional="ZodOptional",h.ZodNullable="ZodNullable",h.ZodDefault="ZodDefault",h.ZodCatch="ZodCatch",h.ZodPromise="ZodPromise",h.ZodBranded="ZodBranded",h.ZodPipeline="ZodPipeline",h.ZodReadonly="ZodReadonly"})(X||(X={}));const oi=(h,e={message:`Input not instance of ${h.name}`})=>xr(a=>a instanceof h,e),kr=ge.create,Rr=De.create,ai=xt.create,ci=Te.create,Lr=Qe.create,hi=Ie.create,li=Ct.create,di=et.create,ui=tt.create,fi=je.create,_i=Oe.create,pi=ke.create,gi=wt.create,vi=ve.create,mi=ae.create,bi=ae.strictCreate,Si=rt.create,yi=kt.create,Ci=st.create,wi=Ce.create,Ei=it.create,xi=Et.create,ki=Pe.create,Ri=Ne.create,Li=nt.create,Di=ot.create,Ti=Ae.create,Ai=at.create,Bi=Ue.create,tr=me.create,Oi=Se.create,Mi=Be.create,Ii=me.createWithPreprocess,Pi=dt.create,Hi=()=>kr().optional(),Fi=()=>Rr().optional(),Ni=()=>Lr().optional(),Wi={string:h=>ge.create({...h,coerce:!0}),number:h=>De.create({...h,coerce:!0}),boolean:h=>Qe.create({...h,coerce:!0}),bigint:h=>Te.create({...h,coerce:!0}),date:h=>Ie.create({...h,coerce:!0})},ji=Q;var Ui=Object.freeze({__proto__:null,defaultErrorMap:We,setErrorMap:Is,getErrorMap:bt,makeIssue:St,EMPTY_PATH:Ps,addIssueToContext:q,ParseStatus:le,INVALID:Q,DIRTY:Fe,OK:de,isAborted:Nt,isDirty:Wt,isValid:Me,isAsync:Xe,get util(){return ne},get objectUtil(){return Ft},ZodParsedType:K,getParsedType:xe,ZodType:se,datetimeRegex:wr,ZodString:ge,ZodNumber:De,ZodBigInt:Te,ZodBoolean:Qe,ZodDate:Ie,ZodSymbol:Ct,ZodUndefined:et,ZodNull:tt,ZodAny:je,ZodUnknown:Oe,ZodNever:ke,ZodVoid:wt,ZodArray:ve,ZodObject:ae,ZodUnion:rt,ZodDiscriminatedUnion:kt,ZodIntersection:st,ZodTuple:Ce,ZodRecord:it,ZodMap:Et,ZodSet:Pe,ZodFunction:Ne,ZodLazy:nt,ZodLiteral:ot,ZodEnum:Ae,ZodNativeEnum:at,ZodPromise:Ue,ZodEffects:me,ZodTransformer:me,ZodOptional:Se,ZodNullable:Be,ZodDefault:ct,ZodCatch:ht,ZodNaN:xt,BRAND:ii,ZodBranded:zt,ZodPipeline:dt,ZodReadonly:lt,custom:xr,Schema:se,ZodSchema:se,late:ni,get ZodFirstPartyTypeKind(){return X},coerce:Wi,any:fi,array:vi,bigint:ci,boolean:Lr,date:hi,discriminatedUnion:yi,effect:tr,enum:Ti,function:Ri,instanceof:oi,intersection:Ci,lazy:Li,literal:Di,map:xi,nan:ai,nativeEnum:Ai,never:pi,null:ui,nullable:Mi,number:Rr,object:mi,oboolean:Ni,onumber:Fi,optional:Oi,ostring:Hi,pipeline:Pi,preprocess:Ii,promise:Bi,record:Ei,set:ki,strictObject:bi,string:kr,symbol:li,transformer:tr,tuple:wi,undefined:di,union:Si,unknown:_i,void:gi,NEVER:ji,ZodIssueCode:j,quotelessJson:Ms,ZodError:fe});function $i(h){const e=/\x1b\[<(\d+);(\d+);(\d+)([mM])/.exec(h);if(!e)return;if(!e[1]||!e[2]||!e[3]||!e[4])throw new Error(`Mouse event: Invalid match for data ${h}`);const a=parseInt(e[1],10),u=parseInt(e[2],10),m=parseInt(e[3],10),y=e[4]==="m";return console.log(`Mouse event: buttonCode=${a}, column=${u}, row=${m}, isRelease=${y}`),h}function zi(h,e){const a=new Os.Terminal({cursorBlink:!1,convertEol:!0,fontSize:13}),u=vr.macchiato.colors;a.options.theme={background:u.base.hex,black:u.crust.hex,brightBlack:u.surface2.hex,blue:u.blue.hex,brightBlue:u.blue.hex,brightCyan:u.sky.hex,brightRed:u.maroon.hex,brightYellow:u.yellow.hex,cursor:u.text.hex,cyan:u.sky.hex,foreground:u.text.hex,green:u.green.hex,magenta:u.lavender.hex,red:u.red.hex,white:u.text.hex,yellow:u.yellow.hex};const m=new As.FitAddon;return a.loadAddon(m),a.open(h),m.fit(),window.addEventListener("resize",()=>{m.fit()}),a.onData(y=>{if(typeof y!="string")throw new Error(`unexpected onData message type: '${JSON.stringify(y)}'`);const k=$i(y);k&&e.onMouseEvent(k)}),a.onKey(y=>{e.onKeyPress(y)}),a}function qi(){let h=Ui.string().safeParse(sessionStorage.getItem("tabId")).data;return h||(h=Math.random().toString(36),sessionStorage.setItem("tabId",h)),{tabId:h}}class Vi{constructor(e){Ke(this,"ready");Ke(this,"tabId");Ke(this,"terminal");Ke(this,"trpc");const a=hs({links:[ws({condition:y=>y.type==="subscription",true:Rs({url:"/trpc"}),false:Cs({url:"/trpc"})})]});this.trpc=a,this.tabId=qi();const u=this.tabId,m=zi(e,{onMouseEvent(y){a.neovim.sendStdin.mutate({tabId:u,data:y}).catch(k=>{console.error("Error sending mouse event",k)})},onKeyPress(y){a.neovim.sendStdin.mutate({tabId:u,data:y.key})}});this.terminal=m,this.ready=new Promise(y=>{console.log("Subscribing to Neovim stdout"),a.neovim.onStdout.subscribe({client:u},{onStarted(){y()},onData(k){m.write(k)},onError(k){console.error("Error from Neovim",k)}})})}async startNeovim(e){return await this.ready,await this.trpc.neovim.start.mutate({startNeovimArguments:{filename:e.filename,additionalEnvironmentVariables:e.additionalEnvironmentVariables,startupScriptModifications:e.startupScriptModifications,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}},tabId:this.tabId})}async runBlockingShellCommand(e){return await this.ready,this.trpc.neovim.runBlockingShellCommand.mutate({...e,tabId:this.tabId})}async runLuaCode(e){return await this.ready,this.trpc.neovim.runLuaCode.mutate({...e,tabId:this.tabId})}async runExCommand(e){return await this.ready,this.trpc.neovim.runExCommand.mutate({...e,tabId:this.tabId})}}const Dr=document.querySelector("#app");if(!Dr)throw new Error("No app element found");const vt=new Vi(Dr);window.startNeovim=async function(h){const e=await vt.startNeovim({additionalEnvironmentVariables:h==null?void 0:h.additionalEnvironmentVariables,filename:(h==null?void 0:h.filename)??"initial-file.txt",startupScriptModifications:(h==null?void 0:h.startupScriptModifications)??[]});return{runBlockingShellCommand(u){return vt.runBlockingShellCommand(u)},runLuaCode(u){return vt.runLuaCode(u)},runExCommand(u){return vt.runExCommand(u)},dir:e}};