wmdev 0.2.2 → 0.3.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,25 +0,0 @@
1
- var Wn=Object.defineProperty;var cs=r=>{throw TypeError(r)};var Nn=(r,l,v)=>l in r?Wn(r,l,{enumerable:!0,configurable:!0,writable:!0,value:v}):r[l]=v;var vt=(r,l,v)=>Nn(r,typeof l!="symbol"?l+"":l,v),Si=(r,l,v)=>l.has(r)||cs("Cannot "+v);var F=(r,l,v)=>(Si(r,l,"read from private field"),v?v.call(r):l.get(r)),ae=(r,l,v)=>l.has(r)?cs("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(r):l.set(r,v),he=(r,l,v,C)=>(Si(r,l,"write to private field"),C?C.call(r,v):l.set(r,v),v),we=(r,l,v)=>(Si(r,l,"access private method"),v);(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const w of document.querySelectorAll('link[rel="modulepreload"]'))C(w);new MutationObserver(w=>{for(const k of w)if(k.type==="childList")for(const x of k.addedNodes)x.tagName==="LINK"&&x.rel==="modulepreload"&&C(x)}).observe(document,{childList:!0,subtree:!0});function v(w){const k={};return w.integrity&&(k.integrity=w.integrity),w.referrerPolicy&&(k.referrerPolicy=w.referrerPolicy),w.crossOrigin==="use-credentials"?k.credentials="include":w.crossOrigin==="anonymous"?k.credentials="omit":k.credentials="same-origin",k}function C(w){if(w.ep)return;w.ep=!0;const k=v(w);fetch(w.href,k)}})();const Un="5";var Bs;typeof window<"u"&&((Bs=window.__svelte??(window.__svelte={})).v??(Bs.v=new Set)).add(Un);const $n=1,jn=2,Os=4,zn=8,Kn=16,qn=1,Vn=4,Gn=8,Xn=16,Jn=1,Yn=2,ke=Symbol(),Ps="http://www.w3.org/1999/xhtml",Zn="@attach",Di=!1;var Gi=Array.isArray,Qn=Array.prototype.indexOf,wr=Array.prototype.includes,ci=Array.from,eo=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,to=Object.getOwnPropertyDescriptors,ro=Object.prototype,io=Array.prototype,Is=Object.getPrototypeOf,hs=Object.isExtensible;const so=()=>{};function no(r){for(var l=0;l<r.length;l++)r[l]()}function Hs(){var r,l,v=new Promise((C,w)=>{r=C,l=w});return{promise:v,resolve:r,reject:l}}const Be=2,Ar=4,Nr=8,Xi=1<<24,Gt=16,dt=32,cr=64,Ri=128,tt=512,Le=1024,Te=2048,ut=4096,Ye=8192,Rt=16384,Br=32768,ar=65536,us=1<<17,oo=1<<18,Tr=1<<19,ao=1<<20,Dt=1<<25,lr=65536,Ai=1<<21,Ji=1<<22,$t=1<<23,nr=Symbol("$state"),lo=Symbol("legacy props"),co=Symbol(""),Yt=new class extends Error{constructor(){super(...arguments);vt(this,"name","StaleReactionError");vt(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var Ts;const Yi=!!((Ts=globalThis.document)!=null&&Ts.contentType)&&globalThis.document.contentType.includes("xml");function Fs(r){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function ho(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function uo(r,l,v){throw new Error("https://svelte.dev/e/each_key_duplicate")}function fo(r){throw new Error("https://svelte.dev/e/effect_in_teardown")}function _o(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function vo(r){throw new Error("https://svelte.dev/e/effect_orphan")}function po(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function go(r){throw new Error("https://svelte.dev/e/props_invalid_value")}function mo(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function So(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function bo(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Co(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function wo(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function yo(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Ws(r){return r===this.v}function Eo(r,l){return r!=r?l==l:r!==l||r!==null&&typeof r=="object"||typeof r=="function"}function Ns(r){return!Eo(r,this.v)}let xo=!1,Ke=null;function yr(r){Ke=r}function He(r,l=!1,v){Ke={p:Ke,i:!1,c:null,e:null,s:r,x:null,l:null}}function Fe(r){var l=Ke,v=l.e;if(v!==null){l.e=null;for(var C of v)ln(C)}return r!==void 0&&(l.x=r),l.i=!0,Ke=l.p,r??{}}function Us(){return!0}let Zt=[];function $s(){var r=Zt;Zt=[],no(r)}function bt(r){if(Zt.length===0&&!Wr){var l=Zt;queueMicrotask(()=>{l===Zt&&$s()})}Zt.push(r)}function ko(){for(;Zt.length>0;)$s()}function js(r){var l=pe;if(l===null)return fe.f|=$t,r;if((l.f&Br)===0&&(l.f&Ar)===0)throw r;Ut(r,l)}function Ut(r,l){for(;l!==null;){if((l.f&Ri)!==0){if((l.f&Br)===0)throw r;try{l.b.error(r);return}catch(v){r=v}}l=l.parent}throw r}const Lo=-7169;function ye(r,l){r.f=r.f&Lo|l}function Zi(r){(r.f&tt)!==0||r.deps===null?ye(r,Le):ye(r,ut)}function zs(r){if(r!==null)for(const l of r)(l.f&Be)===0||(l.f&lr)===0||(l.f^=lr,zs(l.deps))}function Ks(r,l,v){(r.f&Te)!==0?l.add(r):(r.f&ut)!==0&&v.add(r),zs(r.deps),ye(r,Le)}const Yr=new Set;let ue=null,Bi=null,De=null,Ne=[],hi=null,Wr=!1,Er=null;var Ht,fr,tr,_r,vr,pr,Ft,pt,gr,qe,Ti,Mi,Oi,Pi;const ls=class ls{constructor(){ae(this,qe);vt(this,"current",new Map);vt(this,"previous",new Map);ae(this,Ht,new Set);ae(this,fr,new Set);ae(this,tr,0);ae(this,_r,0);ae(this,vr,null);ae(this,pr,new Set);ae(this,Ft,new Set);ae(this,pt,new Map);vt(this,"is_fork",!1);ae(this,gr,!1)}skip_effect(l){F(this,pt).has(l)||F(this,pt).set(l,{d:[],m:[]})}unskip_effect(l){var v=F(this,pt).get(l);if(v){F(this,pt).delete(l);for(var C of v.d)ye(C,Te),ct(C);for(C of v.m)ye(C,ut),ct(C)}}process(l){var w;Ne=[],this.apply();var v=Er=[],C=[];for(const k of l)we(this,qe,Mi).call(this,k,v,C);if(Er=null,we(this,qe,Ti).call(this)){we(this,qe,Oi).call(this,C),we(this,qe,Oi).call(this,v);for(const[k,x]of F(this,pt))Xs(k,x)}else{Bi=this,ue=null;for(const k of F(this,Ht))k(this);F(this,Ht).clear(),F(this,tr)===0&&we(this,qe,Pi).call(this),ds(C),ds(v),F(this,pr).clear(),F(this,Ft).clear(),Bi=null,(w=F(this,vr))==null||w.resolve()}De=null}capture(l,v){v!==ke&&!this.previous.has(l)&&this.previous.set(l,v),(l.f&$t)===0&&(this.current.set(l,l.v),De==null||De.set(l,l.v))}activate(){ue=this,this.apply()}deactivate(){ue===this&&(ue=null,De=null)}flush(){var l;if(Ne.length>0)ue=this,qs();else if(F(this,tr)===0&&!this.is_fork){for(const v of F(this,Ht))v(this);F(this,Ht).clear(),we(this,qe,Pi).call(this),(l=F(this,vr))==null||l.resolve()}this.deactivate()}discard(){for(const l of F(this,fr))l(this);F(this,fr).clear()}increment(l){he(this,tr,F(this,tr)+1),l&&he(this,_r,F(this,_r)+1)}decrement(l){he(this,tr,F(this,tr)-1),l&&he(this,_r,F(this,_r)-1),!F(this,gr)&&(he(this,gr,!0),bt(()=>{he(this,gr,!1),we(this,qe,Ti).call(this)?Ne.length>0&&this.flush():this.revive()}))}revive(){for(const l of F(this,pr))F(this,Ft).delete(l),ye(l,Te),ct(l);for(const l of F(this,Ft))ye(l,ut),ct(l);this.flush()}oncommit(l){F(this,Ht).add(l)}ondiscard(l){F(this,fr).add(l)}settled(){return(F(this,vr)??he(this,vr,Hs())).promise}static ensure(){if(ue===null){const l=ue=new ls;Yr.add(ue),Wr||bt(()=>{ue===l&&l.flush()})}return ue}apply(){}};Ht=new WeakMap,fr=new WeakMap,tr=new WeakMap,_r=new WeakMap,vr=new WeakMap,pr=new WeakMap,Ft=new WeakMap,pt=new WeakMap,gr=new WeakMap,qe=new WeakSet,Ti=function(){return this.is_fork||F(this,_r)>0},Mi=function(l,v,C){l.f^=Le;for(var w=l.first;w!==null;){var k=w.f,x=(k&(dt|cr))!==0,n=x&&(k&Le)!==0,o=n||(k&Ye)!==0||F(this,pt).has(w);if(!o&&w.fn!==null){x?w.f^=Le:(k&Ar)!==0?v.push(w):Xr(w)&&((k&Gt)!==0&&F(this,Ft).add(w),Lr(w));var c=w.first;if(c!==null){w=c;continue}}for(;w!==null;){var f=w.next;if(f!==null){w=f;break}w=w.parent}}},Oi=function(l){for(var v=0;v<l.length;v+=1)Ks(l[v],F(this,pr),F(this,Ft))},Pi=function(){var k;if(Yr.size>1){this.previous.clear();var l=ue,v=De,C=!0;for(const x of Yr){if(x===this){C=!1;continue}const n=[];for(const[c,f]of this.current){if(x.current.has(c))if(C&&f!==x.current.get(c))x.current.set(c,f);else continue;n.push(c)}if(n.length===0)continue;const o=[...x.current.keys()].filter(c=>!this.current.has(c));if(o.length>0){var w=Ne;Ne=[];const c=new Set,f=new Map;for(const a of n)Vs(a,o,c,f);if(Ne.length>0){ue=x,x.apply();for(const a of Ne)we(k=x,qe,Mi).call(k,a,[],[]);x.deactivate()}Ne=w}}ue=l,De=v}F(this,pt).clear(),Yr.delete(this)};let jt=ls;function Do(r){var l=Wr;Wr=!0;try{for(var v;;){if(ko(),Ne.length===0&&(ue==null||ue.flush(),Ne.length===0))return hi=null,v;qs()}}finally{Wr=l}}function qs(){var r=null;try{for(var l=0;Ne.length>0;){var v=jt.ensure();if(l++>1e3){var C,w;Ro()}v.process(Ne),zt.clear()}}finally{Ne=[],hi=null,Er=null}}function Ro(){try{po()}catch(r){Ut(r,hi)}}let nt=null;function ds(r){var l=r.length;if(l!==0){for(var v=0;v<l;){var C=r[v++];if((C.f&(Rt|Ye))===0&&Xr(C)&&(nt=new Set,Lr(C),C.deps===null&&C.first===null&&C.nodes===null&&C.teardown===null&&C.ac===null&&un(C),(nt==null?void 0:nt.size)>0)){zt.clear();for(const w of nt){if((w.f&(Rt|Ye))!==0)continue;const k=[w];let x=w.parent;for(;x!==null;)nt.has(x)&&(nt.delete(x),k.push(x)),x=x.parent;for(let n=k.length-1;n>=0;n--){const o=k[n];(o.f&(Rt|Ye))===0&&Lr(o)}}nt.clear()}}nt=null}}function Vs(r,l,v,C){if(!v.has(r)&&(v.add(r),r.reactions!==null))for(const w of r.reactions){const k=w.f;(k&Be)!==0?Vs(w,l,v,C):(k&(Ji|Gt))!==0&&(k&Te)===0&&Gs(w,l,C)&&(ye(w,Te),ct(w))}}function Gs(r,l,v){const C=v.get(r);if(C!==void 0)return C;if(r.deps!==null)for(const w of r.deps){if(wr.call(l,w))return!0;if((w.f&Be)!==0&&Gs(w,l,v))return v.set(w,!0),!0}return v.set(r,!1),!1}function ct(r){var l=hi=r,v=l.b;if(v!=null&&v.is_pending&&(r.f&(Ar|Nr|Xi))!==0&&(r.f&Br)===0){v.defer_effect(r);return}for(;l.parent!==null;){l=l.parent;var C=l.f;if(Er!==null&&l===pe&&(r.f&Nr)===0)return;if((C&(cr|dt))!==0){if((C&Le)===0)return;l.f^=Le}}Ne.push(l)}function Xs(r,l){if(!((r.f&dt)!==0&&(r.f&Le)!==0)){(r.f&Te)!==0?l.d.push(r):(r.f&ut)!==0&&l.m.push(r),ye(r,Le);for(var v=r.first;v!==null;)Xs(v,l),v=v.next}}function Ao(r){let l=0,v=qt(0),C;return()=>{es()&&(B(v),fi(()=>(l===0&&(C=Xt(()=>r(()=>Kt(v)))),l+=1,()=>{bt(()=>{l-=1,l===0&&(C==null||C(),C=void 0,Kt(v))})})))}}var Bo=ar|Tr;function To(r,l,v,C){new Mo(r,l,v,C)}var et,Vi,gt,rr,We,mt,Ge,ot,kt,ir,Wt,mr,Sr,br,Lt,ni,Ee,Oo,Po,Io,Ii,ei,ti,Hi;class Mo{constructor(l,v,C,w){ae(this,Ee);vt(this,"parent");vt(this,"is_pending",!1);vt(this,"transform_error");ae(this,et);ae(this,Vi,null);ae(this,gt);ae(this,rr);ae(this,We);ae(this,mt,null);ae(this,Ge,null);ae(this,ot,null);ae(this,kt,null);ae(this,ir,0);ae(this,Wt,0);ae(this,mr,!1);ae(this,Sr,new Set);ae(this,br,new Set);ae(this,Lt,null);ae(this,ni,Ao(()=>(he(this,Lt,qt(F(this,ir))),()=>{he(this,Lt,null)})));var k;he(this,et,l),he(this,gt,v),he(this,rr,x=>{var n=pe;n.b=this,n.f|=Ri,C(x)}),this.parent=pe.b,this.transform_error=w??((k=this.parent)==null?void 0:k.transform_error)??(x=>x),he(this,We,Gr(()=>{we(this,Ee,Ii).call(this)},Bo))}defer_effect(l){Ks(l,F(this,Sr),F(this,br))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!F(this,gt).pending}update_pending_count(l){we(this,Ee,Hi).call(this,l),he(this,ir,F(this,ir)+l),!(!F(this,Lt)||F(this,mr))&&(he(this,mr,!0),bt(()=>{he(this,mr,!1),F(this,Lt)&&xr(F(this,Lt),F(this,ir))}))}get_effect_pending(){return F(this,ni).call(this),B(F(this,Lt))}error(l){var v=F(this,gt).onerror;let C=F(this,gt).failed;if(!v&&!C)throw l;F(this,mt)&&(Re(F(this,mt)),he(this,mt,null)),F(this,Ge)&&(Re(F(this,Ge)),he(this,Ge,null)),F(this,ot)&&(Re(F(this,ot)),he(this,ot,null));var w=!1,k=!1;const x=()=>{if(w){yo();return}w=!0,k&&Co(),F(this,ot)!==null&&or(F(this,ot),()=>{he(this,ot,null)}),we(this,Ee,ti).call(this,()=>{jt.ensure(),we(this,Ee,Ii).call(this)})},n=o=>{try{k=!0,v==null||v(o,x),k=!1}catch(c){Ut(c,F(this,We)&&F(this,We).parent)}C&&he(this,ot,we(this,Ee,ti).call(this,()=>{jt.ensure();try{return je(()=>{var c=pe;c.b=this,c.f|=Ri,C(F(this,et),()=>o,()=>x)})}catch(c){return Ut(c,F(this,We).parent),null}}))};bt(()=>{var o;try{o=this.transform_error(l)}catch(c){Ut(c,F(this,We)&&F(this,We).parent);return}o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(n,c=>Ut(c,F(this,We)&&F(this,We).parent)):n(o)})}}et=new WeakMap,Vi=new WeakMap,gt=new WeakMap,rr=new WeakMap,We=new WeakMap,mt=new WeakMap,Ge=new WeakMap,ot=new WeakMap,kt=new WeakMap,ir=new WeakMap,Wt=new WeakMap,mr=new WeakMap,Sr=new WeakMap,br=new WeakMap,Lt=new WeakMap,ni=new WeakMap,Ee=new WeakSet,Oo=function(){try{he(this,mt,je(()=>F(this,rr).call(this,F(this,et))))}catch(l){this.error(l)}},Po=function(l){const v=F(this,gt).failed;v&&he(this,ot,je(()=>{v(F(this,et),()=>l,()=>()=>{})}))},Io=function(){const l=F(this,gt).pending;l&&(this.is_pending=!0,he(this,Ge,je(()=>l(F(this,et)))),bt(()=>{var v=he(this,kt,document.createDocumentFragment()),C=At();v.append(C),he(this,mt,we(this,Ee,ti).call(this,()=>(jt.ensure(),je(()=>F(this,rr).call(this,C))))),F(this,Wt)===0&&(F(this,et).before(v),he(this,kt,null),or(F(this,Ge),()=>{he(this,Ge,null)}),we(this,Ee,ei).call(this))}))},Ii=function(){try{if(this.is_pending=this.has_pending_snippet(),he(this,Wt,0),he(this,ir,0),he(this,mt,je(()=>{F(this,rr).call(this,F(this,et))})),F(this,Wt)>0){var l=he(this,kt,document.createDocumentFragment());_n(F(this,mt),l);const v=F(this,gt).pending;he(this,Ge,je(()=>v(F(this,et))))}else we(this,Ee,ei).call(this)}catch(v){this.error(v)}},ei=function(){this.is_pending=!1;for(const l of F(this,Sr))ye(l,Te),ct(l);for(const l of F(this,br))ye(l,ut),ct(l);F(this,Sr).clear(),F(this,br).clear()},ti=function(l){var v=pe,C=fe,w=Ke;wt(F(this,We)),it(F(this,We)),yr(F(this,We).ctx);try{return l()}catch(k){return js(k),null}finally{wt(v),it(C),yr(w)}},Hi=function(l){var v;if(!this.has_pending_snippet()){this.parent&&we(v=this.parent,Ee,Hi).call(v,l);return}he(this,Wt,F(this,Wt)+l),F(this,Wt)===0&&(we(this,Ee,ei).call(this),F(this,Ge)&&or(F(this,Ge),()=>{he(this,Ge,null)}),F(this,kt)&&(F(this,et).before(F(this,kt)),he(this,kt,null)))};function Js(r,l,v,C){const w=ui;var k=r.filter(a=>!a.settled);if(v.length===0&&k.length===0){C(l.map(w));return}var x=pe,n=Ho(),o=k.length===1?k[0].promise:k.length>1?Promise.all(k.map(a=>a.promise)):null;function c(a){n();try{C(a)}catch(d){(x.f&Rt)===0&&Ut(d,x)}Fi()}if(v.length===0){o.then(()=>c(l.map(w)));return}function f(){n(),Promise.all(v.map(a=>Wo(a))).then(a=>c([...l.map(w),...a])).catch(a=>Ut(a,x))}o?o.then(f):f()}function Ho(){var r=pe,l=fe,v=Ke,C=ue;return function(k=!0){wt(r),it(l),yr(v),k&&(C==null||C.activate())}}function Fi(r=!0){wt(null),it(null),yr(null),r&&(ue==null||ue.deactivate())}function Fo(){var r=pe.b,l=ue,v=r.is_rendered();return r.update_pending_count(1),l.increment(v),()=>{r.update_pending_count(-1),l.decrement(v)}}function ui(r){var l=Be|Te,v=fe!==null&&(fe.f&Be)!==0?fe:null;return pe!==null&&(pe.f|=Tr),{ctx:Ke,deps:null,effects:null,equals:Ws,f:l,fn:r,reactions:null,rv:0,v:ke,wv:0,parent:v??pe,ac:null}}function Wo(r,l,v){pe===null&&ho();var w=void 0,k=qt(ke),x=!fe,n=new Map;return ea(()=>{var d;var o=Hs();w=o.promise;try{Promise.resolve(r()).then(o.resolve,o.reject).finally(Fi)}catch(p){o.reject(p),Fi()}var c=ue;if(x){var f=Fo();(d=n.get(c))==null||d.reject(Yt),n.delete(c),n.set(c,o)}const a=(p,g=void 0)=>{if(c.activate(),g)g!==Yt&&(k.f|=$t,xr(k,g));else{(k.f&$t)!==0&&(k.f^=$t),xr(k,p);for(const[u,e]of n){if(n.delete(u),u===c)break;e.reject(Yt)}}f&&f()};o.promise.then(a,p=>a(null,p||"unknown"))}),ts(()=>{for(const o of n.values())o.reject(Yt)}),new Promise(o=>{function c(f){function a(){f===w?o(k):c(w)}f.then(a,a)}c(w)})}function Ce(r){const l=ui(r);return vn(l),l}function Ys(r){const l=ui(r);return l.equals=Ns,l}function No(r){var l=r.effects;if(l!==null){r.effects=null;for(var v=0;v<l.length;v+=1)Re(l[v])}}function Uo(r){for(var l=r.parent;l!==null;){if((l.f&Be)===0)return(l.f&Rt)===0?l:null;l=l.parent}return null}function Qi(r){var l,v=pe;wt(Uo(r));try{r.f&=~lr,No(r),l=Sn(r)}finally{wt(v)}return l}function Zs(r){var l=Qi(r);if(!r.equals(l)&&(r.wv=gn(),(!(ue!=null&&ue.is_fork)||r.deps===null)&&(r.v=l,r.deps===null))){ye(r,Le);return}Vt||(De!==null?(es()||ue!=null&&ue.is_fork)&&De.set(r,l):Zi(r))}function $o(r){var l,v;if(r.effects!==null)for(const C of r.effects)(C.teardown||C.ac)&&((l=C.teardown)==null||l.call(C),(v=C.ac)==null||v.abort(Yt),C.teardown=so,C.ac=null,Ur(C,0),rs(C))}function Qs(r){if(r.effects!==null)for(const l of r.effects)l.teardown&&Lr(l)}let Wi=new Set;const zt=new Map;let en=!1;function qt(r,l){var v={f:0,v:r,reactions:null,equals:Ws,rv:0,wv:0};return v}function oe(r,l){const v=qt(r);return vn(v),v}function jo(r,l=!1,v=!0){const C=qt(r);return l||(C.equals=Ns),C}function G(r,l,v=!1){fe!==null&&(!ht||(fe.f&us)!==0)&&Us()&&(fe.f&(Be|Gt|Ji|us))!==0&&(rt===null||!wr.call(rt,r))&&bo();let C=v?ze(l):l;return xr(r,C)}function xr(r,l){if(!r.equals(l)){var v=r.v;Vt?zt.set(r,l):zt.set(r,v),r.v=l;var C=jt.ensure();if(C.capture(r,v),(r.f&Be)!==0){const w=r;(r.f&Te)!==0&&Qi(w),Zi(w)}r.wv=gn(),tn(r,Te),pe!==null&&(pe.f&Le)!==0&&(pe.f&(dt|cr))===0&&(Qe===null?ia([r]):Qe.push(r)),!C.is_fork&&Wi.size>0&&!en&&zo()}return l}function zo(){en=!1;for(const r of Wi)(r.f&Le)!==0&&ye(r,ut),Xr(r)&&Lr(r);Wi.clear()}function Kt(r){G(r,r.v+1)}function tn(r,l){var v=r.reactions;if(v!==null)for(var C=v.length,w=0;w<C;w++){var k=v[w],x=k.f,n=(x&Te)===0;if(n&&ye(k,l),(x&Be)!==0){var o=k;De==null||De.delete(o),(x&lr)===0&&(x&tt&&(k.f|=lr),tn(o,ut))}else n&&((x&Gt)!==0&&nt!==null&&nt.add(k),ct(k))}}function ze(r){if(typeof r!="object"||r===null||nr in r)return r;const l=Is(r);if(l!==ro&&l!==io)return r;var v=new Map,C=Gi(r),w=oe(0),k=Bt,x=n=>{if(Bt===k)return n();var o=fe,c=Bt;it(null),gs(k);var f=n();return it(o),gs(c),f};return C&&v.set("length",oe(r.length)),new Proxy(r,{defineProperty(n,o,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&mo();var f=v.get(o);return f===void 0?x(()=>{var a=oe(c.value);return v.set(o,a),a}):G(f,c.value,!0),!0},deleteProperty(n,o){var c=v.get(o);if(c===void 0){if(o in n){const f=x(()=>oe(ke));v.set(o,f),Kt(w)}}else G(c,ke),Kt(w);return!0},get(n,o,c){var p;if(o===nr)return r;var f=v.get(o),a=o in n;if(f===void 0&&(!a||(p=ur(n,o))!=null&&p.writable)&&(f=x(()=>{var g=ze(a?n[o]:ke),u=oe(g);return u}),v.set(o,f)),f!==void 0){var d=B(f);return d===ke?void 0:d}return Reflect.get(n,o,c)},getOwnPropertyDescriptor(n,o){var c=Reflect.getOwnPropertyDescriptor(n,o);if(c&&"value"in c){var f=v.get(o);f&&(c.value=B(f))}else if(c===void 0){var a=v.get(o),d=a==null?void 0:a.v;if(a!==void 0&&d!==ke)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return c},has(n,o){var d;if(o===nr)return!0;var c=v.get(o),f=c!==void 0&&c.v!==ke||Reflect.has(n,o);if(c!==void 0||pe!==null&&(!f||(d=ur(n,o))!=null&&d.writable)){c===void 0&&(c=x(()=>{var p=f?ze(n[o]):ke,g=oe(p);return g}),v.set(o,c));var a=B(c);if(a===ke)return!1}return f},set(n,o,c,f){var s;var a=v.get(o),d=o in n;if(C&&o==="length")for(var p=c;p<a.v;p+=1){var g=v.get(p+"");g!==void 0?G(g,ke):p in n&&(g=x(()=>oe(ke)),v.set(p+"",g))}if(a===void 0)(!d||(s=ur(n,o))!=null&&s.writable)&&(a=x(()=>oe(void 0)),G(a,ze(c)),v.set(o,a));else{d=a.v!==ke;var u=x(()=>ze(c));G(a,u)}var e=Reflect.getOwnPropertyDescriptor(n,o);if(e!=null&&e.set&&e.set.call(f,c),!d){if(C&&typeof o=="string"){var i=v.get("length"),t=Number(o);Number.isInteger(t)&&t>=i.v&&G(i,t+1)}Kt(w)}return!0},ownKeys(n){B(w);var o=Reflect.ownKeys(n).filter(a=>{var d=v.get(a);return d===void 0||d.v!==ke});for(var[c,f]of v)f.v!==ke&&!(c in n)&&o.push(c);return o},setPrototypeOf(){So()}})}function fs(r){try{if(r!==null&&typeof r=="object"&&nr in r)return r[nr]}catch{}return r}function Ko(r,l){return Object.is(fs(r),fs(l))}var _s,rn,sn,nn;function qo(){if(_s===void 0){_s=window,rn=/Firefox/.test(navigator.userAgent);var r=Element.prototype,l=Node.prototype,v=Text.prototype;sn=ur(l,"firstChild").get,nn=ur(l,"nextSibling").get,hs(r)&&(r.__click=void 0,r.__className=void 0,r.__attributes=null,r.__style=void 0,r.__e=void 0),hs(v)&&(v.__t=void 0)}}function At(r=""){return document.createTextNode(r)}function kr(r){return sn.call(r)}function qr(r){return nn.call(r)}function Q(r,l){return kr(r)}function Ie(r,l=!1){{var v=kr(r);return v instanceof Comment&&v.data===""?qr(v):v}}function Z(r,l=1,v=!1){let C=r;for(;l--;)C=qr(C);return C}function Vo(r){r.textContent=""}function on(){return!1}function Go(r,l,v){return document.createElementNS(Ps,r,void 0)}function Xo(r,l){if(l){const v=document.body;r.autofocus=!0,bt(()=>{document.activeElement===v&&r.focus()})}}let vs=!1;function Jo(){vs||(vs=!0,document.addEventListener("reset",r=>{Promise.resolve().then(()=>{var l;if(!r.defaultPrevented)for(const v of r.target.elements)(l=v.__on_r)==null||l.call(v)})},{capture:!0}))}function di(r){var l=fe,v=pe;it(null),wt(null);try{return r()}finally{it(l),wt(v)}}function an(r,l,v,C=v){r.addEventListener(l,()=>di(v));const w=r.__on_r;w?r.__on_r=()=>{w(),C(!0)}:r.__on_r=()=>C(!0),Jo()}function Yo(r){pe===null&&(fe===null&&vo(),_o()),Vt&&fo()}function Zo(r,l){var v=l.last;v===null?l.last=l.first=r:(v.next=r,r.prev=v,l.last=r)}function yt(r,l){var v=pe;v!==null&&(v.f&Ye)!==0&&(r|=Ye);var C={ctx:Ke,deps:null,nodes:null,f:r|Te|tt,first:null,fn:l,last:null,next:null,parent:v,b:v&&v.b,prev:null,teardown:null,wv:0,ac:null},w=C;if((r&Ar)!==0)Er!==null?Er.push(C):ct(C);else if(l!==null){try{Lr(C)}catch(x){throw Re(C),x}w.deps===null&&w.teardown===null&&w.nodes===null&&w.first===w.last&&(w.f&Tr)===0&&(w=w.first,(r&Gt)!==0&&(r&ar)!==0&&w!==null&&(w.f|=ar))}if(w!==null&&(w.parent=v,v!==null&&Zo(w,v),fe!==null&&(fe.f&Be)!==0&&(r&cr)===0)){var k=fe;(k.effects??(k.effects=[])).push(w)}return C}function es(){return fe!==null&&!ht}function ts(r){const l=yt(Nr,null);return ye(l,Le),l.teardown=r,l}function Mr(r){Yo();var l=pe.f,v=!fe&&(l&dt)!==0&&(l&Br)===0;if(v){var C=Ke;(C.e??(C.e=[])).push(r)}else return ln(r)}function ln(r){return yt(Ar|ao,r)}function Qo(r){jt.ensure();const l=yt(cr|Tr,r);return(v={})=>new Promise(C=>{v.outro?or(l,()=>{Re(l),C(void 0)}):(Re(l),C(void 0))})}function Vr(r){return yt(Ar,r)}function ea(r){return yt(Ji|Tr,r)}function fi(r,l=0){return yt(Nr|l,r)}function le(r,l=[],v=[],C=[]){Js(C,l,v,w=>{yt(Nr,()=>r(...w.map(B)))})}function Gr(r,l=0){var v=yt(Gt|l,r);return v}function cn(r,l=0){var v=yt(Xi|l,r);return v}function je(r){return yt(dt|Tr,r)}function hn(r){var l=r.teardown;if(l!==null){const v=Vt,C=fe;ps(!0),it(null);try{l.call(null)}finally{ps(v),it(C)}}}function rs(r,l=!1){var v=r.first;for(r.first=r.last=null;v!==null;){const w=v.ac;w!==null&&di(()=>{w.abort(Yt)});var C=v.next;(v.f&cr)!==0?v.parent=null:Re(v,l),v=C}}function ta(r){for(var l=r.first;l!==null;){var v=l.next;(l.f&dt)===0&&Re(l),l=v}}function Re(r,l=!0){var v=!1;(l||(r.f&oo)!==0)&&r.nodes!==null&&r.nodes.end!==null&&(ra(r.nodes.start,r.nodes.end),v=!0),rs(r,l&&!v),Ur(r,0),ye(r,Rt);var C=r.nodes&&r.nodes.t;if(C!==null)for(const k of C)k.stop();hn(r);var w=r.parent;w!==null&&w.first!==null&&un(r),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes=r.ac=null}function ra(r,l){for(;r!==null;){var v=r===l?null:qr(r);r.remove(),r=v}}function un(r){var l=r.parent,v=r.prev,C=r.next;v!==null&&(v.next=C),C!==null&&(C.prev=v),l!==null&&(l.first===r&&(l.first=C),l.last===r&&(l.last=v))}function or(r,l,v=!0){var C=[];dn(r,C,!0);var w=()=>{v&&Re(r),l&&l()},k=C.length;if(k>0){var x=()=>--k||w();for(var n of C)n.out(x)}else w()}function dn(r,l,v){if((r.f&Ye)===0){r.f^=Ye;var C=r.nodes&&r.nodes.t;if(C!==null)for(const n of C)(n.is_global||v)&&l.push(n);for(var w=r.first;w!==null;){var k=w.next,x=(w.f&ar)!==0||(w.f&dt)!==0&&(r.f&Gt)!==0;dn(w,l,x?v:!1),w=k}}}function is(r){fn(r,!0)}function fn(r,l){if((r.f&Ye)!==0){r.f^=Ye,(r.f&Le)===0&&(ye(r,Te),ct(r));for(var v=r.first;v!==null;){var C=v.next,w=(v.f&ar)!==0||(v.f&dt)!==0;fn(v,w?l:!1),v=C}var k=r.nodes&&r.nodes.t;if(k!==null)for(const x of k)(x.is_global||l)&&x.in()}}function _n(r,l){if(r.nodes)for(var v=r.nodes.start,C=r.nodes.end;v!==null;){var w=v===C?null:qr(v);l.append(v),v=w}}let ri=!1,Vt=!1;function ps(r){Vt=r}let fe=null,ht=!1;function it(r){fe=r}let pe=null;function wt(r){pe=r}let rt=null;function vn(r){fe!==null&&(rt===null?rt=[r]:rt.push(r))}let Ue=null,Ve=0,Qe=null;function ia(r){Qe=r}let pn=1,Qt=0,Bt=Qt;function gs(r){Bt=r}function gn(){return++pn}function Xr(r){var l=r.f;if((l&Te)!==0)return!0;if(l&Be&&(r.f&=~lr),(l&ut)!==0){for(var v=r.deps,C=v.length,w=0;w<C;w++){var k=v[w];if(Xr(k)&&Zs(k),k.wv>r.wv)return!0}(l&tt)!==0&&De===null&&ye(r,Le)}return!1}function mn(r,l,v=!0){var C=r.reactions;if(C!==null&&!(rt!==null&&wr.call(rt,r)))for(var w=0;w<C.length;w++){var k=C[w];(k.f&Be)!==0?mn(k,l,!1):l===k&&(v?ye(k,Te):(k.f&Le)!==0&&ye(k,ut),ct(k))}}function Sn(r){var u;var l=Ue,v=Ve,C=Qe,w=fe,k=rt,x=Ke,n=ht,o=Bt,c=r.f;Ue=null,Ve=0,Qe=null,fe=(c&(dt|cr))===0?r:null,rt=null,yr(r.ctx),ht=!1,Bt=++Qt,r.ac!==null&&(di(()=>{r.ac.abort(Yt)}),r.ac=null);try{r.f|=Ai;var f=r.fn,a=f();r.f|=Br;var d=r.deps,p=ue==null?void 0:ue.is_fork;if(Ue!==null){var g;if(p||Ur(r,Ve),d!==null&&Ve>0)for(d.length=Ve+Ue.length,g=0;g<Ue.length;g++)d[Ve+g]=Ue[g];else r.deps=d=Ue;if(es()&&(r.f&tt)!==0)for(g=Ve;g<d.length;g++)((u=d[g]).reactions??(u.reactions=[])).push(r)}else!p&&d!==null&&Ve<d.length&&(Ur(r,Ve),d.length=Ve);if(Us()&&Qe!==null&&!ht&&d!==null&&(r.f&(Be|ut|Te))===0)for(g=0;g<Qe.length;g++)mn(Qe[g],r);if(w!==null&&w!==r){if(Qt++,w.deps!==null)for(let e=0;e<v;e+=1)w.deps[e].rv=Qt;if(l!==null)for(const e of l)e.rv=Qt;Qe!==null&&(C===null?C=Qe:C.push(...Qe))}return(r.f&$t)!==0&&(r.f^=$t),a}catch(e){return js(e)}finally{r.f^=Ai,Ue=l,Ve=v,Qe=C,fe=w,rt=k,yr(x),ht=n,Bt=o}}function sa(r,l){let v=l.reactions;if(v!==null){var C=Qn.call(v,r);if(C!==-1){var w=v.length-1;w===0?v=l.reactions=null:(v[C]=v[w],v.pop())}}if(v===null&&(l.f&Be)!==0&&(Ue===null||!wr.call(Ue,l))){var k=l;(k.f&tt)!==0&&(k.f^=tt,k.f&=~lr),Zi(k),$o(k),Ur(k,0)}}function Ur(r,l){var v=r.deps;if(v!==null)for(var C=l;C<v.length;C++)sa(r,v[C])}function Lr(r){var l=r.f;if((l&Rt)===0){ye(r,Le);var v=pe,C=ri;pe=r,ri=!0;try{(l&(Gt|Xi))!==0?ta(r):rs(r),hn(r);var w=Sn(r);r.teardown=typeof w=="function"?w:null,r.wv=pn;var k;Di&&xo&&(r.f&Te)!==0&&r.deps}finally{ri=C,pe=v}}}async function na(){await Promise.resolve(),Do()}function B(r){var l=r.f,v=(l&Be)!==0;if(fe!==null&&!ht){var C=pe!==null&&(pe.f&Rt)!==0;if(!C&&(rt===null||!wr.call(rt,r))){var w=fe.deps;if((fe.f&Ai)!==0)r.rv<Qt&&(r.rv=Qt,Ue===null&&w!==null&&w[Ve]===r?Ve++:Ue===null?Ue=[r]:Ue.push(r));else{(fe.deps??(fe.deps=[])).push(r);var k=r.reactions;k===null?r.reactions=[fe]:wr.call(k,fe)||k.push(fe)}}}if(Vt&&zt.has(r))return zt.get(r);if(v){var x=r;if(Vt){var n=x.v;return((x.f&Le)===0&&x.reactions!==null||Cn(x))&&(n=Qi(x)),zt.set(x,n),n}var o=(x.f&tt)===0&&!ht&&fe!==null&&(ri||(fe.f&tt)!==0),c=(x.f&Br)===0;Xr(x)&&(o&&(x.f|=tt),Zs(x)),o&&!c&&(Qs(x),bn(x))}if(De!=null&&De.has(r))return De.get(r);if((r.f&$t)!==0)throw r.v;return r.v}function bn(r){if(r.f|=tt,r.deps!==null)for(const l of r.deps)(l.reactions??(l.reactions=[])).push(r),(l.f&Be)!==0&&(l.f&tt)===0&&(Qs(l),bn(l))}function Cn(r){if(r.v===ke)return!0;if(r.deps===null)return!1;for(const l of r.deps)if(zt.has(l)||(l.f&Be)!==0&&Cn(l))return!0;return!1}function Xt(r){var l=ht;try{return ht=!0,r()}finally{ht=l}}const er=Symbol("events"),wn=new Set,Ni=new Set;function yn(r,l,v,C={}){function w(k){if(C.capture||Ui.call(l,k),!k.cancelBubble)return di(()=>v==null?void 0:v.call(this,k))}return r.startsWith("pointer")||r.startsWith("touch")||r==="wheel"?bt(()=>{l.addEventListener(r,w,C)}):l.addEventListener(r,w,C),w}function _i(r,l,v,C,w){var k={capture:C,passive:w},x=yn(r,l,v,k);(l===document.body||l===window||l===document||l instanceof HTMLMediaElement)&&ts(()=>{l.removeEventListener(r,x,k)})}function Me(r,l,v){(l[er]??(l[er]={}))[r]=v}function Tt(r){for(var l=0;l<r.length;l++)wn.add(r[l]);for(var v of Ni)v(r)}let ms=null;function Ui(r){var e,i;var l=this,v=l.ownerDocument,C=r.type,w=((e=r.composedPath)==null?void 0:e.call(r))||[],k=w[0]||r.target;ms=r;var x=0,n=ms===r&&r[er];if(n){var o=w.indexOf(n);if(o!==-1&&(l===document||l===window)){r[er]=l;return}var c=w.indexOf(l);if(c===-1)return;o<=c&&(x=o)}if(k=w[x]||r.target,k!==l){eo(r,"currentTarget",{configurable:!0,get(){return k||v}});var f=fe,a=pe;it(null),wt(null);try{for(var d,p=[];k!==null;){var g=k.assignedSlot||k.parentNode||k.host||null;try{var u=(i=k[er])==null?void 0:i[C];u!=null&&(!k.disabled||r.target===k)&&u.call(k,r)}catch(t){d?p.push(t):d=t}if(r.cancelBubble||g===l||g===null)break;k=g}if(d){for(let t of p)queueMicrotask(()=>{throw t});throw d}}finally{r[er]=l,delete r.currentTarget,it(f),wt(a)}}}var Ms;const bi=((Ms=globalThis==null?void 0:globalThis.window)==null?void 0:Ms.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:r=>r});function oa(r){return(bi==null?void 0:bi.createHTML(r))??r}function En(r){var l=Go("template");return l.innerHTML=oa(r.replaceAll("<!>","<!---->")),l.content}function $r(r,l){var v=pe;v.nodes===null&&(v.nodes={start:r,end:l,a:null,t:null})}function ie(r,l){var v=(l&Jn)!==0,C=(l&Yn)!==0,w,k=!r.startsWith("<!>");return()=>{w===void 0&&(w=En(k?r:"<!>"+r),v||(w=kr(w)));var x=C||rn?document.importNode(w,!0):w.cloneNode(!0);if(v){var n=kr(x),o=x.lastChild;$r(n,o)}else $r(x,x);return x}}function aa(r,l,v="svg"){var C=!r.startsWith("<!>"),w=`<${v}>${C?r:"<!>"+r}</${v}>`,k;return()=>{if(!k){var x=En(w),n=kr(x);k=kr(n)}var o=k.cloneNode(!0);return $r(o,o),o}}function vi(r,l){return aa(r,l,"svg")}function Je(r=""){{var l=At(r+"");return $r(l,l),l}}function Dr(){var r=document.createDocumentFragment(),l=document.createComment(""),v=At();return r.append(l,v),$r(l,v),r}function J(r,l){r!==null&&r.before(l)}function la(r){return r.endsWith("capture")&&r!=="gotpointercapture"&&r!=="lostpointercapture"}const ca=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function ha(r){return ca.includes(r)}const ua={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function da(r){return r=r.toLowerCase(),ua[r]??r}const fa=["touchstart","touchmove"];function _a(r){return fa.includes(r)}function _e(r,l){var v=l==null?"":typeof l=="object"?`${l}`:l;v!==(r.__t??(r.__t=r.nodeValue))&&(r.__t=v,r.nodeValue=`${v}`)}function va(r,l){return pa(r,l)}const Zr=new Map;function pa(r,{target:l,anchor:v,props:C={},events:w,context:k,intro:x=!0,transformError:n}){qo();var o=void 0,c=Qo(()=>{var f=v??l.appendChild(At());To(f,{pending:()=>{}},p=>{He({});var g=Ke;k&&(g.c=k),w&&(C.$$events=w),o=r(p,C)||{},Fe()},n);var a=new Set,d=p=>{for(var g=0;g<p.length;g++){var u=p[g];if(!a.has(u)){a.add(u);var e=_a(u);for(const s of[l,document]){var i=Zr.get(s);i===void 0&&(i=new Map,Zr.set(s,i));var t=i.get(u);t===void 0?(s.addEventListener(u,Ui,{passive:e}),i.set(u,1)):i.set(u,t+1)}}}};return d(ci(wn)),Ni.add(d),()=>{var e;for(var p of a)for(const i of[l,document]){var g=Zr.get(i),u=g.get(p);--u==0?(i.removeEventListener(p,Ui),g.delete(p),g.size===0&&Zr.delete(i)):g.set(p,u)}Ni.delete(d),f!==v&&((e=f.parentNode)==null||e.removeChild(f))}});return ga.set(o,c),o}let ga=new WeakMap;var at,St,Xe,sr,zr,Kr,oi;class ss{constructor(l,v=!0){vt(this,"anchor");ae(this,at,new Map);ae(this,St,new Map);ae(this,Xe,new Map);ae(this,sr,new Set);ae(this,zr,!0);ae(this,Kr,l=>{if(F(this,at).has(l)){var v=F(this,at).get(l),C=F(this,St).get(v);if(C)is(C),F(this,sr).delete(v);else{var w=F(this,Xe).get(v);w&&(F(this,St).set(v,w.effect),F(this,Xe).delete(v),w.fragment.lastChild.remove(),this.anchor.before(w.fragment),C=w.effect)}for(const[k,x]of F(this,at)){if(F(this,at).delete(k),k===l)break;const n=F(this,Xe).get(x);n&&(Re(n.effect),F(this,Xe).delete(x))}for(const[k,x]of F(this,St)){if(k===v||F(this,sr).has(k))continue;const n=()=>{if(Array.from(F(this,at).values()).includes(k)){var c=document.createDocumentFragment();_n(x,c),c.append(At()),F(this,Xe).set(k,{effect:x,fragment:c})}else Re(x);F(this,sr).delete(k),F(this,St).delete(k)};F(this,zr)||!C?(F(this,sr).add(k),or(x,n,!1)):n()}}});ae(this,oi,l=>{F(this,at).delete(l);const v=Array.from(F(this,at).values());for(const[C,w]of F(this,Xe))v.includes(C)||(Re(w.effect),F(this,Xe).delete(C))});this.anchor=l,he(this,zr,v)}ensure(l,v){var C=ue,w=on();if(v&&!F(this,St).has(l)&&!F(this,Xe).has(l))if(w){var k=document.createDocumentFragment(),x=At();k.append(x),F(this,Xe).set(l,{effect:je(()=>v(x)),fragment:k})}else F(this,St).set(l,je(()=>v(this.anchor)));if(F(this,at).set(C,l),w){for(const[n,o]of F(this,St))n===l?C.unskip_effect(o):C.skip_effect(o);for(const[n,o]of F(this,Xe))n===l?C.unskip_effect(o.effect):C.skip_effect(o.effect);C.oncommit(F(this,Kr)),C.ondiscard(F(this,oi))}else F(this,Kr).call(this,C)}}at=new WeakMap,St=new WeakMap,Xe=new WeakMap,sr=new WeakMap,zr=new WeakMap,Kr=new WeakMap,oi=new WeakMap;function ns(r,l,...v){var C=new ss(r);Gr(()=>{const w=l()??null;C.ensure(w,w&&(k=>w(k,...v)))},ar)}function os(r){Ke===null&&Fs(),Mr(()=>{const l=Xt(r);if(typeof l=="function")return l})}function ma(r){Ke===null&&Fs(),os(()=>()=>Xt(r))}function de(r,l,v=!1){var C=new ss(r),w=v?ar:0;function k(x,n){C.ensure(x,n)}Gr(()=>{var x=!1;l((n,o=0)=>{x=!0,k(o,n)}),x||k(!1,null)},w)}const Sa=Symbol("NaN");function ba(r,l,v){var C=new ss(r);Gr(()=>{var w=l();w!==w&&(w=Sa),C.ensure(w,v)})}function jr(r,l){return l}function Ca(r,l,v){for(var C=[],w=l.length,k,x=l.length,n=0;n<w;n++){let a=l[n];or(a,()=>{if(k){if(k.pending.delete(a),k.done.add(a),k.pending.size===0){var d=r.outrogroups;$i(ci(k.done)),d.delete(k),d.size===0&&(r.outrogroups=null)}}else x-=1},!1)}if(x===0){var o=C.length===0&&v!==null;if(o){var c=v,f=c.parentNode;Vo(f),f.append(c),r.items.clear()}$i(l,!o)}else k={pending:new Set(l),done:new Set},(r.outrogroups??(r.outrogroups=new Set)).add(k)}function $i(r,l=!0){for(var v=0;v<r.length;v++)Re(r[v],l)}var Ss;function Ct(r,l,v,C,w,k=null){var x=r,n=new Map,o=(l&Os)!==0;if(o){var c=r;x=c.appendChild(At())}var f=null,a=Ys(()=>{var i=v();return Gi(i)?i:i==null?[]:ci(i)}),d,p=!0;function g(){e.fallback=f,wa(e,d,x,l,C),f!==null&&(d.length===0?(f.f&Dt)===0?is(f):(f.f^=Dt,Fr(f,null,x)):or(f,()=>{f=null}))}var u=Gr(()=>{d=B(a);for(var i=d.length,t=new Set,s=ue,h=on(),m=0;m<i;m+=1){var S=d[m],b=C(S,m),_=p?null:n.get(b);_?(_.v&&xr(_.v,S),_.i&&xr(_.i,m),h&&s.unskip_effect(_.e)):(_=ya(n,p?x:Ss??(Ss=At()),S,b,m,w,l,v),p||(_.e.f|=Dt),n.set(b,_)),t.add(b)}if(i===0&&k&&!f&&(p?f=je(()=>k(x)):(f=je(()=>k(Ss??(Ss=At()))),f.f|=Dt)),i>t.size&&uo(),!p)if(h){for(const[y,D]of n)t.has(y)||s.skip_effect(D.e);s.oncommit(g),s.ondiscard(()=>{})}else g();B(a)}),e={effect:u,items:n,outrogroups:null,fallback:f};p=!1}function Pr(r){for(;r!==null&&(r.f&dt)===0;)r=r.next;return r}function wa(r,l,v,C,w){var D,T,O,A,W,H,U,V,$;var k=(C&zn)!==0,x=l.length,n=r.items,o=Pr(r.effect.first),c,f=null,a,d=[],p=[],g,u,e,i;if(k)for(i=0;i<x;i+=1)g=l[i],u=w(g,i),e=n.get(u).e,(e.f&Dt)===0&&((T=(D=e.nodes)==null?void 0:D.a)==null||T.measure(),(a??(a=new Set)).add(e));for(i=0;i<x;i+=1){if(g=l[i],u=w(g,i),e=n.get(u).e,r.outrogroups!==null)for(const E of r.outrogroups)E.pending.delete(e),E.done.delete(e);if((e.f&Dt)!==0)if(e.f^=Dt,e===o)Fr(e,null,v);else{var t=f?f.next:o;e===r.effect.last&&(r.effect.last=e.prev),e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),It(r,f,e),It(r,e,t),Fr(e,t,v),f=e,d=[],p=[],o=Pr(f.next);continue}if((e.f&Ye)!==0&&(is(e),k&&((A=(O=e.nodes)==null?void 0:O.a)==null||A.unfix(),(a??(a=new Set)).delete(e))),e!==o){if(c!==void 0&&c.has(e)){if(d.length<p.length){var s=p[0],h;f=s.prev;var m=d[0],S=d[d.length-1];for(h=0;h<d.length;h+=1)Fr(d[h],s,v);for(h=0;h<p.length;h+=1)c.delete(p[h]);It(r,m.prev,S.next),It(r,f,m),It(r,S,s),o=s,f=S,i-=1,d=[],p=[]}else c.delete(e),Fr(e,o,v),It(r,e.prev,e.next),It(r,e,f===null?r.effect.first:f.next),It(r,f,e),f=e;continue}for(d=[],p=[];o!==null&&o!==e;)(c??(c=new Set)).add(o),p.push(o),o=Pr(o.next);if(o===null)continue}(e.f&Dt)===0&&d.push(e),f=e,o=Pr(e.next)}if(r.outrogroups!==null){for(const E of r.outrogroups)E.pending.size===0&&($i(ci(E.done)),(W=r.outrogroups)==null||W.delete(E));r.outrogroups.size===0&&(r.outrogroups=null)}if(o!==null||c!==void 0){var b=[];if(c!==void 0)for(e of c)(e.f&Ye)===0&&b.push(e);for(;o!==null;)(o.f&Ye)===0&&o!==r.fallback&&b.push(o),o=Pr(o.next);var _=b.length;if(_>0){var y=(C&Os)!==0&&x===0?v:null;if(k){for(i=0;i<_;i+=1)(U=(H=b[i].nodes)==null?void 0:H.a)==null||U.measure();for(i=0;i<_;i+=1)($=(V=b[i].nodes)==null?void 0:V.a)==null||$.fix()}Ca(r,b,y)}}k&&bt(()=>{var E,R;if(a!==void 0)for(e of a)(R=(E=e.nodes)==null?void 0:E.a)==null||R.apply()})}function ya(r,l,v,C,w,k,x,n){var o=(x&$n)!==0?(x&Kn)===0?jo(v,!1,!1):qt(v):null,c=(x&jn)!==0?qt(w):null;return{v:o,i:c,e:je(()=>(k(l,o??v,c??w,n),()=>{r.delete(C)}))}}function Fr(r,l,v){if(r.nodes)for(var C=r.nodes.start,w=r.nodes.end,k=l&&(l.f&Dt)===0?l.nodes.start:v;C!==null;){var x=qr(C);if(k.before(C),C===w)return;C=x}}function It(r,l,v){l===null?r.effect.first=v:l.next=v,v===null?r.effect.last=l:v.prev=l}function Ea(r,l,v){Vr(()=>{var C=Xt(()=>l(r,v==null?void 0:v())||{});if(C!=null&&C.destroy)return()=>C.destroy()})}function xa(r,l){var v=void 0,C;cn(()=>{v!==(v=l())&&(C&&(Re(C),C=null),v&&(C=je(()=>{Vr(()=>v(r))})))})}function xn(r){var l,v,C="";if(typeof r=="string"||typeof r=="number")C+=r;else if(typeof r=="object")if(Array.isArray(r)){var w=r.length;for(l=0;l<w;l++)r[l]&&(v=xn(r[l]))&&(C&&(C+=" "),C+=v)}else for(v in r)r[v]&&(C&&(C+=" "),C+=v);return C}function ka(){for(var r,l,v=0,C="",w=arguments.length;v<w;v++)(r=arguments[v])&&(l=xn(r))&&(C&&(C+=" "),C+=l);return C}function kn(r){return typeof r=="object"?ka(r):r??""}const bs=[...`
2
- \r\f \v\uFEFF`];function La(r,l,v){var C=r==null?"":""+r;if(l&&(C=C?C+" "+l:l),v){for(var w of Object.keys(v))if(v[w])C=C?C+" "+w:w;else if(C.length)for(var k=w.length,x=0;(x=C.indexOf(w,x))>=0;){var n=x+k;(x===0||bs.includes(C[x-1]))&&(n===C.length||bs.includes(C[n]))?C=(x===0?"":C.substring(0,x))+C.substring(n+1):x=n}}return C===""?null:C}function Cs(r,l=!1){var v=l?" !important;":";",C="";for(var w of Object.keys(r)){var k=r[w];k!=null&&k!==""&&(C+=" "+w+": "+k+v)}return C}function Ci(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function Da(r,l){if(l){var v="",C,w;if(Array.isArray(l)?(C=l[0],w=l[1]):C=l,r){r=String(r).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var k=!1,x=0,n=!1,o=[];C&&o.push(...Object.keys(C).map(Ci)),w&&o.push(...Object.keys(w).map(Ci));var c=0,f=-1;const u=r.length;for(var a=0;a<u;a++){var d=r[a];if(n?d==="/"&&r[a-1]==="*"&&(n=!1):k?k===d&&(k=!1):d==="/"&&r[a+1]==="*"?n=!0:d==='"'||d==="'"?k=d:d==="("?x++:d===")"&&x--,!n&&k===!1&&x===0){if(d===":"&&f===-1)f=a;else if(d===";"||a===u-1){if(f!==-1){var p=Ci(r.substring(c,f).trim());if(!o.includes(p)){d!==";"&&a++;var g=r.substring(c,a).trim();v+=" "+g+";"}}c=a+1,f=-1}}}}return C&&(v+=Cs(C)),w&&(v+=Cs(w,!0)),v=v.trim(),v===""?null:v}return r==null?null:String(r)}function Ae(r,l,v,C,w,k){var x=r.__className;if(x!==v||x===void 0){var n=La(v,C,k);n==null?r.removeAttribute("class"):l?r.className=n:r.setAttribute("class",n),r.__className=v}else if(k&&w!==k)for(var o in k){var c=!!k[o];(w==null||c!==!!w[o])&&r.classList.toggle(o,c)}return k}function wi(r,l={},v,C){for(var w in v){var k=v[w];l[w]!==k&&(v[w]==null?r.style.removeProperty(w):r.style.setProperty(w,k,C))}}function Ra(r,l,v,C){var w=r.__style;if(w!==l){var k=Da(l,C);k==null?r.removeAttribute("style"):r.style.cssText=k,r.__style=l}else C&&(Array.isArray(C)?(wi(r,v==null?void 0:v[0],C[0]),wi(r,v==null?void 0:v[1],C[1],"important")):wi(r,v,C));return C}function ji(r,l,v=!1){if(r.multiple){if(l==null)return;if(!Gi(l))return wo();for(var C of r.options)C.selected=l.includes(ws(C));return}for(C of r.options){var w=ws(C);if(Ko(w,l)){C.selected=!0;return}}(!v||l!==void 0)&&(r.selectedIndex=-1)}function Aa(r){var l=new MutationObserver(()=>{ji(r,r.__value)});l.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),ts(()=>{l.disconnect()})}function ws(r){return"__value"in r?r.__value:r.value}const Ir=Symbol("class"),Hr=Symbol("style"),Ln=Symbol("is custom element"),Dn=Symbol("is html"),Ba=Yi?"option":"OPTION",Ta=Yi?"select":"SELECT",Ma=Yi?"progress":"PROGRESS";function ys(r,l){var v=pi(r);v.value===(v.value=l??void 0)||r.value===l&&(l!==0||r.nodeName!==Ma)||(r.value=l??"")}function zi(r,l){var v=pi(r);v.checked!==(v.checked=l??void 0)&&(r.checked=l)}function Oa(r,l){l?r.hasAttribute("selected")||r.setAttribute("selected",""):r.removeAttribute("selected")}function $e(r,l,v,C){var w=pi(r);w[l]!==(w[l]=v)&&(l==="loading"&&(r[co]=v),v==null?r.removeAttribute(l):typeof v!="string"&&An(r).includes(l)?r[l]=v:r.setAttribute(l,v))}function Pa(r,l,v,C,w=!1,k=!1){var x=pi(r),n=x[Ln],o=!x[Dn],c=l||{},f=r.nodeName===Ba;for(var a in l)a in v||(v[a]=null);v.class?v.class=kn(v.class):v[Ir]&&(v.class=null),v[Hr]&&(v.style??(v.style=null));var d=An(r);for(const h in v){let m=v[h];if(f&&h==="value"&&m==null){r.value=r.__value="",c[h]=m;continue}if(h==="class"){var p=r.namespaceURI==="http://www.w3.org/1999/xhtml";Ae(r,p,m,C,l==null?void 0:l[Ir],v[Ir]),c[h]=m,c[Ir]=v[Ir];continue}if(h==="style"){Ra(r,m,l==null?void 0:l[Hr],v[Hr]),c[h]=m,c[Hr]=v[Hr];continue}var g=c[h];if(!(m===g&&!(m===void 0&&r.hasAttribute(h)))){c[h]=m;var u=h[0]+h[1];if(u!=="$$")if(u==="on"){const S={},b="$$"+h;let _=h.slice(2);var e=ha(_);if(la(_)&&(_=_.slice(0,-7),S.capture=!0),!e&&g){if(m!=null)continue;r.removeEventListener(_,c[b],S),c[b]=null}if(e)Me(_,r,m),Tt([_]);else if(m!=null){let y=function(D){c[h].call(this,D)};var s=y;c[b]=yn(_,r,y,S)}}else if(h==="style")$e(r,h,m);else if(h==="autofocus")Xo(r,!!m);else if(!n&&(h==="__value"||h==="value"&&m!=null))r.value=r.__value=m;else if(h==="selected"&&f)Oa(r,m);else{var i=h;o||(i=da(i));var t=i==="defaultValue"||i==="defaultChecked";if(m==null&&!n&&!t)if(x[h]=null,i==="value"||i==="checked"){let S=r;const b=l===void 0;if(i==="value"){let _=S.defaultValue;S.removeAttribute(i),S.defaultValue=_,S.value=S.__value=b?_:null}else{let _=S.defaultChecked;S.removeAttribute(i),S.defaultChecked=_,S.checked=b?_:!1}}else r.removeAttribute(h);else t||d.includes(i)&&(n||typeof m!="string")?(r[i]=m,i in x&&(x[i]=ke)):typeof m!="function"&&$e(r,i,m)}}}return c}function Rn(r,l,v=[],C=[],w=[],k,x=!1,n=!1){Js(w,v,C,o=>{var c=void 0,f={},a=r.nodeName===Ta,d=!1;if(cn(()=>{var g=l(...o.map(B)),u=Pa(r,c,g,k,x,n);d&&a&&"value"in g&&ji(r,g.value);for(let i of Object.getOwnPropertySymbols(f))g[i]||Re(f[i]);for(let i of Object.getOwnPropertySymbols(g)){var e=g[i];i.description===Zn&&(!c||e!==c[i])&&(f[i]&&Re(f[i]),f[i]=je(()=>xa(r,()=>e))),u[i]=e}c=u}),a){var p=r;Vr(()=>{ji(p,c.value,!0),Aa(p)})}d=!0})}function pi(r){return r.__attributes??(r.__attributes={[Ln]:r.nodeName.includes("-"),[Dn]:r.namespaceURI===Ps})}var Es=new Map;function An(r){var l=r.getAttribute("is")||r.nodeName,v=Es.get(l);if(v)return v;Es.set(l,v=[]);for(var C,w=r,k=Element.prototype;k!==w;){C=to(w);for(var x in C)C[x].set&&v.push(x);w=Is(w)}return v}function Ki(r,l,v=l){var C=new WeakSet;an(r,"input",async w=>{var k=w?r.defaultValue:r.value;if(k=yi(r)?Ei(k):k,v(k),ue!==null&&C.add(ue),await na(),k!==(k=l())){var x=r.selectionStart,n=r.selectionEnd,o=r.value.length;if(r.value=k??"",n!==null){var c=r.value.length;x===n&&n===o&&c>o?(r.selectionStart=c,r.selectionEnd=c):(r.selectionStart=x,r.selectionEnd=Math.min(n,c))}}}),Xt(l)==null&&r.value&&(v(yi(r)?Ei(r.value):r.value),ue!==null&&C.add(ue)),fi(()=>{var w=l();if(r===document.activeElement){var k=Bi??ue;if(C.has(k))return}yi(r)&&w===Ei(r.value)||r.type==="date"&&!w&&!r.value||w!==r.value&&(r.value=w??"")})}function Ia(r,l,v=l){an(r,"change",C=>{var w=C?r.defaultChecked:r.checked;v(w)}),Xt(l)==null&&v(r.checked),fi(()=>{var C=l();r.checked=!!C})}function yi(r){var l=r.type;return l==="number"||l==="range"}function Ei(r){return r===""?null:+r}function xs(r,l){return r===l||(r==null?void 0:r[nr])===l}function gi(r={},l,v,C){return Vr(()=>{var w,k;return fi(()=>{w=k,k=[],Xt(()=>{r!==v(...k)&&(l(r,...k),w&&xs(v(...w),r)&&l(null,...w))})}),()=>{bt(()=>{k&&xs(v(...k),r)&&l(null,...k)})}}),r}let Qr=!1;function Ha(r){var l=Qr;try{return Qr=!1,[r(),Qr]}finally{Qr=l}}const Fa={get(r,l){if(!r.exclude.includes(l))return r.props[l]},set(r,l){return!1},getOwnPropertyDescriptor(r,l){if(!r.exclude.includes(l)&&l in r.props)return{enumerable:!0,configurable:!0,value:r.props[l]}},has(r,l){return r.exclude.includes(l)?!1:l in r.props},ownKeys(r){return Reflect.ownKeys(r.props).filter(l=>!r.exclude.includes(l))}};function Bn(r,l,v){return new Proxy({props:r,exclude:l},Fa)}function Pe(r,l,v,C){var t;var w=(v&Gn)!==0,k=(v&Xn)!==0,x=C,n=!0,o=()=>(n&&(n=!1,x=k?Xt(C):C),x),c;if(w){var f=nr in r||lo in r;c=((t=ur(r,l))==null?void 0:t.set)??(f&&l in r?s=>r[l]=s:void 0)}var a,d=!1;w?[a,d]=Ha(()=>r[l]):a=r[l],a===void 0&&C!==void 0&&(a=o(),c&&(go(),c(a)));var p;if(p=()=>{var s=r[l];return s===void 0?o():(n=!0,s)},(v&Vn)===0)return p;if(c){var g=r.$$legacy;return(function(s,h){return arguments.length>0?((!h||g||d)&&c(h?p():s),s):p()})}var u=!1,e=((v&qn)!==0?ui:Ys)(()=>(u=!1,p()));w&&B(e);var i=pe;return(function(s,h){if(arguments.length>0){const m=h?B(e):w?ze(s):s;return G(e,m),u=!0,x!==void 0&&(x=m),s}return Vt&&u||(i.f&Rt)!==0?e.v:B(e)})}const ii="wt-ssh-host";function as(r){return r.repo?`${r.repo} #${r.number}`:`PR #${r.number}`}function dr(r){return r instanceof Error?r.message:String(r)}var Wa=ie('<a target="_blank" rel="noopener"> </a>'),Na=ie("<span> </span>");function Tn(r,l){He(l,!0);let v=Pe(l,"clickable",3,!1);function C(c){return c==="merged"?"bg-[#8b5cf6]/20 text-[#a78bfa]":c==="closed"?"bg-danger/20 text-danger":c==="open"?"bg-success/20 text-success":"bg-muted/20 text-muted"}let w=Ce(()=>as(l.pr));var k=Dr(),x=Ie(k);{var n=c=>{var f=Wa(),a=Q(f);le(d=>{$e(f,"href",l.pr.url),Ae(f,1,`shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded-full no-underline hover:opacity-80 ${d??""}`),_e(a,B(w))},[()=>C(l.pr.state)]),J(c,f)},o=c=>{var f=Na(),a=Q(f);le(d=>{Ae(f,1,`shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded-full ${d??""}`),_e(a,B(w))},[()=>C(l.pr.state)]),J(c,f)};de(x,c=>{v()&&l.pr.url?c(n):c(o,!1)})}J(r,k),Fe()}var Ua=vi('<svg class="text-success" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="none"><circle cx="5" cy="12" r="1.5"></circle><circle cx="12" cy="12" r="1.5"></circle><circle cx="19" cy="12" r="1.5"></circle></svg>'),$a=vi('<svg class="text-warning" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path><path d="M12 7v2"></path><path d="M12 13h.01"></path></svg>'),ja=vi('<svg class="text-success" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>'),za=vi('<svg class="text-danger" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>'),Ka=ie("<span><!> </span>");function qa(r,l){const v=f=>{var a=Dr(),d=Ie(a);{var p=i=>{var t=Ua();le(()=>{$e(t,"width",C()),$e(t,"height",C())}),J(i,t)},g=i=>{var t=$a();le(()=>{$e(t,"width",C()),$e(t,"height",C())}),J(i,t)},u=i=>{var t=ja();le(()=>{$e(t,"width",C()),$e(t,"height",C())}),J(i,t)},e=i=>{var t=za();le(()=>{$e(t,"width",C()),$e(t,"height",C())}),J(i,t)};de(d,i=>{l.status==="working"?i(p):l.status==="waiting"?i(g,1):l.status==="done"?i(u,2):l.status==="error"&&i(e,3)})}J(f,a)};let C=Pe(l,"size",3,10),w=Pe(l,"pill",3,!1);function k(f){return f==="working"?"bg-success/15 text-success":f==="waiting"?"bg-warning/15 text-warning":f==="done"?"bg-success/15 text-success":f==="error"?"bg-danger/15 text-danger":"bg-hover text-muted"}var x=Dr(),n=Ie(x);{var o=f=>{var a=Ka(),d=Q(a);v(d);var p=Z(d);le(g=>{Ae(a,1,`text-xs px-2 py-0.5 rounded-xl flex items-center gap-1 ${g??""}`),_e(p,` ${(l.status||"idle")??""}`)},[()=>k(l.status)]),J(f,a)},c=f=>{v(f)};de(n,f=>{w()?f(o):f(c,!1)})}J(r,x)}var Va=ie("<span> </span>"),Ga=ie("<span> </span>"),Xa=ie("<span> </span>"),Ja=ie('<span class="flex gap-2 text-[11px] text-muted font-mono"></span>'),Ya=ie('<li><button type="button"><span class="flex items-center gap-1.5 pr-5 flex-wrap"><div class="flex items-center gap-2 max-w-[90%] min-w-0"><span class="font-medium truncate"> </span> <span class="shrink-0"><!></span></div> <!></span> <span class="flex gap-2 text-[11px] text-muted items-center flex-wrap"><!> <!></span> <!></button> <button type="button" class="absolute top-2 right-2 w-5 h-5 rounded flex items-center justify-center text-muted hover:text-danger hover:bg-hover opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer" title="Remove worktree">&times;</button></li>'),Za=ie('<ul class="list-none overflow-y-auto flex-1 p-2"></ul>');function Qa(r,l){He(l,!0);var v=Za();Ct(v,21,()=>l.worktrees,C=>C.branch,(C,w)=>{const k=Ce(()=>B(w).branch===l.selected),x=Ce(()=>l.removing.has(B(w).branch));var n=Ya(),o=Q(n),c=Q(o),f=Q(c),a=Q(f),d=Q(a),p=Z(a,2),g=Q(p);qa(g,{get status(){return B(w).agent},size:14});var u=Z(f,2);Ct(u,17,()=>B(w).prs,_=>_.repo,(_,y)=>{Tn(_,{get pr(){return B(y)}})});var e=Z(c,2),i=Q(e);{var t=_=>{var y=Va(),D=Q(y);le(()=>_e(D,B(w).agentName)),J(_,y)};de(i,_=>{B(w).agentName&&_(t)})}var s=Z(i,2);{var h=_=>{var y=Ga(),D=Q(y);le(()=>_e(D,B(w).profile)),J(_,y)};de(s,_=>{B(w).profile&&_(h)})}var m=Z(e,2);{var S=_=>{var y=Ja();Ct(y,21,()=>B(w).services,jr,(D,T)=>{var O=Dr(),A=Ie(O);{var W=H=>{var U=Xa(),V=Q(U);le(()=>{Ae(U,1,kn(B(T).running?"text-success":"")),_e(V,`${B(T).name??""}:${B(T).port??""}`)}),J(H,U)};de(A,H=>{B(T).port&&H(W)})}J(D,O)}),J(_,y)};de(m,_=>{B(w).services.length>0&&_(S)})}var b=Z(o,2);le(()=>{Ae(n,1,`mb-0.5 group relative ${B(x)?"opacity-40 pointer-events-none":""}`),Ae(o,1,`w-full py-2.5 px-3 rounded-md border cursor-pointer flex flex-col gap-1 text-left text-inherit text-sm bg-transparent hover:bg-hover ${B(k)?"bg-active border-accent":"border-transparent"}`),_e(d,B(w).branch)}),Me("click",o,()=>l.onselect(B(w).branch)),Me("click",b,_=>{_.stopPropagation(),l.onremove(B(w).branch)}),J(C,n)}),J(r,v),Fe()}Tt(["click"]);var el=ie('<button type="button" title="View CI checks"><span></span> CI</button>');function tl(r,l){He(l,!0);function v(x){return x==="failed"?"bg-danger/20 text-danger":x==="success"?"bg-success/20 text-success":x==="pending"?"bg-warning/20 text-warning":"bg-muted/20 text-muted"}function C(x){return x==="failed"?"bg-danger":x==="success"?"bg-success":x==="pending"?"bg-warning animate-pulse":"bg-muted"}var w=el(),k=Q(w);le((x,n)=>{Ae(w,1,`shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded-full flex items-center gap-1 cursor-pointer border-none hover:opacity-80 ${x??""}`),Ae(k,1,`inline-block w-1.5 h-1.5 rounded-full ${n??""}`)},[()=>v(l.pr.ciStatus),()=>C(l.pr.ciStatus)]),Me("click",w,x=>{x.stopPropagation(),l.onclick(l.pr)}),J(r,w),Fe()}Tt(["click"]);var rl=ie('<button type="button" class="shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded-full flex items-center gap-1 cursor-pointer border-none hover:opacity-80 bg-accent/20 text-accent" title="Send PR comments to Claude for review"><span class="inline-block w-1.5 h-1.5 rounded-full bg-accent"></span> </button>');function il(r,l){He(l,!0);var v=rl(),C=Z(Q(v));le(()=>_e(C,` ${l.pr.comments.length??""} ${l.pr.comments.length===1?"comment":"comments"}`)),Me("click",v,w=>{w.stopPropagation(),l.onclick(l.pr)}),J(r,v),Fe()}Tt(["click"]);var sl=ie("<button><!></button>");function st(r,l){let v=Pe(l,"variant",3,"default"),C=Pe(l,"small",3,!1),w=Pe(l,"class",3,""),k=Bn(l,["$$slots","$$events","$$legacy","variant","small","class","children"]);const x={normal:"px-3 py-1.5 text-xs",small:"px-2.5 py-1 text-[11px] font-semibold"},n={default:"border-edge bg-surface text-primary hover:bg-hover",cta:"border-accent bg-accent text-white hover:opacity-90",danger:"border-danger bg-danger text-white hover:opacity-90","accent-outline":"border-accent text-accent bg-surface hover:bg-accent/10","danger-outline":"border-danger text-danger bg-surface hover:bg-danger/10"};var o=sl();Rn(o,()=>({class:`rounded-md border cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed ${x[C()?"small":"normal"]??""} ${n[v()]??""} ${w()??""}`,...k}));var c=Q(o);ns(c,()=>l.children),J(r,o)}var nl=ie('<button type="button" class="p-1 -ml-1 cursor-pointer bg-transparent border-none text-muted hover:text-primary" title="Toggle sidebar"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></button>'),ol=ie("<!> <!> <!>",1),al=ie('<a target="_blank" rel="noopener"> </a>'),ll=ie('<div class="flex items-center gap-1"><a class="text-[11px] px-1.5 py-0.5 rounded border border-accent/40 text-accent font-mono no-underline hover:opacity-80" title="Open in Cursor">Cursor</a><button type="button" class="text-[11px] px-1 py-0.5 rounded border border-accent/40 text-accent cursor-pointer bg-transparent hover:opacity-80 flex items-center" title="Cursor SSH settings"><svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"></path><circle cx="12" cy="12" r="3"></circle></svg></button></div>'),cl=ie("<!> <!>",1),hl=ie('<div class="flex gap-2 items-center"><!> <!></div>'),ul=ie('<div class="flex items-center justify-between px-4 py-2 bg-topbar border-b border-edge min-h-12"><div class="flex items-center gap-3"><!> <span class="text-sm font-semibold truncate"> </span> <!> <!></div> <!></div>');function dl(r,l){He(l,!0);let v=Pe(l,"isMobile",3,!1),C=Ce(()=>{var e;const u=(e=l.worktree)==null?void 0:e.dir;return u?l.sshHost?`cursor://vscode-remote/ssh-remote+${l.sshHost}${u}`:`cursor://file${u}`:null});var w=ul(),k=Q(w),x=Q(k);{var n=u=>{var e=nl();Me("click",e,function(...i){var t;(t=l.ontogglesidebar)==null||t.apply(this,i)}),J(u,e)};de(x,u=>{v()&&l.ontogglesidebar&&u(n)})}var o=Z(x,2),c=Q(o),f=Z(o,2);Ct(f,17,()=>{var u;return((u=l.worktree)==null?void 0:u.prs)??[]},u=>u.repo,(u,e)=>{var i=ol(),t=Ie(i);Tn(t,{get pr(){return B(e)},clickable:!0});var s=Z(t,2);{var h=b=>{tl(b,{get pr(){return B(e)},get onclick(){return l.onciclick}})};de(s,b=>{B(e).ciChecks&&B(e).ciChecks.length>0&&b(h)})}var m=Z(s,2);{var S=b=>{il(b,{get pr(){return B(e)},get onclick(){return l.onreviewsclick}})};de(m,b=>{B(e).comments.length>0&&b(S)})}J(u,i)});var a=Z(f,2);{var d=u=>{var e=cl(),i=Ie(e);Ct(i,17,()=>{var h;return((h=l.worktree)==null?void 0:h.services)??[]},jr,(h,m)=>{var S=Dr(),b=Ie(S);{var _=y=>{var D=al(),T=Q(D);le(()=>{$e(D,"href",`${window.location.protocol??""}//${window.location.hostname??""}:${B(m).port??""}`),Ae(D,1,`text-[11px] px-1.5 py-0.5 rounded border font-mono no-underline hover:opacity-80 ${B(m).running?"text-success border-success/40":"text-muted border-edge pointer-events-none"}`),_e(T,`${B(m).name??""} :${B(m).port??""}`)}),J(y,D)};de(b,y=>{B(m).port&&y(_)})}J(h,S)});var t=Z(i,2);{var s=h=>{var m=ll(),S=Q(m),b=Z(S);le(()=>$e(S,"href",B(C))),Me("click",b,function(..._){var y;(y=l.onsettings)==null||y.apply(this,_)}),J(h,m)};de(t,h=>{B(C)&&h(s)})}J(u,e)};de(a,u=>{v()||u(d)})}var p=Z(k,2);{var g=u=>{var e=hl(),i=Q(e);st(i,{variant:"accent-outline",get onclick(){return l.onmerge},title:"Merge worktree",children:(s,h)=>{var m=Je();le(()=>_e(m,v()?"M":"Merge")),J(s,m)},$$slots:{default:!0}});var t=Z(i,2);st(t,{variant:"danger-outline",get onclick(){return l.onremove},title:"Remove worktree",children:(s,h)=>{var m=Je();le(()=>_e(m,v()?"R":"Remove")),J(s,m)},$$slots:{default:!0}}),J(u,e)};de(p,u=>{l.name&&u(g)})}le(()=>_e(c,l.name??"Select a worktree")),J(r,w),Fe()}Tt(["click"]);var xi={exports:{}},ks;function fl(){return ks||(ks=1,(function(r,l){(function(v,C){r.exports=C()})(globalThis,(()=>(()=>{var v={4567:function(x,n,o){var c=this&&this.__decorate||function(t,s,h,m){var S,b=arguments.length,_=b<3?s:m===null?m=Object.getOwnPropertyDescriptor(s,h):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(t,s,h,m);else for(var y=t.length-1;y>=0;y--)(S=t[y])&&(_=(b<3?S(_):b>3?S(s,h,_):S(s,h))||_);return b>3&&_&&Object.defineProperty(s,h,_),_},f=this&&this.__param||function(t,s){return function(h,m){s(h,m,t)}};Object.defineProperty(n,"__esModule",{value:!0}),n.AccessibilityManager=void 0;const a=o(9042),d=o(9924),p=o(844),g=o(4725),u=o(2585),e=o(3656);let i=n.AccessibilityManager=class extends p.Disposable{constructor(t,s,h,m){super(),this._terminal=t,this._coreBrowserService=h,this._renderService=m,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let S=0;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);if(this._topBoundaryFocusListener=S=>this._handleBoundaryFocus(S,0),this._bottomBoundaryFocusListener=S=>this._handleBoundaryFocus(S,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 d.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((S=>this._handleResize(S.rows)))),this.register(this._terminal.onRender((S=>this._refreshRows(S.start,S.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((S=>this._handleChar(S)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
3
- `)))),this.register(this._terminal.onA11yTab((S=>this._handleTab(S)))),this.register(this._terminal.onKey((S=>this._handleKey(S.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,e.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,p.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(t){for(let s=0;s<t;s++)this._handleChar(" ")}_handleChar(t){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
4
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=a.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,s){this._liveRegionDebouncer.refresh(t,s,this._terminal.rows)}_renderRows(t,s){const h=this._terminal.buffer,m=h.lines.length.toString();for(let S=t;S<=s;S++){const b=h.lines.get(h.ydisp+S),_=[],y=(b==null?void 0:b.translateToString(!0,void 0,void 0,_))||"",D=(h.ydisp+S+1).toString(),T=this._rowElements[S];T&&(y.length===0?(T.innerText=" ",this._rowColumns.set(T,[0,1])):(T.textContent=y,this._rowColumns.set(T,_)),T.setAttribute("aria-posinset",D),T.setAttribute("aria-setsize",m))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,s){const h=t.target,m=this._rowElements[s===0?1:this._rowElements.length-2];if(h.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||t.relatedTarget!==m)return;let S,b;if(s===0?(S=h,b=this._rowElements.pop(),this._rowContainer.removeChild(b)):(S=this._rowElements.shift(),b=h,this._rowContainer.removeChild(S)),S.removeEventListener("focus",this._topBoundaryFocusListener),b.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){const _=this._createAccessibilityTreeNode();this._rowElements.unshift(_),this._rowContainer.insertAdjacentElement("afterbegin",_)}else{const _=this._createAccessibilityTreeNode();this._rowElements.push(_),this._rowContainer.appendChild(_)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(s===0?-1:1),this._rowElements[s===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){var y;if(this._rowElements.length===0)return;const t=document.getSelection();if(!t)return;if(t.isCollapsed)return void(this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection());if(!t.anchorNode||!t.focusNode)return void console.error("anchorNode and/or focusNode are null");let s={node:t.anchorNode,offset:t.anchorOffset},h={node:t.focusNode,offset:t.focusOffset};if((s.node.compareDocumentPosition(h.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===h.node&&s.offset>h.offset)&&([s,h]=[h,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 m=this._rowElements.slice(-1)[0];if(h.node.compareDocumentPosition(m)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(h={node:m,offset:((y=m.textContent)==null?void 0:y.length)??0}),!this._rowContainer.contains(h.node))return;const S=({node:D,offset:T})=>{const O=D instanceof Text?D.parentNode:D;let A=parseInt(O==null?void 0:O.getAttribute("aria-posinset"),10)-1;if(isNaN(A))return console.warn("row is invalid. Race condition?"),null;const W=this._rowColumns.get(O);if(!W)return console.warn("columns is null. Race condition?"),null;let H=T<W.length?W[T]:W.slice(-1)[0]+1;return H>=this._terminal.cols&&(++A,H=0),{row:A,column:H}},b=S(s),_=S(h);if(b&&_){if(b.row>_.row||b.row===_.row&&b.column>=_.column)throw new Error("invalid range");this._terminal.select(b.column,b.row,(_.row-b.row)*this._terminal.cols-b.column+_.column)}}_handleResize(t){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>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_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 t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}};n.AccessibilityManager=i=c([f(1,u.IInstantiationService),f(2,g.ICoreBrowserService),f(3,g.IRenderService)],i)},3614:(x,n)=>{function o(d){return d.replace(/\r?\n/g,"\r")}function c(d,p){return p?"\x1B[200~"+d+"\x1B[201~":d}function f(d,p,g,u){d=c(d=o(d),g.decPrivateModes.bracketedPasteMode&&u.rawOptions.ignoreBracketedPasteMode!==!0),g.triggerDataEvent(d,!0),p.value=""}function a(d,p,g){const u=g.getBoundingClientRect(),e=d.clientX-u.left-10,i=d.clientY-u.top-10;p.style.width="20px",p.style.height="20px",p.style.left=`${e}px`,p.style.top=`${i}px`,p.style.zIndex="1000",p.focus()}Object.defineProperty(n,"__esModule",{value:!0}),n.rightClickHandler=n.moveTextAreaUnderMouseCursor=n.paste=n.handlePasteEvent=n.copyHandler=n.bracketTextForPaste=n.prepareTextForTerminal=void 0,n.prepareTextForTerminal=o,n.bracketTextForPaste=c,n.copyHandler=function(d,p){d.clipboardData&&d.clipboardData.setData("text/plain",p.selectionText),d.preventDefault()},n.handlePasteEvent=function(d,p,g,u){d.stopPropagation(),d.clipboardData&&f(d.clipboardData.getData("text/plain"),p,g,u)},n.paste=f,n.moveTextAreaUnderMouseCursor=a,n.rightClickHandler=function(d,p,g,u,e){a(d,p,g),e&&u.rightClickSelect(d),p.value=u.selectionText,p.select()}},7239:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ColorContrastCache=void 0;const c=o(1505);n.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(f,a,d){this._css.set(f,a,d)}getCss(f,a){return this._css.get(f,a)}setColor(f,a,d){this._color.set(f,a,d)}getColor(f,a){return this._color.get(f,a)}clear(){this._color.clear(),this._css.clear()}}},3656:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.addDisposableDomListener=void 0,n.addDisposableDomListener=function(o,c,f,a){o.addEventListener(c,f,a);let d=!1;return{dispose:()=>{d||(d=!0,o.removeEventListener(c,f,a))}}}},3551:function(x,n,o){var c=this&&this.__decorate||function(i,t,s,h){var m,S=arguments.length,b=S<3?t:h===null?h=Object.getOwnPropertyDescriptor(t,s):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(i,t,s,h);else for(var _=i.length-1;_>=0;_--)(m=i[_])&&(b=(S<3?m(b):S>3?m(t,s,b):m(t,s))||b);return S>3&&b&&Object.defineProperty(t,s,b),b},f=this&&this.__param||function(i,t){return function(s,h){t(s,h,i)}};Object.defineProperty(n,"__esModule",{value:!0}),n.Linkifier=void 0;const a=o(3656),d=o(8460),p=o(844),g=o(2585),u=o(4725);let e=n.Linkifier=class extends p.Disposable{get currentLink(){return this._currentLink}constructor(i,t,s,h,m){super(),this._element=i,this._mouseService=t,this._renderService=s,this._bufferService=h,this._linkProviderService=m,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new d.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new d.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,p.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,p.toDisposable)((()=>{var S;this._lastMouseEvent=void 0,(S=this._activeProviderReplies)==null||S.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,a.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,a.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(i){this._lastMouseEvent=i;const t=this._positionFromMouseEvent(i,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;const s=i.composedPath();for(let h=0;h<s.length;h++){const m=s[h];if(m.classList.contains("xterm"))break;if(m.classList.contains("xterm-hover"))return}this._lastBufferCell&&t.x===this._lastBufferCell.x&&t.y===this._lastBufferCell.y||(this._handleHover(t),this._lastBufferCell=t)}_handleHover(i){if(this._activeLine!==i.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(i,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,i)||(this._clearCurrentLink(),this._askForLink(i,!0))}_askForLink(i,t){var h,m;this._activeProviderReplies&&t||((h=this._activeProviderReplies)==null||h.forEach((S=>{S==null||S.forEach((b=>{b.link.dispose&&b.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=i.y);let s=!1;for(const[S,b]of this._linkProviderService.linkProviders.entries())t?(m=this._activeProviderReplies)!=null&&m.get(S)&&(s=this._checkLinkProviderResult(S,i,s)):b.provideLinks(i.y,(_=>{var D,T;if(this._isMouseOut)return;const y=_==null?void 0:_.map((O=>({link:O})));(D=this._activeProviderReplies)==null||D.set(S,y),s=this._checkLinkProviderResult(S,i,s),((T=this._activeProviderReplies)==null?void 0:T.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(i.y,this._activeProviderReplies)}))}_removeIntersectingLinks(i,t){const s=new Set;for(let h=0;h<t.size;h++){const m=t.get(h);if(m)for(let S=0;S<m.length;S++){const b=m[S],_=b.link.range.start.y<i?0:b.link.range.start.x,y=b.link.range.end.y>i?this._bufferService.cols:b.link.range.end.x;for(let D=_;D<=y;D++){if(s.has(D)){m.splice(S--,1);break}s.add(D)}}}}_checkLinkProviderResult(i,t,s){var S;if(!this._activeProviderReplies)return s;const h=this._activeProviderReplies.get(i);let m=!1;for(let b=0;b<i;b++)this._activeProviderReplies.has(b)&&!this._activeProviderReplies.get(b)||(m=!0);if(!m&&h){const b=h.find((_=>this._linkAtPosition(_.link,t)));b&&(s=!0,this._handleNewLink(b))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let b=0;b<this._activeProviderReplies.size;b++){const _=(S=this._activeProviderReplies.get(b))==null?void 0:S.find((y=>this._linkAtPosition(y.link,t)));if(_){s=!0,this._handleNewLink(_);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(i){if(!this._currentLink)return;const t=this._positionFromMouseEvent(i,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(i,this._currentLink.link.text)}_clearCurrentLink(i,t){this._currentLink&&this._lastMouseEvent&&(!i||!t||this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,p.disposeArray)(this._linkCacheDisposables))}_handleNewLink(i){if(!this._lastMouseEvent)return;const t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(i.link,t)&&(this._currentLink=i,this._currentLink.state={decorations:{underline:i.link.decorations===void 0||i.link.decorations.underline,pointerCursor:i.link.decorations===void 0||i.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,i.link,this._lastMouseEvent),i.link.decorations={},Object.defineProperties(i.link.decorations,{pointerCursor:{get:()=>{var s,h;return(h=(s=this._currentLink)==null?void 0:s.state)==null?void 0:h.decorations.pointerCursor},set:s=>{var h;(h=this._currentLink)!=null&&h.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,h;return(h=(s=this._currentLink)==null?void 0:s.state)==null?void 0:h.decorations.underline},set:s=>{var h,m,S;(h=this._currentLink)!=null&&h.state&&((S=(m=this._currentLink)==null?void 0:m.state)==null?void 0:S.decorations.underline)!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(i.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((s=>{if(!this._currentLink)return;const h=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,m=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=h&&this._currentLink.link.range.end.y<=m&&(this._clearCurrentLink(h,m),this._lastMouseEvent)){const S=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);S&&this._askForLink(S,!1)}}))))}_linkHover(i,t,s){var h;(h=this._currentLink)!=null&&h.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&i.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(s,t.text)}_fireUnderlineEvent(i,t){const s=i.range,h=this._bufferService.buffer.ydisp,m=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-h-1,s.end.x,s.end.y-h-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(m)}_linkLeave(i,t,s){var h;(h=this._currentLink)!=null&&h.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&i.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(s,t.text)}_linkAtPosition(i,t){const s=i.range.start.y*this._bufferService.cols+i.range.start.x,h=i.range.end.y*this._bufferService.cols+i.range.end.x,m=t.y*this._bufferService.cols+t.x;return s<=m&&m<=h}_positionFromMouseEvent(i,t,s){const h=s.getCoords(i,t,this._bufferService.cols,this._bufferService.rows);if(h)return{x:h[0],y:h[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(i,t,s,h,m){return{x1:i,y1:t,x2:s,y2:h,cols:this._bufferService.cols,fg:m}}};n.Linkifier=e=c([f(1,u.IMouseService),f(2,u.IRenderService),f(3,g.IBufferService),f(4,u.ILinkProviderService)],e)},9042:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.tooMuchOutput=n.promptLabel=void 0,n.promptLabel="Terminal input",n.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(x,n,o){var c=this&&this.__decorate||function(u,e,i,t){var s,h=arguments.length,m=h<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,i):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(u,e,i,t);else for(var S=u.length-1;S>=0;S--)(s=u[S])&&(m=(h<3?s(m):h>3?s(e,i,m):s(e,i))||m);return h>3&&m&&Object.defineProperty(e,i,m),m},f=this&&this.__param||function(u,e){return function(i,t){e(i,t,u)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkProvider=void 0;const a=o(511),d=o(2585);let p=n.OscLinkProvider=class{constructor(u,e,i){this._bufferService=u,this._optionsService=e,this._oscLinkService=i}provideLinks(u,e){var y;const i=this._bufferService.buffer.lines.get(u-1);if(!i)return void e(void 0);const t=[],s=this._optionsService.rawOptions.linkHandler,h=new a.CellData,m=i.getTrimmedLength();let S=-1,b=-1,_=!1;for(let D=0;D<m;D++)if(b!==-1||i.hasContent(D)){if(i.loadCell(D,h),h.hasExtendedAttrs()&&h.extended.urlId){if(b===-1){b=D,S=h.extended.urlId;continue}_=h.extended.urlId!==S}else b!==-1&&(_=!0);if(_||b!==-1&&D===m-1){const T=(y=this._oscLinkService.getLinkData(S))==null?void 0:y.uri;if(T){const O={start:{x:b+1,y:u},end:{x:D+(_||D!==m-1?0:1),y:u}};let A=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{const W=new URL(T);["http:","https:"].includes(W.protocol)||(A=!0)}catch{A=!0}A||t.push({text:T,range:O,activate:(W,H)=>s?s.activate(W,H,O):g(0,H),hover:(W,H)=>{var U;return(U=s==null?void 0:s.hover)==null?void 0:U.call(s,W,H,O)},leave:(W,H)=>{var U;return(U=s==null?void 0:s.leave)==null?void 0:U.call(s,W,H,O)}})}_=!1,h.hasExtendedAttrs()&&h.extended.urlId?(b=D,S=h.extended.urlId):(b=-1,S=-1)}}e(t)}};function g(u,e){if(confirm(`Do you want to navigate to ${e}?
5
-
6
- WARNING: This link could potentially be dangerous`)){const i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}n.OscLinkProvider=p=c([f(0,d.IBufferService),f(1,d.IOptionsService),f(2,d.IOscLinkService)],p)},6193:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RenderDebouncer=void 0,n.RenderDebouncer=class{constructor(o,c){this._renderCallback=o,this._coreBrowserService=c,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,c,f){this._rowCount=f,o=o!==void 0?o:0,c=c!==void 0?c: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,c):c,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),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const o of this._refreshCallbacks)o(0);this._refreshCallbacks=[]}}},3236:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Terminal=void 0;const c=o(3614),f=o(3656),a=o(3551),d=o(9042),p=o(3730),g=o(1680),u=o(3107),e=o(5744),i=o(2950),t=o(1296),s=o(428),h=o(4269),m=o(5114),S=o(8934),b=o(3230),_=o(9312),y=o(4725),D=o(6731),T=o(8055),O=o(8969),A=o(8460),W=o(844),H=o(6114),U=o(8437),V=o(2584),$=o(7399),E=o(5941),R=o(9074),M=o(2585),P=o(5435),j=o(4567),q=o(779);class ee 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=H,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new W.MutableDisposable),this._onCursorMove=this.register(new A.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new A.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new A.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new A.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new A.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new A.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new A.EventEmitter),this._onBlur=this.register(new A.EventEmitter),this._onA11yCharEmitter=this.register(new A.EventEmitter),this._onA11yTabEmitter=this.register(new A.EventEmitter),this._onWillOpen=this.register(new A.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(R.DecorationService),this._instantiationService.setService(M.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(p.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((L,z)=>this.refresh(L,z)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((L=>this._reportWindowsOptions(L)))),this.register(this._inputHandler.onColor((L=>this._handleColorEvent(L)))),this.register((0,A.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,A.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,A.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,A.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((L=>this._afterResize(L.cols,L.rows)))),this.register((0,W.toDisposable)((()=>{var L,z;this._customKeyEventHandler=void 0,(z=(L=this.element)==null?void 0:L.parentNode)==null||z.removeChild(this.element)})))}_handleColorEvent(I){if(this._themeService)for(const L of I){let z,N="";switch(L.index){case 256:z="foreground",N="10";break;case 257:z="background",N="11";break;case 258:z="cursor",N="12";break;default:z="ansi",N="4;"+L.index}switch(L.type){case 0:const Y=T.color.toColorRGB(z==="ansi"?this._themeService.colors.ansi[L.index]:this._themeService.colors[z]);this.coreService.triggerDataEvent(`${V.C0.ESC}]${N};${(0,E.toRgbString)(Y)}${V.C1_ESCAPED.ST}`);break;case 1:if(z==="ansi")this._themeService.modifyColors((X=>X.ansi[L.index]=T.channels.toColor(...L.color)));else{const X=z;this._themeService.modifyColors((ne=>ne[X]=T.channels.toColor(...L.color)))}break;case 2:this._themeService.restoreColor(L.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(j.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(I){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.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(V.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,L=this.buffer.lines.get(I);if(!L)return;const z=Math.min(this.buffer.x,this.cols-1),N=this._renderService.dimensions.css.cell.height,Y=L.getWidth(z),X=this._renderService.dimensions.css.cell.width*Y,ne=this.buffer.y*this._renderService.dimensions.css.cell.height,ve=z*this._renderService.dimensions.css.cell.width;this.textarea.style.left=ve+"px",this.textarea.style.top=ne+"px",this.textarea.style.width=X+"px",this.textarea.style.height=N+"px",this.textarea.style.lineHeight=N+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(L=>{this.hasSelection()&&(0,c.copyHandler)(L,this._selectionService)})));const I=L=>(0,c.handlePasteEvent)(L,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",I)),this.register((0,f.addDisposableDomListener)(this.element,"paste",I)),H.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(L=>{L.button===2&&(0,c.rightClickHandler)(L,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(L=>{(0,c.rightClickHandler)(L,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),H.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(L=>{L.button===1&&(0,c.moveTextAreaUnderMouseCursor)(L,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(I=>this._keyUp(I)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(I=>this._keyDown(I)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(I=>this._keyPress(I)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(I=>this._compositionHelper.compositionupdate(I)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(I=>this._inputEvent(I)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(I){var z;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"),((z=this.element)==null?void 0:z.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=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 L=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),L.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,f.addDisposableDomListener)(this.screenElement,"mousemove",(N=>this.updateCursorStyle(N)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),L.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",d.promptLabel),H.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(m.CoreBrowserService,this.textarea,I.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(N=>this._handleTextAreaFocus(N)))),this.register((0,f.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(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(D.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(h.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(b.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((N=>this._onRender.fire(N)))),this.onResize((N=>this._renderService.resize(N.cols,N.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(i.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(S.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(a.Linkifier,this.screenElement)),this.element.appendChild(L);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(g.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(_.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((N=>this.scrollLines(N.amount,N.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((N=>this._renderService.handleSelectionChanged(N.start,N.end,N.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((N=>{this.textarea.value=N,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((N=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(u.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(N=>this._selectionService.handleMouseDown(N)))),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(j.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(N=>this._handleScreenReaderModeOptionChange(N)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(N=>{!this._overviewRulerRenderer&&N&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(e.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(t.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const I=this,L=this.element;function z(X){const ne=I._mouseService.getMouseReportCoords(X,I.screenElement);if(!ne)return!1;let ve,ge;switch(X.overrideType||X.type){case"mousemove":ge=32,X.buttons===void 0?(ve=3,X.button!==void 0&&(ve=X.button<3?X.button:3)):ve=1&X.buttons?0:4&X.buttons?1:2&X.buttons?2:3;break;case"mouseup":ge=0,ve=X.button<3?X.button:3;break;case"mousedown":ge=1,ve=X.button<3?X.button:3;break;case"wheel":if(I._customWheelEventHandler&&I._customWheelEventHandler(X)===!1||I.viewport.getLinesScrolled(X)===0)return!1;ge=X.deltaY<0?0:1,ve=4;break;default:return!1}return!(ge===void 0||ve===void 0||ve>4)&&I.coreMouseService.triggerMouseEvent({col:ne.col,row:ne.row,x:ne.x,y:ne.y,button:ve,action:ge,ctrl:X.ctrlKey,alt:X.altKey,shift:X.shiftKey})}const N={mouseup:null,wheel:null,mousedrag:null,mousemove:null},Y={mouseup:X=>(z(X),X.buttons||(this._document.removeEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.removeEventListener("mousemove",N.mousedrag)),this.cancel(X)),wheel:X=>(z(X),this.cancel(X,!0)),mousedrag:X=>{X.buttons&&z(X)},mousemove:X=>{X.buttons||z(X)}};this.register(this.coreMouseService.onProtocolChange((X=>{X?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(X)),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&X?N.mousemove||(L.addEventListener("mousemove",Y.mousemove),N.mousemove=Y.mousemove):(L.removeEventListener("mousemove",N.mousemove),N.mousemove=null),16&X?N.wheel||(L.addEventListener("wheel",Y.wheel,{passive:!1}),N.wheel=Y.wheel):(L.removeEventListener("wheel",N.wheel),N.wheel=null),2&X?N.mouseup||(N.mouseup=Y.mouseup):(this._document.removeEventListener("mouseup",N.mouseup),N.mouseup=null),4&X?N.mousedrag||(N.mousedrag=Y.mousedrag):(this._document.removeEventListener("mousemove",N.mousedrag),N.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(L,"mousedown",(X=>{if(X.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(X))return z(X),N.mouseup&&this._document.addEventListener("mouseup",N.mouseup),N.mousedrag&&this._document.addEventListener("mousemove",N.mousedrag),this.cancel(X)}))),this.register((0,f.addDisposableDomListener)(L,"wheel",(X=>{if(!N.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(X)===!1)return!1;if(!this.buffer.hasScrollback){const ne=this.viewport.getLinesScrolled(X);if(ne===0)return;const ve=V.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(X.deltaY<0?"A":"B");let ge="";for(let xe=0;xe<Math.abs(ne);xe++)ge+=ve;return this.coreService.triggerDataEvent(ge,!0),this.cancel(X,!0)}return this.viewport.handleWheel(X)?this.cancel(X):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(L,"touchstart",(X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(X),this.cancel(X)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(L,"touchmove",(X=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(X)?void 0:this.cancel(X)}),{passive:!1}))}refresh(I,L){var z;(z=this._renderService)==null||z.refreshRows(I,L)}updateCursorStyle(I){var L;(L=this._selectionService)!=null&&L.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,L,z=0){var N;z===1?(super.scrollLines(I,L,z),this.refresh(0,this.rows-1)):(N=this.viewport)==null||N.scrollLines(I)}paste(I){(0,c.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 L=this._characterJoinerService.register(I);return this.refresh(0,this.rows-1),L}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,L,z){this._selectionService.setSelection(I,L,z)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var I;(I=this._selectionService)==null||I.clearSelection()}selectAll(){var I;(I=this._selectionService)==null||I.selectAll()}selectLines(I,L){var z;(z=this._selectionService)==null||z.selectLines(I,L)}_keyDown(I){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;const L=this.browser.isMac&&this.options.macOptionIsMeta&&I.altKey;if(!L&&!this._compositionHelper.keydown(I))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;L||I.key!=="Dead"&&I.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const z=(0,$.evaluateKeyboardEvent)(I,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(I),z.type===3||z.type===2){const N=this.rows-1;return this.scrollLines(z.type===2?-N:N),this.cancel(I,!0)}return z.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,I)||(z.cancel&&this.cancel(I,!0),!z.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):(z.key!==V.C0.ETX&&z.key!==V.C0.CR||(this.textarea.value=""),this._onKey.fire({key:z.key,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(z.key,!0),!this.optionsService.rawOptions.screenReaderMode||I.altKey||I.ctrlKey?this.cancel(I,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(I,L){const z=I.isMac&&!this.options.macOptionIsMeta&&L.altKey&&!L.ctrlKey&&!L.metaKey||I.isWindows&&L.altKey&&L.ctrlKey&&!L.metaKey||I.isWindows&&L.getModifierState("AltGraph");return L.type==="keypress"?z:z&&(!L.keyCode||L.keyCode>47)}_keyUp(I){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1||((function(L){return L.keyCode===16||L.keyCode===17||L.keyCode===18})(I)||this.focus(),this.updateCursorStyle(I),this._keyPressHandled=!1)}_keyPress(I){let L;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;if(this.cancel(I),I.charCode)L=I.charCode;else if(I.which===null||I.which===void 0)L=I.keyCode;else{if(I.which===0||I.charCode===0)return!1;L=I.which}return!(!L||(I.altKey||I.ctrlKey||I.metaKey)&&!this._isThirdLevelShift(this.browser,I)||(L=String.fromCharCode(L),this._onKey.fire({key:L,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(L,!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 L=I.data;return this.coreService.triggerDataEvent(L,!0),this.cancel(I),!0}return!1}resize(I,L){I!==this.cols||L!==this.rows?super.resize(I,L):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(I,L){var z,N;(z=this._charSizeService)==null||z.measure(),(N=this.viewport)==null||N.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 L=1;L<this.rows;L++)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 L,z;this.options.rows=this.rows,this.options.cols=this.cols;const I=this._customKeyEventHandler;this._setup(),super.reset(),(L=this._selectionService)==null||L.reset(),this._decorationService.reset(),(z=this.viewport)==null||z.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(V.C0.ESC+"[I"):this.coreService.triggerDataEvent(V.C0.ESC+"[O")}_reportWindowsOptions(I){if(this._renderService)switch(I){case P.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const L=this._renderService.dimensions.css.canvas.width.toFixed(0),z=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${V.C0.ESC}[4;${z};${L}t`);break;case P.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const N=this._renderService.dimensions.css.cell.width.toFixed(0),Y=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${V.C0.ESC}[6;${Y};${N}t`)}}cancel(I,L){if(this.options.cancelEvents||L)return I.preventDefault(),I.stopPropagation(),!1}}n.Terminal=ee},9924:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TimeBasedDebouncer=void 0,n.TimeBasedDebouncer=class{constructor(o,c=1e3){this._renderCallback=o,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(o,c,f){this._rowCount=f,o=o!==void 0?o:0,c=c!==void 0?c: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,c):c;const a=Date.now();if(a-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=a,this._innerRefresh();else if(!this._additionalRefreshRequested){const d=a-this._lastRefreshMs,p=this._debounceThresholdMS-d;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),p)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const o=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(o,c)}}},1680:function(x,n,o){var c=this&&this.__decorate||function(i,t,s,h){var m,S=arguments.length,b=S<3?t:h===null?h=Object.getOwnPropertyDescriptor(t,s):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(i,t,s,h);else for(var _=i.length-1;_>=0;_--)(m=i[_])&&(b=(S<3?m(b):S>3?m(t,s,b):m(t,s))||b);return S>3&&b&&Object.defineProperty(t,s,b),b},f=this&&this.__param||function(i,t){return function(s,h){t(s,h,i)}};Object.defineProperty(n,"__esModule",{value:!0}),n.Viewport=void 0;const a=o(3656),d=o(4725),p=o(8460),g=o(844),u=o(2585);let e=n.Viewport=class extends g.Disposable{constructor(i,t,s,h,m,S,b,_){super(),this._viewportElement=i,this._scrollArea=t,this._bufferService=s,this._optionsService=h,this._charSizeService=m,this._renderService=S,this._coreBrowserService=b,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,a.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((y=>this._activeBuffer=y.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((y=>this._renderDimensions=y))),this._handleThemeChange(_.colors),this.register(_.onChangeColors((y=>this._handleThemeChange(y)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(i){this._viewportElement.style.backgroundColor=i.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(i){if(i)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 t=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==t&&(this._lastRecordedBufferHeight=t,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const i=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==i&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=i),this._refreshAnimationFrame=null}syncScrollArea(i=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(i);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(i)}_handleScroll(i){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 t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const i=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(i*(this._smoothScrollState.target-this._smoothScrollState.origin)),i<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(i,t){const s=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&this._viewportElement.scrollTop!==0||t>0&&s<this._lastRecordedBufferHeight)||(i.cancelable&&i.preventDefault(),!1)}handleWheel(i){const t=this._getPixelsScrolled(i);return t!==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+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(i,t))}scrollLines(i){if(i!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const t=i*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:i,suppressScrollEvent:!1})}_getPixelsScrolled(i){if(i.deltaY===0||i.shiftKey)return 0;let t=this._applyScrollModifier(i.deltaY,i);return i.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(i,t){var _;let s,h="";const m=[],S=t??this._bufferService.buffer.lines.length,b=this._bufferService.buffer.lines;for(let y=i;y<S;y++){const D=b.get(y);if(!D)continue;const T=(_=b.get(y+1))==null?void 0:_.isWrapped;if(h+=D.translateToString(!T),!T||y===b.length-1){const O=document.createElement("div");O.textContent=h,m.push(O),h.length>0&&(s=O),h=""}}return{bufferElements:m,cursorElement:s}}getLinesScrolled(i){if(i.deltaY===0||i.shiftKey)return 0;let t=this._applyScrollModifier(i.deltaY,i);return i.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(i,t){const s=this._optionsService.rawOptions.fastScrollModifier;return s==="alt"&&t.altKey||s==="ctrl"&&t.ctrlKey||s==="shift"&&t.shiftKey?i*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:i*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(i){this._lastTouchY=i.touches[0].pageY}handleTouchMove(i){const t=this._lastTouchY-i.touches[0].pageY;return this._lastTouchY=i.touches[0].pageY,t!==0&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(i,t))}};n.Viewport=e=c([f(2,u.IBufferService),f(3,u.IOptionsService),f(4,d.ICharSizeService),f(5,d.IRenderService),f(6,d.ICoreBrowserService),f(7,d.IThemeService)],e)},3107:function(x,n,o){var c=this&&this.__decorate||function(u,e,i,t){var s,h=arguments.length,m=h<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,i):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(u,e,i,t);else for(var S=u.length-1;S>=0;S--)(s=u[S])&&(m=(h<3?s(m):h>3?s(e,i,m):s(e,i))||m);return h>3&&m&&Object.defineProperty(e,i,m),m},f=this&&this.__param||function(u,e){return function(i,t){e(i,t,u)}};Object.defineProperty(n,"__esModule",{value:!0}),n.BufferDecorationRenderer=void 0;const a=o(4725),d=o(844),p=o(2585);let g=n.BufferDecorationRenderer=class extends d.Disposable{constructor(u,e,i,t,s){super(),this._screenElement=u,this._bufferService=e,this._coreBrowserService=i,this._decorationService=t,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((h=>this._removeDecoration(h)))),this.register((0,d.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 u of this._decorationService.decorations)this._renderDecoration(u);this._dimensionsChanged=!1}_renderDecoration(u){this._refreshStyle(u),this._dimensionsChanged&&this._refreshXPosition(u)}_createElement(u){var t;const e=this._coreBrowserService.mainDocument.createElement("div");e.classList.add("xterm-decoration"),e.classList.toggle("xterm-decoration-top-layer",((t=u==null?void 0:u.options)==null?void 0:t.layer)==="top"),e.style.width=`${Math.round((u.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,e.style.height=(u.options.height||1)*this._renderService.dimensions.css.cell.height+"px",e.style.top=(u.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",e.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const i=u.options.x??0;return i&&i>this._bufferService.cols&&(e.style.display="none"),this._refreshXPosition(u,e),e}_refreshStyle(u){const e=u.marker.line-this._bufferService.buffers.active.ydisp;if(e<0||e>=this._bufferService.rows)u.element&&(u.element.style.display="none",u.onRenderEmitter.fire(u.element));else{let i=this._decorationElements.get(u);i||(i=this._createElement(u),u.element=i,this._decorationElements.set(u,i),this._container.appendChild(i),u.onDispose((()=>{this._decorationElements.delete(u),i.remove()}))),i.style.top=e*this._renderService.dimensions.css.cell.height+"px",i.style.display=this._altBufferIsActive?"none":"block",u.onRenderEmitter.fire(i)}}_refreshXPosition(u,e=u.element){if(!e)return;const i=u.options.x??0;(u.options.anchor||"left")==="right"?e.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":e.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(u){var e;(e=this._decorationElements.get(u))==null||e.remove(),this._decorationElements.delete(u),u.dispose()}};n.BufferDecorationRenderer=g=c([f(1,p.IBufferService),f(2,a.ICoreBrowserService),f(3,p.IDecorationService),f(4,a.IRenderService)],g)},5871:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ColorZoneStore=void 0,n.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(o){if(o.options.overviewRulerOptions){for(const c of this._zones)if(c.color===o.options.overviewRulerOptions.color&&c.position===o.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,o.marker.line))return;if(this._lineAdjacentToZone(c,o.marker.line,o.options.overviewRulerOptions.position))return void this._addLineToZone(c,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,c){return c>=o.startBufferLine&&c<=o.endBufferLine}_lineAdjacentToZone(o,c,f){return c>=o.startBufferLine-this._linePadding[f||"full"]&&c<=o.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(o,c){o.startBufferLine=Math.min(o.startBufferLine,c),o.endBufferLine=Math.max(o.endBufferLine,c)}}},5744:function(x,n,o){var c=this&&this.__decorate||function(s,h,m,S){var b,_=arguments.length,y=_<3?h:S===null?S=Object.getOwnPropertyDescriptor(h,m):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(s,h,m,S);else for(var D=s.length-1;D>=0;D--)(b=s[D])&&(y=(_<3?b(y):_>3?b(h,m,y):b(h,m))||y);return _>3&&y&&Object.defineProperty(h,m,y),y},f=this&&this.__param||function(s,h){return function(m,S){h(m,S,s)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OverviewRulerRenderer=void 0;const a=o(5871),d=o(4725),p=o(844),g=o(2585),u={full:0,left:0,center:0,right:0},e={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0};let t=n.OverviewRulerRenderer=class extends p.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,h,m,S,b,_,y){var T;super(),this._viewportElement=s,this._screenElement=h,this._bufferService=m,this._decorationService=S,this._renderService=b,this._optionsService=_,this._coreBrowserService=y,this._colorZoneStore=new a.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(T=this._viewportElement.parentElement)==null||T.insertBefore(this._canvas,this._viewportElement);const D=this._canvas.getContext("2d");if(!D)throw new Error("Ctx cannot be null");this._ctx=D,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,p.toDisposable)((()=>{var O;(O=this._canvas)==null||O.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const s=Math.floor(this._canvas.width/3),h=Math.ceil(this._canvas.width/3);e.full=this._canvas.width,e.left=s,e.center=h,e.right=s,this._refreshDrawHeightConstants(),i.full=0,i.left=0,i.center=e.left,i.right=e.left+e.center}_refreshDrawHeightConstants(){u.full=Math.round(2*this._coreBrowserService.dpr);const s=this._canvas.height/this._bufferService.buffer.lines.length,h=Math.round(Math.max(Math.min(s,12),6)*this._coreBrowserService.dpr);u.left=h,u.center=h,u.right=h}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.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 h of this._decorationService.decorations)this._colorZoneStore.addDecoration(h);this._ctx.lineWidth=1;const s=this._colorZoneStore.zones;for(const h of s)h.position!=="full"&&this._renderColorZone(h);for(const h of s)h.position==="full"&&this._renderColorZone(h);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(s){this._ctx.fillStyle=s.color,this._ctx.fillRect(i[s.position||"full"],Math.round((this._canvas.height-1)*(s.startBufferLine/this._bufferService.buffers.active.lines.length)-u[s.position||"full"]/2),e[s.position||"full"],Math.round((this._canvas.height-1)*((s.endBufferLine-s.startBufferLine)/this._bufferService.buffers.active.lines.length)+u[s.position||"full"]))}_queueRefresh(s,h){this._shouldUpdateDimensions=s||this._shouldUpdateDimensions,this._shouldUpdateAnchor=h||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};n.OverviewRulerRenderer=t=c([f(2,g.IBufferService),f(3,g.IDecorationService),f(4,d.IRenderService),f(5,g.IOptionsService),f(6,d.ICoreBrowserService)],t)},2950:function(x,n,o){var c=this&&this.__decorate||function(u,e,i,t){var s,h=arguments.length,m=h<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,i):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(u,e,i,t);else for(var S=u.length-1;S>=0;S--)(s=u[S])&&(m=(h<3?s(m):h>3?s(e,i,m):s(e,i))||m);return h>3&&m&&Object.defineProperty(e,i,m),m},f=this&&this.__param||function(u,e){return function(i,t){e(i,t,u)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CompositionHelper=void 0;const a=o(4725),d=o(2585),p=o(2584);let g=n.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(u,e,i,t,s,h){this._textarea=u,this._compositionView=e,this._bufferService=i,this._optionsService=t,this._coreService=s,this._renderService=h,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(u){this._compositionView.textContent=u.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(u){if(this._isComposing||this._isSendingComposition){if(u.keyCode===229||u.keyCode===16||u.keyCode===17||u.keyCode===18)return!1;this._finalizeComposition(!1)}return u.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(u){if(this._compositionView.classList.remove("active"),this._isComposing=!1,u){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let i;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,i=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}}),0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const u=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const e=this._textarea.value,i=e.replace(u,"");this._dataAlreadySent=i,e.length>u.length?this._coreService.triggerDataEvent(i,!0):e.length<u.length?this._coreService.triggerDataEvent(`${p.C0.DEL}`,!0):e.length===u.length&&e!==u&&this._coreService.triggerDataEvent(e,!0)}}),0)}updateCompositionElements(u){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,t=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=t+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const h=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=t+"px",this._textarea.style.width=Math.max(h.width,1)+"px",this._textarea.style.height=Math.max(h.height,1)+"px",this._textarea.style.lineHeight=h.height+"px"}u||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};n.CompositionHelper=g=c([f(2,d.IBufferService),f(3,d.IOptionsService),f(4,d.ICoreService),f(5,a.IRenderService)],g)},9806:(x,n)=>{function o(c,f,a){const d=a.getBoundingClientRect(),p=c.getComputedStyle(a),g=parseInt(p.getPropertyValue("padding-left")),u=parseInt(p.getPropertyValue("padding-top"));return[f.clientX-d.left-g,f.clientY-d.top-u]}Object.defineProperty(n,"__esModule",{value:!0}),n.getCoords=n.getCoordsRelativeToElement=void 0,n.getCoordsRelativeToElement=o,n.getCoords=function(c,f,a,d,p,g,u,e,i){if(!g)return;const t=o(c,f,a);return t?(t[0]=Math.ceil((t[0]+(i?u/2:0))/u),t[1]=Math.ceil(t[1]/e),t[0]=Math.min(Math.max(t[0],1),d+(i?1:0)),t[1]=Math.min(Math.max(t[1],1),p),t):void 0}},9504:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.moveToCellSequence=void 0;const c=o(2584);function f(e,i,t,s){const h=e-a(e,t),m=i-a(i,t),S=Math.abs(h-m)-(function(b,_,y){let D=0;const T=b-a(b,y),O=_-a(_,y);for(let A=0;A<Math.abs(T-O);A++){const W=d(b,_)==="A"?-1:1,H=y.buffer.lines.get(T+W*A);H!=null&&H.isWrapped&&D++}return D})(e,i,t);return u(S,g(d(e,i),s))}function a(e,i){let t=0,s=i.buffer.lines.get(e),h=s==null?void 0:s.isWrapped;for(;h&&e>=0&&e<i.rows;)t++,s=i.buffer.lines.get(--e),h=s==null?void 0:s.isWrapped;return t}function d(e,i){return e>i?"A":"B"}function p(e,i,t,s,h,m){let S=e,b=i,_="";for(;S!==t||b!==s;)S+=h?1:-1,h&&S>m.cols-1?(_+=m.buffer.translateBufferLineToString(b,!1,e,S),S=0,e=0,b++):!h&&S<0&&(_+=m.buffer.translateBufferLineToString(b,!1,0,e+1),S=m.cols-1,e=S,b--);return _+m.buffer.translateBufferLineToString(b,!1,e,S)}function g(e,i){const t=i?"O":"[";return c.C0.ESC+t+e}function u(e,i){e=Math.floor(e);let t="";for(let s=0;s<e;s++)t+=i;return t}n.moveToCellSequence=function(e,i,t,s){const h=t.buffer.x,m=t.buffer.y;if(!t.buffer.hasScrollback)return(function(_,y,D,T,O,A){return f(y,T,O,A).length===0?"":u(p(_,y,_,y-a(y,O),!1,O).length,g("D",A))})(h,m,0,i,t,s)+f(m,i,t,s)+(function(_,y,D,T,O,A){let W;W=f(y,T,O,A).length>0?T-a(T,O):y;const H=T,U=(function(V,$,E,R,M,P){let j;return j=f(E,R,M,P).length>0?R-a(R,M):$,V<E&&j<=R||V>=E&&j<R?"C":"D"})(_,y,D,T,O,A);return u(p(_,W,D,H,U==="C",O).length,g(U,A))})(h,m,e,i,t,s);let S;if(m===i)return S=h>e?"D":"C",u(Math.abs(h-e),g(S,s));S=m>i?"D":"C";const b=Math.abs(m-i);return u((function(_,y){return y.cols-_})(m>i?e:h,t)+(b-1)*t.cols+1+((m>i?h:e)-1),g(S,s))}},1296:function(x,n,o){var c=this&&this.__decorate||function(A,W,H,U){var V,$=arguments.length,E=$<3?W:U===null?U=Object.getOwnPropertyDescriptor(W,H):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(A,W,H,U);else for(var R=A.length-1;R>=0;R--)(V=A[R])&&(E=($<3?V(E):$>3?V(W,H,E):V(W,H))||E);return $>3&&E&&Object.defineProperty(W,H,E),E},f=this&&this.__param||function(A,W){return function(H,U){W(H,U,A)}};Object.defineProperty(n,"__esModule",{value:!0}),n.DomRenderer=void 0;const a=o(3787),d=o(2550),p=o(2223),g=o(6171),u=o(6052),e=o(4725),i=o(8055),t=o(8460),s=o(844),h=o(2585),m="xterm-dom-renderer-owner-",S="xterm-rows",b="xterm-fg-",_="xterm-bg-",y="xterm-focus",D="xterm-selection";let T=1,O=n.DomRenderer=class extends s.Disposable{constructor(A,W,H,U,V,$,E,R,M,P,j,q,ee){super(),this._terminal=A,this._document=W,this._element=H,this._screenElement=U,this._viewportElement=V,this._helperContainer=$,this._linkifier2=E,this._charSizeService=M,this._optionsService=P,this._bufferService=j,this._coreBrowserService=q,this._themeService=ee,this._terminalClass=T++,this._rowElements=[],this._selectionRenderModel=(0,u.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new t.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(S),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(D),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,g.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((re=>this._injectCss(re)))),this._injectCss(this._themeService.colors),this._rowFactory=R.createInstance(a.DomRendererRowFactory,document),this._element.classList.add(m+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((re=>this._handleLinkHover(re)))),this.register(this._linkifier2.onHideLinkUnderline((re=>this._handleLinkLeave(re)))),this.register((0,s.toDisposable)((()=>{this._element.classList.remove(m+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new d.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 A=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*A,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*A),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/A),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/A),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const H of this._rowElements)H.style.width=`${this.dimensions.css.canvas.width}px`,H.style.height=`${this.dimensions.css.cell.height}px`,H.style.lineHeight=`${this.dimensions.css.cell.height}px`,H.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const W=`${this._terminalSelector} .${S} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=W,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(A){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let W=`${this._terminalSelector} .${S} { color: ${A.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;W+=`${this._terminalSelector} .${S} .xterm-dim { color: ${i.color.multiplyOpacity(A.foreground,.5).css};}`,W+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const H=`blink_underline_${this._terminalClass}`,U=`blink_bar_${this._terminalClass}`,V=`blink_block_${this._terminalClass}`;W+=`@keyframes ${H} { 50% { border-bottom-style: hidden; }}`,W+=`@keyframes ${U} { 50% { box-shadow: none; }}`,W+=`@keyframes ${V} { 0% { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css}; } 50% { background-color: inherit; color: ${A.cursor.css}; }}`,W+=`${this._terminalSelector} .${S}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${H} 1s step-end infinite;}${this._terminalSelector} .${S}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${S}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${V} 1s step-end infinite;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-block { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css};}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${A.cursor.css} !important; color: ${A.cursorAccent.css} !important;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${A.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${A.cursor.css} inset;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${A.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,W+=`${this._terminalSelector} .${D} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${D} div { position: absolute; background-color: ${A.selectionBackgroundOpaque.css};}${this._terminalSelector} .${D} div { position: absolute; background-color: ${A.selectionInactiveBackgroundOpaque.css};}`;for(const[$,E]of A.ansi.entries())W+=`${this._terminalSelector} .${b}${$} { color: ${E.css}; }${this._terminalSelector} .${b}${$}.xterm-dim { color: ${i.color.multiplyOpacity(E,.5).css}; }${this._terminalSelector} .${_}${$} { background-color: ${E.css}; }`;W+=`${this._terminalSelector} .${b}${p.INVERTED_DEFAULT_COLOR} { color: ${i.color.opaque(A.background).css}; }${this._terminalSelector} .${b}${p.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${i.color.multiplyOpacity(i.color.opaque(A.background),.5).css}; }${this._terminalSelector} .${_}${p.INVERTED_DEFAULT_COLOR} { background-color: ${A.foreground.css}; }`,this._themeStyleElement.textContent=W}_setDefaultSpacing(){const A=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${A}px`,this._rowFactory.defaultSpacing=A}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(A,W){for(let H=this._rowElements.length;H<=W;H++){const U=this._document.createElement("div");this._rowContainer.appendChild(U),this._rowElements.push(U)}for(;this._rowElements.length>W;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(A,W){this._refreshRowElements(A,W),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(y),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(A,W,H){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(A,W,H),this.renderRows(0,this._bufferService.rows-1),!A||!W)return;this._selectionRenderModel.update(this._terminal,A,W,H);const U=this._selectionRenderModel.viewportStartRow,V=this._selectionRenderModel.viewportEndRow,$=this._selectionRenderModel.viewportCappedStartRow,E=this._selectionRenderModel.viewportCappedEndRow;if($>=this._bufferService.rows||E<0)return;const R=this._document.createDocumentFragment();if(H){const M=A[0]>W[0];R.appendChild(this._createSelectionElement($,M?W[0]:A[0],M?A[0]:W[0],E-$+1))}else{const M=U===$?A[0]:0,P=$===V?W[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement($,M,P));const j=E-$-1;if(R.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,j)),$!==E){const q=V===E?W[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(E,0,q))}}this._selectionContainer.appendChild(R)}_createSelectionElement(A,W,H,U=1){const V=this._document.createElement("div"),$=W*this.dimensions.css.cell.width;let E=this.dimensions.css.cell.width*(H-W);return $+E>this.dimensions.css.canvas.width&&(E=this.dimensions.css.canvas.width-$),V.style.height=U*this.dimensions.css.cell.height+"px",V.style.top=A*this.dimensions.css.cell.height+"px",V.style.left=`${$}px`,V.style.width=`${E}px`,V}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 A of this._rowElements)A.replaceChildren()}renderRows(A,W){const H=this._bufferService.buffer,U=H.ybase+H.y,V=Math.min(H.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,E=this._optionsService.rawOptions.cursorStyle,R=this._optionsService.rawOptions.cursorInactiveStyle;for(let M=A;M<=W;M++){const P=M+H.ydisp,j=this._rowElements[M],q=H.lines.get(P);if(!j||!q)break;j.replaceChildren(...this._rowFactory.createRow(q,P,P===U,E,R,V,$,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${m}${this._terminalClass}`}_handleLinkHover(A){this._setCellUnderline(A.x1,A.x2,A.y1,A.y2,A.cols,!0)}_handleLinkLeave(A){this._setCellUnderline(A.x1,A.x2,A.y1,A.y2,A.cols,!1)}_setCellUnderline(A,W,H,U,V,$){H<0&&(A=0),U<0&&(W=0);const E=this._bufferService.rows-1;H=Math.max(Math.min(H,E),0),U=Math.max(Math.min(U,E),0),V=Math.min(V,this._bufferService.cols);const R=this._bufferService.buffer,M=R.ybase+R.y,P=Math.min(R.x,V-1),j=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,ee=this._optionsService.rawOptions.cursorInactiveStyle;for(let re=H;re<=U;++re){const I=re+R.ydisp,L=this._rowElements[re],z=R.lines.get(I);if(!L||!z)break;L.replaceChildren(...this._rowFactory.createRow(z,I,I===M,q,ee,P,j,this.dimensions.css.cell.width,this._widthCache,$?re===H?A:0:-1,$?(re===U?W:V)-1:-1))}}};n.DomRenderer=O=c([f(7,h.IInstantiationService),f(8,e.ICharSizeService),f(9,h.IOptionsService),f(10,h.IBufferService),f(11,e.ICoreBrowserService),f(12,e.IThemeService)],O)},3787:function(x,n,o){var c=this&&this.__decorate||function(S,b,_,y){var D,T=arguments.length,O=T<3?b:y===null?y=Object.getOwnPropertyDescriptor(b,_):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(S,b,_,y);else for(var A=S.length-1;A>=0;A--)(D=S[A])&&(O=(T<3?D(O):T>3?D(b,_,O):D(b,_))||O);return T>3&&O&&Object.defineProperty(b,_,O),O},f=this&&this.__param||function(S,b){return function(_,y){b(_,y,S)}};Object.defineProperty(n,"__esModule",{value:!0}),n.DomRendererRowFactory=void 0;const a=o(2223),d=o(643),p=o(511),g=o(2585),u=o(8055),e=o(4725),i=o(4269),t=o(6171),s=o(3734);let h=n.DomRendererRowFactory=class{constructor(S,b,_,y,D,T,O){this._document=S,this._characterJoinerService=b,this._optionsService=_,this._coreBrowserService=y,this._coreService=D,this._decorationService=T,this._themeService=O,this._workCell=new p.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(S,b,_){this._selectionStart=S,this._selectionEnd=b,this._columnSelectMode=_}createRow(S,b,_,y,D,T,O,A,W,H,U){const V=[],$=this._characterJoinerService.getJoinedCharacters(b),E=this._themeService.colors;let R,M=S.getNoBgTrimmedLength();_&&M<T+1&&(M=T+1);let P=0,j="",q=0,ee=0,re=0,I=!1,L=0,z=!1,N=0;const Y=[],X=H!==-1&&U!==-1;for(let ne=0;ne<M;ne++){S.loadCell(ne,this._workCell);let ve=this._workCell.getWidth();if(ve===0)continue;let ge=!1,xe=ne,se=this._workCell;if($.length>0&&ne===$[0][0]){ge=!0;const me=$.shift();se=new i.JoinedCellData(this._workCell,S.translateToString(!0,me[0],me[1]),me[1]-me[0]),xe=me[1]-1,ve=se.getWidth()}const Et=this._isCellInSelection(ne,b),xt=_&&ne===T,Mt=X&&ne>=H&&ne<=U;let K=!1;this._decorationService.forEachDecorationAtCell(ne,b,void 0,(me=>{K=!0}));let te=se.getChars()||d.WHITESPACE_CELL_CHAR;if(te===" "&&(se.isUnderline()||se.isOverline())&&(te=" "),N=ve*A-W.get(te,se.isBold(),se.isItalic()),R){if(P&&(Et&&z||!Et&&!z&&se.bg===q)&&(Et&&z&&E.selectionForeground||se.fg===ee)&&se.extended.ext===re&&Mt===I&&N===L&&!xt&&!ge&&!K){se.isInvisible()?j+=d.WHITESPACE_CELL_CHAR:j+=te,P++;continue}P&&(R.textContent=j),R=this._document.createElement("span"),P=0,j=""}else R=this._document.createElement("span");if(q=se.bg,ee=se.fg,re=se.extended.ext,I=Mt,L=N,z=Et,ge&&T>=ne&&T<=xe&&(T=ne),!this._coreService.isCursorHidden&&xt&&this._coreService.isCursorInitialized){if(Y.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&Y.push("xterm-cursor-blink"),Y.push(y==="bar"?"xterm-cursor-bar":y==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(D)switch(D){case"outline":Y.push("xterm-cursor-outline");break;case"block":Y.push("xterm-cursor-block");break;case"bar":Y.push("xterm-cursor-bar");break;case"underline":Y.push("xterm-cursor-underline")}}if(se.isBold()&&Y.push("xterm-bold"),se.isItalic()&&Y.push("xterm-italic"),se.isDim()&&Y.push("xterm-dim"),j=se.isInvisible()?d.WHITESPACE_CELL_CHAR:se.getChars()||d.WHITESPACE_CELL_CHAR,se.isUnderline()&&(Y.push(`xterm-underline-${se.extended.underlineStyle}`),j===" "&&(j=" "),!se.isUnderlineColorDefault()))if(se.isUnderlineColorRGB())R.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(se.getUnderlineColor()).join(",")})`;else{let me=se.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&se.isBold()&&me<8&&(me+=8),R.style.textDecorationColor=E.ansi[me].css}se.isOverline()&&(Y.push("xterm-overline"),j===" "&&(j=" ")),se.isStrikethrough()&&Y.push("xterm-strikethrough"),Mt&&(R.style.textDecoration="underline");let ce=se.getFgColor(),Se=se.getFgColorMode(),be=se.getBgColor(),ft=se.getBgColorMode();const Or=!!se.isInverse();if(Or){const me=ce;ce=be,be=me;const mi=Se;Se=ft,ft=mi}let Ze,hr,_t,Ot=!1;switch(this._decorationService.forEachDecorationAtCell(ne,b,void 0,(me=>{me.options.layer!=="top"&&Ot||(me.backgroundColorRGB&&(ft=50331648,be=me.backgroundColorRGB.rgba>>8&16777215,Ze=me.backgroundColorRGB),me.foregroundColorRGB&&(Se=50331648,ce=me.foregroundColorRGB.rgba>>8&16777215,hr=me.foregroundColorRGB),Ot=me.options.layer==="top")})),!Ot&&Et&&(Ze=this._coreBrowserService.isFocused?E.selectionBackgroundOpaque:E.selectionInactiveBackgroundOpaque,be=Ze.rgba>>8&16777215,ft=50331648,Ot=!0,E.selectionForeground&&(Se=50331648,ce=E.selectionForeground.rgba>>8&16777215,hr=E.selectionForeground)),Ot&&Y.push("xterm-decoration-top"),ft){case 16777216:case 33554432:_t=E.ansi[be],Y.push(`xterm-bg-${be}`);break;case 50331648:_t=u.channels.toColor(be>>16,be>>8&255,255&be),this._addStyle(R,`background-color:#${m((be>>>0).toString(16),"0",6)}`);break;default:Or?(_t=E.foreground,Y.push(`xterm-bg-${a.INVERTED_DEFAULT_COLOR}`)):_t=E.background}switch(Ze||se.isDim()&&(Ze=u.color.multiplyOpacity(_t,.5)),Se){case 16777216:case 33554432:se.isBold()&&ce<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ce+=8),this._applyMinimumContrast(R,_t,E.ansi[ce],se,Ze,void 0)||Y.push(`xterm-fg-${ce}`);break;case 50331648:const me=u.channels.toColor(ce>>16&255,ce>>8&255,255&ce);this._applyMinimumContrast(R,_t,me,se,Ze,hr)||this._addStyle(R,`color:#${m(ce.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(R,_t,E.foreground,se,Ze,hr)||Or&&Y.push(`xterm-fg-${a.INVERTED_DEFAULT_COLOR}`)}Y.length&&(R.className=Y.join(" "),Y.length=0),xt||ge||K?R.textContent=j:P++,N!==this.defaultSpacing&&(R.style.letterSpacing=`${N}px`),V.push(R),ne=xe}return R&&P&&(R.textContent=j),V}_applyMinimumContrast(S,b,_,y,D,T){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,t.treatGlyphAsBackgroundColor)(y.getCode()))return!1;const O=this._getContrastCache(y);let A;if(D||T||(A=O.getColor(b.rgba,_.rgba)),A===void 0){const W=this._optionsService.rawOptions.minimumContrastRatio/(y.isDim()?2:1);A=u.color.ensureContrastRatio(D||b,T||_,W),O.setColor((D||b).rgba,(T||_).rgba,A??null)}return!!A&&(this._addStyle(S,`color:${A.css}`),!0)}_getContrastCache(S){return S.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(S,b){S.setAttribute("style",`${S.getAttribute("style")||""}${b};`)}_isCellInSelection(S,b){const _=this._selectionStart,y=this._selectionEnd;return!(!_||!y)&&(this._columnSelectMode?_[0]<=y[0]?S>=_[0]&&b>=_[1]&&S<y[0]&&b<=y[1]:S<_[0]&&b>=_[1]&&S>=y[0]&&b<=y[1]:b>_[1]&&b<y[1]||_[1]===y[1]&&b===_[1]&&S>=_[0]&&S<y[0]||_[1]<y[1]&&b===y[1]&&S<y[0]||_[1]<y[1]&&b===_[1]&&S>=_[0])}};function m(S,b,_){for(;S.length<_;)S=b+S;return S}n.DomRendererRowFactory=h=c([f(1,e.ICharacterJoinerService),f(2,g.IOptionsService),f(3,e.ICoreBrowserService),f(4,g.ICoreService),f(5,g.IDecorationService),f(6,e.IThemeService)],h)},2550:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WidthCache=void 0,n.WidthCache=class{constructor(o,c){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 f=o.createElement("span");f.classList.add("xterm-char-measure-element");const a=o.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold";const d=o.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontStyle="italic";const p=o.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontWeight="bold",p.style.fontStyle="italic",this._measureElements=[f,a,d,p],this._container.appendChild(f),this._container.appendChild(a),this._container.appendChild(d),this._container.appendChild(p),c.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,c,f,a){o===this._font&&c===this._fontSize&&f===this._weight&&a===this._weightBold||(this._font=o,this._fontSize=c,this._weight=f,this._weightBold=a,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${a}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${a}`,this.clear())}get(o,c,f){let a=0;if(!c&&!f&&o.length===1&&(a=o.charCodeAt(0))<256){if(this._flat[a]!==-9999)return this._flat[a];const g=this._measure(o,0);return g>0&&(this._flat[a]=g),g}let d=o;c&&(d+="B"),f&&(d+="I");let p=this._holey.get(d);if(p===void 0){let g=0;c&&(g|=1),f&&(g|=2),p=this._measure(o,g),p>0&&this._holey.set(d,p)}return p}_measure(o,c){const f=this._measureElements[c];return f.textContent=o.repeat(32),f.offsetWidth/32}}},2223:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TEXT_BASELINE=n.DIM_OPACITY=n.INVERTED_DEFAULT_COLOR=void 0;const c=o(6114);n.INVERTED_DEFAULT_COLOR=257,n.DIM_OPACITY=.5,n.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(x,n)=>{function o(f){return 57508<=f&&f<=57558}function c(f){return f>=128512&&f<=128591||f>=127744&&f<=128511||f>=128640&&f<=128767||f>=9728&&f<=9983||f>=9984&&f<=10175||f>=65024&&f<=65039||f>=129280&&f<=129535||f>=127462&&f<=127487}Object.defineProperty(n,"__esModule",{value:!0}),n.computeNextVariantOffset=n.createRenderDimensions=n.treatGlyphAsBackgroundColor=n.allowRescaling=n.isEmoji=n.isRestrictedPowerlineGlyph=n.isPowerlineGlyph=n.throwIfFalsy=void 0,n.throwIfFalsy=function(f){if(!f)throw new Error("value must not be falsy");return f},n.isPowerlineGlyph=o,n.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},n.isEmoji=c,n.allowRescaling=function(f,a,d,p){return a===1&&d>Math.ceil(1.5*p)&&f!==void 0&&f>255&&!c(f)&&!o(f)&&!(function(g){return 57344<=g&&g<=63743})(f)},n.treatGlyphAsBackgroundColor=function(f){return o(f)||(function(a){return 9472<=a&&a<=9631})(f)},n.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},n.computeNextVariantOffset=function(f,a,d=0){return(f-(2*Math.round(a)-d))%(2*Math.round(a))}},6052:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.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(f,a,d,p=!1){if(this.selectionStart=a,this.selectionEnd=d,!a||!d||a[0]===d[0]&&a[1]===d[1])return void this.clear();const g=f.buffers.active.ydisp,u=a[1]-g,e=d[1]-g,i=Math.max(u,0),t=Math.min(e,f.rows-1);i>=f.rows||t<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=p,this.viewportStartRow=u,this.viewportEndRow=e,this.viewportCappedStartRow=i,this.viewportCappedEndRow=t,this.startCol=a[0],this.endCol=d[0])}isCellSelected(f,a,d){return!!this.hasSelection&&(d-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?a>=this.startCol&&d>=this.viewportCappedStartRow&&a<this.endCol&&d<=this.viewportCappedEndRow:a<this.startCol&&d>=this.viewportCappedStartRow&&a>=this.endCol&&d<=this.viewportCappedEndRow:d>this.viewportStartRow&&d<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&d===this.viewportStartRow&&a>=this.startCol&&a<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportEndRow&&a<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportStartRow&&a>=this.startCol)}}n.createSelectionRenderModel=function(){return new o}},456:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SelectionModel=void 0,n.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,c=this.selectionEnd;return!(!o||!c)&&(o[1]>c[1]||o[1]===c[1]&&o[0]>c[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(x,n,o){var c=this&&this.__decorate||function(t,s,h,m){var S,b=arguments.length,_=b<3?s:m===null?m=Object.getOwnPropertyDescriptor(s,h):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(t,s,h,m);else for(var y=t.length-1;y>=0;y--)(S=t[y])&&(_=(b<3?S(_):b>3?S(s,h,_):S(s,h))||_);return b>3&&_&&Object.defineProperty(s,h,_),_},f=this&&this.__param||function(t,s){return function(h,m){s(h,m,t)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CharSizeService=void 0;const a=o(2585),d=o(8460),p=o(844);let g=n.CharSizeService=class extends p.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(t,s,h){super(),this._optionsService=h,this.width=0,this.height=0,this._onCharSizeChange=this.register(new d.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new i(this._optionsService))}catch{this._measureStrategy=this.register(new e(t,s,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const t=this._measureStrategy.measure();t.width===this.width&&t.height===this.height||(this.width=t.width,this.height=t.height,this._onCharSizeChange.fire())}};n.CharSizeService=g=c([f(2,a.IOptionsService)],g);class u extends p.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(s,h){s!==void 0&&s>0&&h!==void 0&&h>0&&(this._result.width=s,this._result.height=h)}}class e extends u{constructor(s,h,m){super(),this._document=s,this._parentElement=h,this._optionsService=m,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class i extends u{constructor(s){super(),this._optionsService=s,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const h=this._ctx.measureText("W");if(!("width"in h&&"fontBoundingBoxAscent"in h&&"fontBoundingBoxDescent"in h))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(x,n,o){var c=this&&this.__decorate||function(i,t,s,h){var m,S=arguments.length,b=S<3?t:h===null?h=Object.getOwnPropertyDescriptor(t,s):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(i,t,s,h);else for(var _=i.length-1;_>=0;_--)(m=i[_])&&(b=(S<3?m(b):S>3?m(t,s,b):m(t,s))||b);return S>3&&b&&Object.defineProperty(t,s,b),b},f=this&&this.__param||function(i,t){return function(s,h){t(s,h,i)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CharacterJoinerService=n.JoinedCellData=void 0;const a=o(3734),d=o(643),p=o(511),g=o(2585);class u extends a.AttributeData{constructor(t,s,h){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=s,this._width=h}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}n.JoinedCellData=u;let e=n.CharacterJoinerService=class Mn{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new p.CellData}register(t){const s={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(s),s.id}deregister(t){for(let s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===t)return this._characterJoiners.splice(s,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];const s=this._bufferService.buffer.lines.get(t);if(!s||s.length===0)return[];const h=[],m=s.translateToString(!0);let S=0,b=0,_=0,y=s.getFg(0),D=s.getBg(0);for(let T=0;T<s.getTrimmedLength();T++)if(s.loadCell(T,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==y||this._workCell.bg!==D){if(T-S>1){const O=this._getJoinedRanges(m,_,b,s,S);for(let A=0;A<O.length;A++)h.push(O[A])}S=T,_=b,y=this._workCell.fg,D=this._workCell.bg}b+=this._workCell.getChars().length||d.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-S>1){const T=this._getJoinedRanges(m,_,b,s,S);for(let O=0;O<T.length;O++)h.push(T[O])}return h}_getJoinedRanges(t,s,h,m,S){const b=t.substring(s,h);let _=[];try{_=this._characterJoiners[0].handler(b)}catch(y){console.error(y)}for(let y=1;y<this._characterJoiners.length;y++)try{const D=this._characterJoiners[y].handler(b);for(let T=0;T<D.length;T++)Mn._mergeRanges(_,D[T])}catch(D){console.error(D)}return this._stringRangesToCellRanges(_,m,S),_}_stringRangesToCellRanges(t,s,h){let m=0,S=!1,b=0,_=t[m];if(_){for(let y=h;y<this._bufferService.cols;y++){const D=s.getWidth(y),T=s.getString(y).length||d.WHITESPACE_CELL_CHAR.length;if(D!==0){if(!S&&_[0]<=b&&(_[0]=y,S=!0),_[1]<=b){if(_[1]=y,_=t[++m],!_)break;_[0]<=b?(_[0]=y,S=!0):S=!1}b+=T}}_&&(_[1]=this._bufferService.cols)}}static _mergeRanges(t,s){let h=!1;for(let m=0;m<t.length;m++){const S=t[m];if(h){if(s[1]<=S[0])return t[m-1][1]=s[1],t;if(s[1]<=S[1])return t[m-1][1]=Math.max(s[1],S[1]),t.splice(m,1),t;t.splice(m,1),m--}else{if(s[1]<=S[0])return t.splice(m,0,s),t;if(s[1]<=S[1])return S[0]=Math.min(s[0],S[0]),t;s[0]<S[1]&&(S[0]=Math.min(s[0],S[0]),h=!0)}}return h?t[t.length-1][1]=s[1]:t.push(s),t}};n.CharacterJoinerService=e=c([f(0,g.IBufferService)],e)},5114:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoreBrowserService=void 0;const c=o(844),f=o(8460),a=o(3656);class d extends c.Disposable{constructor(u,e,i){super(),this._textarea=u,this._window=e,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new p(this._window),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new f.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((t=>this._screenDprMonitor.setWindow(t)))),this.register((0,f.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(u){this._window!==u&&(this._window=u,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}n.CoreBrowserService=d;class p extends c.Disposable{constructor(u){super(),this._parentWindow=u,this._windowResizeListener=this.register(new c.MutableDisposable),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,c.toDisposable)((()=>this.clearListener())))}setWindow(u){this._parentWindow=u,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,a.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var u;this._outerListener&&((u=this._resolutionMediaMatchList)==null||u.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.LinkProviderService=void 0;const c=o(844);class f extends c.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,c.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(d){return this.linkProviders.push(d),{dispose:()=>{const p=this.linkProviders.indexOf(d);p!==-1&&this.linkProviders.splice(p,1)}}}}n.LinkProviderService=f},8934:function(x,n,o){var c=this&&this.__decorate||function(g,u,e,i){var t,s=arguments.length,h=s<3?u:i===null?i=Object.getOwnPropertyDescriptor(u,e):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")h=Reflect.decorate(g,u,e,i);else for(var m=g.length-1;m>=0;m--)(t=g[m])&&(h=(s<3?t(h):s>3?t(u,e,h):t(u,e))||h);return s>3&&h&&Object.defineProperty(u,e,h),h},f=this&&this.__param||function(g,u){return function(e,i){u(e,i,g)}};Object.defineProperty(n,"__esModule",{value:!0}),n.MouseService=void 0;const a=o(4725),d=o(9806);let p=n.MouseService=class{constructor(g,u){this._renderService=g,this._charSizeService=u}getCoords(g,u,e,i,t){return(0,d.getCoords)(window,g,u,e,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,t)}getMouseReportCoords(g,u){const e=(0,d.getCoordsRelativeToElement)(window,g,u);if(this._charSizeService.hasValidSize)return e[0]=Math.min(Math.max(e[0],0),this._renderService.dimensions.css.canvas.width-1),e[1]=Math.min(Math.max(e[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(e[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(e[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(e[0]),y:Math.floor(e[1])}}};n.MouseService=p=c([f(0,a.IRenderService),f(1,a.ICharSizeService)],p)},3230:function(x,n,o){var c=this&&this.__decorate||function(t,s,h,m){var S,b=arguments.length,_=b<3?s:m===null?m=Object.getOwnPropertyDescriptor(s,h):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(t,s,h,m);else for(var y=t.length-1;y>=0;y--)(S=t[y])&&(_=(b<3?S(_):b>3?S(s,h,_):S(s,h))||_);return b>3&&_&&Object.defineProperty(s,h,_),_},f=this&&this.__param||function(t,s){return function(h,m){s(h,m,t)}};Object.defineProperty(n,"__esModule",{value:!0}),n.RenderService=void 0;const a=o(6193),d=o(4725),p=o(8460),g=o(844),u=o(7226),e=o(2585);let i=n.RenderService=class extends g.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(t,s,h,m,S,b,_,y){super(),this._rowCount=t,this._charSizeService=m,this._renderer=this.register(new g.MutableDisposable),this._pausedResizeTask=new u.DebouncedIdleTask,this._observerDisposable=this.register(new g.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new p.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new p.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new p.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new p.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(((D,T)=>this._renderRows(D,T)),_),this.register(this._renderDebouncer),this.register(_.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(b.onResize((()=>this._fullRefresh()))),this.register(b.buffers.onBufferActivate((()=>{var D;return(D=this._renderer.value)==null?void 0:D.clear()}))),this.register(h.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(S.onDecorationRegistered((()=>this._fullRefresh()))),this.register(S.onDecorationRemoved((()=>this._fullRefresh()))),this.register(h.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(b.cols,b.rows),this._fullRefresh()}))),this.register(h.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(b.buffer.y,b.buffer.y,!0)))),this.register(y.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(_.window,s),this.register(_.onWindowChange((D=>this._registerIntersectionObserver(D,s))))}_registerIntersectionObserver(t,s){if("IntersectionObserver"in t){const h=new t.IntersectionObserver((m=>this._handleIntersectionChange(m[m.length-1])),{threshold:0});h.observe(s),this._observerDisposable.value=(0,g.toDisposable)((()=>h.disconnect()))}}_handleIntersectionChange(t){this._isPaused=t.isIntersecting===void 0?t.intersectionRatio===0:!t.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(t,s,h=!1){this._isPaused?this._needsFullRefresh=!0:(h||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(t,s,this._rowCount))}_renderRows(t,s){this._renderer.value&&(t=Math.min(t,this._rowCount-1),s=Math.min(s,this._rowCount-1),this._renderer.value.renderRows(t,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:t,end:s}),this._onRender.fire({start:t,end:s}),this._isNextRenderRedrawOnly=!0)}resize(t,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(t){this._renderer.value=t,this._renderer.value&&(this._renderer.value.onRequestRedraw((s=>this.refreshRows(s.start,s.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(t){return this._renderDebouncer.addRefreshCallback(t)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var t,s;this._renderer.value&&((s=(t=this._renderer.value).clearTextureAtlas)==null||s.call(t),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(t,s){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var h;return(h=this._renderer.value)==null?void 0:h.handleResize(t,s)})):this._renderer.value.handleResize(t,s),this._fullRefresh())}handleCharSizeChanged(){var t;(t=this._renderer.value)==null||t.handleCharSizeChanged()}handleBlur(){var t;(t=this._renderer.value)==null||t.handleBlur()}handleFocus(){var t;(t=this._renderer.value)==null||t.handleFocus()}handleSelectionChanged(t,s,h){var m;this._selectionState.start=t,this._selectionState.end=s,this._selectionState.columnSelectMode=h,(m=this._renderer.value)==null||m.handleSelectionChanged(t,s,h)}handleCursorMove(){var t;(t=this._renderer.value)==null||t.handleCursorMove()}clear(){var t;(t=this._renderer.value)==null||t.clear()}};n.RenderService=i=c([f(2,e.IOptionsService),f(3,d.ICharSizeService),f(4,e.IDecorationService),f(5,e.IBufferService),f(6,d.ICoreBrowserService),f(7,d.IThemeService)],i)},9312:function(x,n,o){var c=this&&this.__decorate||function(_,y,D,T){var O,A=arguments.length,W=A<3?y:T===null?T=Object.getOwnPropertyDescriptor(y,D):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")W=Reflect.decorate(_,y,D,T);else for(var H=_.length-1;H>=0;H--)(O=_[H])&&(W=(A<3?O(W):A>3?O(y,D,W):O(y,D))||W);return A>3&&W&&Object.defineProperty(y,D,W),W},f=this&&this.__param||function(_,y){return function(D,T){y(D,T,_)}};Object.defineProperty(n,"__esModule",{value:!0}),n.SelectionService=void 0;const a=o(9806),d=o(9504),p=o(456),g=o(4725),u=o(8460),e=o(844),i=o(6114),t=o(4841),s=o(511),h=o(2585),m=" ",S=new RegExp(m,"g");let b=n.SelectionService=class extends e.Disposable{constructor(_,y,D,T,O,A,W,H,U){super(),this._element=_,this._screenElement=y,this._linkifier=D,this._bufferService=T,this._coreService=O,this._mouseService=A,this._optionsService=W,this._renderService=H,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 u.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new u.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new u.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new u.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=V=>this._handleMouseMove(V),this._mouseUpListener=V=>this._handleMouseUp(V),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((V=>this._handleTrim(V))),this.register(this._bufferService.buffers.onBufferActivate((V=>this._handleBufferActivate(V)))),this.enable(),this._model=new p.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,e.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const _=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!(!_||!y||_[0]===y[0]&&_[1]===y[1])}get selectionText(){const _=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;if(!_||!y)return"";const D=this._bufferService.buffer,T=[];if(this._activeSelectionMode===3){if(_[0]===y[0])return"";const O=_[0]<y[0]?_[0]:y[0],A=_[0]<y[0]?y[0]:_[0];for(let W=_[1];W<=y[1];W++){const H=D.translateBufferLineToString(W,!0,O,A);T.push(H)}}else{const O=_[1]===y[1]?y[0]:void 0;T.push(D.translateBufferLineToString(_[1],!0,_[0],O));for(let A=_[1]+1;A<=y[1]-1;A++){const W=D.lines.get(A),H=D.translateBufferLineToString(A,!0);W!=null&&W.isWrapped?T[T.length-1]+=H:T.push(H)}if(_[1]!==y[1]){const A=D.lines.get(y[1]),W=D.translateBufferLineToString(y[1],!0,0,y[0]);A&&A.isWrapped?T[T.length-1]+=W:T.push(W)}}return T.map((O=>O.replace(S," "))).join(i.isWindows?`\r
7
- `:`
8
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(_){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),i.isLinux&&_&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(_){const y=this._getMouseBufferCoords(_),D=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!!(D&&T&&y)&&this._areCoordsInSelection(y,D,T)}isCellInSelection(_,y){const D=this._model.finalSelectionStart,T=this._model.finalSelectionEnd;return!(!D||!T)&&this._areCoordsInSelection([_,y],D,T)}_areCoordsInSelection(_,y,D){return _[1]>y[1]&&_[1]<D[1]||y[1]===D[1]&&_[1]===y[1]&&_[0]>=y[0]&&_[0]<D[0]||y[1]<D[1]&&_[1]===D[1]&&_[0]<D[0]||y[1]<D[1]&&_[1]===y[1]&&_[0]>=y[0]}_selectWordAtCursor(_,y){var O,A;const D=(A=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:A.range;if(D)return this._model.selectionStart=[D.start.x-1,D.start.y-1],this._model.selectionStartLength=(0,t.getRangeLength)(D,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const T=this._getMouseBufferCoords(_);return!!T&&(this._selectWordAt(T,y),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(_,y){this._model.clearSelection(),_=Math.max(_,0),y=Math.min(y,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,_],this._model.selectionEnd=[this._bufferService.cols,y],this.refresh(),this._onSelectionChange.fire()}_handleTrim(_){this._model.handleTrim(_)&&this.refresh()}_getMouseBufferCoords(_){const y=this._mouseService.getCoords(_,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(y)return y[0]--,y[1]--,y[1]+=this._bufferService.buffer.ydisp,y}_getMouseEventScrollAmount(_){let y=(0,a.getCoordsRelativeToElement)(this._coreBrowserService.window,_,this._screenElement)[1];const D=this._renderService.dimensions.css.canvas.height;return y>=0&&y<=D?0:(y>D&&(y-=D),y=Math.min(Math.max(y,-50),50),y/=50,y/Math.abs(y)+Math.round(14*y))}shouldForceSelection(_){return i.isMac?_.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:_.shiftKey}handleMouseDown(_){if(this._mouseDownTimeStamp=_.timeStamp,(_.button!==2||!this.hasSelection)&&_.button===0){if(!this._enabled){if(!this.shouldForceSelection(_))return;_.stopPropagation()}_.preventDefault(),this._dragScrollAmount=0,this._enabled&&_.shiftKey?this._handleIncrementalClick(_):_.detail===1?this._handleSingleClick(_):_.detail===2?this._handleDoubleClick(_):_.detail===3&&this._handleTripleClick(_),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(_){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(_))}_handleSingleClick(_){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(_)?3:0,this._model.selectionStart=this._getMouseBufferCoords(_),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const y=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);y&&y.length!==this._model.selectionStart[0]&&y.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(_){this._selectWordAtCursor(_,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(_){const y=this._getMouseBufferCoords(_);y&&(this._activeSelectionMode=2,this._selectLineAt(y[1]))}shouldColumnSelect(_){return _.altKey&&!(i.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(_){if(_.stopImmediatePropagation(),!this._model.selectionStart)return;const y=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(_),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(_),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const D=this._bufferService.buffer;if(this._model.selectionEnd[1]<D.lines.length){const T=D.lines.get(this._model.selectionEnd[1]);T&&T.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}y&&y[0]===this._model.selectionEnd[0]&&y[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const _=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(_.ydisp+this._bufferService.rows,_.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=_.ydisp),this.refresh()}}_handleMouseUp(_){const y=_.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&y<500&&_.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const D=this._mouseService.getCoords(_,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(D&&D[0]!==void 0&&D[1]!==void 0){const T=(0,d.moveToCellSequence)(D[0]-1,D[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(T,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const _=this._model.finalSelectionStart,y=this._model.finalSelectionEnd,D=!(!_||!y||_[0]===y[0]&&_[1]===y[1]);D?_&&y&&(this._oldSelectionStart&&this._oldSelectionEnd&&_[0]===this._oldSelectionStart[0]&&_[1]===this._oldSelectionStart[1]&&y[0]===this._oldSelectionEnd[0]&&y[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(_,y,D)):this._oldHasSelection&&this._fireOnSelectionChange(_,y,D)}_fireOnSelectionChange(_,y,D){this._oldSelectionStart=_,this._oldSelectionEnd=y,this._oldHasSelection=D,this._onSelectionChange.fire()}_handleBufferActivate(_){this.clearSelection(),this._trimListener.dispose(),this._trimListener=_.activeBuffer.lines.onTrim((y=>this._handleTrim(y)))}_convertViewportColToCharacterIndex(_,y){let D=y;for(let T=0;y>=T;T++){const O=_.loadCell(T,this._workCell).getChars().length;this._workCell.getWidth()===0?D--:O>1&&y!==T&&(D+=O-1)}return D}setSelection(_,y,D){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[_,y],this._model.selectionStartLength=D,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(_){this._isClickInSelection(_)||(this._selectWordAtCursor(_,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(_,y,D=!0,T=!0){if(_[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,A=O.lines.get(_[1]);if(!A)return;const W=O.translateBufferLineToString(_[1],!1);let H=this._convertViewportColToCharacterIndex(A,_[0]),U=H;const V=_[0]-H;let $=0,E=0,R=0,M=0;if(W.charAt(H)===" "){for(;H>0&&W.charAt(H-1)===" ";)H--;for(;U<W.length&&W.charAt(U+1)===" ";)U++}else{let q=_[0],ee=_[0];A.getWidth(q)===0&&($++,q--),A.getWidth(ee)===2&&(E++,ee++);const re=A.getString(ee).length;for(re>1&&(M+=re-1,U+=re-1);q>0&&H>0&&!this._isCharWordSeparator(A.loadCell(q-1,this._workCell));){A.loadCell(q-1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===0?($++,q--):I>1&&(R+=I-1,H-=I-1),H--,q--}for(;ee<A.length&&U+1<W.length&&!this._isCharWordSeparator(A.loadCell(ee+1,this._workCell));){A.loadCell(ee+1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===2?(E++,ee++):I>1&&(M+=I-1,U+=I-1),U++,ee++}}U++;let P=H+V-$+R,j=Math.min(this._bufferService.cols,U-H+$+E-R-M);if(y||W.slice(H,U).trim()!==""){if(D&&P===0&&A.getCodePoint(0)!==32){const q=O.lines.get(_[1]-1);if(q&&A.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){const ee=this._getWordAt([this._bufferService.cols-1,_[1]-1],!1,!0,!1);if(ee){const re=this._bufferService.cols-ee.start;P-=re,j+=re}}}if(T&&P+j===this._bufferService.cols&&A.getCodePoint(this._bufferService.cols-1)!==32){const q=O.lines.get(_[1]+1);if(q!=null&&q.isWrapped&&q.getCodePoint(0)!==32){const ee=this._getWordAt([0,_[1]+1],!1,!1,!0);ee&&(j+=ee.length)}}return{start:P,length:j}}}_selectWordAt(_,y){const D=this._getWordAt(_,y);if(D){for(;D.start<0;)D.start+=this._bufferService.cols,_[1]--;this._model.selectionStart=[D.start,_[1]],this._model.selectionStartLength=D.length}}_selectToWordAt(_){const y=this._getWordAt(_,!0);if(y){let D=_[1];for(;y.start<0;)y.start+=this._bufferService.cols,D--;if(!this._model.areSelectionValuesReversed())for(;y.start+y.length>this._bufferService.cols;)y.length-=this._bufferService.cols,D++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?y.start:y.start+y.length,D]}}_isCharWordSeparator(_){return _.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(_.getChars())>=0}_selectLineAt(_){const y=this._bufferService.buffer.getWrappedRangeForLine(_),D={start:{x:0,y:y.first},end:{x:this._bufferService.cols-1,y:y.last}};this._model.selectionStart=[0,y.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,t.getRangeLength)(D,this._bufferService.cols)}};n.SelectionService=b=c([f(3,h.IBufferService),f(4,h.ICoreService),f(5,g.IMouseService),f(6,h.IOptionsService),f(7,g.IRenderService),f(8,g.ICoreBrowserService)],b)},4725:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ILinkProviderService=n.IThemeService=n.ICharacterJoinerService=n.ISelectionService=n.IRenderService=n.IMouseService=n.ICoreBrowserService=n.ICharSizeService=void 0;const c=o(8343);n.ICharSizeService=(0,c.createDecorator)("CharSizeService"),n.ICoreBrowserService=(0,c.createDecorator)("CoreBrowserService"),n.IMouseService=(0,c.createDecorator)("MouseService"),n.IRenderService=(0,c.createDecorator)("RenderService"),n.ISelectionService=(0,c.createDecorator)("SelectionService"),n.ICharacterJoinerService=(0,c.createDecorator)("CharacterJoinerService"),n.IThemeService=(0,c.createDecorator)("ThemeService"),n.ILinkProviderService=(0,c.createDecorator)("LinkProviderService")},6731:function(x,n,o){var c=this&&this.__decorate||function(b,_,y,D){var T,O=arguments.length,A=O<3?_:D===null?D=Object.getOwnPropertyDescriptor(_,y):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(b,_,y,D);else for(var W=b.length-1;W>=0;W--)(T=b[W])&&(A=(O<3?T(A):O>3?T(_,y,A):T(_,y))||A);return O>3&&A&&Object.defineProperty(_,y,A),A},f=this&&this.__param||function(b,_){return function(y,D){_(y,D,b)}};Object.defineProperty(n,"__esModule",{value:!0}),n.ThemeService=n.DEFAULT_ANSI_COLORS=void 0;const a=o(7239),d=o(8055),p=o(8460),g=o(844),u=o(2585),e=d.css.toColor("#ffffff"),i=d.css.toColor("#000000"),t=d.css.toColor("#ffffff"),s=d.css.toColor("#000000"),h={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};n.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const b=[d.css.toColor("#2e3436"),d.css.toColor("#cc0000"),d.css.toColor("#4e9a06"),d.css.toColor("#c4a000"),d.css.toColor("#3465a4"),d.css.toColor("#75507b"),d.css.toColor("#06989a"),d.css.toColor("#d3d7cf"),d.css.toColor("#555753"),d.css.toColor("#ef2929"),d.css.toColor("#8ae234"),d.css.toColor("#fce94f"),d.css.toColor("#729fcf"),d.css.toColor("#ad7fa8"),d.css.toColor("#34e2e2"),d.css.toColor("#eeeeec")],_=[0,95,135,175,215,255];for(let y=0;y<216;y++){const D=_[y/36%6|0],T=_[y/6%6|0],O=_[y%6];b.push({css:d.channels.toCss(D,T,O),rgba:d.channels.toRgba(D,T,O)})}for(let y=0;y<24;y++){const D=8+10*y;b.push({css:d.channels.toCss(D,D,D),rgba:d.channels.toRgba(D,D,D)})}return b})());let m=n.ThemeService=class extends g.Disposable{get colors(){return this._colors}constructor(b){super(),this._optionsService=b,this._contrastCache=new a.ColorContrastCache,this._halfContrastCache=new a.ColorContrastCache,this._onChangeColors=this.register(new p.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:e,background:i,cursor:t,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:h,selectionBackgroundOpaque:d.color.blend(i,h),selectionInactiveBackgroundTransparent:h,selectionInactiveBackgroundOpaque:d.color.blend(i,h),ansi:n.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(b={}){const _=this._colors;if(_.foreground=S(b.foreground,e),_.background=S(b.background,i),_.cursor=S(b.cursor,t),_.cursorAccent=S(b.cursorAccent,s),_.selectionBackgroundTransparent=S(b.selectionBackground,h),_.selectionBackgroundOpaque=d.color.blend(_.background,_.selectionBackgroundTransparent),_.selectionInactiveBackgroundTransparent=S(b.selectionInactiveBackground,_.selectionBackgroundTransparent),_.selectionInactiveBackgroundOpaque=d.color.blend(_.background,_.selectionInactiveBackgroundTransparent),_.selectionForeground=b.selectionForeground?S(b.selectionForeground,d.NULL_COLOR):void 0,_.selectionForeground===d.NULL_COLOR&&(_.selectionForeground=void 0),d.color.isOpaque(_.selectionBackgroundTransparent)&&(_.selectionBackgroundTransparent=d.color.opacity(_.selectionBackgroundTransparent,.3)),d.color.isOpaque(_.selectionInactiveBackgroundTransparent)&&(_.selectionInactiveBackgroundTransparent=d.color.opacity(_.selectionInactiveBackgroundTransparent,.3)),_.ansi=n.DEFAULT_ANSI_COLORS.slice(),_.ansi[0]=S(b.black,n.DEFAULT_ANSI_COLORS[0]),_.ansi[1]=S(b.red,n.DEFAULT_ANSI_COLORS[1]),_.ansi[2]=S(b.green,n.DEFAULT_ANSI_COLORS[2]),_.ansi[3]=S(b.yellow,n.DEFAULT_ANSI_COLORS[3]),_.ansi[4]=S(b.blue,n.DEFAULT_ANSI_COLORS[4]),_.ansi[5]=S(b.magenta,n.DEFAULT_ANSI_COLORS[5]),_.ansi[6]=S(b.cyan,n.DEFAULT_ANSI_COLORS[6]),_.ansi[7]=S(b.white,n.DEFAULT_ANSI_COLORS[7]),_.ansi[8]=S(b.brightBlack,n.DEFAULT_ANSI_COLORS[8]),_.ansi[9]=S(b.brightRed,n.DEFAULT_ANSI_COLORS[9]),_.ansi[10]=S(b.brightGreen,n.DEFAULT_ANSI_COLORS[10]),_.ansi[11]=S(b.brightYellow,n.DEFAULT_ANSI_COLORS[11]),_.ansi[12]=S(b.brightBlue,n.DEFAULT_ANSI_COLORS[12]),_.ansi[13]=S(b.brightMagenta,n.DEFAULT_ANSI_COLORS[13]),_.ansi[14]=S(b.brightCyan,n.DEFAULT_ANSI_COLORS[14]),_.ansi[15]=S(b.brightWhite,n.DEFAULT_ANSI_COLORS[15]),b.extendedAnsi){const y=Math.min(_.ansi.length-16,b.extendedAnsi.length);for(let D=0;D<y;D++)_.ansi[D+16]=S(b.extendedAnsi[D],n.DEFAULT_ANSI_COLORS[D+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(b){this._restoreColor(b),this._onChangeColors.fire(this.colors)}_restoreColor(b){if(b!==void 0)switch(b){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[b]=this._restoreColors.ansi[b]}else for(let _=0;_<this._restoreColors.ansi.length;++_)this._colors.ansi[_]=this._restoreColors.ansi[_]}modifyColors(b){b(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 S(b,_){if(b!==void 0)try{return d.css.toColor(b)}catch{}return _}n.ThemeService=m=c([f(0,u.IOptionsService)],m)},6349:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CircularList=void 0;const c=o(8460),f=o(844);class a extends f.Disposable{constructor(p){super(),this._maxLength=p,this.onDeleteEmitter=this.register(new c.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new c.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new c.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(p){if(this._maxLength===p)return;const g=new Array(p);for(let u=0;u<Math.min(p,this.length);u++)g[u]=this._array[this._getCyclicIndex(u)];this._array=g,this._maxLength=p,this._startIndex=0}get length(){return this._length}set length(p){if(p>this._length)for(let g=this._length;g<p;g++)this._array[g]=void 0;this._length=p}get(p){return this._array[this._getCyclicIndex(p)]}set(p,g){this._array[this._getCyclicIndex(p)]=g}push(p){this._array[this._getCyclicIndex(this._length)]=p,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(p,g,...u){if(g){for(let e=p;e<this._length-g;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+g)];this._length-=g,this.onDeleteEmitter.fire({index:p,amount:g})}for(let e=this._length-1;e>=p;e--)this._array[this._getCyclicIndex(e+u.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<u.length;e++)this._array[this._getCyclicIndex(p+e)]=u[e];if(u.length&&this.onInsertEmitter.fire({index:p,amount:u.length}),this._length+u.length>this._maxLength){const e=this._length+u.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=u.length}trimStart(p){p>this._length&&(p=this._length),this._startIndex+=p,this._length-=p,this.onTrimEmitter.fire(p)}shiftElements(p,g,u){if(!(g<=0)){if(p<0||p>=this._length)throw new Error("start argument out of range");if(p+u<0)throw new Error("Cannot shift elements in list beyond index 0");if(u>0){for(let i=g-1;i>=0;i--)this.set(p+i+u,this.get(p+i));const e=p+g+u-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e<g;e++)this.set(p+e+u,this.get(p+e))}}_getCyclicIndex(p){return(this._startIndex+p)%this._maxLength}}n.CircularList=a},1439:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clone=void 0,n.clone=function o(c,f=5){if(typeof c!="object")return c;const a=Array.isArray(c)?[]:{};for(const d in c)a[d]=f<=1?c[d]:c[d]&&o(c[d],f-1);return a}},8055:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.contrastRatio=n.toPaddedHex=n.rgba=n.rgb=n.css=n.color=n.channels=n.NULL_COLOR=void 0;let o=0,c=0,f=0,a=0;var d,p,g,u,e;function i(s){const h=s.toString(16);return h.length<2?"0"+h:h}function t(s,h){return s<h?(h+.05)/(s+.05):(s+.05)/(h+.05)}n.NULL_COLOR={css:"#00000000",rgba:0},(function(s){s.toCss=function(h,m,S,b){return b!==void 0?`#${i(h)}${i(m)}${i(S)}${i(b)}`:`#${i(h)}${i(m)}${i(S)}`},s.toRgba=function(h,m,S,b=255){return(h<<24|m<<16|S<<8|b)>>>0},s.toColor=function(h,m,S,b){return{css:s.toCss(h,m,S,b),rgba:s.toRgba(h,m,S,b)}}})(d||(n.channels=d={})),(function(s){function h(m,S){return a=Math.round(255*S),[o,c,f]=e.toChannels(m.rgba),{css:d.toCss(o,c,f,a),rgba:d.toRgba(o,c,f,a)}}s.blend=function(m,S){if(a=(255&S.rgba)/255,a===1)return{css:S.css,rgba:S.rgba};const b=S.rgba>>24&255,_=S.rgba>>16&255,y=S.rgba>>8&255,D=m.rgba>>24&255,T=m.rgba>>16&255,O=m.rgba>>8&255;return o=D+Math.round((b-D)*a),c=T+Math.round((_-T)*a),f=O+Math.round((y-O)*a),{css:d.toCss(o,c,f),rgba:d.toRgba(o,c,f)}},s.isOpaque=function(m){return(255&m.rgba)==255},s.ensureContrastRatio=function(m,S,b){const _=e.ensureContrastRatio(m.rgba,S.rgba,b);if(_)return d.toColor(_>>24&255,_>>16&255,_>>8&255)},s.opaque=function(m){const S=(255|m.rgba)>>>0;return[o,c,f]=e.toChannels(S),{css:d.toCss(o,c,f),rgba:S}},s.opacity=h,s.multiplyOpacity=function(m,S){return a=255&m.rgba,h(m,a*S/255)},s.toColorRGB=function(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}})(p||(n.color=p={})),(function(s){let h,m;try{const S=document.createElement("canvas");S.width=1,S.height=1;const b=S.getContext("2d",{willReadFrequently:!0});b&&(h=b,h.globalCompositeOperation="copy",m=h.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(S){if(S.match(/#[\da-f]{3,8}/i))switch(S.length){case 4:return o=parseInt(S.slice(1,2).repeat(2),16),c=parseInt(S.slice(2,3).repeat(2),16),f=parseInt(S.slice(3,4).repeat(2),16),d.toColor(o,c,f);case 5:return o=parseInt(S.slice(1,2).repeat(2),16),c=parseInt(S.slice(2,3).repeat(2),16),f=parseInt(S.slice(3,4).repeat(2),16),a=parseInt(S.slice(4,5).repeat(2),16),d.toColor(o,c,f,a);case 7:return{css:S,rgba:(parseInt(S.slice(1),16)<<8|255)>>>0};case 9:return{css:S,rgba:parseInt(S.slice(1),16)>>>0}}const b=S.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(b)return o=parseInt(b[1]),c=parseInt(b[2]),f=parseInt(b[3]),a=Math.round(255*(b[5]===void 0?1:parseFloat(b[5]))),d.toColor(o,c,f,a);if(!h||!m)throw new Error("css.toColor: Unsupported css format");if(h.fillStyle=m,h.fillStyle=S,typeof h.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(h.fillRect(0,0,1,1),[o,c,f,a]=h.getImageData(0,0,1,1).data,a!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:d.toRgba(o,c,f,a),css:S}}})(g||(n.css=g={})),(function(s){function h(m,S,b){const _=m/255,y=S/255,D=b/255;return .2126*(_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4))+.7152*(y<=.03928?y/12.92:Math.pow((y+.055)/1.055,2.4))+.0722*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))}s.relativeLuminance=function(m){return h(m>>16&255,m>>8&255,255&m)},s.relativeLuminance2=h})(u||(n.rgb=u={})),(function(s){function h(S,b,_){const y=S>>24&255,D=S>>16&255,T=S>>8&255;let O=b>>24&255,A=b>>16&255,W=b>>8&255,H=t(u.relativeLuminance2(O,A,W),u.relativeLuminance2(y,D,T));for(;H<_&&(O>0||A>0||W>0);)O-=Math.max(0,Math.ceil(.1*O)),A-=Math.max(0,Math.ceil(.1*A)),W-=Math.max(0,Math.ceil(.1*W)),H=t(u.relativeLuminance2(O,A,W),u.relativeLuminance2(y,D,T));return(O<<24|A<<16|W<<8|255)>>>0}function m(S,b,_){const y=S>>24&255,D=S>>16&255,T=S>>8&255;let O=b>>24&255,A=b>>16&255,W=b>>8&255,H=t(u.relativeLuminance2(O,A,W),u.relativeLuminance2(y,D,T));for(;H<_&&(O<255||A<255||W<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),A=Math.min(255,A+Math.ceil(.1*(255-A))),W=Math.min(255,W+Math.ceil(.1*(255-W))),H=t(u.relativeLuminance2(O,A,W),u.relativeLuminance2(y,D,T));return(O<<24|A<<16|W<<8|255)>>>0}s.blend=function(S,b){if(a=(255&b)/255,a===1)return b;const _=b>>24&255,y=b>>16&255,D=b>>8&255,T=S>>24&255,O=S>>16&255,A=S>>8&255;return o=T+Math.round((_-T)*a),c=O+Math.round((y-O)*a),f=A+Math.round((D-A)*a),d.toRgba(o,c,f)},s.ensureContrastRatio=function(S,b,_){const y=u.relativeLuminance(S>>8),D=u.relativeLuminance(b>>8);if(t(y,D)<_){if(D<y){const A=h(S,b,_),W=t(y,u.relativeLuminance(A>>8));if(W<_){const H=m(S,b,_);return W>t(y,u.relativeLuminance(H>>8))?A:H}return A}const T=m(S,b,_),O=t(y,u.relativeLuminance(T>>8));if(O<_){const A=h(S,b,_);return O>t(y,u.relativeLuminance(A>>8))?T:A}return T}},s.reduceLuminance=h,s.increaseLuminance=m,s.toChannels=function(S){return[S>>24&255,S>>16&255,S>>8&255,255&S]}})(e||(n.rgba=e={})),n.toPaddedHex=i,n.contrastRatio=t},8969:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoreTerminal=void 0;const c=o(844),f=o(2585),a=o(4348),d=o(7866),p=o(744),g=o(7302),u=o(6975),e=o(8460),i=o(1753),t=o(1480),s=o(7994),h=o(9282),m=o(5435),S=o(5981),b=o(2660);let _=!1;class y extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event((T=>{var O;(O=this._onScrollApi)==null||O.fire(T.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(T){for(const O in T)this.optionsService.options[O]=T[O]}constructor(T){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new a.InstantiationService,this.optionsService=this.register(new g.OptionsService(T)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(p.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(d.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(u.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(i.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(t.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(b.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new m.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.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 S.WriteBuffer(((O,A)=>this._inputHandler.parse(O,A)))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(T,O){this._writeBuffer.write(T,O)}writeSync(T,O){this._logService.logLevel<=f.LogLevelEnum.WARN&&!_&&(this._logService.warn("writeSync is unreliable and will be removed soon."),_=!0),this._writeBuffer.writeSync(T,O)}input(T,O=!0){this.coreService.triggerDataEvent(T,O)}resize(T,O){isNaN(T)||isNaN(O)||(T=Math.max(T,p.MINIMUM_COLS),O=Math.max(O,p.MINIMUM_ROWS),this._bufferService.resize(T,O))}scroll(T,O=!1){this._bufferService.scroll(T,O)}scrollLines(T,O,A){this._bufferService.scrollLines(T,O,A)}scrollPages(T){this.scrollLines(T*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(T){const O=T-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(T,O){return this._inputHandler.registerEscHandler(T,O)}registerDcsHandler(T,O){return this._inputHandler.registerDcsHandler(T,O)}registerCsiHandler(T,O){return this._inputHandler.registerCsiHandler(T,O)}registerOscHandler(T,O){return this._inputHandler.registerOscHandler(T,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let T=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?T=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(T=!0),T?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const T=[];T.push(this.onLineFeed(h.updateWindowsModeWrappedState.bind(null,this._bufferService))),T.push(this.registerCsiHandler({final:"H"},(()=>((0,h.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(const O of T)O.dispose()}))}}}n.CoreTerminal=y},8460:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.runAndSubscribe=n.forwardEvent=n.EventEmitter=void 0,n.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=o=>(this._listeners.push(o),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===o)return void this._listeners.splice(c,1)}}})),this._event}fire(o,c){const f=[];for(let a=0;a<this._listeners.length;a++)f.push(this._listeners[a]);for(let a=0;a<f.length;a++)f[a].call(void 0,o,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},n.forwardEvent=function(o,c){return o((f=>c.fire(f)))},n.runAndSubscribe=function(o,c){return c(void 0),o((f=>c(f)))}},5435:function(x,n,o){var c=this&&this.__decorate||function($,E,R,M){var P,j=arguments.length,q=j<3?E:M===null?M=Object.getOwnPropertyDescriptor(E,R):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate($,E,R,M);else for(var ee=$.length-1;ee>=0;ee--)(P=$[ee])&&(q=(j<3?P(q):j>3?P(E,R,q):P(E,R))||q);return j>3&&q&&Object.defineProperty(E,R,q),q},f=this&&this.__param||function($,E){return function(R,M){E(R,M,$)}};Object.defineProperty(n,"__esModule",{value:!0}),n.InputHandler=n.WindowsOptionsReportType=void 0;const a=o(2584),d=o(7116),p=o(2015),g=o(844),u=o(482),e=o(8437),i=o(8460),t=o(643),s=o(511),h=o(3734),m=o(2585),S=o(1480),b=o(6242),_=o(6351),y=o(5941),D={"(":0,")":1,"*":2,"+":3,"-":1,".":2},T=131072;function O($,E){if($>24)return E.setWinLines||!1;switch($){case 1:return!!E.restoreWin;case 2:return!!E.minimizeWin;case 3:return!!E.setWinPosition;case 4:return!!E.setWinSizePixels;case 5:return!!E.raiseWin;case 6:return!!E.lowerWin;case 7:return!!E.refreshWin;case 8:return!!E.setWinSizeChars;case 9:return!!E.maximizeWin;case 10:return!!E.fullscreenWin;case 11:return!!E.getWinState;case 13:return!!E.getWinPosition;case 14:return!!E.getWinSizePixels;case 15:return!!E.getScreenSizePixels;case 16:return!!E.getCellSizePixels;case 18:return!!E.getWinSizeChars;case 19:return!!E.getScreenSizeChars;case 20:return!!E.getIconTitle;case 21:return!!E.getWinTitle;case 22:return!!E.pushTitle;case 23:return!!E.popTitle;case 24:return!!E.setWinLines}return!1}var A;(function($){$[$.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",$[$.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(A||(n.WindowsOptionsReportType=A={}));let W=0;class H extends g.Disposable{getAttrData(){return this._curAttrData}constructor(E,R,M,P,j,q,ee,re,I=new p.EscapeSequenceParser){super(),this._bufferService=E,this._charsetService=R,this._coreService=M,this._logService=P,this._optionsService=j,this._oscLinkService=q,this._coreMouseService=ee,this._unicodeService=re,this._parser=I,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new u.StringToUtf32,this._utf8Decoder=new u.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new i.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new i.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new i.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new i.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new i.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new i.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new i.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new i.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new i.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new i.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new i.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new i.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new i.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((L=>this._activeBuffer=L.activeBuffer))),this._parser.setCsiHandlerFallback(((L,z)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(L),params:z.toArray()})})),this._parser.setEscHandlerFallback((L=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(L)})})),this._parser.setExecuteHandlerFallback((L=>{this._logService.debug("Unknown EXECUTE code: ",{code:L})})),this._parser.setOscHandlerFallback(((L,z,N)=>{this._logService.debug("Unknown OSC code: ",{identifier:L,action:z,data:N})})),this._parser.setDcsHandlerFallback(((L,z,N)=>{z==="HOOK"&&(N=N.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(L),action:z,payload:N})})),this._parser.setPrintHandler(((L,z,N)=>this.print(L,z,N))),this._parser.registerCsiHandler({final:"@"},(L=>this.insertChars(L))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(L=>this.scrollLeft(L))),this._parser.registerCsiHandler({final:"A"},(L=>this.cursorUp(L))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(L=>this.scrollRight(L))),this._parser.registerCsiHandler({final:"B"},(L=>this.cursorDown(L))),this._parser.registerCsiHandler({final:"C"},(L=>this.cursorForward(L))),this._parser.registerCsiHandler({final:"D"},(L=>this.cursorBackward(L))),this._parser.registerCsiHandler({final:"E"},(L=>this.cursorNextLine(L))),this._parser.registerCsiHandler({final:"F"},(L=>this.cursorPrecedingLine(L))),this._parser.registerCsiHandler({final:"G"},(L=>this.cursorCharAbsolute(L))),this._parser.registerCsiHandler({final:"H"},(L=>this.cursorPosition(L))),this._parser.registerCsiHandler({final:"I"},(L=>this.cursorForwardTab(L))),this._parser.registerCsiHandler({final:"J"},(L=>this.eraseInDisplay(L,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(L=>this.eraseInDisplay(L,!0))),this._parser.registerCsiHandler({final:"K"},(L=>this.eraseInLine(L,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(L=>this.eraseInLine(L,!0))),this._parser.registerCsiHandler({final:"L"},(L=>this.insertLines(L))),this._parser.registerCsiHandler({final:"M"},(L=>this.deleteLines(L))),this._parser.registerCsiHandler({final:"P"},(L=>this.deleteChars(L))),this._parser.registerCsiHandler({final:"S"},(L=>this.scrollUp(L))),this._parser.registerCsiHandler({final:"T"},(L=>this.scrollDown(L))),this._parser.registerCsiHandler({final:"X"},(L=>this.eraseChars(L))),this._parser.registerCsiHandler({final:"Z"},(L=>this.cursorBackwardTab(L))),this._parser.registerCsiHandler({final:"`"},(L=>this.charPosAbsolute(L))),this._parser.registerCsiHandler({final:"a"},(L=>this.hPositionRelative(L))),this._parser.registerCsiHandler({final:"b"},(L=>this.repeatPrecedingCharacter(L))),this._parser.registerCsiHandler({final:"c"},(L=>this.sendDeviceAttributesPrimary(L))),this._parser.registerCsiHandler({prefix:">",final:"c"},(L=>this.sendDeviceAttributesSecondary(L))),this._parser.registerCsiHandler({final:"d"},(L=>this.linePosAbsolute(L))),this._parser.registerCsiHandler({final:"e"},(L=>this.vPositionRelative(L))),this._parser.registerCsiHandler({final:"f"},(L=>this.hVPosition(L))),this._parser.registerCsiHandler({final:"g"},(L=>this.tabClear(L))),this._parser.registerCsiHandler({final:"h"},(L=>this.setMode(L))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(L=>this.setModePrivate(L))),this._parser.registerCsiHandler({final:"l"},(L=>this.resetMode(L))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(L=>this.resetModePrivate(L))),this._parser.registerCsiHandler({final:"m"},(L=>this.charAttributes(L))),this._parser.registerCsiHandler({final:"n"},(L=>this.deviceStatus(L))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(L=>this.deviceStatusPrivate(L))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(L=>this.softReset(L))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(L=>this.setCursorStyle(L))),this._parser.registerCsiHandler({final:"r"},(L=>this.setScrollRegion(L))),this._parser.registerCsiHandler({final:"s"},(L=>this.saveCursor(L))),this._parser.registerCsiHandler({final:"t"},(L=>this.windowOptions(L))),this._parser.registerCsiHandler({final:"u"},(L=>this.restoreCursor(L))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(L=>this.insertColumns(L))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(L=>this.deleteColumns(L))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(L=>this.selectProtected(L))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(L=>this.requestMode(L,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(L=>this.requestMode(L,!1))),this._parser.setExecuteHandler(a.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(a.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(a.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(a.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(a.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(a.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(a.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(a.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(a.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(a.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new b.OscHandler((L=>(this.setTitle(L),this.setIconName(L),!0)))),this._parser.registerOscHandler(1,new b.OscHandler((L=>this.setIconName(L)))),this._parser.registerOscHandler(2,new b.OscHandler((L=>this.setTitle(L)))),this._parser.registerOscHandler(4,new b.OscHandler((L=>this.setOrReportIndexedColor(L)))),this._parser.registerOscHandler(8,new b.OscHandler((L=>this.setHyperlink(L)))),this._parser.registerOscHandler(10,new b.OscHandler((L=>this.setOrReportFgColor(L)))),this._parser.registerOscHandler(11,new b.OscHandler((L=>this.setOrReportBgColor(L)))),this._parser.registerOscHandler(12,new b.OscHandler((L=>this.setOrReportCursorColor(L)))),this._parser.registerOscHandler(104,new b.OscHandler((L=>this.restoreIndexedColor(L)))),this._parser.registerOscHandler(110,new b.OscHandler((L=>this.restoreFgColor(L)))),this._parser.registerOscHandler(111,new b.OscHandler((L=>this.restoreBgColor(L)))),this._parser.registerOscHandler(112,new b.OscHandler((L=>this.restoreCursorColor(L)))),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 L in d.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:L},(()=>this.selectCharset("("+L))),this._parser.registerEscHandler({intermediates:")",final:L},(()=>this.selectCharset(")"+L))),this._parser.registerEscHandler({intermediates:"*",final:L},(()=>this.selectCharset("*"+L))),this._parser.registerEscHandler({intermediates:"+",final:L},(()=>this.selectCharset("+"+L))),this._parser.registerEscHandler({intermediates:"-",final:L},(()=>this.selectCharset("-"+L))),this._parser.registerEscHandler({intermediates:".",final:L},(()=>this.selectCharset("."+L))),this._parser.registerEscHandler({intermediates:"/",final:L},(()=>this.selectCharset("/"+L)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((L=>(this._logService.error("Parsing error: ",L),L))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new _.DcsHandler(((L,z)=>this.requestStatusString(L,z))))}_preserveStack(E,R,M,P){this._parseStack.paused=!0,this._parseStack.cursorStartX=E,this._parseStack.cursorStartY=R,this._parseStack.decodedLength=M,this._parseStack.position=P}_logSlowResolvingAsync(E){this._logService.logLevel<=m.LogLevelEnum.WARN&&Promise.race([E,new Promise(((R,M)=>setTimeout((()=>M("#SLOW_TIMEOUT")),5e3)))]).catch((R=>{if(R!=="#SLOW_TIMEOUT")throw R;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(E,R){let M,P=this._activeBuffer.x,j=this._activeBuffer.y,q=0;const ee=this._parseStack.paused;if(ee){if(M=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,R))return this._logSlowResolvingAsync(M),M;P=this._parseStack.cursorStartX,j=this._parseStack.cursorStartY,this._parseStack.paused=!1,E.length>T&&(q=this._parseStack.position+T)}if(this._logService.logLevel<=m.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof E=="string"?` "${E}"`:` "${Array.prototype.map.call(E,(L=>String.fromCharCode(L))).join("")}"`),typeof E=="string"?E.split("").map((L=>L.charCodeAt(0))):E),this._parseBuffer.length<E.length&&this._parseBuffer.length<T&&(this._parseBuffer=new Uint32Array(Math.min(E.length,T))),ee||this._dirtyRowTracker.clearRange(),E.length>T)for(let L=q;L<E.length;L+=T){const z=L+T<E.length?L+T:E.length,N=typeof E=="string"?this._stringDecoder.decode(E.substring(L,z),this._parseBuffer):this._utf8Decoder.decode(E.subarray(L,z),this._parseBuffer);if(M=this._parser.parse(this._parseBuffer,N))return this._preserveStack(P,j,N,L),this._logSlowResolvingAsync(M),M}else if(!ee){const L=typeof E=="string"?this._stringDecoder.decode(E,this._parseBuffer):this._utf8Decoder.decode(E,this._parseBuffer);if(M=this._parser.parse(this._parseBuffer,L))return this._preserveStack(P,j,L,0),this._logSlowResolvingAsync(M),M}this._activeBuffer.x===P&&this._activeBuffer.y===j||this._onCursorMove.fire();const re=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(re,this._bufferService.rows-1))}print(E,R,M){let P,j;const q=this._charsetService.charset,ee=this._optionsService.rawOptions.screenReaderMode,re=this._bufferService.cols,I=this._coreService.decPrivateModes.wraparound,L=this._coreService.modes.insertMode,z=this._curAttrData;let N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&M-R>0&&N.getWidth(this._activeBuffer.x-1)===2&&N.setCellFromCodepoint(this._activeBuffer.x-1,0,1,z);let Y=this._parser.precedingJoinState;for(let X=R;X<M;++X){if(P=E[X],P<127&&q){const xe=q[String.fromCharCode(P)];xe&&(P=xe.charCodeAt(0))}const ne=this._unicodeService.charProperties(P,Y);j=S.UnicodeService.extractWidth(ne);const ve=S.UnicodeService.extractShouldJoin(ne),ge=ve?S.UnicodeService.extractWidth(Y):0;if(Y=ne,ee&&this._onA11yChar.fire((0,u.stringFromCodePoint)(P)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+j-ge>re){if(I){const xe=N;let se=this._activeBuffer.x-ge;for(this._activeBuffer.x=ge,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),N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ge>0&&N instanceof e.BufferLine&&N.copyCellsFrom(xe,se,0,ge,!1);se<re;)xe.setCellFromCodepoint(se++,0,1,z)}else if(this._activeBuffer.x=re-1,j===2)continue}if(ve&&this._activeBuffer.x){const xe=N.getWidth(this._activeBuffer.x-1)?1:2;N.addCodepointToCell(this._activeBuffer.x-xe,P,j);for(let se=j-ge;--se>=0;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}else if(L&&(N.insertCells(this._activeBuffer.x,j-ge,this._activeBuffer.getNullCell(z)),N.getWidth(re-1)===2&&N.setCellFromCodepoint(re-1,t.NULL_CELL_CODE,t.NULL_CELL_WIDTH,z)),N.setCellFromCodepoint(this._activeBuffer.x++,P,j,z),j>0)for(;--j;)N.setCellFromCodepoint(this._activeBuffer.x++,0,0,z)}this._parser.precedingJoinState=Y,this._activeBuffer.x<re&&M-R>0&&N.getWidth(this._activeBuffer.x)===0&&!N.hasContent(this._activeBuffer.x)&&N.setCellFromCodepoint(this._activeBuffer.x,0,1,z),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(E,R){return E.final!=="t"||E.prefix||E.intermediates?this._parser.registerCsiHandler(E,R):this._parser.registerCsiHandler(E,(M=>!O(M.params[0],this._optionsService.rawOptions.windowOptions)||R(M)))}registerDcsHandler(E,R){return this._parser.registerDcsHandler(E,new _.DcsHandler(R))}registerEscHandler(E,R){return this._parser.registerEscHandler(E,R)}registerOscHandler(E,R){return this._parser.registerOscHandler(E,new b.OscHandler(R))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var E;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&&((E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&E.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);R.hasWidth(this._activeBuffer.x)&&!R.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const E=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-E),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(E=this._bufferService.cols-1){this._activeBuffer.x=Math.min(E,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(E,R){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=E,this._activeBuffer.y=this._activeBuffer.scrollTop+R):(this._activeBuffer.x=E,this._activeBuffer.y=R),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(E,R){this._restrictCursor(),this._setCursor(this._activeBuffer.x+E,this._activeBuffer.y+R)}cursorUp(E){const R=this._activeBuffer.y-this._activeBuffer.scrollTop;return R>=0?this._moveCursor(0,-Math.min(R,E.params[0]||1)):this._moveCursor(0,-(E.params[0]||1)),!0}cursorDown(E){const R=this._activeBuffer.scrollBottom-this._activeBuffer.y;return R>=0?this._moveCursor(0,Math.min(R,E.params[0]||1)):this._moveCursor(0,E.params[0]||1),!0}cursorForward(E){return this._moveCursor(E.params[0]||1,0),!0}cursorBackward(E){return this._moveCursor(-(E.params[0]||1),0),!0}cursorNextLine(E){return this.cursorDown(E),this._activeBuffer.x=0,!0}cursorPrecedingLine(E){return this.cursorUp(E),this._activeBuffer.x=0,!0}cursorCharAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(E){return this._setCursor(E.length>=2?(E.params[1]||1)-1:0,(E.params[0]||1)-1),!0}charPosAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(E){return this._moveCursor(E.params[0]||1,0),!0}linePosAbsolute(E){return this._setCursor(this._activeBuffer.x,(E.params[0]||1)-1),!0}vPositionRelative(E){return this._moveCursor(0,E.params[0]||1),!0}hVPosition(E){return this.cursorPosition(E),!0}tabClear(E){const R=E.params[0];return R===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:R===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=E.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=E.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(E){const R=E.params[0];return R===1&&(this._curAttrData.bg|=536870912),R!==2&&R!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(E,R,M,P=!1,j=!1){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);q.replaceCells(R,M,this._activeBuffer.getNullCell(this._eraseAttrData()),j),P&&(q.isWrapped=!1)}_resetBufferLine(E,R=!1){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);M&&(M.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),R),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+E),M.isWrapped=!1)}eraseInDisplay(E,R=!1){let M;switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:for(M=this._activeBuffer.y,this._dirtyRowTracker.markDirty(M),this._eraseInBufferLine(M++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);M<this._bufferService.rows;M++)this._resetBufferLine(M,R);this._dirtyRowTracker.markDirty(M);break;case 1:for(M=this._activeBuffer.y,this._dirtyRowTracker.markDirty(M),this._eraseInBufferLine(M,0,this._activeBuffer.x+1,!0,R),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(M+1).isWrapped=!1);M--;)this._resetBufferLine(M,R);this._dirtyRowTracker.markDirty(0);break;case 2:for(M=this._bufferService.rows,this._dirtyRowTracker.markDirty(M-1);M--;)this._resetBufferLine(M,R);this._dirtyRowTracker.markDirty(0);break;case 3:const P=this._activeBuffer.lines.length-this._bufferService.rows;P>0&&(this._activeBuffer.lines.trimStart(P),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-P,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-P,0),this._onScroll.fire(0))}return!0}eraseInLine(E,R=!1){switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,R);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,R)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(E){this._restrictCursor();let R=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=this._activeBuffer.ybase+this._activeBuffer.y,P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,j=this._bufferService.rows-1+this._activeBuffer.ybase-P+1;for(;R--;)this._activeBuffer.lines.splice(j-1,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}deleteLines(E){this._restrictCursor();let R=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const M=this._activeBuffer.ybase+this._activeBuffer.y;let P;for(P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-P;R--;)this._activeBuffer.lines.splice(M,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(E){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.insertCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(E){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.deleteCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(E){let R=E.params[0]||1;for(;R--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(E){let R=E.params[0]||1;for(;R--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(e.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=E.params[0]||1;for(let M=this._activeBuffer.scrollTop;M<=this._activeBuffer.scrollBottom;++M){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);P.deleteCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=E.params[0]||1;for(let M=this._activeBuffer.scrollTop;M<=this._activeBuffer.scrollBottom;++M){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);P.insertCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=E.params[0]||1;for(let M=this._activeBuffer.scrollTop;M<=this._activeBuffer.scrollBottom;++M){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);P.insertCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=E.params[0]||1;for(let M=this._activeBuffer.scrollTop;M<=this._activeBuffer.scrollBottom;++M){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+M);P.deleteCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(E){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(E.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(E){const R=this._parser.precedingJoinState;if(!R)return!0;const M=E.params[0]||1,P=S.UnicodeService.extractWidth(R),j=this._activeBuffer.x-P,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(j),ee=new Uint32Array(q.length*M);let re=0;for(let L=0;L<q.length;){const z=q.codePointAt(L)||0;ee[re++]=z,L+=z>65535?2:1}let I=re;for(let L=1;L<M;++L)ee.copyWithin(I,0,re),I+=re;return this.print(ee,0,I),!0}sendDeviceAttributesPrimary(E){return E.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(a.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(a.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(E){return E.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(a.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(a.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(E.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(a.C0.ESC+"[>83;40003;0c")),!0}_is(E){return(this._optionsService.rawOptions.termName+"").indexOf(E)===0}setMode(E){for(let R=0;R<E.length;R++)switch(E.params[R]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(E){for(let R=0;R<E.length;R++)switch(E.params[R]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),this._charsetService.setgCharset(1,d.DEFAULT_CHARSET),this._charsetService.setgCharset(2,d.DEFAULT_CHARSET),this._charsetService.setgCharset(3,d.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(E){for(let R=0;R<E.length;R++)switch(E.params[R]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(E){for(let R=0;R<E.length;R++)switch(E.params[R]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),E.params[R]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(E,R){const M=this._coreService.decPrivateModes,{activeProtocol:P,activeEncoding:j}=this._coreMouseService,q=this._coreService,{buffers:ee,cols:re}=this._bufferService,{active:I,alt:L}=ee,z=this._optionsService.rawOptions,N=ve=>ve?1:2,Y=E.params[0];return X=Y,ne=R?Y===2?4:Y===4?N(q.modes.insertMode):Y===12?3:Y===20?N(z.convertEol):0:Y===1?N(M.applicationCursorKeys):Y===3?z.windowOptions.setWinLines?re===80?2:re===132?1:0:0:Y===6?N(M.origin):Y===7?N(M.wraparound):Y===8?3:Y===9?N(P==="X10"):Y===12?N(z.cursorBlink):Y===25?N(!q.isCursorHidden):Y===45?N(M.reverseWraparound):Y===66?N(M.applicationKeypad):Y===67?4:Y===1e3?N(P==="VT200"):Y===1002?N(P==="DRAG"):Y===1003?N(P==="ANY"):Y===1004?N(M.sendFocus):Y===1005?4:Y===1006?N(j==="SGR"):Y===1015?4:Y===1016?N(j==="SGR_PIXELS"):Y===1048?1:Y===47||Y===1047||Y===1049?N(I===L):Y===2004?N(M.bracketedPasteMode):0,q.triggerDataEvent(`${a.C0.ESC}[${R?"":"?"}${X};${ne}$y`),!0;var X,ne}_updateAttrColor(E,R,M,P,j){return R===2?(E|=50331648,E&=-16777216,E|=h.AttributeData.fromColorRGB([M,P,j])):R===5&&(E&=-50331904,E|=33554432|255&M),E}_extractColor(E,R,M){const P=[0,0,-1,0,0,0];let j=0,q=0;do{if(P[q+j]=E.params[R+q],E.hasSubParams(R+q)){const ee=E.getSubParams(R+q);let re=0;do P[1]===5&&(j=1),P[q+re+1+j]=ee[re];while(++re<ee.length&&re+q+1+j<P.length);break}if(P[1]===5&&q+j>=2||P[1]===2&&q+j>=5)break;P[1]&&(j=1)}while(++q+R<E.length&&q+j<P.length);for(let ee=2;ee<P.length;++ee)P[ee]===-1&&(P[ee]=0);switch(P[0]){case 38:M.fg=this._updateAttrColor(M.fg,P[1],P[3],P[4],P[5]);break;case 48:M.bg=this._updateAttrColor(M.bg,P[1],P[3],P[4],P[5]);break;case 58:M.extended=M.extended.clone(),M.extended.underlineColor=this._updateAttrColor(M.extended.underlineColor,P[1],P[3],P[4],P[5])}return q}_processUnderline(E,R){R.extended=R.extended.clone(),(!~E||E>5)&&(E=1),R.extended.underlineStyle=E,R.fg|=268435456,E===0&&(R.fg&=-268435457),R.updateExtended()}_processSGR0(E){E.fg=e.DEFAULT_ATTR_DATA.fg,E.bg=e.DEFAULT_ATTR_DATA.bg,E.extended=E.extended.clone(),E.extended.underlineStyle=0,E.extended.underlineColor&=-67108864,E.updateExtended()}charAttributes(E){if(E.length===1&&E.params[0]===0)return this._processSGR0(this._curAttrData),!0;const R=E.length;let M;const P=this._curAttrData;for(let j=0;j<R;j++)M=E.params[j],M>=30&&M<=37?(P.fg&=-50331904,P.fg|=16777216|M-30):M>=40&&M<=47?(P.bg&=-50331904,P.bg|=16777216|M-40):M>=90&&M<=97?(P.fg&=-50331904,P.fg|=16777224|M-90):M>=100&&M<=107?(P.bg&=-50331904,P.bg|=16777224|M-100):M===0?this._processSGR0(P):M===1?P.fg|=134217728:M===3?P.bg|=67108864:M===4?(P.fg|=268435456,this._processUnderline(E.hasSubParams(j)?E.getSubParams(j)[0]:1,P)):M===5?P.fg|=536870912:M===7?P.fg|=67108864:M===8?P.fg|=1073741824:M===9?P.fg|=2147483648:M===2?P.bg|=134217728:M===21?this._processUnderline(2,P):M===22?(P.fg&=-134217729,P.bg&=-134217729):M===23?P.bg&=-67108865:M===24?(P.fg&=-268435457,this._processUnderline(0,P)):M===25?P.fg&=-536870913:M===27?P.fg&=-67108865:M===28?P.fg&=-1073741825:M===29?P.fg&=2147483647:M===39?(P.fg&=-67108864,P.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):M===49?(P.bg&=-67108864,P.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):M===38||M===48||M===58?j+=this._extractColor(E,j,P):M===53?P.bg|=1073741824:M===55?P.bg&=-1073741825:M===59?(P.extended=P.extended.clone(),P.extended.underlineColor=-1,P.updateExtended()):M===100?(P.fg&=-67108864,P.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,P.bg&=-67108864,P.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",M);return!0}deviceStatus(E){switch(E.params[0]){case 5:this._coreService.triggerDataEvent(`${a.C0.ESC}[0n`);break;case 6:const R=this._activeBuffer.y+1,M=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[${R};${M}R`)}return!0}deviceStatusPrivate(E){if(E.params[0]===6){const R=this._activeBuffer.y+1,M=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${a.C0.ESC}[?${R};${M}R`)}return!0}softReset(E){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=e.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(E){const R=E.params[0]||1;switch(R){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const M=R%2==1;return this._optionsService.options.cursorBlink=M,!0}setScrollRegion(E){const R=E.params[0]||1;let M;return(E.length<2||(M=E.params[1])>this._bufferService.rows||M===0)&&(M=this._bufferService.rows),M>R&&(this._activeBuffer.scrollTop=R-1,this._activeBuffer.scrollBottom=M-1,this._setCursor(0,0)),!0}windowOptions(E){if(!O(E.params[0],this._optionsService.rawOptions.windowOptions))return!0;const R=E.length>1?E.params[1]:0;switch(E.params[0]){case 14:R!==2&&this._onRequestWindowsOptionsReport.fire(A.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(A.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${a.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:R!==0&&R!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),R!==0&&R!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:R!==0&&R!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),R!==0&&R!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(E){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(E){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(E){return this._windowTitle=E,this._onTitleChange.fire(E),!0}setIconName(E){return this._iconName=E,!0}setOrReportIndexedColor(E){const R=[],M=E.split(";");for(;M.length>1;){const P=M.shift(),j=M.shift();if(/^\d+$/.exec(P)){const q=parseInt(P);if(V(q))if(j==="?")R.push({type:0,index:q});else{const ee=(0,y.parseColor)(j);ee&&R.push({type:1,index:q,color:ee})}}}return R.length&&this._onColor.fire(R),!0}setHyperlink(E){const R=E.split(";");return!(R.length<2)&&(R[1]?this._createHyperlink(R[0],R[1]):!R[0]&&this._finishHyperlink())}_createHyperlink(E,R){this._getCurrentLinkId()&&this._finishHyperlink();const M=E.split(":");let P;const j=M.findIndex((q=>q.startsWith("id=")));return j!==-1&&(P=M[j].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:P,uri:R}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(E,R){const M=E.split(";");for(let P=0;P<M.length&&!(R>=this._specialColors.length);++P,++R)if(M[P]==="?")this._onColor.fire([{type:0,index:this._specialColors[R]}]);else{const j=(0,y.parseColor)(M[P]);j&&this._onColor.fire([{type:1,index:this._specialColors[R],color:j}])}return!0}setOrReportFgColor(E){return this._setOrReportSpecialColor(E,0)}setOrReportBgColor(E){return this._setOrReportSpecialColor(E,1)}setOrReportCursorColor(E){return this._setOrReportSpecialColor(E,2)}restoreIndexedColor(E){if(!E)return this._onColor.fire([{type:2}]),!0;const R=[],M=E.split(";");for(let P=0;P<M.length;++P)if(/^\d+$/.exec(M[P])){const j=parseInt(M[P]);V(j)&&R.push({type:2,index:j})}return R.length&&this._onColor.fire(R),!0}restoreFgColor(E){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(E){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(E){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),!0}selectCharset(E){return E.length!==2?(this.selectDefaultCharset(),!0):(E[0]==="/"||this._charsetService.setgCharset(D[E[0]],d.CHARSETS[E[1]]||d.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 E=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,E,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(E){return this._charsetService.setgLevel(E),!0}screenAlignmentPattern(){const E=new s.CellData;E.content=4194373,E.fg=this._curAttrData.fg,E.bg=this._curAttrData.bg,this._setCursor(0,0);for(let R=0;R<this._bufferService.rows;++R){const M=this._activeBuffer.ybase+this._activeBuffer.y+R,P=this._activeBuffer.lines.get(M);P&&(P.fill(E),P.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(E,R){const M=this._bufferService.buffer,P=this._optionsService.rawOptions;return(j=>(this._coreService.triggerDataEvent(`${a.C0.ESC}${j}${a.C0.ESC}\\`),!0))(E==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:E==='"p'?'P1$r61;1"p':E==="r"?`P1$r${M.scrollTop+1};${M.scrollBottom+1}r`:E==="m"?"P1$r0m":E===" q"?`P1$r${{block:2,underline:4,bar:6}[P.cursorStyle]-(P.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(E,R){this._dirtyRowTracker.markRangeDirty(E,R)}}n.InputHandler=H;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($,E){$>E&&(W=$,$=E,E=W),$<this.start&&(this.start=$),E>this.end&&(this.end=E)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function V($){return 0<=$&&$<256}U=c([f(0,m.IBufferService)],U)},844:(x,n)=>{function o(c){for(const f of c)f.dispose();c.length=0}Object.defineProperty(n,"__esModule",{value:!0}),n.getDisposeArrayDisposable=n.disposeArray=n.toDisposable=n.MutableDisposable=n.Disposable=void 0,n.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const c of this._disposables)c.dispose();this._disposables.length=0}register(c){return this._disposables.push(c),c}unregister(c){const f=this._disposables.indexOf(c);f!==-1&&this._disposables.splice(f,1)}},n.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(c){var f;this._isDisposed||c===this._value||((f=this._value)==null||f.dispose(),this._value=c)}clear(){this.value=void 0}dispose(){var c;this._isDisposed=!0,(c=this._value)==null||c.dispose(),this._value=void 0}},n.toDisposable=function(c){return{dispose:c}},n.disposeArray=o,n.getDisposeArrayDisposable=function(c){return{dispose:()=>o(c)}}},1505:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.FourKeyMap=n.TwoKeyMap=void 0;class o{constructor(){this._data={}}set(f,a,d){this._data[f]||(this._data[f]={}),this._data[f][a]=d}get(f,a){return this._data[f]?this._data[f][a]:void 0}clear(){this._data={}}}n.TwoKeyMap=o,n.FourKeyMap=class{constructor(){this._data=new o}set(c,f,a,d,p){this._data.get(c,f)||this._data.set(c,f,new o),this._data.get(c,f).set(a,d,p)}get(c,f,a,d){var p;return(p=this._data.get(c,f))==null?void 0:p.get(a,d)}clear(){this._data.clear()}}},6114:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.isChromeOS=n.isLinux=n.isWindows=n.isIphone=n.isIpad=n.isMac=n.getSafariVersion=n.isSafari=n.isLegacyEdge=n.isFirefox=n.isNode=void 0,n.isNode=typeof process<"u"&&"title"in process;const o=n.isNode?"node":navigator.userAgent,c=n.isNode?"node":navigator.platform;n.isFirefox=o.includes("Firefox"),n.isLegacyEdge=o.includes("Edge"),n.isSafari=/^((?!chrome|android).)*safari/i.test(o),n.getSafariVersion=function(){if(!n.isSafari)return 0;const f=o.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},n.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(c),n.isIpad=c==="iPad",n.isIphone=c==="iPhone",n.isWindows=["Windows","Win16","Win32","WinCE"].includes(c),n.isLinux=c.indexOf("Linux")>=0,n.isChromeOS=/\bCrOS\b/.test(o)},6106:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SortedList=void 0;let o=0;n.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(o=this._search(this._getKey(c)),this._array.splice(o,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;const f=this._getKey(c);if(f===void 0||(o=this._search(f),o===-1)||this._getKey(this._array[o])!==f)return!1;do if(this._array[o]===c)return this._array.splice(o,1),!0;while(++o<this._array.length&&this._getKey(this._array[o])===f);return!1}*getKeyIterator(c){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do yield this._array[o];while(++o<this._array.length&&this._getKey(this._array[o])===c)}forEachByKey(c,f){if(this._array.length!==0&&(o=this._search(c),!(o<0||o>=this._array.length)&&this._getKey(this._array[o])===c))do f(this._array[o]);while(++o<this._array.length&&this._getKey(this._array[o])===c)}values(){return[...this._array].values()}_search(c){let f=0,a=this._array.length-1;for(;a>=f;){let d=f+a>>1;const p=this._getKey(this._array[d]);if(p>c)a=d-1;else{if(!(p<c)){for(;d>0&&this._getKey(this._array[d-1])===c;)d--;return d}f=d+1}}return f}}},7226:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DebouncedIdleTask=n.IdleTaskQueue=n.PriorityTaskQueue=void 0;const c=o(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(p){this._tasks.push(p),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(p){this._idleCallback=void 0;let g=0,u=0,e=p.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(g=Date.now(),this._tasks[this._i]()||this._i++,g=Math.max(1,Date.now()-g),u=Math.max(g,u),i=p.timeRemaining(),1.5*u>i)return e-g<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-g))}ms`),void this._start();e=i}this.clear()}}class a extends f{_requestCallback(p){return setTimeout((()=>p(this._createDeadline(16))))}_cancelCallback(p){clearTimeout(p)}_createDeadline(p){const g=Date.now()+p;return{timeRemaining:()=>Math.max(0,g-Date.now())}}}n.PriorityTaskQueue=a,n.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(d){return requestIdleCallback(d)}_cancelCallback(d){cancelIdleCallback(d)}}:a,n.DebouncedIdleTask=class{constructor(){this._queue=new n.IdleTaskQueue}set(d){this._queue.clear(),this._queue.enqueue(d)}flush(){this._queue.flush()}}},9282:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.updateWindowsModeWrappedState=void 0;const c=o(643);n.updateWindowsModeWrappedState=function(f){const a=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),d=a==null?void 0:a.get(f.cols-1),p=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);p&&d&&(p.isWrapped=d[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&d[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ExtendedAttrs=n.AttributeData=void 0;class o{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(a){return[a>>>16&255,a>>>8&255,255&a]}static fromColorRGB(a){return(255&a[0])<<16|(255&a[1])<<8|255&a[2]}clone(){const a=new o;return a.fg=this.fg,a.bg=this.bg,a.extended=this.extended.clone(),a}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}n.AttributeData=o;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(a){this._ext=a}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(a){this._ext&=-469762049,this._ext|=a<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(a){this._ext&=-67108864,this._ext|=67108863&a}get urlId(){return this._urlId}set urlId(a){this._urlId=a}get underlineVariantOffset(){const a=(3758096384&this._ext)>>29;return a<0?4294967288^a:a}set underlineVariantOffset(a){this._ext&=536870911,this._ext|=a<<29&3758096384}constructor(a=0,d=0){this._ext=0,this._urlId=0,this._ext=a,this._urlId=d}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}n.ExtendedAttrs=c},9092:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Buffer=n.MAX_BUFFER_SIZE=void 0;const c=o(6349),f=o(7226),a=o(3734),d=o(8437),p=o(4634),g=o(511),u=o(643),e=o(4863),i=o(7116);n.MAX_BUFFER_SIZE=4294967295,n.Buffer=class{constructor(t,s,h){this._hasScrollback=t,this._optionsService=s,this._bufferService=h,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=d.DEFAULT_ATTR_DATA.clone(),this.savedCharset=i.DEFAULT_CHARSET,this.markers=[],this._nullCell=g.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]),this._whitespaceCell=g.CellData.fromCharData([0,u.WHITESPACE_CELL_CHAR,u.WHITESPACE_CELL_WIDTH,u.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new a.ExtendedAttrs),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new a.ExtendedAttrs),this._whitespaceCell}getBlankLine(t,s){return new d.BufferLine(this._bufferService.cols,this.getNullCell(t),s)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;const s=t+this._optionsService.rawOptions.scrollback;return s>n.MAX_BUFFER_SIZE?n.MAX_BUFFER_SIZE:s}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=d.DEFAULT_ATTR_DATA);let s=this._rows;for(;s--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,s){const h=this.getNullCell(d.DEFAULT_ATTR_DATA);let m=0;const S=this._getCorrectBufferLength(s);if(S>this.lines.maxLength&&(this.lines.maxLength=S),this.lines.length>0){if(this._cols<t)for(let _=0;_<this.lines.length;_++)m+=+this.lines.get(_).resize(t,h);let b=0;if(this._rows<s)for(let _=this._rows;_<s;_++)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 d.BufferLine(t,h)):this.ybase>0&&this.lines.length<=this.ybase+this.y+b+1?(this.ybase--,b++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(t,h)));else for(let _=this._rows;_>s;_--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(S<this.lines.maxLength){const _=this.lines.length-S;_>0&&(this.lines.trimStart(_),this.ybase=Math.max(this.ybase-_,0),this.ydisp=Math.max(this.ydisp-_,0),this.savedY=Math.max(this.savedY-_,0)),this.lines.maxLength=S}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,s-1),b&&(this.y+=b),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(t,s),this._cols>t))for(let b=0;b<this.lines.length;b++)m+=+this.lines.get(b).resize(t,h);this._cols=t,this._rows=s,this._memoryCleanupQueue.clear(),m>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let s=0;for(;this._memoryCleanupPosition<this.lines.length;)if(s+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),s>100)return!0;return t}get _isReflowEnabled(){const t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,s){this._cols!==t&&(t>this._cols?this._reflowLarger(t,s):this._reflowSmaller(t,s))}_reflowLarger(t,s){const h=(0,p.reflowLargerGetLinesToRemove)(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA));if(h.length>0){const m=(0,p.reflowLargerCreateNewLayout)(this.lines,h);(0,p.reflowLargerApplyNewLayout)(this.lines,m.layout),this._reflowLargerAdjustViewport(t,s,m.countRemoved)}}_reflowLargerAdjustViewport(t,s,h){const m=this.getNullCell(d.DEFAULT_ATTR_DATA);let S=h;for(;S-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new d.BufferLine(t,m))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-h,0)}_reflowSmaller(t,s){const h=this.getNullCell(d.DEFAULT_ATTR_DATA),m=[];let S=0;for(let b=this.lines.length-1;b>=0;b--){let _=this.lines.get(b);if(!_||!_.isWrapped&&_.getTrimmedLength()<=t)continue;const y=[_];for(;_.isWrapped&&b>0;)_=this.lines.get(--b),y.unshift(_);const D=this.ybase+this.y;if(D>=b&&D<b+y.length)continue;const T=y[y.length-1].getTrimmedLength(),O=(0,p.reflowSmallerGetNewLineLengths)(y,this._cols,t),A=O.length-y.length;let W;W=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+A):Math.max(0,this.lines.length-this.lines.maxLength+A);const H=[];for(let M=0;M<A;M++){const P=this.getBlankLine(d.DEFAULT_ATTR_DATA,!0);H.push(P)}H.length>0&&(m.push({start:b+y.length+S,newLines:H}),S+=H.length),y.push(...H);let U=O.length-1,V=O[U];V===0&&(U--,V=O[U]);let $=y.length-A-1,E=T;for(;$>=0;){const M=Math.min(E,V);if(y[U]===void 0)break;if(y[U].copyCellsFrom(y[$],E-M,V-M,M,!0),V-=M,V===0&&(U--,V=O[U]),E-=M,E===0){$--;const P=Math.max($,0);E=(0,p.getWrappedLineTrimmedLength)(y,P,this._cols)}}for(let M=0;M<y.length;M++)O[M]<t&&y[M].setCell(O[M],h);let R=A-W;for(;R-- >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+S)-s&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+A,this.ybase+s-1)}if(m.length>0){const b=[],_=[];for(let U=0;U<this.lines.length;U++)_.push(this.lines.get(U));const y=this.lines.length;let D=y-1,T=0,O=m[T];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+S);let A=0;for(let U=Math.min(this.lines.maxLength-1,y+S-1);U>=0;U--)if(O&&O.start>D+A){for(let V=O.newLines.length-1;V>=0;V--)this.lines.set(U--,O.newLines[V]);U++,b.push({index:D+1,amount:O.newLines.length}),A+=O.newLines.length,O=m[++T]}else this.lines.set(U,_[D--]);let W=0;for(let U=b.length-1;U>=0;U--)b[U].index+=W,this.lines.onInsertEmitter.fire(b[U]),W+=b[U].amount;const H=Math.max(0,y+S-this.lines.maxLength);H>0&&this.lines.onTrimEmitter.fire(H)}}translateBufferLineToString(t,s,h=0,m){const S=this.lines.get(t);return S?S.translateToString(s,h,m):""}getWrappedRangeForLine(t){let s=t,h=t;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;h+1<this.lines.length&&this.lines.get(h+1).isWrapped;)h++;return{first:s,last:h}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].line===t&&(this.markers[s].dispose(),this.markers.splice(s--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose(),this.markers.splice(t--,1);this._isClearing=!1}addMarker(t){const s=new e.Marker(t);return this.markers.push(s),s.register(this.lines.onTrim((h=>{s.line-=h,s.line<0&&s.dispose()}))),s.register(this.lines.onInsert((h=>{s.line>=h.index&&(s.line+=h.amount)}))),s.register(this.lines.onDelete((h=>{s.line>=h.index&&s.line<h.index+h.amount&&s.dispose(),s.line>h.index&&(s.line-=h.amount)}))),s.register(s.onDispose((()=>this._removeMarker(s)))),s}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}}},8437:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLine=n.DEFAULT_ATTR_DATA=void 0;const c=o(3734),f=o(511),a=o(643),d=o(482);n.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let p=0;class g{constructor(e,i,t=!1){this.isWrapped=t,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const s=i||f.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]);for(let h=0;h<e;++h)this.setCell(h,s);this.length=e}get(e){const i=this._data[3*e+0],t=2097151&i;return[this._data[3*e+1],2097152&i?this._combined[e]:t?(0,d.stringFromCodePoint)(t):"",i>>22,2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):t]}set(e,i){this._data[3*e+1]=i[a.CHAR_DATA_ATTR_INDEX],i[a.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=i[1],this._data[3*e+0]=2097152|e|i[a.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=i[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|i[a.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const i=this._data[3*e+0];return 2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&i}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const i=this._data[3*e+0];return 2097152&i?this._combined[e]:2097151&i?(0,d.stringFromCodePoint)(2097151&i):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,i){return p=3*e,i.content=this._data[p+0],i.fg=this._data[p+1],i.bg=this._data[p+2],2097152&i.content&&(i.combinedData=this._combined[e]),268435456&i.bg&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){2097152&i.content&&(this._combined[e]=i.combinedData),268435456&i.bg&&(this._extendedAttrs[e]=i.extended),this._data[3*e+0]=i.content,this._data[3*e+1]=i.fg,this._data[3*e+2]=i.bg}setCellFromCodepoint(e,i,t,s){268435456&s.bg&&(this._extendedAttrs[e]=s.extended),this._data[3*e+0]=i|t<<22,this._data[3*e+1]=s.fg,this._data[3*e+2]=s.bg}addCodepointToCell(e,i,t){let s=this._data[3*e+0];2097152&s?this._combined[e]+=(0,d.stringFromCodePoint)(i):2097151&s?(this._combined[e]=(0,d.stringFromCodePoint)(2097151&s)+(0,d.stringFromCodePoint)(i),s&=-2097152,s|=2097152):s=i|4194304,t&&(s&=-12582913,s|=t<<22),this._data[3*e+0]=s}insertCells(e,i,t){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,t),i<this.length-e){const s=new f.CellData;for(let h=this.length-e-i-1;h>=0;--h)this.setCell(e+i+h,this.loadCell(e+h,s));for(let h=0;h<i;++h)this.setCell(e+h,t)}else for(let s=e;s<this.length;++s)this.setCell(s,t);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,t)}deleteCells(e,i,t){if(e%=this.length,i<this.length-e){const s=new f.CellData;for(let h=0;h<this.length-e-i;++h)this.setCell(e+h,this.loadCell(e+i+h,s));for(let h=this.length-i;h<this.length;++h)this.setCell(h,t)}else for(let s=e;s<this.length;++s)this.setCell(s,t);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,t),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,t)}replaceCells(e,i,t,s=!1){if(s)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,t),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,t);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,t),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,t),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,t);e<i&&e<this.length;)this.setCell(e++,t)}resize(e,i){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const t=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*t)this._data=new Uint32Array(this._data.buffer,0,t);else{const s=new Uint32Array(t);s.set(this._data),this._data=s}for(let s=this.length;s<e;++s)this.setCell(s,i)}else{this._data=this._data.subarray(0,t);const s=Object.keys(this._combined);for(let m=0;m<s.length;m++){const S=parseInt(s[m],10);S>=e&&delete this._combined[S]}const h=Object.keys(this._extendedAttrs);for(let m=0;m<h.length;m++){const S=parseInt(h[m],10);S>=e&&delete this._extendedAttrs[S]}}return this.length=e,4*t*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i)for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(const i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){const e=new g(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const i in this._combined)e._combined[i]=this._combined[i];for(const i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,i,t,s,h){const m=e._data;if(h)for(let b=s-1;b>=0;b--){for(let _=0;_<3;_++)this._data[3*(t+b)+_]=m[3*(i+b)+_];268435456&m[3*(i+b)+2]&&(this._extendedAttrs[t+b]=e._extendedAttrs[i+b])}else for(let b=0;b<s;b++){for(let _=0;_<3;_++)this._data[3*(t+b)+_]=m[3*(i+b)+_];268435456&m[3*(i+b)+2]&&(this._extendedAttrs[t+b]=e._extendedAttrs[i+b])}const S=Object.keys(e._combined);for(let b=0;b<S.length;b++){const _=parseInt(S[b],10);_>=i&&(this._combined[_-i+t]=e._combined[_])}}translateToString(e,i,t,s){i=i??0,t=t??this.length,e&&(t=Math.min(t,this.getTrimmedLength())),s&&(s.length=0);let h="";for(;i<t;){const m=this._data[3*i+0],S=2097151&m,b=2097152&m?this._combined[i]:S?(0,d.stringFromCodePoint)(S):a.WHITESPACE_CELL_CHAR;if(h+=b,s)for(let _=0;_<b.length;++_)s.push(i);i+=m>>22||1}return s&&s.push(i),h}}n.BufferLine=g},4841:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getRangeLength=void 0,n.getRangeLength=function(o,c){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 c*(o.end.y-o.start.y)+(o.end.x-o.start.x+1)}},4634:(x,n)=>{function o(c,f,a){if(f===c.length-1)return c[f].getTrimmedLength();const d=!c[f].hasContent(a-1)&&c[f].getWidth(a-1)===1,p=c[f+1].getWidth(0)===2;return d&&p?a-1:a}Object.defineProperty(n,"__esModule",{value:!0}),n.getWrappedLineTrimmedLength=n.reflowSmallerGetNewLineLengths=n.reflowLargerApplyNewLayout=n.reflowLargerCreateNewLayout=n.reflowLargerGetLinesToRemove=void 0,n.reflowLargerGetLinesToRemove=function(c,f,a,d,p){const g=[];for(let u=0;u<c.length-1;u++){let e=u,i=c.get(++e);if(!i.isWrapped)continue;const t=[c.get(u)];for(;e<c.length&&i.isWrapped;)t.push(i),i=c.get(++e);if(d>=u&&d<e){u+=t.length-1;continue}let s=0,h=o(t,s,f),m=1,S=0;for(;m<t.length;){const _=o(t,m,f),y=_-S,D=a-h,T=Math.min(y,D);t[s].copyCellsFrom(t[m],S,h,T,!1),h+=T,h===a&&(s++,h=0),S+=T,S===_&&(m++,S=0),h===0&&s!==0&&t[s-1].getWidth(a-1)===2&&(t[s].copyCellsFrom(t[s-1],a-1,h++,1,!1),t[s-1].setCell(a-1,p))}t[s].replaceCells(h,a,p);let b=0;for(let _=t.length-1;_>0&&(_>s||t[_].getTrimmedLength()===0);_--)b++;b>0&&(g.push(u+t.length-b),g.push(b)),u+=t.length-1}return g},n.reflowLargerCreateNewLayout=function(c,f){const a=[];let d=0,p=f[d],g=0;for(let u=0;u<c.length;u++)if(p===u){const e=f[++d];c.onDeleteEmitter.fire({index:u-g,amount:e}),u+=e-1,g+=e,p=f[++d]}else a.push(u);return{layout:a,countRemoved:g}},n.reflowLargerApplyNewLayout=function(c,f){const a=[];for(let d=0;d<f.length;d++)a.push(c.get(f[d]));for(let d=0;d<a.length;d++)c.set(d,a[d]);c.length=f.length},n.reflowSmallerGetNewLineLengths=function(c,f,a){const d=[],p=c.map(((i,t)=>o(c,t,f))).reduce(((i,t)=>i+t));let g=0,u=0,e=0;for(;e<p;){if(p-e<a){d.push(p-e);break}g+=a;const i=o(c,u,f);g>i&&(g-=i,u++);const t=c[u].getWidth(g-1)===2;t&&g--;const s=t?a-1:a;d.push(s),e+=s}return d},n.getWrappedLineTrimmedLength=o},5295:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferSet=void 0;const c=o(8460),f=o(844),a=o(9092);class d extends f.Disposable{constructor(g,u){super(),this._optionsService=g,this._bufferService=u,this._onBufferActivate=this.register(new c.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 a.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new a.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(g){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(g),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(g,u){this._normal.resize(g,u),this._alt.resize(g,u),this.setupTabStops(g)}setupTabStops(g){this._normal.setupTabStops(g),this._alt.setupTabStops(g)}}n.BufferSet=d},511:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CellData=void 0;const c=o(482),f=o(643),a=o(3734);class d extends a.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new a.ExtendedAttrs,this.combinedData=""}static fromCharData(g){const u=new d;return u.setFromCharData(g),u}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(g){this.fg=g[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let u=!1;if(g[f.CHAR_DATA_CHAR_INDEX].length>2)u=!0;else if(g[f.CHAR_DATA_CHAR_INDEX].length===2){const e=g[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const i=g[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(e-55296)+i-56320+65536|g[f.CHAR_DATA_WIDTH_INDEX]<<22:u=!0}else u=!0}else this.content=g[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|g[f.CHAR_DATA_WIDTH_INDEX]<<22;u&&(this.combinedData=g[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|g[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}n.CellData=d},643:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WHITESPACE_CELL_CODE=n.WHITESPACE_CELL_WIDTH=n.WHITESPACE_CELL_CHAR=n.NULL_CELL_CODE=n.NULL_CELL_WIDTH=n.NULL_CELL_CHAR=n.CHAR_DATA_CODE_INDEX=n.CHAR_DATA_WIDTH_INDEX=n.CHAR_DATA_CHAR_INDEX=n.CHAR_DATA_ATTR_INDEX=n.DEFAULT_EXT=n.DEFAULT_ATTR=n.DEFAULT_COLOR=void 0,n.DEFAULT_COLOR=0,n.DEFAULT_ATTR=256|n.DEFAULT_COLOR<<9,n.DEFAULT_EXT=0,n.CHAR_DATA_ATTR_INDEX=0,n.CHAR_DATA_CHAR_INDEX=1,n.CHAR_DATA_WIDTH_INDEX=2,n.CHAR_DATA_CODE_INDEX=3,n.NULL_CELL_CHAR="",n.NULL_CELL_WIDTH=1,n.NULL_CELL_CODE=0,n.WHITESPACE_CELL_CHAR=" ",n.WHITESPACE_CELL_WIDTH=1,n.WHITESPACE_CELL_CODE=32},4863:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Marker=void 0;const c=o(8460),f=o(844);class a{get id(){return this._id}constructor(p){this.line=p,this.isDisposed=!1,this._disposables=[],this._id=a._nextId++,this._onDispose=this.register(new c.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(p){return this._disposables.push(p),p}}n.Marker=a,a._nextId=1},7116:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DEFAULT_CHARSET=n.CHARSETS=void 0,n.CHARSETS={},n.DEFAULT_CHARSET=n.CHARSETS.B,n.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},n.CHARSETS.A={"#":"£"},n.CHARSETS.B=void 0,n.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},n.CHARSETS.C=n.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},n.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},n.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},n.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},n.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},n.CHARSETS.E=n.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},n.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},n.CHARSETS.H=n.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},n.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(x,n)=>{var o,c,f;Object.defineProperty(n,"__esModule",{value:!0}),n.C1_ESCAPED=n.C1=n.C0=void 0,(function(a){a.NUL="\0",a.SOH="",a.STX="",a.ETX="",a.EOT="",a.ENQ="",a.ACK="",a.BEL="\x07",a.BS="\b",a.HT=" ",a.LF=`
9
- `,a.VT="\v",a.FF="\f",a.CR="\r",a.SO="",a.SI="",a.DLE="",a.DC1="",a.DC2="",a.DC3="",a.DC4="",a.NAK="",a.SYN="",a.ETB="",a.CAN="",a.EM="",a.SUB="",a.ESC="\x1B",a.FS="",a.GS="",a.RS="",a.US="",a.SP=" ",a.DEL=""})(o||(n.C0=o={})),(function(a){a.PAD="€",a.HOP="",a.BPH="‚",a.NBH="ƒ",a.IND="„",a.NEL="…",a.SSA="†",a.ESA="‡",a.HTS="ˆ",a.HTJ="‰",a.VTS="Š",a.PLD="‹",a.PLU="Œ",a.RI="",a.SS2="Ž",a.SS3="",a.DCS="",a.PU1="‘",a.PU2="’",a.STS="“",a.CCH="”",a.MW="•",a.SPA="–",a.EPA="—",a.SOS="˜",a.SGCI="™",a.SCI="š",a.CSI="›",a.ST="œ",a.OSC="",a.PM="ž",a.APC="Ÿ"})(c||(n.C1=c={})),(function(a){a.ST=`${o.ESC}\\`})(f||(n.C1_ESCAPED=f={}))},7399:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.evaluateKeyboardEvent=void 0;const c=o(2584),f={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};n.evaluateKeyboardEvent=function(a,d,p,g){const u={type:0,cancel:!1,key:void 0},e=(a.shiftKey?1:0)|(a.altKey?2:0)|(a.ctrlKey?4:0)|(a.metaKey?8:0);switch(a.keyCode){case 0:a.key==="UIKeyInputUpArrow"?u.key=d?c.C0.ESC+"OA":c.C0.ESC+"[A":a.key==="UIKeyInputLeftArrow"?u.key=d?c.C0.ESC+"OD":c.C0.ESC+"[D":a.key==="UIKeyInputRightArrow"?u.key=d?c.C0.ESC+"OC":c.C0.ESC+"[C":a.key==="UIKeyInputDownArrow"&&(u.key=d?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:u.key=a.ctrlKey?"\b":c.C0.DEL,a.altKey&&(u.key=c.C0.ESC+u.key);break;case 9:if(a.shiftKey){u.key=c.C0.ESC+"[Z";break}u.key=c.C0.HT,u.cancel=!0;break;case 13:u.key=a.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,u.cancel=!0;break;case 27:u.key=c.C0.ESC,a.altKey&&(u.key=c.C0.ESC+c.C0.ESC),u.cancel=!0;break;case 37:if(a.metaKey)break;e?(u.key=c.C0.ESC+"[1;"+(e+1)+"D",u.key===c.C0.ESC+"[1;3D"&&(u.key=c.C0.ESC+(p?"b":"[1;5D"))):u.key=d?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(a.metaKey)break;e?(u.key=c.C0.ESC+"[1;"+(e+1)+"C",u.key===c.C0.ESC+"[1;3C"&&(u.key=c.C0.ESC+(p?"f":"[1;5C"))):u.key=d?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(a.metaKey)break;e?(u.key=c.C0.ESC+"[1;"+(e+1)+"A",p||u.key!==c.C0.ESC+"[1;3A"||(u.key=c.C0.ESC+"[1;5A")):u.key=d?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(a.metaKey)break;e?(u.key=c.C0.ESC+"[1;"+(e+1)+"B",p||u.key!==c.C0.ESC+"[1;3B"||(u.key=c.C0.ESC+"[1;5B")):u.key=d?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:a.shiftKey||a.ctrlKey||(u.key=c.C0.ESC+"[2~");break;case 46:u.key=e?c.C0.ESC+"[3;"+(e+1)+"~":c.C0.ESC+"[3~";break;case 36:u.key=e?c.C0.ESC+"[1;"+(e+1)+"H":d?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:u.key=e?c.C0.ESC+"[1;"+(e+1)+"F":d?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:a.shiftKey?u.type=2:a.ctrlKey?u.key=c.C0.ESC+"[5;"+(e+1)+"~":u.key=c.C0.ESC+"[5~";break;case 34:a.shiftKey?u.type=3:a.ctrlKey?u.key=c.C0.ESC+"[6;"+(e+1)+"~":u.key=c.C0.ESC+"[6~";break;case 112:u.key=e?c.C0.ESC+"[1;"+(e+1)+"P":c.C0.ESC+"OP";break;case 113:u.key=e?c.C0.ESC+"[1;"+(e+1)+"Q":c.C0.ESC+"OQ";break;case 114:u.key=e?c.C0.ESC+"[1;"+(e+1)+"R":c.C0.ESC+"OR";break;case 115:u.key=e?c.C0.ESC+"[1;"+(e+1)+"S":c.C0.ESC+"OS";break;case 116:u.key=e?c.C0.ESC+"[15;"+(e+1)+"~":c.C0.ESC+"[15~";break;case 117:u.key=e?c.C0.ESC+"[17;"+(e+1)+"~":c.C0.ESC+"[17~";break;case 118:u.key=e?c.C0.ESC+"[18;"+(e+1)+"~":c.C0.ESC+"[18~";break;case 119:u.key=e?c.C0.ESC+"[19;"+(e+1)+"~":c.C0.ESC+"[19~";break;case 120:u.key=e?c.C0.ESC+"[20;"+(e+1)+"~":c.C0.ESC+"[20~";break;case 121:u.key=e?c.C0.ESC+"[21;"+(e+1)+"~":c.C0.ESC+"[21~";break;case 122:u.key=e?c.C0.ESC+"[23;"+(e+1)+"~":c.C0.ESC+"[23~";break;case 123:u.key=e?c.C0.ESC+"[24;"+(e+1)+"~":c.C0.ESC+"[24~";break;default:if(!a.ctrlKey||a.shiftKey||a.altKey||a.metaKey)if(p&&!g||!a.altKey||a.metaKey)!p||a.altKey||a.ctrlKey||a.shiftKey||!a.metaKey?a.key&&!a.ctrlKey&&!a.altKey&&!a.metaKey&&a.keyCode>=48&&a.key.length===1?u.key=a.key:a.key&&a.ctrlKey&&(a.key==="_"&&(u.key=c.C0.US),a.key==="@"&&(u.key=c.C0.NUL)):a.keyCode===65&&(u.type=1);else{const i=f[a.keyCode],t=i==null?void 0:i[a.shiftKey?1:0];if(t)u.key=c.C0.ESC+t;else if(a.keyCode>=65&&a.keyCode<=90){const s=a.ctrlKey?a.keyCode-64:a.keyCode+32;let h=String.fromCharCode(s);a.shiftKey&&(h=h.toUpperCase()),u.key=c.C0.ESC+h}else if(a.keyCode===32)u.key=c.C0.ESC+(a.ctrlKey?c.C0.NUL:" ");else if(a.key==="Dead"&&a.code.startsWith("Key")){let s=a.code.slice(3,4);a.shiftKey||(s=s.toLowerCase()),u.key=c.C0.ESC+s,u.cancel=!0}}else a.keyCode>=65&&a.keyCode<=90?u.key=String.fromCharCode(a.keyCode-64):a.keyCode===32?u.key=c.C0.NUL:a.keyCode>=51&&a.keyCode<=55?u.key=String.fromCharCode(a.keyCode-51+27):a.keyCode===56?u.key=c.C0.DEL:a.keyCode===219?u.key=c.C0.ESC:a.keyCode===220?u.key=c.C0.FS:a.keyCode===221&&(u.key=c.C0.GS)}return u}},482:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Utf8ToUtf32=n.StringToUtf32=n.utf32ToString=n.stringFromCodePoint=void 0,n.stringFromCodePoint=function(o){return o>65535?(o-=65536,String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):String.fromCharCode(o)},n.utf32ToString=function(o,c=0,f=o.length){let a="";for(let d=c;d<f;++d){let p=o[d];p>65535?(p-=65536,a+=String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):a+=String.fromCharCode(p)}return a},n.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(o,c){const f=o.length;if(!f)return 0;let a=0,d=0;if(this._interim){const p=o.charCodeAt(d++);56320<=p&&p<=57343?c[a++]=1024*(this._interim-55296)+p-56320+65536:(c[a++]=this._interim,c[a++]=p),this._interim=0}for(let p=d;p<f;++p){const g=o.charCodeAt(p);if(55296<=g&&g<=56319){if(++p>=f)return this._interim=g,a;const u=o.charCodeAt(p);56320<=u&&u<=57343?c[a++]=1024*(g-55296)+u-56320+65536:(c[a++]=g,c[a++]=u)}else g!==65279&&(c[a++]=g)}return a}},n.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(o,c){const f=o.length;if(!f)return 0;let a,d,p,g,u=0,e=0,i=0;if(this.interim[0]){let h=!1,m=this.interim[0];m&=(224&m)==192?31:(240&m)==224?15:7;let S,b=0;for(;(S=63&this.interim[++b])&&b<4;)m<<=6,m|=S;const _=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,y=_-b;for(;i<y;){if(i>=f)return 0;if(S=o[i++],(192&S)!=128){i--,h=!0;break}this.interim[b++]=S,m<<=6,m|=63&S}h||(_===2?m<128?i--:c[u++]=m:_===3?m<2048||m>=55296&&m<=57343||m===65279||(c[u++]=m):m<65536||m>1114111||(c[u++]=m)),this.interim.fill(0)}const t=f-4;let s=i;for(;s<f;){for(;!(!(s<t)||128&(a=o[s])||128&(d=o[s+1])||128&(p=o[s+2])||128&(g=o[s+3]));)c[u++]=a,c[u++]=d,c[u++]=p,c[u++]=g,s+=4;if(a=o[s++],a<128)c[u++]=a;else if((224&a)==192){if(s>=f)return this.interim[0]=a,u;if(d=o[s++],(192&d)!=128){s--;continue}if(e=(31&a)<<6|63&d,e<128){s--;continue}c[u++]=e}else if((240&a)==224){if(s>=f)return this.interim[0]=a,u;if(d=o[s++],(192&d)!=128){s--;continue}if(s>=f)return this.interim[0]=a,this.interim[1]=d,u;if(p=o[s++],(192&p)!=128){s--;continue}if(e=(15&a)<<12|(63&d)<<6|63&p,e<2048||e>=55296&&e<=57343||e===65279)continue;c[u++]=e}else if((248&a)==240){if(s>=f)return this.interim[0]=a,u;if(d=o[s++],(192&d)!=128){s--;continue}if(s>=f)return this.interim[0]=a,this.interim[1]=d,u;if(p=o[s++],(192&p)!=128){s--;continue}if(s>=f)return this.interim[0]=a,this.interim[1]=d,this.interim[2]=p,u;if(g=o[s++],(192&g)!=128){s--;continue}if(e=(7&a)<<18|(63&d)<<12|(63&p)<<6|63&g,e<65536||e>1114111)continue;c[u++]=e}}return u}}},225:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeV6=void 0;const c=o(1480),f=[[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]],a=[[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 d;n.UnicodeV6=class{constructor(){if(this.version="6",!d){d=new Uint8Array(65536),d.fill(1),d[0]=0,d.fill(0,1,32),d.fill(0,127,160),d.fill(2,4352,4448),d[9001]=2,d[9002]=2,d.fill(2,11904,42192),d[12351]=1,d.fill(2,44032,55204),d.fill(2,63744,64256),d.fill(2,65040,65050),d.fill(2,65072,65136),d.fill(2,65280,65377),d.fill(2,65504,65511);for(let p=0;p<f.length;++p)d.fill(0,f[p][0],f[p][1]+1)}}wcwidth(p){return p<32?0:p<127?1:p<65536?d[p]:(function(g,u){let e,i=0,t=u.length-1;if(g<u[0][0]||g>u[t][1])return!1;for(;t>=i;)if(e=i+t>>1,g>u[e][1])i=e+1;else{if(!(g<u[e][0]))return!0;t=e-1}return!1})(p,a)?0:p>=131072&&p<=196605||p>=196608&&p<=262141?2:1}charProperties(p,g){let u=this.wcwidth(p),e=u===0&&g!==0;if(e){const i=c.UnicodeService.extractWidth(g);i===0?e=!1:i>u&&(u=i)}return c.UnicodeService.createPropertyValue(0,u,e)}}},5981:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WriteBuffer=void 0;const c=o(8460),f=o(844);class a extends f.Disposable{constructor(p){super(),this._action=p,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(p,g){if(g!==void 0&&this._syncCalls>g)return void(this._syncCalls=0);if(this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let u;for(this._isSyncWriting=!0;u=this._writeBuffer.shift();){this._action(u);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(p,g){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(g),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=p.length,this._writeBuffer.push(p),this._callbacks.push(g)}_innerWrite(p=0,g=!0){const u=p||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],i=this._action(e,g);if(i){const s=h=>Date.now()-u>=12?setTimeout((()=>this._innerWrite(0,h))):this._innerWrite(u,h);return void i.catch((h=>(queueMicrotask((()=>{throw h})),Promise.resolve(!1)))).then(s)}const t=this._callbacks[this._bufferOffset];if(t&&t(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-u>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}n.WriteBuffer=a},5941:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.toRgbString=n.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})$/,c=/^[\da-f]+$/;function f(a,d){const p=a.toString(16),g=p.length<2?"0"+p:p;switch(d){case 4:return p[0];case 8:return g;case 12:return(g+g).slice(0,3);default:return g+g}}n.parseColor=function(a){if(!a)return;let d=a.toLowerCase();if(d.indexOf("rgb:")===0){d=d.slice(4);const p=o.exec(d);if(p){const g=p[1]?15:p[4]?255:p[7]?4095:65535;return[Math.round(parseInt(p[1]||p[4]||p[7]||p[10],16)/g*255),Math.round(parseInt(p[2]||p[5]||p[8]||p[11],16)/g*255),Math.round(parseInt(p[3]||p[6]||p[9]||p[12],16)/g*255)]}}else if(d.indexOf("#")===0&&(d=d.slice(1),c.exec(d)&&[3,6,9,12].includes(d.length))){const p=d.length/3,g=[0,0,0];for(let u=0;u<3;++u){const e=parseInt(d.slice(p*u,p*u+p),16);g[u]=p===1?e<<4:p===2?e:p===3?e>>4:e>>8}return g}},n.toRgbString=function(a,d=16){const[p,g,u]=a;return`rgb:${f(p,d)}/${f(g,d)}/${f(u,d)}`}},5770:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.PAYLOAD_LIMIT=void 0,n.PAYLOAD_LIMIT=1e7},6351:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DcsHandler=n.DcsParser=void 0;const c=o(482),f=o(8742),a=o(5770),d=[];n.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=d,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}registerHandler(g,u){this._handlers[g]===void 0&&(this._handlers[g]=[]);const e=this._handlers[g];return e.push(u),{dispose:()=>{const i=e.indexOf(u);i!==-1&&e.splice(i,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}reset(){if(this._active.length)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].unhook(!1);this._stack.paused=!1,this._active=d,this._ident=0}hook(g,u){if(this.reset(),this._ident=g,this._active=this._handlers[g]||d,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(u);else this._handlerFb(this._ident,"HOOK",u)}put(g,u,e){if(this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].put(g,u,e);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(g,u,e))}unhook(g,u=!0){if(this._active.length){let e=!1,i=this._active.length-1,t=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,e=u,t=this._stack.fallThrough,this._stack.paused=!1),!t&&e===!1){for(;i>=0&&(e=this._active[i].unhook(g),e!==!0);i--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,e;i--}for(;i>=0;i--)if(e=this._active[i].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",g);this._active=d,this._ident=0}};const p=new f.Params;p.addParam(0),n.DcsHandler=class{constructor(g){this._handler=g,this._data="",this._params=p,this._hitLimit=!1}hook(g){this._params=g.length>1||g.params[0]?g.clone():p,this._data="",this._hitLimit=!1}put(g,u,e){this._hitLimit||(this._data+=(0,c.utf32ToString)(g,u,e),this._data.length>a.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(g){let u=!1;if(this._hitLimit)u=!1;else if(g&&(u=this._handler(this._data,this._params),u instanceof Promise))return u.then((e=>(this._params=p,this._data="",this._hitLimit=!1,e)));return this._params=p,this._data="",this._hitLimit=!1,u}}},2015:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.EscapeSequenceParser=n.VT500_TRANSITION_TABLE=n.TransitionTable=void 0;const c=o(844),f=o(8742),a=o(6242),d=o(6351);class p{constructor(i){this.table=new Uint8Array(i)}setDefault(i,t){this.table.fill(i<<4|t)}add(i,t,s,h){this.table[t<<8|i]=s<<4|h}addMany(i,t,s,h){for(let m=0;m<i.length;m++)this.table[t<<8|i[m]]=s<<4|h}}n.TransitionTable=p;const g=160;n.VT500_TRANSITION_TABLE=(function(){const e=new p(4095),i=Array.apply(null,Array(256)).map(((b,_)=>_)),t=(b,_)=>i.slice(b,_),s=t(32,127),h=t(0,24);h.push(25),h.push.apply(h,t(28,32));const m=t(0,14);let S;for(S in e.setDefault(1,0),e.addMany(s,0,2,0),m)e.addMany([24,26,153,154],S,3,0),e.addMany(t(128,144),S,3,0),e.addMany(t(144,152),S,3,0),e.add(156,S,0,0),e.add(27,S,11,1),e.add(157,S,4,8),e.addMany([152,158,159],S,0,7),e.add(155,S,11,3),e.add(144,S,11,9);return e.addMany(h,0,3,0),e.addMany(h,1,3,1),e.add(127,1,0,1),e.addMany(h,8,0,8),e.addMany(h,3,3,3),e.add(127,3,0,3),e.addMany(h,4,3,4),e.add(127,4,0,4),e.addMany(h,6,3,6),e.addMany(h,5,3,5),e.add(127,5,0,5),e.addMany(h,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(t(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(h,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(t(64,127),3,7,0),e.addMany(t(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(t(48,60),4,8,4),e.addMany(t(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(t(32,64),6,0,6),e.add(127,6,0,6),e.addMany(t(64,127),6,0,0),e.addMany(t(32,48),3,9,5),e.addMany(t(32,48),5,9,5),e.addMany(t(48,64),5,0,6),e.addMany(t(64,127),5,7,0),e.addMany(t(32,48),4,9,5),e.addMany(t(32,48),1,9,2),e.addMany(t(32,48),2,9,2),e.addMany(t(48,127),2,10,0),e.addMany(t(48,80),1,10,0),e.addMany(t(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(t(96,127),1,10,0),e.add(80,1,11,9),e.addMany(h,9,0,9),e.add(127,9,0,9),e.addMany(t(28,32),9,0,9),e.addMany(t(32,48),9,9,12),e.addMany(t(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(h,11,0,11),e.addMany(t(32,128),11,0,11),e.addMany(t(28,32),11,0,11),e.addMany(h,10,0,10),e.add(127,10,0,10),e.addMany(t(28,32),10,0,10),e.addMany(t(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(t(32,48),10,9,12),e.addMany(h,12,0,12),e.add(127,12,0,12),e.addMany(t(28,32),12,0,12),e.addMany(t(32,48),12,9,12),e.addMany(t(48,64),12,0,11),e.addMany(t(64,127),12,12,13),e.addMany(t(64,127),10,12,13),e.addMany(t(64,127),9,12,13),e.addMany(h,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(g,0,2,0),e.add(g,8,5,8),e.add(g,6,0,6),e.add(g,11,0,11),e.add(g,13,13,13),e})();class u extends c.Disposable{constructor(i=n.VT500_TRANSITION_TABLE){super(),this._transitions=i,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,h)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,c.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new a.OscParser),this._dcsParser=this.register(new d.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(i,t=[64,126]){let s=0;if(i.prefix){if(i.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=i.prefix.charCodeAt(0),s&&60>s||s>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(i.intermediates){if(i.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let m=0;m<i.intermediates.length;++m){const S=i.intermediates.charCodeAt(m);if(32>S||S>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=S}}if(i.final.length!==1)throw new Error("final must be a single byte");const h=i.final.charCodeAt(0);if(t[0]>h||h>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=h,s}identToString(i){const t=[];for(;i;)t.push(String.fromCharCode(255&i)),i>>=8;return t.reverse().join("")}setPrintHandler(i){this._printHandler=i}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(i,t){const s=this._identifier(i,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);const h=this._escHandlers[s];return h.push(t),{dispose:()=>{const m=h.indexOf(t);m!==-1&&h.splice(m,1)}}}clearEscHandler(i){this._escHandlers[this._identifier(i,[48,126])]&&delete this._escHandlers[this._identifier(i,[48,126])]}setEscHandlerFallback(i){this._escHandlerFb=i}setExecuteHandler(i,t){this._executeHandlers[i.charCodeAt(0)]=t}clearExecuteHandler(i){this._executeHandlers[i.charCodeAt(0)]&&delete this._executeHandlers[i.charCodeAt(0)]}setExecuteHandlerFallback(i){this._executeHandlerFb=i}registerCsiHandler(i,t){const s=this._identifier(i);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);const h=this._csiHandlers[s];return h.push(t),{dispose:()=>{const m=h.indexOf(t);m!==-1&&h.splice(m,1)}}}clearCsiHandler(i){this._csiHandlers[this._identifier(i)]&&delete this._csiHandlers[this._identifier(i)]}setCsiHandlerFallback(i){this._csiHandlerFb=i}registerDcsHandler(i,t){return this._dcsParser.registerHandler(this._identifier(i),t)}clearDcsHandler(i){this._dcsParser.clearHandler(this._identifier(i))}setDcsHandlerFallback(i){this._dcsParser.setHandlerFallback(i)}registerOscHandler(i,t){return this._oscParser.registerHandler(i,t)}clearOscHandler(i){this._oscParser.clearHandler(i)}setOscHandlerFallback(i){this._oscParser.setHandlerFallback(i)}setErrorHandler(i){this._errorHandler=i}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(i,t,s,h,m){this._parseStack.state=i,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=h,this._parseStack.chunkPos=m}parse(i,t,s){let h,m=0,S=0,b=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,b=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 _=this._parseStack.handlers;let y=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&y>-1){for(;y>=0&&(h=_[y](this._params),h!==!0);y--)if(h instanceof Promise)return this._parseStack.handlerPos=y,h}this._parseStack.handlers=[];break;case 4:if(s===!1&&y>-1){for(;y>=0&&(h=_[y](),h!==!0);y--)if(h instanceof Promise)return this._parseStack.handlerPos=y,h}this._parseStack.handlers=[];break;case 6:if(m=i[this._parseStack.chunkPos],h=this._dcsParser.unhook(m!==24&&m!==26,s),h)return h;m===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(m=i[this._parseStack.chunkPos],h=this._oscParser.end(m!==24&&m!==26,s),h)return h;m===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,b=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let _=b;_<t;++_){switch(m=i[_],S=this._transitions.table[this.currentState<<8|(m<160?m:g)],S>>4){case 2:for(let A=_+1;;++A){if(A>=t||(m=i[A])<32||m>126&&m<g){this._printHandler(i,_,A),_=A-1;break}if(++A>=t||(m=i[A])<32||m>126&&m<g){this._printHandler(i,_,A),_=A-1;break}if(++A>=t||(m=i[A])<32||m>126&&m<g){this._printHandler(i,_,A),_=A-1;break}if(++A>=t||(m=i[A])<32||m>126&&m<g){this._printHandler(i,_,A),_=A-1;break}}break;case 3:this._executeHandlers[m]?this._executeHandlers[m]():this._executeHandlerFb(m),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:_,code:m,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const y=this._csiHandlers[this._collect<<8|m];let D=y?y.length-1:-1;for(;D>=0&&(h=y[D](this._params),h!==!0);D--)if(h instanceof Promise)return this._preserveStack(3,y,D,S,_),h;D<0&&this._csiHandlerFb(this._collect<<8|m,this._params),this.precedingJoinState=0;break;case 8:do switch(m){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(m-48)}while(++_<t&&(m=i[_])>47&&m<60);_--;break;case 9:this._collect<<=8,this._collect|=m;break;case 10:const T=this._escHandlers[this._collect<<8|m];let O=T?T.length-1:-1;for(;O>=0&&(h=T[O](),h!==!0);O--)if(h instanceof Promise)return this._preserveStack(4,T,O,S,_),h;O<0&&this._escHandlerFb(this._collect<<8|m),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|m,this._params);break;case 13:for(let A=_+1;;++A)if(A>=t||(m=i[A])===24||m===26||m===27||m>127&&m<g){this._dcsParser.put(i,_,A),_=A-1;break}break;case 14:if(h=this._dcsParser.unhook(m!==24&&m!==26),h)return this._preserveStack(6,[],0,S,_),h;m===27&&(S|=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 A=_+1;;A++)if(A>=t||(m=i[A])<32||m>127&&m<g){this._oscParser.put(i,_,A),_=A-1;break}break;case 6:if(h=this._oscParser.end(m!==24&&m!==26),h)return this._preserveStack(5,[],0,S,_),h;m===27&&(S|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&S}}}n.EscapeSequenceParser=u},6242:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OscHandler=n.OscParser=void 0;const c=o(5770),f=o(482),a=[];n.OscParser=class{constructor(){this._state=0,this._active=a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(d,p){this._handlers[d]===void 0&&(this._handlers[d]=[]);const g=this._handlers[d];return g.push(p),{dispose:()=>{const u=g.indexOf(p);u!==-1&&g.splice(u,1)}}}clearHandler(d){this._handlers[d]&&delete this._handlers[d]}setHandlerFallback(d){this._handlerFb=d}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}reset(){if(this._state===2)for(let d=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;d>=0;--d)this._active[d].end(!1);this._stack.paused=!1,this._active=a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||a,this._active.length)for(let d=this._active.length-1;d>=0;d--)this._active[d].start();else this._handlerFb(this._id,"START")}_put(d,p,g){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(d,p,g);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(d,p,g))}start(){this.reset(),this._state=1}put(d,p,g){if(this._state!==3){if(this._state===1)for(;p<g;){const u=d[p++];if(u===59){this._state=2,this._start();break}if(u<48||57<u)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+u-48}this._state===2&&g-p>0&&this._put(d,p,g)}}end(d,p=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let g=!1,u=this._active.length-1,e=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,g=p,e=this._stack.fallThrough,this._stack.paused=!1),!e&&g===!1){for(;u>=0&&(g=this._active[u].end(d),g!==!0);u--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,g;u--}for(;u>=0;u--)if(g=this._active[u].end(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,g}else this._handlerFb(this._id,"END",d);this._active=a,this._id=-1,this._state=0}}},n.OscHandler=class{constructor(d){this._handler=d,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(d,p,g){this._hitLimit||(this._data+=(0,f.utf32ToString)(d,p,g),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(d){let p=!1;if(this._hitLimit)p=!1;else if(d&&(p=this._handler(this._data),p instanceof Promise))return p.then((g=>(this._data="",this._hitLimit=!1,g)));return this._data="",this._hitLimit=!1,p}}},8742:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Params=void 0;const o=2147483647;class c{static fromArray(a){const d=new c;if(!a.length)return d;for(let p=Array.isArray(a[0])?1:0;p<a.length;++p){const g=a[p];if(Array.isArray(g))for(let u=0;u<g.length;++u)d.addSubParam(g[u]);else d.addParam(g)}return d}constructor(a=32,d=32){if(this.maxLength=a,this.maxSubParamsLength=d,d>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(a),this.length=0,this._subParams=new Int32Array(d),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(a),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const a=new c(this.maxLength,this.maxSubParamsLength);return a.params.set(this.params),a.length=this.length,a._subParams.set(this._subParams),a._subParamsLength=this._subParamsLength,a._subParamsIdx.set(this._subParamsIdx),a._rejectDigits=this._rejectDigits,a._rejectSubDigits=this._rejectSubDigits,a._digitIsSub=this._digitIsSub,a}toArray(){const a=[];for(let d=0;d<this.length;++d){a.push(this.params[d]);const p=this._subParamsIdx[d]>>8,g=255&this._subParamsIdx[d];g-p>0&&a.push(Array.prototype.slice.call(this._subParams,p,g))}return a}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(a){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(a<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=a>o?o:a}}addSubParam(a){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(a<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=a>o?o:a,this._subParamsIdx[this.length-1]++}}hasSubParams(a){return(255&this._subParamsIdx[a])-(this._subParamsIdx[a]>>8)>0}getSubParams(a){const d=this._subParamsIdx[a]>>8,p=255&this._subParamsIdx[a];return p-d>0?this._subParams.subarray(d,p):null}getSubParamsAll(){const a={};for(let d=0;d<this.length;++d){const p=this._subParamsIdx[d]>>8,g=255&this._subParamsIdx[d];g-p>0&&(a[d]=this._subParams.slice(p,g))}return a}addDigit(a){let d;if(this._rejectDigits||!(d=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const p=this._digitIsSub?this._subParams:this.params,g=p[d-1];p[d-1]=~g?Math.min(10*g+a,o):a}}n.Params=c},5741:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.AddonManager=void 0,n.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let o=this._addons.length-1;o>=0;o--)this._addons[o].instance.dispose()}loadAddon(o,c){const f={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(f),c.dispose=()=>this._wrappedAddonDispose(f),c.activate(o)}_wrappedAddonDispose(o){if(o.isDisposed)return;let c=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===o){c=f;break}if(c===-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(c,1)}}},8771:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferApiView=void 0;const c=o(3785),f=o(511);n.BufferApiView=class{constructor(a,d){this._buffer=a,this.type=d}init(a){return this._buffer=a,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(a){const d=this._buffer.lines.get(a);if(d)return new c.BufferLineApiView(d)}getNullCell(){return new f.CellData}}},3785:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLineApiView=void 0;const c=o(511);n.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,a){if(!(f<0||f>=this._line.length))return a?(this._line.loadCell(f,a),a):this._line.loadCell(f,new c.CellData)}translateToString(f,a,d){return this._line.translateToString(f,a,d)}}},8285:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferNamespaceApi=void 0;const c=o(8771),f=o(8460),a=o(844);class d extends a.Disposable{constructor(g){super(),this._core=g,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new c.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new c.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}n.BufferNamespaceApi=d},7975:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ParserApi=void 0,n.ParserApi=class{constructor(o){this._core=o}registerCsiHandler(o,c){return this._core.registerCsiHandler(o,(f=>c(f.toArray())))}addCsiHandler(o,c){return this.registerCsiHandler(o,c)}registerDcsHandler(o,c){return this._core.registerDcsHandler(o,((f,a)=>c(f,a.toArray())))}addDcsHandler(o,c){return this.registerDcsHandler(o,c)}registerEscHandler(o,c){return this._core.registerEscHandler(o,c)}addEscHandler(o,c){return this.registerEscHandler(o,c)}registerOscHandler(o,c){return this._core.registerOscHandler(o,c)}addOscHandler(o,c){return this.registerOscHandler(o,c)}}},7090:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeApi=void 0,n.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(x,n,o){var c=this&&this.__decorate||function(e,i,t,s){var h,m=arguments.length,S=m<3?i:s===null?s=Object.getOwnPropertyDescriptor(i,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(e,i,t,s);else for(var b=e.length-1;b>=0;b--)(h=e[b])&&(S=(m<3?h(S):m>3?h(i,t,S):h(i,t))||S);return m>3&&S&&Object.defineProperty(i,t,S),S},f=this&&this.__param||function(e,i){return function(t,s){i(t,s,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.BufferService=n.MINIMUM_ROWS=n.MINIMUM_COLS=void 0;const a=o(8460),d=o(844),p=o(5295),g=o(2585);n.MINIMUM_COLS=2,n.MINIMUM_ROWS=1;let u=n.BufferService=class extends d.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new a.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,n.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,n.MINIMUM_ROWS),this.buffers=this.register(new p.BufferSet(e,this))}resize(e,i){this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){const t=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=t.getBlankLine(e,i),this._cachedBlankLine=s),s.isWrapped=i;const h=t.ybase+t.scrollTop,m=t.ybase+t.scrollBottom;if(t.scrollTop===0){const S=t.lines.isFull;m===t.lines.length-1?S?t.lines.recycle().copyFrom(s):t.lines.push(s.clone()):t.lines.splice(m+1,0,s.clone()),S?this.isUserScrolling&&(t.ydisp=Math.max(t.ydisp-1,0)):(t.ybase++,this.isUserScrolling||t.ydisp++)}else{const S=m-h+1;t.lines.shiftElements(h+1,S-1,-1),t.lines.set(m,s.clone())}this.isUserScrolling||(t.ydisp=t.ybase),this._onScroll.fire(t.ydisp)}scrollLines(e,i,t){const s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const h=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),h!==s.ydisp&&(i||this._onScroll.fire(s.ydisp))}};n.BufferService=u=c([f(0,g.IOptionsService)],u)},7994:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CharsetService=void 0,n.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(o){this.glevel=o,this.charset=this._charsets[o]}setgCharset(o,c){this._charsets[o]=c,this.glevel===o&&(this.charset=c)}}},1753:function(x,n,o){var c=this&&this.__decorate||function(s,h,m,S){var b,_=arguments.length,y=_<3?h:S===null?S=Object.getOwnPropertyDescriptor(h,m):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(s,h,m,S);else for(var D=s.length-1;D>=0;D--)(b=s[D])&&(y=(_<3?b(y):_>3?b(h,m,y):b(h,m))||y);return _>3&&y&&Object.defineProperty(h,m,y),y},f=this&&this.__param||function(s,h){return function(m,S){h(m,S,s)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreMouseService=void 0;const a=o(2585),d=o(8460),p=o(844),g={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 u(s,h){let m=(s.ctrl?16:0)|(s.shift?4:0)|(s.alt?8:0);return s.button===4?(m|=64,m|=s.action):(m|=3&s.button,4&s.button&&(m|=64),8&s.button&&(m|=128),s.action===32?m|=32:s.action!==0||h||(m|=3)),m}const e=String.fromCharCode,i={DEFAULT:s=>{const h=[u(s,!1)+32,s.col+32,s.row+32];return h[0]>255||h[1]>255||h[2]>255?"":`\x1B[M${e(h[0])}${e(h[1])}${e(h[2])}`},SGR:s=>{const h=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${u(s,!0)};${s.col};${s.row}${h}`},SGR_PIXELS:s=>{const h=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${u(s,!0)};${s.x};${s.y}${h}`}};let t=n.CoreMouseService=class extends p.Disposable{constructor(s,h){super(),this._bufferService=s,this._coreService=h,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new d.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const m of Object.keys(g))this.addProtocol(m,g[m]);for(const m of Object.keys(i))this.addEncoding(m,i[m]);this.reset()}addProtocol(s,h){this._protocols[s]=h}addEncoding(s,h){this._encodings[s]=h}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 h=this._encodings[this._activeEncoding](s);return h&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(h):this._coreService.triggerDataEvent(h,!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,h,m){if(m){if(s.x!==h.x||s.y!==h.y)return!1}else if(s.col!==h.col||s.row!==h.row)return!1;return s.button===h.button&&s.action===h.action&&s.ctrl===h.ctrl&&s.alt===h.alt&&s.shift===h.shift}};n.CoreMouseService=t=c([f(0,a.IBufferService),f(1,a.ICoreService)],t)},6975:function(x,n,o){var c=this&&this.__decorate||function(t,s,h,m){var S,b=arguments.length,_=b<3?s:m===null?m=Object.getOwnPropertyDescriptor(s,h):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(t,s,h,m);else for(var y=t.length-1;y>=0;y--)(S=t[y])&&(_=(b<3?S(_):b>3?S(s,h,_):S(s,h))||_);return b>3&&_&&Object.defineProperty(s,h,_),_},f=this&&this.__param||function(t,s){return function(h,m){s(h,m,t)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreService=void 0;const a=o(1439),d=o(8460),p=o(844),g=o(2585),u=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let i=n.CoreService=class extends p.Disposable{constructor(t,s,h){super(),this._bufferService=t,this._logService=s,this._optionsService=h,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new d.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new d.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new d.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new d.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,a.clone)(u),this.decPrivateModes=(0,a.clone)(e)}reset(){this.modes=(0,a.clone)(u),this.decPrivateModes=(0,a.clone)(e)}triggerDataEvent(t,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const h=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&h.ybase!==h.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`,(()=>t.split("").map((m=>m.charCodeAt(0))))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`,(()=>t.split("").map((s=>s.charCodeAt(0))))),this._onBinary.fire(t))}};n.CoreService=i=c([f(0,g.IBufferService),f(1,g.ILogService),f(2,g.IOptionsService)],i)},9074:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DecorationService=void 0;const c=o(8055),f=o(8460),a=o(844),d=o(6106);let p=0,g=0;class u extends a.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new d.SortedList((t=>t==null?void 0:t.marker.line)),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,a.toDisposable)((()=>this.reset())))}registerDecoration(t){if(t.marker.isDisposed)return;const s=new e(t);if(s){const h=s.marker.onDispose((()=>s.dispose()));s.onDispose((()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),h.dispose())})),this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(const t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,s,h){let m=0,S=0;for(const b of this._decorations.getKeyIterator(s))m=b.options.x??0,S=m+(b.options.width??1),t>=m&&t<S&&(!h||(b.options.layer??"bottom")===h)&&(yield b)}forEachDecorationAtCell(t,s,h,m){this._decorations.forEachByKey(s,(S=>{p=S.options.x??0,g=p+(S.options.width??1),t>=p&&t<g&&(!h||(S.options.layer??"bottom")===h)&&m(S)}))}}n.DecorationService=u;class e extends a.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=c.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=c.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(t){super(),this.options=t,this.onRenderEmitter=this.register(new f.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.InstantiationService=n.ServiceCollection=void 0;const c=o(2585),f=o(8343);class a{constructor(...p){this._entries=new Map;for(const[g,u]of p)this.set(g,u)}set(p,g){const u=this._entries.get(p);return this._entries.set(p,g),u}forEach(p){for(const[g,u]of this._entries.entries())p(g,u)}has(p){return this._entries.has(p)}get(p){return this._entries.get(p)}}n.ServiceCollection=a,n.InstantiationService=class{constructor(){this._services=new a,this._services.set(c.IInstantiationService,this)}setService(d,p){this._services.set(d,p)}getService(d){return this._services.get(d)}createInstance(d,...p){const g=(0,f.getServiceDependencies)(d).sort(((i,t)=>i.index-t.index)),u=[];for(const i of g){const t=this._services.get(i.id);if(!t)throw new Error(`[createInstance] ${d.name} depends on UNKNOWN service ${i.id}.`);u.push(t)}const e=g.length>0?g[0].index:p.length;if(p.length!==e)throw new Error(`[createInstance] First service dependency of ${d.name} at position ${e+1} conflicts with ${p.length} static arguments`);return new d(...p,...u)}}},7866:function(x,n,o){var c=this&&this.__decorate||function(e,i,t,s){var h,m=arguments.length,S=m<3?i:s===null?s=Object.getOwnPropertyDescriptor(i,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(e,i,t,s);else for(var b=e.length-1;b>=0;b--)(h=e[b])&&(S=(m<3?h(S):m>3?h(i,t,S):h(i,t))||S);return m>3&&S&&Object.defineProperty(i,t,S),S},f=this&&this.__param||function(e,i){return function(t,s){i(t,s,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.traceCall=n.setTraceLogger=n.LogService=void 0;const a=o(844),d=o(2585),p={trace:d.LogLevelEnum.TRACE,debug:d.LogLevelEnum.DEBUG,info:d.LogLevelEnum.INFO,warn:d.LogLevelEnum.WARN,error:d.LogLevelEnum.ERROR,off:d.LogLevelEnum.OFF};let g,u=n.LogService=class extends a.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=d.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),g=this}_updateLogLevel(){this._logLevel=p[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,t){this._evalLazyOptionalParams(t),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...t)}trace(e,...i){var t;this._logLevel<=d.LogLevelEnum.TRACE&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.trace.bind(this._optionsService.options.logger))??console.log,e,i)}debug(e,...i){var t;this._logLevel<=d.LogLevelEnum.DEBUG&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.debug.bind(this._optionsService.options.logger))??console.log,e,i)}info(e,...i){var t;this._logLevel<=d.LogLevelEnum.INFO&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.info.bind(this._optionsService.options.logger))??console.info,e,i)}warn(e,...i){var t;this._logLevel<=d.LogLevelEnum.WARN&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.warn.bind(this._optionsService.options.logger))??console.warn,e,i)}error(e,...i){var t;this._logLevel<=d.LogLevelEnum.ERROR&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.error.bind(this._optionsService.options.logger))??console.error,e,i)}};n.LogService=u=c([f(0,d.IOptionsService)],u),n.setTraceLogger=function(e){g=e},n.traceCall=function(e,i,t){if(typeof t.value!="function")throw new Error("not supported");const s=t.value;t.value=function(...h){if(g.logLevel!==d.LogLevelEnum.TRACE)return s.apply(this,h);g.trace(`GlyphRenderer#${s.name}(${h.map((S=>JSON.stringify(S))).join(", ")})`);const m=s.apply(this,h);return g.trace(`GlyphRenderer#${s.name} return`,m),m}}},7302:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OptionsService=n.DEFAULT_OPTIONS=void 0;const c=o(8460),f=o(844),a=o(6114);n.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:a.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const d=["normal","bold","100","200","300","400","500","600","700","800","900"];class p extends f.Disposable{constructor(u){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;const e={...n.DEFAULT_OPTIONS};for(const i in u)if(i in e)try{const t=u[i];e[i]=this._sanitizeAndValidateOption(i,t)}catch(t){console.error(t)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(u,e){return this.onOptionChange((i=>{i===u&&e(this.rawOptions[u])}))}onMultipleOptionChange(u,e){return this.onOptionChange((i=>{u.indexOf(i)!==-1&&e()}))}_setupOptions(){const u=i=>{if(!(i in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},e=(i,t)=>{if(!(i in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${i}"`);t=this._sanitizeAndValidateOption(i,t),this.rawOptions[i]!==t&&(this.rawOptions[i]=t,this._onOptionChange.fire(i))};for(const i in this.rawOptions){const t={get:u.bind(this,i),set:e.bind(this,i)};Object.defineProperty(this.options,i,t)}}_sanitizeAndValidateOption(u,e){switch(u){case"cursorStyle":if(e||(e=n.DEFAULT_OPTIONS[u]),!(function(i){return i==="block"||i==="underline"||i==="bar"})(e))throw new Error(`"${e}" is not a valid value for ${u}`);break;case"wordSeparator":e||(e=n.DEFAULT_OPTIONS[u]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=d.includes(e)?e:n.DEFAULT_OPTIONS[u];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${u} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${u} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${u} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${u} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}n.OptionsService=p},2660:function(x,n,o){var c=this&&this.__decorate||function(p,g,u,e){var i,t=arguments.length,s=t<3?g:e===null?e=Object.getOwnPropertyDescriptor(g,u):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(p,g,u,e);else for(var h=p.length-1;h>=0;h--)(i=p[h])&&(s=(t<3?i(s):t>3?i(g,u,s):i(g,u))||s);return t>3&&s&&Object.defineProperty(g,u,s),s},f=this&&this.__param||function(p,g){return function(u,e){g(u,e,p)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkService=void 0;const a=o(2585);let d=n.OscLinkService=class{constructor(p){this._bufferService=p,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(p){const g=this._bufferService.buffer;if(p.id===void 0){const h=g.addMarker(g.ybase+g.y),m={data:p,id:this._nextId++,lines:[h]};return h.onDispose((()=>this._removeMarkerFromLink(m,h))),this._dataByLinkId.set(m.id,m),m.id}const u=p,e=this._getEntryIdKey(u),i=this._entriesWithId.get(e);if(i)return this.addLineToLink(i.id,g.ybase+g.y),i.id;const t=g.addMarker(g.ybase+g.y),s={id:this._nextId++,key:this._getEntryIdKey(u),data:u,lines:[t]};return t.onDispose((()=>this._removeMarkerFromLink(s,t))),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(p,g){const u=this._dataByLinkId.get(p);if(u&&u.lines.every((e=>e.line!==g))){const e=this._bufferService.buffer.addMarker(g);u.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(u,e)))}}getLinkData(p){var g;return(g=this._dataByLinkId.get(p))==null?void 0:g.data}_getEntryIdKey(p){return`${p.id};;${p.uri}`}_removeMarkerFromLink(p,g){const u=p.lines.indexOf(g);u!==-1&&(p.lines.splice(u,1),p.lines.length===0&&(p.data.id!==void 0&&this._entriesWithId.delete(p.key),this._dataByLinkId.delete(p.id)))}};n.OscLinkService=d=c([f(0,a.IBufferService)],d)},8343:(x,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createDecorator=n.getServiceDependencies=n.serviceRegistry=void 0;const o="di$target",c="di$dependencies";n.serviceRegistry=new Map,n.getServiceDependencies=function(f){return f[c]||[]},n.createDecorator=function(f){if(n.serviceRegistry.has(f))return n.serviceRegistry.get(f);const a=function(d,p,g){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(u,e,i){e[o]===e?e[c].push({id:u,index:i}):(e[c]=[{id:u,index:i}],e[o]=e)})(a,d,g)};return a.toString=()=>f,n.serviceRegistry.set(f,a),a}},2585:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.IDecorationService=n.IUnicodeService=n.IOscLinkService=n.IOptionsService=n.ILogService=n.LogLevelEnum=n.IInstantiationService=n.ICharsetService=n.ICoreService=n.ICoreMouseService=n.IBufferService=void 0;const c=o(8343);var f;n.IBufferService=(0,c.createDecorator)("BufferService"),n.ICoreMouseService=(0,c.createDecorator)("CoreMouseService"),n.ICoreService=(0,c.createDecorator)("CoreService"),n.ICharsetService=(0,c.createDecorator)("CharsetService"),n.IInstantiationService=(0,c.createDecorator)("InstantiationService"),(function(a){a[a.TRACE=0]="TRACE",a[a.DEBUG=1]="DEBUG",a[a.INFO=2]="INFO",a[a.WARN=3]="WARN",a[a.ERROR=4]="ERROR",a[a.OFF=5]="OFF"})(f||(n.LogLevelEnum=f={})),n.ILogService=(0,c.createDecorator)("LogService"),n.IOptionsService=(0,c.createDecorator)("OptionsService"),n.IOscLinkService=(0,c.createDecorator)("OscLinkService"),n.IUnicodeService=(0,c.createDecorator)("UnicodeService"),n.IDecorationService=(0,c.createDecorator)("DecorationService")},1480:(x,n,o)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeService=void 0;const c=o(8460),f=o(225);class a{static extractShouldJoin(p){return(1&p)!=0}static extractWidth(p){return p>>1&3}static extractCharKind(p){return p>>3}static createPropertyValue(p,g,u=!1){return(16777215&p)<<3|(3&g)<<1|(u?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;const p=new f.UnicodeV6;this.register(p),this._active=p.version,this._activeProvider=p}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(p){if(!this._providers[p])throw new Error(`unknown Unicode version "${p}"`);this._active=p,this._activeProvider=this._providers[p],this._onChange.fire(p)}register(p){this._providers[p.version]=p}wcwidth(p){return this._activeProvider.wcwidth(p)}getStringCellWidth(p){let g=0,u=0;const e=p.length;for(let i=0;i<e;++i){let t=p.charCodeAt(i);if(55296<=t&&t<=56319){if(++i>=e)return g+this.wcwidth(t);const m=p.charCodeAt(i);56320<=m&&m<=57343?t=1024*(t-55296)+m-56320+65536:g+=this.wcwidth(m)}const s=this.charProperties(t,u);let h=a.extractWidth(s);a.extractShouldJoin(s)&&(h-=a.extractWidth(u)),g+=h,u=s}return g}charProperties(p,g){return this._activeProvider.charProperties(p,g)}}n.UnicodeService=a}},C={};function w(x){var n=C[x];if(n!==void 0)return n.exports;var o=C[x]={exports:{}};return v[x].call(o.exports,o,o.exports,w),o.exports}var k={};return(()=>{var x=k;Object.defineProperty(x,"__esModule",{value:!0}),x.Terminal=void 0;const n=w(9042),o=w(3236),c=w(844),f=w(5741),a=w(8285),d=w(7975),p=w(7090),g=["cols","rows"];class u extends c.Disposable{constructor(i){super(),this._core=this.register(new o.Terminal(i)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};const t=h=>this._core.options[h],s=(h,m)=>{this._checkReadonlyOptions(h),this._core.options[h]=m};for(const h in this._core.options){const m={get:t.bind(this,h),set:s.bind(this,h)};Object.defineProperty(this._publicOptions,h,m)}}_checkReadonlyOptions(i){if(g.includes(i))throw new Error(`Option "${i}" 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 d.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new p.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new a.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const i=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:i.applicationCursorKeys,applicationKeypadMode:i.applicationKeypad,bracketedPasteMode:i.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:i.origin,reverseWraparoundMode:i.reverseWraparound,sendFocusMode:i.sendFocus,wraparoundMode:i.wraparound}}get options(){return this._publicOptions}set options(i){for(const t in i)this._publicOptions[t]=i[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(i,t=!0){this._core.input(i,t)}resize(i,t){this._verifyIntegers(i,t),this._core.resize(i,t)}open(i){this._core.open(i)}attachCustomKeyEventHandler(i){this._core.attachCustomKeyEventHandler(i)}attachCustomWheelEventHandler(i){this._core.attachCustomWheelEventHandler(i)}registerLinkProvider(i){return this._core.registerLinkProvider(i)}registerCharacterJoiner(i){return this._checkProposedApi(),this._core.registerCharacterJoiner(i)}deregisterCharacterJoiner(i){this._checkProposedApi(),this._core.deregisterCharacterJoiner(i)}registerMarker(i=0){return this._verifyIntegers(i),this._core.registerMarker(i)}registerDecoration(i){return this._checkProposedApi(),this._verifyPositiveIntegers(i.x??0,i.width??0,i.height??0),this._core.registerDecoration(i)}hasSelection(){return this._core.hasSelection()}select(i,t,s){this._verifyIntegers(i,t,s),this._core.select(i,t,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(i,t){this._verifyIntegers(i,t),this._core.selectLines(i,t)}dispose(){super.dispose()}scrollLines(i){this._verifyIntegers(i),this._core.scrollLines(i)}scrollPages(i){this._verifyIntegers(i),this._core.scrollPages(i)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(i){this._verifyIntegers(i),this._core.scrollToLine(i)}clear(){this._core.clear()}write(i,t){this._core.write(i,t)}writeln(i,t){this._core.write(i),this._core.write(`\r
10
- `,t)}paste(i){this._core.paste(i)}refresh(i,t){this._verifyIntegers(i,t),this._core.refresh(i,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(i){this._addonManager.loadAddon(this,i)}static get strings(){return n}_verifyIntegers(...i){for(const t of i)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...i){for(const t of i)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw new Error("This API only accepts positive integers")}}x.Terminal=u})(),k})()))})(xi)),xi.exports}var _l=fl(),ki={exports:{}},Ls;function vl(){return Ls||(Ls=1,(function(r,l){(function(v,C){r.exports=C()})(self,(()=>(()=>{var v={};return(()=>{var C=v;Object.defineProperty(C,"__esModule",{value:!0}),C.FitAddon=void 0,C.FitAddon=class{activate(w){this._terminal=w}dispose(){}fit(){const w=this.proposeDimensions();if(!w||!this._terminal||isNaN(w.cols)||isNaN(w.rows))return;const k=this._terminal._core;this._terminal.rows===w.rows&&this._terminal.cols===w.cols||(k._renderService.clear(),this._terminal.resize(w.cols,w.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const w=this._terminal._core,k=w._renderService.dimensions;if(k.css.cell.width===0||k.css.cell.height===0)return;const x=this._terminal.options.scrollback===0?0:w.viewport.scrollBarWidth,n=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(n.getPropertyValue("height")),c=Math.max(0,parseInt(n.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),a=o-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),d=c-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-x;return{cols:Math.max(2,Math.floor(d/k.css.cell.width)),rows:Math.max(1,Math.floor(a/k.css.cell.height))}}}})(),v})()))})(ki)),ki.exports}var pl=vl(),Li={exports:{}},Ds;function gl(){return Ds||(Ds=1,(function(r,l){(function(v,C){r.exports=C()})(self,(()=>(()=>{var v={6:(x,n)=>{function o(f){try{const a=new URL(f),d=a.password&&a.username?`${a.protocol}//${a.username}:${a.password}@${a.host}`:a.username?`${a.protocol}//${a.username}@${a.host}`:`${a.protocol}//${a.host}`;return f.toLocaleLowerCase().startsWith(d.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(n,"__esModule",{value:!0}),n.LinkComputer=n.WebLinkProvider=void 0,n.WebLinkProvider=class{constructor(f,a,d,p={}){this._terminal=f,this._regex=a,this._handler=d,this._options=p}provideLinks(f,a){const d=c.computeLink(f,this._regex,this._terminal,this._handler);a(this._addCallbacks(d))}_addCallbacks(f){return f.map((a=>(a.leave=this._options.leave,a.hover=(d,p)=>{if(this._options.hover){const{range:g}=a;this._options.hover(d,p,g)}},a)))}};class c{static computeLink(a,d,p,g){const u=new RegExp(d.source,(d.flags||"")+"g"),[e,i]=c._getWindowedLineStrings(a-1,p),t=e.join("");let s;const h=[];for(;s=u.exec(t);){const m=s[0];if(!o(m))continue;const[S,b]=c._mapStrIdx(p,i,0,s.index),[_,y]=c._mapStrIdx(p,S,b,m.length);if(S===-1||b===-1||_===-1||y===-1)continue;const D={start:{x:b+1,y:S+1},end:{x:y,y:_+1}};h.push({range:D,text:m,activate:g})}return h}static _getWindowedLineStrings(a,d){let p,g=a,u=a,e=0,i="";const t=[];if(p=d.buffer.active.getLine(a)){const s=p.translateToString(!0);if(p.isWrapped&&s[0]!==" "){for(e=0;(p=d.buffer.active.getLine(--g))&&e<2048&&(i=p.translateToString(!0),e+=i.length,t.push(i),p.isWrapped&&i.indexOf(" ")===-1););t.reverse()}for(t.push(s),e=0;(p=d.buffer.active.getLine(++u))&&p.isWrapped&&e<2048&&(i=p.translateToString(!0),e+=i.length,t.push(i),i.indexOf(" ")===-1););}return[t,g]}static _mapStrIdx(a,d,p,g){const u=a.buffer.active,e=u.getNullCell();let i=p;for(;g;){const t=u.getLine(d);if(!t)return[-1,-1];for(let s=i;s<t.length;++s){t.getCell(s,e);const h=e.getChars();if(e.getWidth()&&(g-=h.length||1,s===t.length-1&&h==="")){const m=u.getLine(d+1);m&&m.isWrapped&&(m.getCell(0,e),e.getWidth()===2&&(g+=1))}if(g<0)return[d,s]}d++,i=0}return[d,i]}}n.LinkComputer=c}},C={};function w(x){var n=C[x];if(n!==void 0)return n.exports;var o=C[x]={exports:{}};return v[x](o,o.exports,w),o.exports}var k={};return(()=>{var x=k;Object.defineProperty(x,"__esModule",{value:!0}),x.WebLinksAddon=void 0;const n=w(6),o=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function c(f,a){const d=window.open();if(d){try{d.opener=null}catch{}d.location.href=a}else console.warn("Opening link blocked as opener could not be cleared")}x.WebLinksAddon=class{constructor(f=c,a={}){this._handler=f,this._options=a}activate(f){this._terminal=f;const a=this._options,d=a.urlRegex||o;this._linkProvider=this._terminal.registerLinkProvider(new n.WebLinkProvider(this._terminal,d,this._handler,a))}dispose(){var f;(f=this._linkProvider)==null||f.dispose()}}})(),k})()))})(Li)),Li.exports}var ml=gl(),Sl=ie('<div class="flex-1 min-h-0 w-full p-1 overflow-hidden"></div>');function bl(r,l){He(l,!0);let v=Pe(l,"isMobile",3,!1),C,w,k,x,n;function o(p){var u;if((u=navigator.clipboard)!=null&&u.writeText){navigator.clipboard.writeText(p).catch(()=>{});return}const g=document.createElement("textarea");g.value=p,g.style.position="fixed",g.style.opacity="0",document.body.appendChild(g),g.select(),document.execCommand("copy"),document.body.removeChild(g)}function c(p){(x==null?void 0:x.readyState)===WebSocket.OPEN&&x.send(JSON.stringify({type:"selectPane",pane:p}))}function f(p){(x==null?void 0:x.readyState)===WebSocket.OPEN&&x.send(JSON.stringify({type:"input",data:p}))}os(()=>{w=new _l.Terminal({cursorBlink:!0,theme:{background:"#0d1117",foreground:"#e6edf3",cursor:"#58a6ff",selectionBackground:"#264f78"},fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo, monospace",fontSize:v()?13:11,scrollback:1e4}),k=new pl.FitAddon,w.loadAddon(k),w.loadAddon(new ml.WebLinksAddon),w.open(C),C.addEventListener("contextmenu",g=>g.preventDefault()),w.parser.registerOscHandler(52,g=>{const u=g.indexOf(";");if(u!==-1){const e=g.slice(u+1);try{o(atob(e))}catch{}}return!0}),w.onSelectionChange(()=>{const g=w.getSelection();g&&o(g)}),w.attachCustomKeyEventHandler(g=>{if(g.type!=="keydown")return!0;const u=g.metaKey||g.ctrlKey;return u&&(g.key==="c"||g.key==="C")?w.hasSelection()?(o(w.getSelection()),w.clearSelection(),!1):!0:!(u&&(g.key==="ArrowUp"||g.key==="ArrowDown")||u&&(g.key==="k"||g.key==="K")||u&&(g.key==="m"||g.key==="M")||u&&(g.key==="d"||g.key==="D"))}),requestAnimationFrame(()=>{k.fit(),w.focus()});const p=location.protocol==="https:"?"wss:":"ws:";x=new WebSocket(`${p}//${location.host}/ws/${encodeURIComponent(l.worktree)}`),x.onmessage=g=>{try{const u=JSON.parse(g.data);switch(u.type){case"scrollback":case"output":w.write(u.data);break;case"exit":w.writeln(`\r
11
- \x1B[33m[Process exited with code ${u.exitCode}]\x1B[0m`);break;case"error":w.writeln(`\r
12
- \x1B[31m[Error: ${u.message}]\x1B[0m`);break}}catch{}},x.onopen=()=>{k.fit();const g={type:"resize",cols:w.cols,rows:w.rows};v()&&l.initialPane!==void 0&&(g.initialPane=l.initialPane),x.send(JSON.stringify(g))},x.onclose=()=>{w.writeln(`\r
13
- \x1B[90m[Disconnected]\x1B[0m`)},w.onData(g=>{x.readyState===WebSocket.OPEN&&x.send(JSON.stringify({type:"input",data:g}))}),n=new ResizeObserver(()=>{k.fit(),x.readyState===WebSocket.OPEN&&x.send(JSON.stringify({type:"resize",cols:w.cols,rows:w.rows}))}),n.observe(C)}),ma(()=>{n==null||n.disconnect(),x==null||x.close(),w==null||w.dispose()});var a={sendSelectPane:c,sendInput:f},d=Sl();return gi(d,p=>C=p,()=>C),J(r,d),Fe(a)}var Cl=ie("<dialog><!></dialog>");function Jr(r,l){He(l,!0);let v=Pe(l,"wide",3,!1),C;Mr(()=>{C==null||C.showModal()});var w=Cl(),k=Q(w);ns(k,()=>l.children),gi(w,x=>C=x,()=>C),le(()=>Ae(w,1,`bg-sidebar text-primary border border-edge rounded-xl p-6 w-[90%] ${v()?"max-w-[560px]":"max-w-[380px]"}`)),_i("close",w,function(...x){var n;(n=l.onclose)==null||n.apply(this,x)}),J(r,w),Fe()}var wl=ie('<p class="text-[12px] text-danger mb-4 -mt-2 whitespace-pre-wrap"> </p>'),yl=ie('<span class="spinner"></span>'),El=ie("<!> ",1),xl=ie('<form><h2 class="text-base mb-4">Confirm</h2> <p class="text-[13px] text-muted mb-6"> </p> <!> <div class="flex justify-end gap-2"><!> <!></div></form>');function Rs(r,l){He(l,!0);let v=Pe(l,"loading",3,!1),C=Pe(l,"error",3,""),w=Pe(l,"confirmLabel",3,"Remove"),k=Pe(l,"variant",3,"danger");Jr(r,{get onclose(){return l.oncancel},children:(x,n)=>{var o=xl(),c=Z(Q(o),2),f=Q(c),a=Z(c,2);{var d=e=>{var i=wl(),t=Q(i);le(()=>_e(t,C())),J(e,i)};de(a,e=>{C()&&e(d)})}var p=Z(a,2),g=Q(p);st(g,{type:"button",get onclick(){return l.oncancel},get disabled(){return v()},children:(e,i)=>{var t=Je("Cancel");J(e,t)},$$slots:{default:!0}});var u=Z(g,2);{let e=Ce(()=>k()==="accent"?"cta":"danger");st(u,{type:"submit",get variant(){return B(e)},class:"flex items-center gap-1.5",get disabled(){return v()},autofocus:!0,children:(i,t)=>{var s=El(),h=Ie(s);{var m=b=>{var _=yl();J(b,_)};de(h,b=>{v()&&b(m)})}var S=Z(h);le(()=>_e(S,` ${w()??""}`)),J(i,s)},$$slots:{default:!0}})}le(()=>_e(f,l.message)),_i("submit",o,e=>{e.preventDefault(),l.onconfirm()}),J(x,o)},$$slots:{default:!0}}),Fe()}var kl=ie('<label><input type="radio" name="agent" class="accent-[var(--accent)]"/> </label>'),Ll=ie('<label><input type="radio" name="profile" class="accent-[var(--accent)]"/> </label>'),Dl=ie('<div class="flex flex-col gap-2 mb-6"></div>'),Rl=ie('<span class="spinner"></span>'),Al=ie("<!> Create",1),Bl=ie('<form><h2 class="text-base mb-4">New Worktree</h2> <div class="mb-4"><label class="block text-xs text-muted mb-1.5" for="wt-prompt">Prompt <span class="opacity-60">(optional)</span></label> <textarea id="wt-prompt" rows="3" class="w-full px-2.5 py-1.5 rounded-md border border-edge bg-surface text-primary text-[13px] placeholder:text-muted/50 outline-none focus:border-accent resize-y" placeholder="Describe the task for the agent..."></textarea></div> <div class="mb-4"><label class="block text-xs text-muted mb-1.5" for="wt-name">Name <span class="opacity-60">(optional)</span></label> <input id="wt-name" type="text" class="w-full px-2.5 py-1.5 rounded-md border border-edge bg-surface text-primary text-[13px] placeholder:text-muted/50 outline-none focus:border-accent" placeholder="auto-generated if empty"/></div> <div class="flex gap-2 mb-4"></div> <!> <label class="flex items-center gap-2 mb-4 text-[13px] text-muted cursor-pointer"><input type="checkbox" class="accent-[var(--accent)]"/> Save as default</label> <div class="flex justify-end gap-2"><!> <!></div></form>');function Tl(r,l){He(l,!0);let v=Pe(l,"loading",3,!1),C=Pe(l,"profiles",19,()=>[]);const w=[{value:"claude",label:"Claude"},{value:"codex",label:"Codex"}],k="wt-default-profile",x="wt-default-agent",n=localStorage.getItem(k),o=localStorage.getItem(x);let c=Ce(()=>{var e;return n??((e=C()[0])==null?void 0:e.name)??"Full"}),f=oe(""),a=oe(""),d=oe(ze(o??"claude")),p=oe(ze(n??"Full")),g=oe(!1);function u(e){e.focus()}Mr(()=>{C().some(e=>e.name===B(p))||G(p,B(c),!0)}),Jr(r,{get onclose(){return l.oncancel},children:(e,i)=>{var t=Bl(),s=Z(Q(t),2),h=Z(Q(s),2);Ea(h,H=>u==null?void 0:u(H)),Vr(()=>Ki(h,()=>B(a),H=>G(a,H)));var m=Z(s,2),S=Z(Q(m),2),b=Z(m,2);Ct(b,21,()=>w,jr,(H,U)=>{var V=kl(),$=Q(V),E=Z($);le(()=>{Ae(V,1,`flex-1 flex items-center justify-center gap-2 p-2.5 rounded-lg border cursor-pointer text-[13px] transition-colors
14
- ${B(d)===B(U).value?"border-accent bg-accent/10":"border-edge hover:bg-hover"}`),ys($,B(U).value),zi($,B(d)===B(U).value),_e(E,` ${B(U).label??""}`)}),Me("change",$,()=>G(d,B(U).value,!0)),J(H,V)});var _=Z(b,2);{var y=H=>{var U=Dl();Ct(U,21,C,jr,(V,$)=>{var E=Ll(),R=Q(E),M=Z(R);le(()=>{Ae(E,1,`flex items-center gap-2.5 p-2.5 rounded-lg border cursor-pointer text-[13px] transition-colors
15
- ${B(p)===B($).name?"border-accent bg-accent/10":"border-edge hover:bg-hover"}`),ys(R,B($).name),zi(R,B(p)===B($).name),_e(M,` ${B($).name??""}`)}),Me("change",R,()=>G(p,B($).name,!0)),J(V,E)}),J(H,U)};de(_,H=>{C().length>1&&H(y)})}var D=Z(_,2),T=Q(D),O=Z(D,2),A=Q(O);st(A,{type:"button",get onclick(){return l.oncancel},get disabled(){return v()},children:(H,U)=>{var V=Je("Cancel");J(H,V)},$$slots:{default:!0}});var W=Z(A,2);st(W,{type:"submit",variant:"cta",class:"flex items-center gap-1.5",get disabled(){return v()},children:(H,U)=>{var V=Al(),$=Ie(V);{var E=R=>{var M=Rl();J(R,M)};de($,R=>{v()&&R(E)})}J(H,V)},$$slots:{default:!0}}),_i("submit",t,H=>{H.preventDefault(),B(g)?(localStorage.setItem(k,B(p)),localStorage.setItem(x,B(d))):(localStorage.removeItem(k),localStorage.removeItem(x)),l.oncreate(B(f).trim(),B(p),B(d),B(a).trim())}),Me("keydown",h,H=>{var U;H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),(U=H.currentTarget.form)==null||U.requestSubmit())}),Ki(S,()=>B(f),H=>G(f,H)),Ia(T,()=>B(g),H=>G(g,H)),J(e,t)},$$slots:{default:!0}}),Fe()}Tt(["keydown","change"]);var Ml=ie('<form><h2 class="text-base mb-4">Settings</h2> <div class="mb-4"><label class="block text-xs text-muted mb-1.5" for="ssh-host">SSH Host <span class="opacity-60">(for "Open in Cursor")</span></label> <input id="ssh-host" type="text" class="w-full px-2.5 py-1.5 rounded-md border border-edge bg-surface text-primary text-[13px] placeholder:text-muted/50 outline-none focus:border-accent" placeholder="e.g. devbox or 10.0.0.5"/> <p class="text-[11px] text-muted mt-1.5">Must match an entry in your local <code class="text-accent/80">~/.ssh/config</code>. Leave empty for local mode.</p></div> <div class="flex justify-end gap-2"><!> <!></div></form>');function Ol(r,l){He(l,!0);let v=oe(ze(localStorage.getItem(ii)??"")),C;Mr(()=>{C==null||C.focus()});function w(){const k=B(v).trim();k?localStorage.setItem(ii,k):localStorage.removeItem(ii),l.onsave(k)}Jr(r,{get onclose(){return l.onclose},children:(k,x)=>{var n=Ml(),o=Z(Q(n),2),c=Z(Q(o),2);gi(c,p=>C=p,()=>C);var f=Z(o,2),a=Q(f);st(a,{type:"button",get onclick(){return l.onclose},children:(p,g)=>{var u=Je("Cancel");J(p,u)},$$slots:{default:!0}});var d=Z(a,2);st(d,{type:"submit",variant:"cta",children:(p,g)=>{var u=Je("Save");J(p,u)},$$slots:{default:!0}}),_i("submit",n,p=>{p.preventDefault(),w()}),Ki(c,()=>B(v),p=>G(v,p)),J(k,n)},$$slots:{default:!0}}),Fe()}async function Jt(r,l){const v=await fetch(`/api/${r}`,{headers:{"Content-Type":"application/json"},...l}),C=await v.json();if(!v.ok)throw new Error(C.error||`HTTP ${v.status}`);return C}function Pl(){return Jt("config")}function Il(){return Jt("worktrees")}function Hl(r,l,v,C){return Jt("worktrees",{method:"POST",body:JSON.stringify({...r?{branch:r}:{},profile:l,agent:v,...C?{prompt:C}:{}})})}function Fl(r){return Jt(`worktrees/${encodeURIComponent(r)}`,{method:"DELETE"})}function Wl(r){return Jt(`worktrees/${encodeURIComponent(r)}/open`,{method:"POST"})}function Nl(r){return Jt(`worktrees/${encodeURIComponent(r)}/merge`,{method:"POST"})}async function Ul(r){return(await Jt(`ci-logs/${r}`)).logs}async function On(r,l,v){await Jt(`worktrees/${encodeURIComponent(r)}/send`,{method:"POST",body:JSON.stringify({text:l,...v?{preamble:v}:{}})})}function $l(r){return r.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g,"").replace(/\x1B[@-_]/g,"")}function Pn(r,l=3e4){const C=$l(r).replace(/\r\n/g,`
16
- `).replace(/\r/g,`
17
- `).replace(/[^\x09\x0A\x20-\x7E]/g,"");return C.length>l?`[... truncated]
18
- `+C.slice(-l):C}var jl=ie("<button><!></button>");function qi(r,l){let v=Bn(l,["$$slots","$$events","$$legacy","children"]);var C=jl();Rn(C,()=>({type:"button",class:"text-[11px] text-accent cursor-pointer bg-transparent border-none p-0 hover:underline disabled:opacity-50 disabled:cursor-not-allowed",...v}));var w=Q(C);ns(w,()=>l.children),J(r,C)}var zl=ie('<a target="_blank" rel="noopener" class="text-[11px] text-muted hover:text-primary no-underline hover:underline">GitHub &nearr;</a>'),Kl=ie('<div class="text-[12px] text-muted py-2">Loading logs...</div>'),ql=ie('<div class="text-[12px] text-danger py-2"> </div>'),Vl=ie('<pre class="bg-surface border border-edge rounded-md p-3 text-[11px] font-mono overflow-x-auto max-h-[300px] overflow-y-auto whitespace-pre-wrap m-0"> </pre> <div class="flex justify-end items-center gap-2 mt-1.5"><!> <!></div>',1),Gl=ie('<div class="text-[12px] text-danger py-1.5"> </div>'),Xl=ie('<div class="mt-2"><!> <!></div>'),Jl=ie('<li class="rounded-md border border-edge bg-surface p-3"><div class="flex items-center gap-2"><span> </span> <span class="text-[13px] font-medium flex-1 truncate"> </span> <span> </span></div> <div class="flex items-center gap-2 mt-1.5"><!> <!></div> <!></li>'),Yl=ie('<h2 class="text-base mb-4"> </h2> <ul class="list-none p-0 m-0 flex flex-col gap-2 mb-4"></ul> <div class="flex justify-end"><!></div>',1);function Zl(r,l){He(l,!0);let v=oe(null),C=oe(""),w=oe(!1),k=oe(""),x=oe(!1),n=oe(null),o=oe(""),c=Ce(()=>as(l.pr));async function f(u){if(B(v)===u){G(v,null);return}G(v,u,!0),G(C,""),G(k,""),G(w,!0),G(x,!1),G(o,"");try{G(C,await Ul(u),!0)}catch(e){G(k,dr(e),!0)}finally{G(w,!1)}}async function a(u){if(!l.branch)return;G(o,""),G(n,B(v)??-1,!0);const e=["Fix the failing CI check.",`PR: ${B(c)}`,`Check: ${u}`,"","Logs:"].join(`
19
- `)+`
20
- `,i=Pn(B(C));try{await On(l.branch,i,e),l.onfixsuccess()}catch(t){G(o,dr(t),!0)}finally{G(n,null)}}async function d(){await navigator.clipboard.writeText(B(C)),G(x,!0),setTimeout(()=>{G(x,!1)},2e3)}function p(u){return u==="success"?"✓":u==="failed"?"✗":u==="skipped"?"—":"○"}function g(u){return u==="success"?"text-success":u==="failed"?"text-danger":u==="pending"?"text-warning":"text-muted"}Jr(r,{get onclose(){return l.onclose},wide:!0,children:(u,e)=>{var i=Yl(),t=Ie(i),s=Q(t),h=Z(t,2);Ct(h,21,()=>l.pr.ciChecks,b=>b.name+b.runId,(b,_)=>{var y=Jl(),D=Q(y),T=Q(D),O=Q(T),A=Z(T,2),W=Q(A),H=Z(A,2),U=Q(H),V=Z(D,2),$=Q(V);{var E=q=>{qi(q,{onclick:()=>f(B(_).runId),children:(ee,re)=>{var I=Je();le(()=>_e(I,B(v)===B(_).runId?"Hide logs":"View logs")),J(ee,I)},$$slots:{default:!0}})};de($,q=>{B(_).status==="failed"&&B(_).runId&&q(E)})}var R=Z($,2);{var M=q=>{var ee=zl();le(()=>$e(ee,"href",B(_).url)),J(q,ee)};de(R,q=>{B(_).url&&q(M)})}var P=Z(V,2);{var j=q=>{var ee=Xl(),re=Q(ee);{var I=X=>{var ne=Kl();J(X,ne)},L=X=>{var ne=ql(),ve=Q(ne);le(()=>_e(ve,B(k))),J(X,ne)},z=X=>{var ne=Vl(),ve=Ie(ne),ge=Q(ve),xe=Z(ve,2),se=Q(xe);qi(se,{onclick:d,children:(xt,Mt)=>{var K=Je();le(()=>_e(K,B(x)?"Copied!":"Copy logs")),J(xt,K)},$$slots:{default:!0}});var Et=Z(se,2);{let xt=Ce(()=>!l.branch||!B(C)||B(w)||B(n)!==null);st(Et,{variant:"cta",small:!0,get disabled(){return B(xt)},onclick:()=>a(B(_).name),children:(Mt,K)=>{var te=Je();le(()=>_e(te,B(n)!==null?"Asking agent...":"Ask agent to fix")),J(Mt,te)},$$slots:{default:!0}})}le(()=>_e(ge,B(C))),J(X,ne)};de(re,X=>{B(w)?X(I):B(k)?X(L,1):B(C)&&X(z,2)})}var N=Z(re,2);{var Y=X=>{var ne=Gl(),ve=Q(ne);le(()=>_e(ve,B(o))),J(X,ne)};de(N,X=>{B(o)&&X(Y)})}J(q,ee)};de(P,q=>{B(v)===B(_).runId&&q(j)})}le((q,ee,re)=>{Ae(T,1,`text-sm font-bold ${q??""}`),_e(O,ee),_e(W,B(_).name),Ae(H,1,`text-[11px] ${re??""}`),_e(U,B(_).status)},[()=>g(B(_).status),()=>p(B(_).status),()=>g(B(_).status)]),J(b,y)});var m=Z(h,2),S=Q(m);st(S,{type:"button",get onclick(){return l.onclose},children:(b,_)=>{var y=Je("Close");J(b,y)},$$slots:{default:!0}}),le(()=>_e(s,`CI Checks — ${B(c)??""}`)),J(u,i)},$$slots:{default:!0}}),Fe()}var Ql=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],ec=["difference","intersection","symmetricDifference","union"],As=!1,Cr,lt,Nt,ai,Rr,In,Hn;const li=class li extends Set{constructor(v){super();ae(this,Rr);ae(this,Cr,new Map);ae(this,lt,oe(0));ae(this,Nt,oe(0));ae(this,ai,Bt||-1);if(v){for(var C of v)super.add(C);F(this,Nt).v=super.size}As||we(this,Rr,Hn).call(this)}has(v){var C=super.has(v),w=F(this,Cr),k=w.get(v);if(k===void 0){if(!C)return B(F(this,lt)),!1;k=we(this,Rr,In).call(this,!0),w.set(v,k)}return B(k),C}add(v){return super.has(v)||(super.add(v),G(F(this,Nt),super.size),Kt(F(this,lt))),this}delete(v){var C=super.delete(v),w=F(this,Cr),k=w.get(v);return k!==void 0&&(w.delete(v),G(k,!1)),C&&(G(F(this,Nt),super.size),Kt(F(this,lt))),C}clear(){if(super.size!==0){super.clear();var v=F(this,Cr);for(var C of v.values())G(C,!1);v.clear(),G(F(this,Nt),0),Kt(F(this,lt))}}keys(){return this.values()}values(){return B(F(this,lt)),super.values()}entries(){return B(F(this,lt)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return B(F(this,Nt))}};Cr=new WeakMap,lt=new WeakMap,Nt=new WeakMap,ai=new WeakMap,Rr=new WeakSet,In=function(v){return Bt===F(this,ai)?oe(v):qt(v)},Hn=function(){As=!0;var v=li.prototype,C=Set.prototype;for(const w of Ql)v[w]=function(...k){return B(F(this,lt)),C[w].apply(this,k)};for(const w of ec)v[w]=function(...k){B(F(this,lt));var x=C[w].apply(this,k);return new li(x)}};let si=li;var tc=ie('<li class="rounded-md border border-edge bg-surface p-3"><label class="flex items-start gap-2 cursor-pointer"><input type="checkbox" class="mt-0.5 accent-accent"/> <div class="flex-1 min-w-0"><div class="text-[12px] text-muted mb-1"><span class="font-medium text-primary"> </span> </div> <pre class="text-[11px] font-mono whitespace-pre-wrap m-0 text-primary/80"> </pre></div></label></li>'),rc=ie('<div class="text-[12px] text-danger mb-3"> </div>'),ic=ie('<h2 class="text-base mb-4"> </h2> <div class="flex items-center justify-between mb-3"><!> <span class="text-[11px] text-muted"> </span></div> <ul class="list-none p-0 m-0 flex flex-col gap-2 mb-4 max-h-[400px] overflow-y-auto"></ul> <!> <div class="flex justify-end gap-2"><!> <!></div>',1);function sc(r,l){He(l,!0);let v=oe(ze(new si)),C=oe(!1),w=oe("");Mr(()=>{G(v,new si(l.pr.comments.map((a,d)=>d)),!0)});let k=Ce(()=>as(l.pr)),x=Ce(()=>B(v).size===l.pr.comments.length),n=Ce(()=>B(v).size===0);function o(){if(B(x))B(v).clear();else for(let a=0;a<l.pr.comments.length;a++)B(v).add(a)}function c(a){B(v).has(a)?B(v).delete(a):B(v).add(a)}async function f(){if(!l.branch||B(n))return;G(C,!0),G(w,"");const a=["Review the PR comments and elaborate a plan to address them.",`PR: ${B(k)}`,"","Comments:"].join(`
21
- `)+`
22
- `,d=l.pr.comments.filter((p,g)=>B(v).has(g)).map((p,g)=>`[${g+1}] @${p.author} (${p.createdAt.slice(0,10)}):
23
- ${p.body}`).join(`
24
-
25
- `);try{await On(l.branch,Pn(d,2e4),a),l.onsendsuccess()}catch(p){G(w,dr(p),!0)}finally{G(C,!1)}}Jr(r,{get onclose(){return l.onclose},wide:!0,children:(a,d)=>{var p=ic(),g=Ie(p),u=Q(g),e=Z(g,2),i=Q(e);qi(i,{onclick:o,children:(D,T)=>{var O=Je();le(()=>_e(O,B(x)?"Deselect all":"Select all")),J(D,O)},$$slots:{default:!0}});var t=Z(i,2),s=Q(t),h=Z(e,2);Ct(h,21,()=>l.pr.comments,jr,(D,T,O)=>{var A=tc(),W=Q(A),H=Q(W),U=Z(H,2),V=Q(U),$=Q(V),E=Q($),R=Z($),M=Z(V,2),P=Q(M);le((j,q)=>{zi(H,j),_e(E,`@${B(T).author??""}`),_e(R,` · ${q??""}`),_e(P,B(T).body)},[()=>B(v).has(O),()=>B(T).createdAt.slice(0,10)]),Me("change",H,()=>c(O)),J(D,A)});var m=Z(h,2);{var S=D=>{var T=rc(),O=Q(T);le(()=>_e(O,B(w))),J(D,T)};de(m,D=>{B(w)&&D(S)})}var b=Z(m,2),_=Q(b);st(_,{type:"button",get onclick(){return l.onclose},children:(D,T)=>{var O=Je("Cancel");J(D,O)},$$slots:{default:!0}});var y=Z(_,2);{let D=Ce(()=>B(n)||B(C));st(y,{variant:"cta",small:!0,get disabled(){return B(D)},onclick:f,children:(T,O)=>{var A=Je();le(()=>_e(A,B(C)?"Sending...":`Send ${B(v).size} to agent`)),J(T,A)},$$slots:{default:!0}})}le(()=>{_e(u,`PR Comments — ${B(k)??""}`),_e(s,`${B(v).size??""} of ${l.pr.comments.length??""} selected`)}),J(a,p)},$$slots:{default:!0}}),Fe()}Tt(["change"]);var nc=ie('<button type="button"> </button>'),oc=ie('<nav class="flex items-stretch bg-topbar border-t border-edge pane-bar svelte-19vlwaa"></nav>');function ac(r,l){He(l,!0);var v=oc();Ct(v,21,()=>l.panes,C=>C.index,(C,w)=>{var k=nc(),x=Q(k);le(()=>{Ae(k,1,`flex-1 py-3 text-sm font-medium cursor-pointer border-none bg-transparent ${l.activePane===B(w).index?"text-accent pane-active":"text-muted"}`,"svelte-19vlwaa"),_e(x,B(w).label)}),Me("click",k,()=>l.onselect(B(w).index)),J(C,k)}),J(r,v),Fe()}Tt(["click"]);var lc=ie('<div class="fixed inset-0 bg-black/50 z-40"></div>'),cc=ie('<button class="h-8 w-8 rounded-md border border-edge bg-surface text-muted text-sm flex items-center justify-center cursor-pointer hover:bg-hover" title="Close sidebar">&times;</button>'),hc=ie('<div class="shrink-0 border-t border-edge px-4 py-3 text-[11px] text-muted flex flex-col gap-1"><div class="flex justify-between"><span>Navigate</span><kbd class="opacity-60">Cmd+Up/Down</kbd></div> <div class="flex justify-between"><span>New worktree</span><kbd class="opacity-60">Cmd+K</kbd></div> <div class="flex justify-between"><span>Merge</span><kbd class="opacity-60">Cmd+M</kbd></div> <div class="flex justify-between"><span>Remove</span><kbd class="opacity-60">Cmd+D</kbd></div></div>'),uc=ie('<!> <aside><div class="flex items-center justify-between p-4 border-b border-edge"><h1 class="text-base font-semibold">Dashboard</h1> <div class="flex items-center gap-2"><button class="h-8 px-2 gap-1.5 rounded-md border border-edge bg-surface text-accent text-xs flex items-center justify-center cursor-pointer hover:bg-hover disabled:opacity-50 disabled:cursor-not-allowed" title="New Worktree (Cmd+K)"><span class="text-lg leading-none">+</span> New</button> <!></div></div> <!> <!></aside>',1),dc=ie('<div class="flex-1 flex items-center justify-center text-muted text-sm"><p>Select a worktree from the sidebar to connect</p></div>'),fc=ie('<div class="flex h-dvh bg-surface text-primary"><!> <main class="flex-1 min-w-0 flex flex-col overflow-hidden"><!> <!> <!></main></div> <!> <!> <!> <!> <!> <!>',1);function _c(r,l){He(l,!0);let v=oe(ze({services:[],profiles:{default:{name:"default"}},autoName:!1})),C=oe(ze([])),w=oe(null),k=oe(null),x=oe(null),n=oe(!1),o=oe(""),c=oe(ze(new Set)),f=oe(!1),a=oe(!1),d=oe(null),p=oe(null),g=oe(!1),u=oe(ze(localStorage.getItem(ii)??"")),e=oe(!1),i=oe(!1),t=oe(0),s=oe(void 0);const h=200;let m=Ce(()=>B(C).filter(K=>K.mux==="✓")),S=Ce(()=>B(m).find(K=>K.branch===B(w))),b=Ce(()=>!!B(w));Mr(()=>{!B(w)&&B(m).length>0&&G(w,B(m)[0].branch,!0)});let _=Ce(()=>{var te;const K=((te=B(S))==null?void 0:te.paneCount)??0;return K<2?[]:Array.from({length:K},(ce,Se)=>({index:Se,label:String(Se+1)}))}),y=Ce(()=>B(e)&&B(b)&&B(_).length>0);async function D(){try{G(C,await Il(),!0)}catch(K){console.error("Failed to refresh:",K)}}async function T(K,te,ce,Se){G(g,!0);try{const be=await Hl(K||void 0,te,ce,Se||void 0);await Wl(be.branch),G(f,!1),await D(),G(w,be.branch,!0),B(e)&&G(i,!1)}catch(be){alert(`Failed to create: ${dr(be)}`)}finally{G(g,!1)}}function O(K){if(B(w)!==K)return;const te=B(m).findIndex(Se=>Se.branch===K),ce=B(m)[te-1]??B(m)[te+1];G(w,ce?ce.branch:null,!0)}async function A(){const K=B(k);if(K){G(k,null),O(K),G(c,new Set([...B(c),K]),!0);try{await Fl(K),await D()}catch(te){alert(`Failed to remove: ${dr(te)}`)}finally{G(c,new Set([...B(c)].filter(te=>te!==K)),!0)}}}async function W(){const K=B(x);if(K){G(n,!0),G(o,"");try{await Nl(K),G(x,null),O(K),await D()}catch(te){G(o,dr(te),!0)}finally{G(n,!1)}}}function H(K){const te=B(m).filter(be=>!B(c).has(be.branch));if(te.length===0)return;if(!B(w)){G(w,te[K===1?0:te.length-1].branch,!0);return}const Se=te.findIndex(be=>be.branch===B(w))+K;Se>=0&&Se<te.length&&G(w,te[Se].branch,!0)}function U(K){B(f)||B(k)||B(x)||!(K.metaKey||K.ctrlKey)||(K.key==="ArrowUp"?(K.preventDefault(),H(-1)):K.key==="ArrowDown"?(K.preventDefault(),H(1)):K.key==="k"||K.key==="K"?(K.preventDefault(),B(g)||G(f,!0)):K.key==="m"||K.key==="M"?(K.preventDefault(),B(w)&&G(x,B(w),!0)):(K.key==="d"||K.key==="D")&&(K.preventDefault(),B(w)&&G(k,B(w),!0)))}function V(K){var te;G(t,K,!0),(te=B(s))==null||te.sendSelectPane(K)}os(()=>{Pl().then(Se=>{G(v,Se,!0)}).catch(()=>{}),D();const K=setInterval(D,5e3);window.addEventListener("keydown",U);const te=window.matchMedia("(max-width: 768px)");G(e,te.matches,!0),B(e)&&G(i,!0);function ce(Se){G(e,Se.matches,!0)}return te.addEventListener("change",ce),()=>{clearInterval(K),window.removeEventListener("keydown",U),te.removeEventListener("change",ce)}});var $=fc(),E=Ie($),R=Q(E);{var M=K=>{var te=uc(),ce=Ie(te);{var Se=Oe=>{var Pt=lc();Me("click",Pt,()=>G(i,!1)),Me("keydown",Pt,Fn=>{Fn.key==="Escape"&&G(i,!1)}),J(Oe,Pt)};de(ce,Oe=>{B(e)&&Oe(Se)})}var be=Z(ce,2),ft=Q(be),Or=Z(Q(ft),2),Ze=Q(Or),hr=Z(Ze,2);{var _t=Oe=>{var Pt=cc();Me("click",Pt,()=>G(i,!1)),J(Oe,Pt)};de(hr,Oe=>{B(e)&&Oe(_t)})}var Ot=Z(ft,2);Qa(Ot,{get worktrees(){return B(m)},get selected(){return B(w)},get removing(){return B(c)},onselect:Oe=>{G(w,Oe,!0),B(e)&&G(i,!1)},onremove:Oe=>G(k,Oe,!0)});var me=Z(Ot,2);{var mi=Oe=>{var Pt=hc();J(Oe,Pt)};de(me,Oe=>{B(e)||Oe(mi)})}le(()=>{Ae(be,1,`${B(e)?"fixed inset-0 z-50 w-full":"w-[220px] min-w-[220px]"} bg-sidebar border-r border-edge flex flex-col overflow-hidden`),Ze.disabled=B(g)}),Me("click",Ze,()=>G(f,!0)),J(K,te)};de(R,K=>{(!B(e)||B(i))&&K(M)})}var P=Z(R,2),j=Q(P);dl(j,{get name(){return B(w)},get worktree(){return B(S)},get sshHost(){return B(u)},get isMobile(){return B(e)},ontogglesidebar:()=>G(i,!B(i)),onmerge:()=>{B(w)&&G(x,B(w),!0)},onremove:()=>{B(w)&&G(k,B(w),!0)},onsettings:()=>G(a,!0),onciclick:K=>G(d,K,!0),onreviewsclick:K=>G(p,K,!0)});var q=Z(j,2);{var ee=K=>{var te=Dr(),ce=Ie(te);ba(ce,()=>B(w),Se=>{{let be=Ce(()=>B(e)?B(t):void 0);gi(bl(Se,{get worktree(){return B(w)},get isMobile(){return B(e)},get initialPane(){return B(be)}}),ft=>G(s,ft,!0),()=>B(s))}}),J(K,te)},re=K=>{var te=dc();J(K,te)};de(q,K=>{B(b)?K(ee):K(re,!1)})}var I=Z(q,2);{var L=K=>{ac(K,{get activePane(){return B(t)},get panes(){return B(_)},onselect:V})};de(I,K=>{B(y)&&K(L)})}var z=Z(E,2);{var N=K=>{{let te=Ce(()=>[B(v).profiles.default,...B(v).profiles.sandbox?[B(v).profiles.sandbox]:[]]);Tl(K,{get loading(){return B(g)},get profiles(){return B(te)},oncreate:T,oncancel:()=>G(f,!1)})}};de(z,K=>{B(f)&&K(N)})}var Y=Z(z,2);{var X=K=>{{let te=Ce(()=>`Remove worktree "${B(k)}"? This action cannot be undone.`);Rs(K,{get message(){return B(te)},onconfirm:A,oncancel:()=>G(k,null)})}};de(Y,K=>{B(k)&&K(X)})}var ne=Z(Y,2);{var ve=K=>{{let te=Ce(()=>`Merge worktree "${B(x)}" into main? The worktree will be removed after merging.`);Rs(K,{get message(){return B(te)},confirmLabel:"Merge",variant:"accent",get loading(){return B(n)},get error(){return B(o)},onconfirm:W,oncancel:()=>{G(x,null),G(o,"")}})}};de(ne,K=>{B(x)&&K(ve)})}var ge=Z(ne,2);{var xe=K=>{Ol(K,{onsave:te=>{G(u,te,!0),G(a,!1)},onclose:()=>G(a,!1)})};de(ge,K=>{B(a)&&K(xe)})}var se=Z(ge,2);{var Et=K=>{{let te=Ce(()=>{var ce;return((ce=B(S))==null?void 0:ce.branch)??""});Zl(K,{get pr(){return B(d)},get branch(){return B(te)},onclose:()=>G(d,null),onfixsuccess:()=>{G(d,null),setTimeout(()=>{var ce;return(ce=B(s))==null?void 0:ce.sendInput("\r")},h)}})}};de(se,K=>{B(d)&&K(Et)})}var xt=Z(se,2);{var Mt=K=>{{let te=Ce(()=>{var ce;return((ce=B(S))==null?void 0:ce.branch)??""});sc(K,{get pr(){return B(p)},get branch(){return B(te)},onclose:()=>G(p,null),onsendsuccess:()=>{G(p,null),setTimeout(()=>{var ce;return(ce=B(s))==null?void 0:ce.sendInput("\r")},h)}})}};de(xt,K=>{B(p)&&K(Mt)})}J(r,$),Fe()}Tt(["click","keydown"]);va(_c,{target:document.getElementById("app")});