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.
@@ -0,0 +1,25 @@
1
+ var uo=Object.defineProperty;var xs=r=>{throw TypeError(r)};var fo=(r,o,_)=>o in r?uo(r,o,{enumerable:!0,configurable:!0,writable:!0,value:_}):r[o]=_;var bt=(r,o,_)=>fo(r,typeof o!="symbol"?o+"":o,_),Li=(r,o,_)=>o.has(r)||xs("Cannot "+_);var W=(r,o,_)=>(Li(r,o,"read from private field"),_?_.call(r):o.get(r)),he=(r,o,_)=>o.has(r)?xs("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(r):o.set(r,_),ue=(r,o,_,b)=>(Li(r,o,"write to private field"),b?b.call(r,_):o.set(r,_),_),Ce=(r,o,_)=>(Li(r,o,"access private method"),_);(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const w of document.querySelectorAll('link[rel="modulepreload"]'))b(w);new MutationObserver(w=>{for(const k of w)if(k.type==="childList")for(const E of k.addedNodes)E.tagName==="LINK"&&E.rel==="modulepreload"&&b(E)}).observe(document,{childList:!0,subtree:!0});function _(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 b(w){if(w.ep)return;w.ep=!0;const k=_(w);fetch(w.href,k)}})();const _o="5";var Ks;typeof window<"u"&&((Ks=window.__svelte??(window.__svelte={})).v??(Ks.v=new Set)).add(_o);const vo=1,po=2,Gs=4,go=8,mo=16,So=1,bo=4,wo=8,Co=16,yo=1,xo=2,Pe=Symbol(),Xs="http://www.w3.org/1999/xhtml",Eo="@attach",Fi=!1;var ns=Array.isArray,ko=Array.prototype.indexOf,Rr=Array.prototype.includes,mi=Array.from,Lo=Object.defineProperty,mr=Object.getOwnPropertyDescriptor,Do=Object.getOwnPropertyDescriptors,Ro=Object.prototype,Ao=Array.prototype,Js=Object.getPrototypeOf,Es=Object.isExtensible;const To=()=>{};function Bo(r){for(var o=0;o<r.length;o++)r[o]()}function Ys(){var r,o,_=new Promise((b,w)=>{r=b,o=w});return{promise:_,resolve:r,reject:o}}const We=2,Ir=4,qr=8,os=1<<24,Qt=16,vt=32,pr=64,Ni=128,nt=512,Ie=1024,Ue=2048,_t=4096,tt=8192,Pt=16384,Hr=32768,_r=65536,ks=1<<17,Mo=1<<18,Fr=1<<19,Oo=1<<20,Ot=1<<25,vr=65536,Wi=1<<21,as=1<<22,qt=1<<23,dr=Symbol("$state"),Po=Symbol("legacy props"),Io=Symbol(""),sr=new class extends Error{constructor(){super(...arguments);bt(this,"name","StaleReactionError");bt(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var qs;const ls=!!((qs=globalThis.document)!=null&&qs.contentType)&&globalThis.document.contentType.includes("xml");function Zs(r){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Ho(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Fo(r,o,_){throw new Error("https://svelte.dev/e/each_key_duplicate")}function No(r){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Wo(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Uo(r){throw new Error("https://svelte.dev/e/effect_orphan")}function jo(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function zo(r){throw new Error("https://svelte.dev/e/props_invalid_value")}function $o(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Ko(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function qo(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Vo(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function Go(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Xo(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Qs(r){return r===this.v}function Jo(r,o){return r!=r?o==o:r!==o||r!==null&&typeof r=="object"||typeof r=="function"}function en(r){return!Jo(r,this.v)}let Yo=!1,Xe=null;function Ar(r){Xe=r}function Re(r,o=!1,_){Xe={p:Xe,i:!1,c:null,e:null,s:r,x:null,l:null}}function Ae(r){var o=Xe,_=o.e;if(_!==null){o.e=null;for(var b of _)Cn(b)}return r!==void 0&&(o.x=r),o.i=!0,Xe=o.p,r??{}}function tn(){return!0}let nr=[];function rn(){var r=nr;nr=[],Bo(r)}function Et(r){if(nr.length===0&&!Kr){var o=nr;queueMicrotask(()=>{o===nr&&rn()})}nr.push(r)}function Zo(){for(;nr.length>0;)rn()}function sn(r){var o=ve;if(o===null)return fe.f|=qt,r;if((o.f&Hr)===0&&(o.f&Ir)===0)throw r;Kt(r,o)}function Kt(r,o){for(;o!==null;){if((o.f&Ni)!==0){if((o.f&Hr)===0)throw r;try{o.b.error(r);return}catch(_){r=_}}o=o.parent}throw r}const Qo=-7169;function xe(r,o){r.f=r.f&Qo|o}function cs(r){(r.f&nt)!==0||r.deps===null?xe(r,Ie):xe(r,_t)}function nn(r){if(r!==null)for(const o of r)(o.f&We)===0||(o.f&vr)===0||(o.f^=vr,nn(o.deps))}function on(r,o,_){(r.f&Ue)!==0?o.add(r):(r.f&_t)!==0&&_.add(r),nn(r.deps),xe(r,Ie)}const oi=new Set;let de=null,Ui=null,He=null,Ke=[],Si=null,Kr=!1,Tr=null;var Ut,br,lr,wr,Cr,yr,jt,wt,xr,Je,ji,zi,$i,Ki;const Ss=class Ss{constructor(){he(this,Je);bt(this,"current",new Map);bt(this,"previous",new Map);he(this,Ut,new Set);he(this,br,new Set);he(this,lr,0);he(this,wr,0);he(this,Cr,null);he(this,yr,new Set);he(this,jt,new Set);he(this,wt,new Map);bt(this,"is_fork",!1);he(this,xr,!1)}skip_effect(o){W(this,wt).has(o)||W(this,wt).set(o,{d:[],m:[]})}unskip_effect(o){var _=W(this,wt).get(o);if(_){W(this,wt).delete(o);for(var b of _.d)xe(b,Ue),dt(b);for(b of _.m)xe(b,_t),dt(b)}}process(o){var w;Ke=[],this.apply();var _=Tr=[],b=[];for(const k of o)Ce(this,Je,zi).call(this,k,_,b);if(Tr=null,Ce(this,Je,ji).call(this)){Ce(this,Je,$i).call(this,b),Ce(this,Je,$i).call(this,_);for(const[k,E]of W(this,wt))hn(k,E)}else{Ui=this,de=null;for(const k of W(this,Ut))k(this);W(this,Ut).clear(),W(this,lr)===0&&Ce(this,Je,Ki).call(this),Ls(b),Ls(_),W(this,yr).clear(),W(this,jt).clear(),Ui=null,(w=W(this,Cr))==null||w.resolve()}He=null}capture(o,_){_!==Pe&&!this.previous.has(o)&&this.previous.set(o,_),(o.f&qt)===0&&(this.current.set(o,o.v),He==null||He.set(o,o.v))}activate(){de=this,this.apply()}deactivate(){de===this&&(de=null,He=null)}flush(){var o;if(Ke.length>0)de=this,an();else if(W(this,lr)===0&&!this.is_fork){for(const _ of W(this,Ut))_(this);W(this,Ut).clear(),Ce(this,Je,Ki).call(this),(o=W(this,Cr))==null||o.resolve()}this.deactivate()}discard(){for(const o of W(this,br))o(this);W(this,br).clear()}increment(o){ue(this,lr,W(this,lr)+1),o&&ue(this,wr,W(this,wr)+1)}decrement(o){ue(this,lr,W(this,lr)-1),o&&ue(this,wr,W(this,wr)-1),!W(this,xr)&&(ue(this,xr,!0),Et(()=>{ue(this,xr,!1),Ce(this,Je,ji).call(this)?Ke.length>0&&this.flush():this.revive()}))}revive(){for(const o of W(this,yr))W(this,jt).delete(o),xe(o,Ue),dt(o);for(const o of W(this,jt))xe(o,_t),dt(o);this.flush()}oncommit(o){W(this,Ut).add(o)}ondiscard(o){W(this,br).add(o)}settled(){return(W(this,Cr)??ue(this,Cr,Ys())).promise}static ensure(){if(de===null){const o=de=new Ss;oi.add(de),Kr||Et(()=>{de===o&&o.flush()})}return de}apply(){}};Ut=new WeakMap,br=new WeakMap,lr=new WeakMap,wr=new WeakMap,Cr=new WeakMap,yr=new WeakMap,jt=new WeakMap,wt=new WeakMap,xr=new WeakMap,Je=new WeakSet,ji=function(){return this.is_fork||W(this,wr)>0},zi=function(o,_,b){o.f^=Ie;for(var w=o.first;w!==null;){var k=w.f,E=(k&(vt|pr))!==0,n=E&&(k&Ie)!==0,a=n||(k&tt)!==0||W(this,wt).has(w);if(!a&&w.fn!==null){E?w.f^=Ie:(k&Ir)!==0?_.push(w):ri(w)&&((k&Qt)!==0&&W(this,jt).add(w),Or(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}}},$i=function(o){for(var _=0;_<o.length;_+=1)on(o[_],W(this,yr),W(this,jt))},Ki=function(){var k;if(oi.size>1){this.previous.clear();var o=de,_=He,b=!0;for(const E of oi){if(E===this){b=!1;continue}const n=[];for(const[c,f]of this.current){if(E.current.has(c))if(b&&f!==E.current.get(c))E.current.set(c,f);else continue;n.push(c)}if(n.length===0)continue;const a=[...E.current.keys()].filter(c=>!this.current.has(c));if(a.length>0){var w=Ke;Ke=[];const c=new Set,f=new Map;for(const l of n)ln(l,a,c,f);if(Ke.length>0){de=E,E.apply();for(const l of Ke)Ce(k=E,Je,zi).call(k,l,[],[]);E.deactivate()}Ke=w}}de=o,He=_}W(this,wt).clear(),oi.delete(this)};let Vt=Ss;function ea(r){var o=Kr;Kr=!0;try{for(var _;;){if(Zo(),Ke.length===0&&(de==null||de.flush(),Ke.length===0))return Si=null,_;an()}}finally{Kr=o}}function an(){var r=null;try{for(var o=0;Ke.length>0;){var _=Vt.ensure();if(o++>1e3){var b,w;ta()}_.process(Ke),Gt.clear()}}finally{Ke=[],Si=null,Tr=null}}function ta(){try{jo()}catch(r){Kt(r,Si)}}let lt=null;function Ls(r){var o=r.length;if(o!==0){for(var _=0;_<o;){var b=r[_++];if((b.f&(Pt|tt))===0&&ri(b)&&(lt=new Set,Or(b),b.deps===null&&b.first===null&&b.nodes===null&&b.teardown===null&&b.ac===null&&En(b),(lt==null?void 0:lt.size)>0)){Gt.clear();for(const w of lt){if((w.f&(Pt|tt))!==0)continue;const k=[w];let E=w.parent;for(;E!==null;)lt.has(E)&&(lt.delete(E),k.push(E)),E=E.parent;for(let n=k.length-1;n>=0;n--){const a=k[n];(a.f&(Pt|tt))===0&&Or(a)}}lt.clear()}}lt=null}}function ln(r,o,_,b){if(!_.has(r)&&(_.add(r),r.reactions!==null))for(const w of r.reactions){const k=w.f;(k&We)!==0?ln(w,o,_,b):(k&(as|Qt))!==0&&(k&Ue)===0&&cn(w,o,b)&&(xe(w,Ue),dt(w))}}function cn(r,o,_){const b=_.get(r);if(b!==void 0)return b;if(r.deps!==null)for(const w of r.deps){if(Rr.call(o,w))return!0;if((w.f&We)!==0&&cn(w,o,_))return _.set(w,!0),!0}return _.set(r,!1),!1}function dt(r){var o=Si=r,_=o.b;if(_!=null&&_.is_pending&&(r.f&(Ir|qr|os))!==0&&(r.f&Hr)===0){_.defer_effect(r);return}for(;o.parent!==null;){o=o.parent;var b=o.f;if(Tr!==null&&o===ve&&(r.f&qr)===0)return;if((b&(pr|vt))!==0){if((b&Ie)===0)return;o.f^=Ie}}Ke.push(o)}function hn(r,o){if(!((r.f&vt)!==0&&(r.f&Ie)!==0)){(r.f&Ue)!==0?o.d.push(r):(r.f&_t)!==0&&o.m.push(r),xe(r,Ie);for(var _=r.first;_!==null;)hn(_,o),_=_.next}}function ra(r){let o=0,_=Jt(0),b;return()=>{us()&&(D(_),Ci(()=>(o===0&&(b=er(()=>r(()=>Xt(_)))),o+=1,()=>{Et(()=>{o-=1,o===0&&(b==null||b(),b=void 0,Xt(_))})})))}}var ia=_r|Fr;function sa(r,o,_,b){new na(r,o,_,b)}var st,ss,Ct,cr,$e,yt,Qe,ct,Bt,hr,zt,Er,kr,Lr,Mt,_i,Oe,oa,aa,la,qi,ci,hi,Vi;class na{constructor(o,_,b,w){he(this,Oe);bt(this,"parent");bt(this,"is_pending",!1);bt(this,"transform_error");he(this,st);he(this,ss,null);he(this,Ct);he(this,cr);he(this,$e);he(this,yt,null);he(this,Qe,null);he(this,ct,null);he(this,Bt,null);he(this,hr,0);he(this,zt,0);he(this,Er,!1);he(this,kr,new Set);he(this,Lr,new Set);he(this,Mt,null);he(this,_i,ra(()=>(ue(this,Mt,Jt(W(this,hr))),()=>{ue(this,Mt,null)})));var k;ue(this,st,o),ue(this,Ct,_),ue(this,cr,E=>{var n=ve;n.b=this,n.f|=Ni,b(E)}),this.parent=ve.b,this.transform_error=w??((k=this.parent)==null?void 0:k.transform_error)??(E=>E),ue(this,$e,ti(()=>{Ce(this,Oe,qi).call(this)},ia))}defer_effect(o){on(o,W(this,kr),W(this,Lr))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!W(this,Ct).pending}update_pending_count(o){Ce(this,Oe,Vi).call(this,o),ue(this,hr,W(this,hr)+o),!(!W(this,Mt)||W(this,Er))&&(ue(this,Er,!0),Et(()=>{ue(this,Er,!1),W(this,Mt)&&Br(W(this,Mt),W(this,hr))}))}get_effect_pending(){return W(this,_i).call(this),D(W(this,Mt))}error(o){var _=W(this,Ct).onerror;let b=W(this,Ct).failed;if(!_&&!b)throw o;W(this,yt)&&(Ne(W(this,yt)),ue(this,yt,null)),W(this,Qe)&&(Ne(W(this,Qe)),ue(this,Qe,null)),W(this,ct)&&(Ne(W(this,ct)),ue(this,ct,null));var w=!1,k=!1;const E=()=>{if(w){Xo();return}w=!0,k&&Vo(),W(this,ct)!==null&&fr(W(this,ct),()=>{ue(this,ct,null)}),Ce(this,Oe,hi).call(this,()=>{Vt.ensure(),Ce(this,Oe,qi).call(this)})},n=a=>{try{k=!0,_==null||_(a,E),k=!1}catch(c){Kt(c,W(this,$e)&&W(this,$e).parent)}b&&ue(this,ct,Ce(this,Oe,hi).call(this,()=>{Vt.ensure();try{return Ve(()=>{var c=ve;c.b=this,c.f|=Ni,b(W(this,st),()=>a,()=>E)})}catch(c){return Kt(c,W(this,$e).parent),null}}))};Et(()=>{var a;try{a=this.transform_error(o)}catch(c){Kt(c,W(this,$e)&&W(this,$e).parent);return}a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(n,c=>Kt(c,W(this,$e)&&W(this,$e).parent)):n(a)})}}st=new WeakMap,ss=new WeakMap,Ct=new WeakMap,cr=new WeakMap,$e=new WeakMap,yt=new WeakMap,Qe=new WeakMap,ct=new WeakMap,Bt=new WeakMap,hr=new WeakMap,zt=new WeakMap,Er=new WeakMap,kr=new WeakMap,Lr=new WeakMap,Mt=new WeakMap,_i=new WeakMap,Oe=new WeakSet,oa=function(){try{ue(this,yt,Ve(()=>W(this,cr).call(this,W(this,st))))}catch(o){this.error(o)}},aa=function(o){const _=W(this,Ct).failed;_&&ue(this,ct,Ve(()=>{_(W(this,st),()=>o,()=>()=>{})}))},la=function(){const o=W(this,Ct).pending;o&&(this.is_pending=!0,ue(this,Qe,Ve(()=>o(W(this,st)))),Et(()=>{var _=ue(this,Bt,document.createDocumentFragment()),b=It();_.append(b),ue(this,yt,Ce(this,Oe,hi).call(this,()=>(Vt.ensure(),Ve(()=>W(this,cr).call(this,b))))),W(this,zt)===0&&(W(this,st).before(_),ue(this,Bt,null),fr(W(this,Qe),()=>{ue(this,Qe,null)}),Ce(this,Oe,ci).call(this))}))},qi=function(){try{if(this.is_pending=this.has_pending_snippet(),ue(this,zt,0),ue(this,hr,0),ue(this,yt,Ve(()=>{W(this,cr).call(this,W(this,st))})),W(this,zt)>0){var o=ue(this,Bt,document.createDocumentFragment());Dn(W(this,yt),o);const _=W(this,Ct).pending;ue(this,Qe,Ve(()=>_(W(this,st))))}else Ce(this,Oe,ci).call(this)}catch(_){this.error(_)}},ci=function(){this.is_pending=!1;for(const o of W(this,kr))xe(o,Ue),dt(o);for(const o of W(this,Lr))xe(o,_t),dt(o);W(this,kr).clear(),W(this,Lr).clear()},hi=function(o){var _=ve,b=fe,w=Xe;kt(W(this,$e)),at(W(this,$e)),Ar(W(this,$e).ctx);try{return o()}catch(k){return sn(k),null}finally{kt(_),at(b),Ar(w)}},Vi=function(o){var _;if(!this.has_pending_snippet()){this.parent&&Ce(_=this.parent,Oe,Vi).call(_,o);return}ue(this,zt,W(this,zt)+o),W(this,zt)===0&&(Ce(this,Oe,ci).call(this),W(this,Qe)&&fr(W(this,Qe),()=>{ue(this,Qe,null)}),W(this,Bt)&&(W(this,st).before(W(this,Bt)),ue(this,Bt,null)))};function un(r,o,_,b){const w=bi;var k=r.filter(l=>!l.settled);if(_.length===0&&k.length===0){b(o.map(w));return}var E=ve,n=ca(),a=k.length===1?k[0].promise:k.length>1?Promise.all(k.map(l=>l.promise)):null;function c(l){n();try{b(l)}catch(d){(E.f&Pt)===0&&Kt(d,E)}Gi()}if(_.length===0){a.then(()=>c(o.map(w)));return}function f(){n(),Promise.all(_.map(l=>ua(l))).then(l=>c([...o.map(w),...l])).catch(l=>Kt(l,E))}a?a.then(f):f()}function ca(){var r=ve,o=fe,_=Xe,b=de;return function(k=!0){kt(r),at(o),Ar(_),k&&(b==null||b.activate())}}function Gi(r=!0){kt(null),at(null),Ar(null),r&&(de==null||de.deactivate())}function ha(){var r=ve.b,o=de,_=r.is_rendered();return r.update_pending_count(1),o.increment(_),()=>{r.update_pending_count(-1),o.decrement(_)}}function bi(r){var o=We|Ue,_=fe!==null&&(fe.f&We)!==0?fe:null;return ve!==null&&(ve.f|=Fr),{ctx:Xe,deps:null,effects:null,equals:Qs,f:o,fn:r,reactions:null,rv:0,v:Pe,wv:0,parent:_??ve,ac:null}}function ua(r,o,_){ve===null&&Ho();var w=void 0,k=Jt(Pe),E=!fe,n=new Map;return La(()=>{var d;var a=Ys();w=a.promise;try{Promise.resolve(r()).then(a.resolve,a.reject).finally(Gi)}catch(p){a.reject(p),Gi()}var c=de;if(E){var f=ha();(d=n.get(c))==null||d.reject(sr),n.delete(c),n.set(c,a)}const l=(p,g=void 0)=>{if(c.activate(),g)g!==sr&&(k.f|=qt,Br(k,g));else{(k.f&qt)!==0&&(k.f^=qt),Br(k,p);for(const[h,t]of n){if(n.delete(h),h===c)break;t.reject(sr)}}f&&f()};a.promise.then(l,p=>l(null,p||"unknown"))}),ds(()=>{for(const a of n.values())a.reject(sr)}),new Promise(a=>{function c(f){function l(){f===w?a(k):c(w)}f.then(l,l)}c(w)})}function me(r){const o=bi(r);return Rn(o),o}function dn(r){const o=bi(r);return o.equals=en,o}function da(r){var o=r.effects;if(o!==null){r.effects=null;for(var _=0;_<o.length;_+=1)Ne(o[_])}}function fa(r){for(var o=r.parent;o!==null;){if((o.f&We)===0)return(o.f&Pt)===0?o:null;o=o.parent}return null}function hs(r){var o,_=ve;kt(fa(r));try{r.f&=~vr,da(r),o=Mn(r)}finally{kt(_)}return o}function fn(r){var o=hs(r);if(!r.equals(o)&&(r.wv=Tn(),(!(de!=null&&de.is_fork)||r.deps===null)&&(r.v=o,r.deps===null))){xe(r,Ie);return}Yt||(He!==null?(us()||de!=null&&de.is_fork)&&He.set(r,o):cs(r))}function _a(r){var o,_;if(r.effects!==null)for(const b of r.effects)(b.teardown||b.ac)&&((o=b.teardown)==null||o.call(b),(_=b.ac)==null||_.abort(sr),b.teardown=To,b.ac=null,Vr(b,0),fs(b))}function _n(r){if(r.effects!==null)for(const o of r.effects)o.teardown&&Or(o)}let Xi=new Set;const Gt=new Map;let vn=!1;function Jt(r,o){var _={f:0,v:r,reactions:null,equals:Qs,rv:0,wv:0};return _}function ae(r,o){const _=Jt(r);return Rn(_),_}function va(r,o=!1,_=!0){const b=Jt(r);return o||(b.equals=en),b}function q(r,o,_=!1){fe!==null&&(!ft||(fe.f&ks)!==0)&&tn()&&(fe.f&(We|Qt|as|ks))!==0&&(ot===null||!Rr.call(ot,r))&&qo();let b=_?Le(o):o;return Br(r,b)}function Br(r,o){if(!r.equals(o)){var _=r.v;Yt?Gt.set(r,o):Gt.set(r,_),r.v=o;var b=Vt.ensure();if(b.capture(r,_),(r.f&We)!==0){const w=r;(r.f&Ue)!==0&&hs(w),cs(w)}r.wv=Tn(),pn(r,Ue),ve!==null&&(ve.f&Ie)!==0&&(ve.f&(vt|pr))===0&&(it===null?Aa([r]):it.push(r)),!b.is_fork&&Xi.size>0&&!vn&&pa()}return o}function pa(){vn=!1;for(const r of Xi)(r.f&Ie)!==0&&xe(r,_t),ri(r)&&Or(r);Xi.clear()}function ga(r,o=1){var _=D(r),b=o===1?_++:_--;return q(r,_),b}function Xt(r){q(r,r.v+1)}function pn(r,o){var _=r.reactions;if(_!==null)for(var b=_.length,w=0;w<b;w++){var k=_[w],E=k.f,n=(E&Ue)===0;if(n&&xe(k,o),(E&We)!==0){var a=k;He==null||He.delete(a),(E&vr)===0&&(E&nt&&(k.f|=vr),pn(a,_t))}else n&&((E&Qt)!==0&&lt!==null&&lt.add(k),dt(k))}}function Le(r){if(typeof r!="object"||r===null||dr in r)return r;const o=Js(r);if(o!==Ro&&o!==Ao)return r;var _=new Map,b=ns(r),w=ae(0),k=Ht,E=n=>{if(Ht===k)return n();var a=fe,c=Ht;at(null),Ts(k);var f=n();return at(a),Ts(c),f};return b&&_.set("length",ae(r.length)),new Proxy(r,{defineProperty(n,a,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&$o();var f=_.get(a);return f===void 0?E(()=>{var l=ae(c.value);return _.set(a,l),l}):q(f,c.value,!0),!0},deleteProperty(n,a){var c=_.get(a);if(c===void 0){if(a in n){const f=E(()=>ae(Pe));_.set(a,f),Xt(w)}}else q(c,Pe),Xt(w);return!0},get(n,a,c){var p;if(a===dr)return r;var f=_.get(a),l=a in n;if(f===void 0&&(!l||(p=mr(n,a))!=null&&p.writable)&&(f=E(()=>{var g=Le(l?n[a]:Pe),h=ae(g);return h}),_.set(a,f)),f!==void 0){var d=D(f);return d===Pe?void 0:d}return Reflect.get(n,a,c)},getOwnPropertyDescriptor(n,a){var c=Reflect.getOwnPropertyDescriptor(n,a);if(c&&"value"in c){var f=_.get(a);f&&(c.value=D(f))}else if(c===void 0){var l=_.get(a),d=l==null?void 0:l.v;if(l!==void 0&&d!==Pe)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return c},has(n,a){var d;if(a===dr)return!0;var c=_.get(a),f=c!==void 0&&c.v!==Pe||Reflect.has(n,a);if(c!==void 0||ve!==null&&(!f||(d=mr(n,a))!=null&&d.writable)){c===void 0&&(c=E(()=>{var p=f?Le(n[a]):Pe,g=ae(p);return g}),_.set(a,c));var l=D(c);if(l===Pe)return!1}return f},set(n,a,c,f){var s;var l=_.get(a),d=a in n;if(b&&a==="length")for(var p=c;p<l.v;p+=1){var g=_.get(p+"");g!==void 0?q(g,Pe):p in n&&(g=E(()=>ae(Pe)),_.set(p+"",g))}if(l===void 0)(!d||(s=mr(n,a))!=null&&s.writable)&&(l=E(()=>ae(void 0)),q(l,Le(c)),_.set(a,l));else{d=l.v!==Pe;var h=E(()=>Le(c));q(l,h)}var t=Reflect.getOwnPropertyDescriptor(n,a);if(t!=null&&t.set&&t.set.call(f,c),!d){if(b&&typeof a=="string"){var i=_.get("length"),e=Number(a);Number.isInteger(e)&&e>=i.v&&q(i,e+1)}Xt(w)}return!0},ownKeys(n){D(w);var a=Reflect.ownKeys(n).filter(l=>{var d=_.get(l);return d===void 0||d.v!==Pe});for(var[c,f]of _)f.v!==Pe&&!(c in n)&&a.push(c);return a},setPrototypeOf(){Ko()}})}function Ds(r){try{if(r!==null&&typeof r=="object"&&dr in r)return r[dr]}catch{}return r}function ma(r,o){return Object.is(Ds(r),Ds(o))}var Ji,gn,mn,Sn;function Sa(){if(Ji===void 0){Ji=window,gn=/Firefox/.test(navigator.userAgent);var r=Element.prototype,o=Node.prototype,_=Text.prototype;mn=mr(o,"firstChild").get,Sn=mr(o,"nextSibling").get,Es(r)&&(r.__click=void 0,r.__className=void 0,r.__attributes=null,r.__style=void 0,r.__e=void 0),Es(_)&&(_.__t=void 0)}}function It(r=""){return document.createTextNode(r)}function Mr(r){return mn.call(r)}function Qr(r){return Sn.call(r)}function G(r,o){return Mr(r)}function De(r,o=!1){{var _=Mr(r);return _ instanceof Comment&&_.data===""?Qr(_):_}}function X(r,o=1,_=!1){let b=r;for(;o--;)b=Qr(b);return b}function ba(r){r.textContent=""}function bn(){return!1}function wa(r,o,_){return document.createElementNS(Xs,r,void 0)}function Ca(r,o){if(o){const _=document.body;r.autofocus=!0,Et(()=>{document.activeElement===_&&r.focus()})}}let Rs=!1;function ya(){Rs||(Rs=!0,document.addEventListener("reset",r=>{Promise.resolve().then(()=>{var o;if(!r.defaultPrevented)for(const _ of r.target.elements)(o=_.__on_r)==null||o.call(_)})},{capture:!0}))}function wi(r){var o=fe,_=ve;at(null),kt(null);try{return r()}finally{at(o),kt(_)}}function wn(r,o,_,b=_){r.addEventListener(o,()=>wi(_));const w=r.__on_r;w?r.__on_r=()=>{w(),b(!0)}:r.__on_r=()=>b(!0),ya()}function xa(r){ve===null&&(fe===null&&Uo(),Wo()),Yt&&No()}function Ea(r,o){var _=o.last;_===null?o.last=o.first=r:(_.next=r,r.prev=_,o.last=r)}function Lt(r,o){var _=ve;_!==null&&(_.f&tt)!==0&&(r|=tt);var b={ctx:Xe,deps:null,nodes:null,f:r|Ue|nt,first:null,fn:o,last:null,next:null,parent:_,b:_&&_.b,prev:null,teardown:null,wv:0,ac:null},w=b;if((r&Ir)!==0)Tr!==null?Tr.push(b):dt(b);else if(o!==null){try{Or(b)}catch(E){throw Ne(b),E}w.deps===null&&w.teardown===null&&w.nodes===null&&w.first===w.last&&(w.f&Fr)===0&&(w=w.first,(r&Qt)!==0&&(r&_r)!==0&&w!==null&&(w.f|=_r))}if(w!==null&&(w.parent=_,_!==null&&Ea(w,_),fe!==null&&(fe.f&We)!==0&&(r&pr)===0)){var k=fe;(k.effects??(k.effects=[])).push(w)}return b}function us(){return fe!==null&&!ft}function ds(r){const o=Lt(qr,null);return xe(o,Ie),o.teardown=r,o}function Nr(r){xa();var o=ve.f,_=!fe&&(o&vt)!==0&&(o&Hr)===0;if(_){var b=Xe;(b.e??(b.e=[])).push(r)}else return Cn(r)}function Cn(r){return Lt(Ir|Oo,r)}function ka(r){Vt.ensure();const o=Lt(pr|Fr,r);return(_={})=>new Promise(b=>{_.outro?fr(o,()=>{Ne(o),b(void 0)}):(Ne(o),b(void 0))})}function ei(r){return Lt(Ir,r)}function La(r){return Lt(as|Fr,r)}function Ci(r,o=0){return Lt(qr|o,r)}function oe(r,o=[],_=[],b=[]){un(b,o,_,w=>{Lt(qr,()=>r(...w.map(D)))})}function ti(r,o=0){var _=Lt(Qt|o,r);return _}function yn(r,o=0){var _=Lt(os|o,r);return _}function Ve(r){return Lt(vt|Fr,r)}function xn(r){var o=r.teardown;if(o!==null){const _=Yt,b=fe;As(!0),at(null);try{o.call(null)}finally{As(_),at(b)}}}function fs(r,o=!1){var _=r.first;for(r.first=r.last=null;_!==null;){const w=_.ac;w!==null&&wi(()=>{w.abort(sr)});var b=_.next;(_.f&pr)!==0?_.parent=null:Ne(_,o),_=b}}function Da(r){for(var o=r.first;o!==null;){var _=o.next;(o.f&vt)===0&&Ne(o),o=_}}function Ne(r,o=!0){var _=!1;(o||(r.f&Mo)!==0)&&r.nodes!==null&&r.nodes.end!==null&&(Ra(r.nodes.start,r.nodes.end),_=!0),fs(r,o&&!_),Vr(r,0),xe(r,Pt);var b=r.nodes&&r.nodes.t;if(b!==null)for(const k of b)k.stop();xn(r);var w=r.parent;w!==null&&w.first!==null&&En(r),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes=r.ac=null}function Ra(r,o){for(;r!==null;){var _=r===o?null:Qr(r);r.remove(),r=_}}function En(r){var o=r.parent,_=r.prev,b=r.next;_!==null&&(_.next=b),b!==null&&(b.prev=_),o!==null&&(o.first===r&&(o.first=b),o.last===r&&(o.last=_))}function fr(r,o,_=!0){var b=[];kn(r,b,!0);var w=()=>{_&&Ne(r),o&&o()},k=b.length;if(k>0){var E=()=>--k||w();for(var n of b)n.out(E)}else w()}function kn(r,o,_){if((r.f&tt)===0){r.f^=tt;var b=r.nodes&&r.nodes.t;if(b!==null)for(const n of b)(n.is_global||_)&&o.push(n);for(var w=r.first;w!==null;){var k=w.next,E=(w.f&_r)!==0||(w.f&vt)!==0&&(r.f&Qt)!==0;kn(w,o,E?_:!1),w=k}}}function _s(r){Ln(r,!0)}function Ln(r,o){if((r.f&tt)!==0){r.f^=tt,(r.f&Ie)===0&&(xe(r,Ue),dt(r));for(var _=r.first;_!==null;){var b=_.next,w=(_.f&_r)!==0||(_.f&vt)!==0;Ln(_,w?o:!1),_=b}var k=r.nodes&&r.nodes.t;if(k!==null)for(const E of k)(E.is_global||o)&&E.in()}}function Dn(r,o){if(r.nodes)for(var _=r.nodes.start,b=r.nodes.end;_!==null;){var w=_===b?null:Qr(_);o.append(_),_=w}}let ui=!1,Yt=!1;function As(r){Yt=r}let fe=null,ft=!1;function at(r){fe=r}let ve=null;function kt(r){ve=r}let ot=null;function Rn(r){fe!==null&&(ot===null?ot=[r]:ot.push(r))}let qe=null,Ze=0,it=null;function Aa(r){it=r}let An=1,or=0,Ht=or;function Ts(r){Ht=r}function Tn(){return++An}function ri(r){var o=r.f;if((o&Ue)!==0)return!0;if(o&We&&(r.f&=~vr),(o&_t)!==0){for(var _=r.deps,b=_.length,w=0;w<b;w++){var k=_[w];if(ri(k)&&fn(k),k.wv>r.wv)return!0}(o&nt)!==0&&He===null&&xe(r,Ie)}return!1}function Bn(r,o,_=!0){var b=r.reactions;if(b!==null&&!(ot!==null&&Rr.call(ot,r)))for(var w=0;w<b.length;w++){var k=b[w];(k.f&We)!==0?Bn(k,o,!1):o===k&&(_?xe(k,Ue):(k.f&Ie)!==0&&xe(k,_t),dt(k))}}function Mn(r){var h;var o=qe,_=Ze,b=it,w=fe,k=ot,E=Xe,n=ft,a=Ht,c=r.f;qe=null,Ze=0,it=null,fe=(c&(vt|pr))===0?r:null,ot=null,Ar(r.ctx),ft=!1,Ht=++or,r.ac!==null&&(wi(()=>{r.ac.abort(sr)}),r.ac=null);try{r.f|=Wi;var f=r.fn,l=f();r.f|=Hr;var d=r.deps,p=de==null?void 0:de.is_fork;if(qe!==null){var g;if(p||Vr(r,Ze),d!==null&&Ze>0)for(d.length=Ze+qe.length,g=0;g<qe.length;g++)d[Ze+g]=qe[g];else r.deps=d=qe;if(us()&&(r.f&nt)!==0)for(g=Ze;g<d.length;g++)((h=d[g]).reactions??(h.reactions=[])).push(r)}else!p&&d!==null&&Ze<d.length&&(Vr(r,Ze),d.length=Ze);if(tn()&&it!==null&&!ft&&d!==null&&(r.f&(We|_t|Ue))===0)for(g=0;g<it.length;g++)Bn(it[g],r);if(w!==null&&w!==r){if(or++,w.deps!==null)for(let t=0;t<_;t+=1)w.deps[t].rv=or;if(o!==null)for(const t of o)t.rv=or;it!==null&&(b===null?b=it:b.push(...it))}return(r.f&qt)!==0&&(r.f^=qt),l}catch(t){return sn(t)}finally{r.f^=Wi,qe=o,Ze=_,it=b,fe=w,ot=k,Ar(E),ft=n,Ht=a}}function Ta(r,o){let _=o.reactions;if(_!==null){var b=ko.call(_,r);if(b!==-1){var w=_.length-1;w===0?_=o.reactions=null:(_[b]=_[w],_.pop())}}if(_===null&&(o.f&We)!==0&&(qe===null||!Rr.call(qe,o))){var k=o;(k.f&nt)!==0&&(k.f^=nt,k.f&=~vr),cs(k),_a(k),Vr(k,0)}}function Vr(r,o){var _=r.deps;if(_!==null)for(var b=o;b<_.length;b++)Ta(r,_[b])}function Or(r){var o=r.f;if((o&Pt)===0){xe(r,Ie);var _=ve,b=ui;ve=r,ui=!0;try{(o&(Qt|os))!==0?Da(r):fs(r),xn(r);var w=Mn(r);r.teardown=typeof w=="function"?w:null,r.wv=An;var k;Fi&&Yo&&(r.f&Ue)!==0&&r.deps}finally{ui=b,ve=_}}}async function Ba(){await Promise.resolve(),ea()}function D(r){var o=r.f,_=(o&We)!==0;if(fe!==null&&!ft){var b=ve!==null&&(ve.f&Pt)!==0;if(!b&&(ot===null||!Rr.call(ot,r))){var w=fe.deps;if((fe.f&Wi)!==0)r.rv<or&&(r.rv=or,qe===null&&w!==null&&w[Ze]===r?Ze++:qe===null?qe=[r]:qe.push(r));else{(fe.deps??(fe.deps=[])).push(r);var k=r.reactions;k===null?r.reactions=[fe]:Rr.call(k,fe)||k.push(fe)}}}if(Yt&&Gt.has(r))return Gt.get(r);if(_){var E=r;if(Yt){var n=E.v;return((E.f&Ie)===0&&E.reactions!==null||Pn(E))&&(n=hs(E)),Gt.set(E,n),n}var a=(E.f&nt)===0&&!ft&&fe!==null&&(ui||(fe.f&nt)!==0),c=(E.f&Hr)===0;ri(E)&&(a&&(E.f|=nt),fn(E)),a&&!c&&(_n(E),On(E))}if(He!=null&&He.has(r))return He.get(r);if((r.f&qt)!==0)throw r.v;return r.v}function On(r){if(r.f|=nt,r.deps!==null)for(const o of r.deps)(o.reactions??(o.reactions=[])).push(r),(o.f&We)!==0&&(o.f&nt)===0&&(_n(o),On(o))}function Pn(r){if(r.v===Pe)return!0;if(r.deps===null)return!1;for(const o of r.deps)if(Gt.has(o)||(o.f&We)!==0&&Pn(o))return!0;return!1}function er(r){var o=ft;try{return ft=!0,r()}finally{ft=o}}const ar=Symbol("events"),In=new Set,Yi=new Set;function Hn(r,o,_,b={}){function w(k){if(b.capture||Zi.call(o,k),!k.cancelBubble)return wi(()=>_==null?void 0:_.call(this,k))}return r.startsWith("pointer")||r.startsWith("touch")||r==="wheel"?Et(()=>{o.addEventListener(r,w,b)}):o.addEventListener(r,w,b),w}function ii(r,o,_,b,w){var k={capture:b,passive:w},E=Hn(r,o,_,k);(o===document.body||o===window||o===document||o instanceof HTMLMediaElement)&&ds(()=>{o.removeEventListener(r,E,k)})}function we(r,o,_){(o[ar]??(o[ar]={}))[r]=_}function pt(r){for(var o=0;o<r.length;o++)In.add(r[o]);for(var _ of Yi)_(r)}let Bs=null;function Zi(r){var t,i;var o=this,_=o.ownerDocument,b=r.type,w=((t=r.composedPath)==null?void 0:t.call(r))||[],k=w[0]||r.target;Bs=r;var E=0,n=Bs===r&&r[ar];if(n){var a=w.indexOf(n);if(a!==-1&&(o===document||o===window)){r[ar]=o;return}var c=w.indexOf(o);if(c===-1)return;a<=c&&(E=a)}if(k=w[E]||r.target,k!==o){Lo(r,"currentTarget",{configurable:!0,get(){return k||_}});var f=fe,l=ve;at(null),kt(null);try{for(var d,p=[];k!==null;){var g=k.assignedSlot||k.parentNode||k.host||null;try{var h=(i=k[ar])==null?void 0:i[b];h!=null&&(!k.disabled||r.target===k)&&h.call(k,r)}catch(e){d?p.push(e):d=e}if(r.cancelBubble||g===o||g===null)break;k=g}if(d){for(let e of p)queueMicrotask(()=>{throw e});throw d}}finally{r[ar]=o,delete r.currentTarget,at(f),kt(l)}}}var Vs;const Di=((Vs=globalThis==null?void 0:globalThis.window)==null?void 0:Vs.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:r=>r});function Ma(r){return(Di==null?void 0:Di.createHTML(r))??r}function Fn(r){var o=wa("template");return o.innerHTML=Ma(r.replaceAll("<!>","<!---->")),o.content}function Gr(r,o){var _=ve;_.nodes===null&&(_.nodes={start:r,end:o,a:null,t:null})}function ee(r,o){var _=(o&yo)!==0,b=(o&xo)!==0,w,k=!r.startsWith("<!>");return()=>{w===void 0&&(w=Fn(k?r:"<!>"+r),_||(w=Mr(w)));var E=b||gn?document.importNode(w,!0):w.cloneNode(!0);if(_){var n=Mr(E),a=E.lastChild;Gr(n,a)}else Gr(E,E);return E}}function Oa(r,o,_="svg"){var b=!r.startsWith("<!>"),w=`<${_}>${b?r:"<!>"+r}</${_}>`,k;return()=>{if(!k){var E=Fn(w),n=Mr(E);k=Mr(n)}var a=k.cloneNode(!0);return Gr(a,a),a}}function yi(r,o){return Oa(r,o,"svg")}function Fe(r=""){{var o=It(r+"");return Gr(o,o),o}}function Zt(){var r=document.createDocumentFragment(),o=document.createComment(""),_=It();return r.append(o,_),Gr(o,_),r}function V(r,o){r!==null&&r.before(o)}function Pa(r){return r.endsWith("capture")&&r!=="gotpointercapture"&&r!=="lostpointercapture"}const Ia=["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 Ia.includes(r)}const Fa={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 Na(r){return r=r.toLowerCase(),Fa[r]??r}const Wa=["touchstart","touchmove"];function Ua(r){return Wa.includes(r)}function se(r,o){var _=o==null?"":typeof o=="object"?`${o}`:o;_!==(r.__t??(r.__t=r.nodeValue))&&(r.__t=_,r.nodeValue=`${_}`)}function ja(r,o){return za(r,o)}const ai=new Map;function za(r,{target:o,anchor:_,props:b={},events:w,context:k,intro:E=!0,transformError:n}){Sa();var a=void 0,c=ka(()=>{var f=_??o.appendChild(It());sa(f,{pending:()=>{}},p=>{Re({});var g=Xe;k&&(g.c=k),w&&(b.$$events=w),a=r(p,b)||{},Ae()},n);var l=new Set,d=p=>{for(var g=0;g<p.length;g++){var h=p[g];if(!l.has(h)){l.add(h);var t=Ua(h);for(const s of[o,document]){var i=ai.get(s);i===void 0&&(i=new Map,ai.set(s,i));var e=i.get(h);e===void 0?(s.addEventListener(h,Zi,{passive:t}),i.set(h,1)):i.set(h,e+1)}}}};return d(mi(In)),Yi.add(d),()=>{var t;for(var p of l)for(const i of[o,document]){var g=ai.get(i),h=g.get(p);--h==0?(i.removeEventListener(p,Zi),g.delete(p),g.size===0&&ai.delete(i)):g.set(p,h)}Yi.delete(d),f!==_&&((t=f.parentNode)==null||t.removeChild(f))}});return $a.set(a,c),a}let $a=new WeakMap;var ht,xt,et,ur,Yr,Zr,vi;class vs{constructor(o,_=!0){bt(this,"anchor");he(this,ht,new Map);he(this,xt,new Map);he(this,et,new Map);he(this,ur,new Set);he(this,Yr,!0);he(this,Zr,o=>{if(W(this,ht).has(o)){var _=W(this,ht).get(o),b=W(this,xt).get(_);if(b)_s(b),W(this,ur).delete(_);else{var w=W(this,et).get(_);w&&(W(this,xt).set(_,w.effect),W(this,et).delete(_),w.fragment.lastChild.remove(),this.anchor.before(w.fragment),b=w.effect)}for(const[k,E]of W(this,ht)){if(W(this,ht).delete(k),k===o)break;const n=W(this,et).get(E);n&&(Ne(n.effect),W(this,et).delete(E))}for(const[k,E]of W(this,xt)){if(k===_||W(this,ur).has(k))continue;const n=()=>{if(Array.from(W(this,ht).values()).includes(k)){var c=document.createDocumentFragment();Dn(E,c),c.append(It()),W(this,et).set(k,{effect:E,fragment:c})}else Ne(E);W(this,ur).delete(k),W(this,xt).delete(k)};W(this,Yr)||!b?(W(this,ur).add(k),fr(E,n,!1)):n()}}});he(this,vi,o=>{W(this,ht).delete(o);const _=Array.from(W(this,ht).values());for(const[b,w]of W(this,et))_.includes(b)||(Ne(w.effect),W(this,et).delete(b))});this.anchor=o,ue(this,Yr,_)}ensure(o,_){var b=de,w=bn();if(_&&!W(this,xt).has(o)&&!W(this,et).has(o))if(w){var k=document.createDocumentFragment(),E=It();k.append(E),W(this,et).set(o,{effect:Ve(()=>_(E)),fragment:k})}else W(this,xt).set(o,Ve(()=>_(this.anchor)));if(W(this,ht).set(b,o),w){for(const[n,a]of W(this,xt))n===o?b.unskip_effect(a):b.skip_effect(a);for(const[n,a]of W(this,et))n===o?b.unskip_effect(a.effect):b.skip_effect(a.effect);b.oncommit(W(this,Zr)),b.ondiscard(W(this,vi))}else W(this,Zr).call(this,b)}}ht=new WeakMap,xt=new WeakMap,et=new WeakMap,ur=new WeakMap,Yr=new WeakMap,Zr=new WeakMap,vi=new WeakMap;function ps(r,o,..._){var b=new vs(r);ti(()=>{const w=o()??null;b.ensure(w,w&&(k=>w(k,..._)))},_r)}function gs(r){Xe===null&&Zs(),Nr(()=>{const o=er(r);if(typeof o=="function")return o})}function Ka(r){Xe===null&&Zs(),gs(()=>()=>er(r))}function ne(r,o,_=!1){var b=new vs(r),w=_?_r:0;function k(E,n){b.ensure(E,n)}ti(()=>{var E=!1;o((n,a=0)=>{E=!0,k(a,n)}),E||k(!1,null)},w)}const qa=Symbol("NaN");function Va(r,o,_){var b=new vs(r);ti(()=>{var w=o();w!==w&&(w=qa),b.ensure(w,_)})}function Xr(r,o){return o}function Ga(r,o,_){for(var b=[],w=o.length,k,E=o.length,n=0;n<w;n++){let l=o[n];fr(l,()=>{if(k){if(k.pending.delete(l),k.done.add(l),k.pending.size===0){var d=r.outrogroups;Qi(mi(k.done)),d.delete(k),d.size===0&&(r.outrogroups=null)}}else E-=1},!1)}if(E===0){var a=b.length===0&&_!==null;if(a){var c=_,f=c.parentNode;ba(f),f.append(c),r.items.clear()}Qi(o,!a)}else k={pending:new Set(o),done:new Set},(r.outrogroups??(r.outrogroups=new Set)).add(k)}function Qi(r,o=!0){for(var _=0;_<r.length;_++)Ne(r[_],o)}var Ms;function Ge(r,o,_,b,w,k=null){var E=r,n=new Map,a=(o&Gs)!==0;if(a){var c=r;E=c.appendChild(It())}var f=null,l=dn(()=>{var i=_();return ns(i)?i:i==null?[]:mi(i)}),d,p=!0;function g(){t.fallback=f,Xa(t,d,E,o,b),f!==null&&(d.length===0?(f.f&Ot)===0?_s(f):(f.f^=Ot,$r(f,null,E)):fr(f,()=>{f=null}))}var h=ti(()=>{d=D(l);for(var i=d.length,e=new Set,s=de,u=bn(),m=0;m<i;m+=1){var S=d[m],C=b(S,m),v=p?null:n.get(C);v?(v.v&&Br(v.v,S),v.i&&Br(v.i,m),u&&s.unskip_effect(v.e)):(v=Ja(n,p?E:Ms??(Ms=It()),S,C,m,w,o,_),p||(v.e.f|=Ot),n.set(C,v)),e.add(C)}if(i===0&&k&&!f&&(p?f=Ve(()=>k(E)):(f=Ve(()=>k(Ms??(Ms=It()))),f.f|=Ot)),i>e.size&&Fo(),!p)if(u){for(const[x,T]of n)e.has(x)||s.skip_effect(T.e);s.oncommit(g),s.ondiscard(()=>{})}else g();D(l)}),t={effect:h,items:n,outrogroups:null,fallback:f};p=!1}function Ur(r){for(;r!==null&&(r.f&vt)===0;)r=r.next;return r}function Xa(r,o,_,b,w){var T,M,O,A,H,I,N,U,$;var k=(b&go)!==0,E=o.length,n=r.items,a=Ur(r.effect.first),c,f=null,l,d=[],p=[],g,h,t,i;if(k)for(i=0;i<E;i+=1)g=o[i],h=w(g,i),t=n.get(h).e,(t.f&Ot)===0&&((M=(T=t.nodes)==null?void 0:T.a)==null||M.measure(),(l??(l=new Set)).add(t));for(i=0;i<E;i+=1){if(g=o[i],h=w(g,i),t=n.get(h).e,r.outrogroups!==null)for(const y of r.outrogroups)y.pending.delete(t),y.done.delete(t);if((t.f&Ot)!==0)if(t.f^=Ot,t===a)$r(t,null,_);else{var e=f?f.next:a;t===r.effect.last&&(r.effect.last=t.prev),t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),Wt(r,f,t),Wt(r,t,e),$r(t,e,_),f=t,d=[],p=[],a=Ur(f.next);continue}if((t.f&tt)!==0&&(_s(t),k&&((A=(O=t.nodes)==null?void 0:O.a)==null||A.unfix(),(l??(l=new Set)).delete(t))),t!==a){if(c!==void 0&&c.has(t)){if(d.length<p.length){var s=p[0],u;f=s.prev;var m=d[0],S=d[d.length-1];for(u=0;u<d.length;u+=1)$r(d[u],s,_);for(u=0;u<p.length;u+=1)c.delete(p[u]);Wt(r,m.prev,S.next),Wt(r,f,m),Wt(r,S,s),a=s,f=S,i-=1,d=[],p=[]}else c.delete(t),$r(t,a,_),Wt(r,t.prev,t.next),Wt(r,t,f===null?r.effect.first:f.next),Wt(r,f,t),f=t;continue}for(d=[],p=[];a!==null&&a!==t;)(c??(c=new Set)).add(a),p.push(a),a=Ur(a.next);if(a===null)continue}(t.f&Ot)===0&&d.push(t),f=t,a=Ur(t.next)}if(r.outrogroups!==null){for(const y of r.outrogroups)y.pending.size===0&&(Qi(mi(y.done)),(H=r.outrogroups)==null||H.delete(y));r.outrogroups.size===0&&(r.outrogroups=null)}if(a!==null||c!==void 0){var C=[];if(c!==void 0)for(t of c)(t.f&tt)===0&&C.push(t);for(;a!==null;)(a.f&tt)===0&&a!==r.fallback&&C.push(a),a=Ur(a.next);var v=C.length;if(v>0){var x=(b&Gs)!==0&&E===0?_:null;if(k){for(i=0;i<v;i+=1)(N=(I=C[i].nodes)==null?void 0:I.a)==null||N.measure();for(i=0;i<v;i+=1)($=(U=C[i].nodes)==null?void 0:U.a)==null||$.fix()}Ga(r,C,x)}}k&&Et(()=>{var y,R;if(l!==void 0)for(t of l)(R=(y=t.nodes)==null?void 0:y.a)==null||R.apply()})}function Ja(r,o,_,b,w,k,E,n){var a=(E&vo)!==0?(E&mo)===0?va(_,!1,!1):Jt(_):null,c=(E&po)!==0?Jt(w):null;return{v:a,i:c,e:Ve(()=>(k(o,a??_,c??w,n),()=>{r.delete(b)}))}}function $r(r,o,_){if(r.nodes)for(var b=r.nodes.start,w=r.nodes.end,k=o&&(o.f&Ot)===0?o.nodes.start:_;b!==null;){var E=Qr(b);if(k.before(b),b===w)return;b=E}}function Wt(r,o,_){o===null?r.effect.first=_:o.next=_,_===null?r.effect.last=o:_.prev=o}function Ya(r,o,_){ei(()=>{var b=er(()=>o(r,_==null?void 0:_())||{});if(b!=null&&b.destroy)return()=>b.destroy()})}function Za(r,o){var _=void 0,b;yn(()=>{_!==(_=o())&&(b&&(Ne(b),b=null),_&&(b=Ve(()=>{ei(()=>_(r))})))})}function Nn(r){var o,_,b="";if(typeof r=="string"||typeof r=="number")b+=r;else if(typeof r=="object")if(Array.isArray(r)){var w=r.length;for(o=0;o<w;o++)r[o]&&(_=Nn(r[o]))&&(b&&(b+=" "),b+=_)}else for(_ in r)r[_]&&(b&&(b+=" "),b+=_);return b}function Qa(){for(var r,o,_=0,b="",w=arguments.length;_<w;_++)(r=arguments[_])&&(o=Nn(r))&&(b&&(b+=" "),b+=o);return b}function Wn(r){return typeof r=="object"?Qa(r):r??""}const Os=[...`
2
+ \r\f \v\uFEFF`];function el(r,o,_){var b=r==null?"":""+r;if(o&&(b=b?b+" "+o:o),_){for(var w of Object.keys(_))if(_[w])b=b?b+" "+w:w;else if(b.length)for(var k=w.length,E=0;(E=b.indexOf(w,E))>=0;){var n=E+k;(E===0||Os.includes(b[E-1]))&&(n===b.length||Os.includes(b[n]))?b=(E===0?"":b.substring(0,E))+b.substring(n+1):E=n}}return b===""?null:b}function Ps(r,o=!1){var _=o?" !important;":";",b="";for(var w of Object.keys(r)){var k=r[w];k!=null&&k!==""&&(b+=" "+w+": "+k+_)}return b}function Ri(r){return r[0]!=="-"||r[1]!=="-"?r.toLowerCase():r}function tl(r,o){if(o){var _="",b,w;if(Array.isArray(o)?(b=o[0],w=o[1]):b=o,r){r=String(r).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var k=!1,E=0,n=!1,a=[];b&&a.push(...Object.keys(b).map(Ri)),w&&a.push(...Object.keys(w).map(Ri));var c=0,f=-1;const h=r.length;for(var l=0;l<h;l++){var d=r[l];if(n?d==="/"&&r[l-1]==="*"&&(n=!1):k?k===d&&(k=!1):d==="/"&&r[l+1]==="*"?n=!0:d==='"'||d==="'"?k=d:d==="("?E++:d===")"&&E--,!n&&k===!1&&E===0){if(d===":"&&f===-1)f=l;else if(d===";"||l===h-1){if(f!==-1){var p=Ri(r.substring(c,f).trim());if(!a.includes(p)){d!==";"&&l++;var g=r.substring(c,l).trim();_+=" "+g+";"}}c=l+1,f=-1}}}}return b&&(_+=Ps(b)),w&&(_+=Ps(w,!0)),_=_.trim(),_===""?null:_}return r==null?null:String(r)}function Me(r,o,_,b,w,k){var E=r.__className;if(E!==_||E===void 0){var n=el(_,b,k);n==null?r.removeAttribute("class"):o?r.className=n:r.setAttribute("class",n),r.__className=_}else if(k&&w!==k)for(var a in k){var c=!!k[a];(w==null||c!==!!w[a])&&r.classList.toggle(a,c)}return k}function Ai(r,o={},_,b){for(var w in _){var k=_[w];o[w]!==k&&(_[w]==null?r.style.removeProperty(w):r.style.setProperty(w,k,b))}}function Jr(r,o,_,b){var w=r.__style;if(w!==o){var k=tl(o,b);k==null?r.removeAttribute("style"):r.style.cssText=k,r.__style=o}else b&&(Array.isArray(b)?(Ai(r,_==null?void 0:_[0],b[0]),Ai(r,_==null?void 0:_[1],b[1],"important")):Ai(r,_,b));return b}function es(r,o,_=!1){if(r.multiple){if(o==null)return;if(!ns(o))return Go();for(var b of r.options)b.selected=o.includes(Is(b));return}for(b of r.options){var w=Is(b);if(ma(w,o)){b.selected=!0;return}}(!_||o!==void 0)&&(r.selectedIndex=-1)}function rl(r){var o=new MutationObserver(()=>{es(r,r.__value)});o.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),ds(()=>{o.disconnect()})}function Is(r){return"__value"in r?r.__value:r.value}const jr=Symbol("class"),zr=Symbol("style"),Un=Symbol("is custom element"),jn=Symbol("is html"),il=ls?"option":"OPTION",sl=ls?"select":"SELECT",nl=ls?"progress":"PROGRESS";function Hs(r,o){var _=xi(r);_.value===(_.value=o??void 0)||r.value===o&&(o!==0||r.nodeName!==nl)||(r.value=o??"")}function ts(r,o){var _=xi(r);_.checked!==(_.checked=o??void 0)&&(r.checked=o)}function ol(r,o){o?r.hasAttribute("selected")||r.setAttribute("selected",""):r.removeAttribute("selected")}function ye(r,o,_,b){var w=xi(r);w[o]!==(w[o]=_)&&(o==="loading"&&(r[Io]=_),_==null?r.removeAttribute(o):typeof _!="string"&&$n(r).includes(o)?r[o]=_:r.setAttribute(o,_))}function al(r,o,_,b,w=!1,k=!1){var E=xi(r),n=E[Un],a=!E[jn],c=o||{},f=r.nodeName===il;for(var l in o)l in _||(_[l]=null);_.class?_.class=Wn(_.class):_[jr]&&(_.class=null),_[zr]&&(_.style??(_.style=null));var d=$n(r);for(const u in _){let m=_[u];if(f&&u==="value"&&m==null){r.value=r.__value="",c[u]=m;continue}if(u==="class"){var p=r.namespaceURI==="http://www.w3.org/1999/xhtml";Me(r,p,m,b,o==null?void 0:o[jr],_[jr]),c[u]=m,c[jr]=_[jr];continue}if(u==="style"){Jr(r,m,o==null?void 0:o[zr],_[zr]),c[u]=m,c[zr]=_[zr];continue}var g=c[u];if(!(m===g&&!(m===void 0&&r.hasAttribute(u)))){c[u]=m;var h=u[0]+u[1];if(h!=="$$")if(h==="on"){const S={},C="$$"+u;let v=u.slice(2);var t=Ha(v);if(Pa(v)&&(v=v.slice(0,-7),S.capture=!0),!t&&g){if(m!=null)continue;r.removeEventListener(v,c[C],S),c[C]=null}if(t)we(v,r,m),pt([v]);else if(m!=null){let x=function(T){c[u].call(this,T)};var s=x;c[C]=Hn(v,r,x,S)}}else if(u==="style")ye(r,u,m);else if(u==="autofocus")Ca(r,!!m);else if(!n&&(u==="__value"||u==="value"&&m!=null))r.value=r.__value=m;else if(u==="selected"&&f)ol(r,m);else{var i=u;a||(i=Na(i));var e=i==="defaultValue"||i==="defaultChecked";if(m==null&&!n&&!e)if(E[u]=null,i==="value"||i==="checked"){let S=r;const C=o===void 0;if(i==="value"){let v=S.defaultValue;S.removeAttribute(i),S.defaultValue=v,S.value=S.__value=C?v:null}else{let v=S.defaultChecked;S.removeAttribute(i),S.defaultChecked=v,S.checked=C?v:!1}}else r.removeAttribute(u);else e||d.includes(i)&&(n||typeof m!="string")?(r[i]=m,i in E&&(E[i]=Pe)):typeof m!="function"&&ye(r,i,m)}}}return c}function zn(r,o,_=[],b=[],w=[],k,E=!1,n=!1){un(w,_,b,a=>{var c=void 0,f={},l=r.nodeName===sl,d=!1;if(yn(()=>{var g=o(...a.map(D)),h=al(r,c,g,k,E,n);d&&l&&"value"in g&&es(r,g.value);for(let i of Object.getOwnPropertySymbols(f))g[i]||Ne(f[i]);for(let i of Object.getOwnPropertySymbols(g)){var t=g[i];i.description===Eo&&(!c||t!==c[i])&&(f[i]&&Ne(f[i]),f[i]=Ve(()=>Za(r,()=>t))),h[i]=t}c=h}),l){var p=r;ei(()=>{es(p,c.value,!0),rl(p)})}d=!0})}function xi(r){return r.__attributes??(r.__attributes={[Un]:r.nodeName.includes("-"),[jn]:r.namespaceURI===Xs})}var Fs=new Map;function $n(r){var o=r.getAttribute("is")||r.nodeName,_=Fs.get(o);if(_)return _;Fs.set(o,_=[]);for(var b,w=r,k=Element.prototype;k!==w;){b=Do(w);for(var E in b)b[E].set&&_.push(E);w=Js(w)}return _}function rs(r,o,_=o){var b=new WeakSet;wn(r,"input",async w=>{var k=w?r.defaultValue:r.value;if(k=Ti(r)?Bi(k):k,_(k),de!==null&&b.add(de),await Ba(),k!==(k=o())){var E=r.selectionStart,n=r.selectionEnd,a=r.value.length;if(r.value=k??"",n!==null){var c=r.value.length;E===n&&n===a&&c>a?(r.selectionStart=c,r.selectionEnd=c):(r.selectionStart=E,r.selectionEnd=Math.min(n,c))}}}),er(o)==null&&r.value&&(_(Ti(r)?Bi(r.value):r.value),de!==null&&b.add(de)),Ci(()=>{var w=o();if(r===document.activeElement){var k=Ui??de;if(b.has(k))return}Ti(r)&&w===Bi(r.value)||r.type==="date"&&!w&&!r.value||w!==r.value&&(r.value=w??"")})}function ll(r,o,_=o){wn(r,"change",b=>{var w=b?r.defaultChecked:r.checked;_(w)}),er(o)==null&&_(r.checked),Ci(()=>{var b=o();r.checked=!!b})}function Ti(r){var o=r.type;return o==="number"||o==="range"}function Bi(r){return r===""?null:+r}function Ns(r,o){return r===o||(r==null?void 0:r[dr])===o}function Ei(r={},o,_,b){return ei(()=>{var w,k;return Ci(()=>{w=k,k=[],er(()=>{r!==_(...k)&&(o(r,...k),w&&Ns(_(...w),r)&&o(null,...w))})}),()=>{Et(()=>{k&&Ns(_(...k),r)&&o(null,...k)})}}),r}let li=!1;function cl(r){var o=li;try{return li=!1,[r(),li]}finally{li=o}}const hl={get(r,o){if(!r.exclude.includes(o))return r.props[o]},set(r,o){return!1},getOwnPropertyDescriptor(r,o){if(!r.exclude.includes(o)&&o in r.props)return{enumerable:!0,configurable:!0,value:r.props[o]}},has(r,o){return r.exclude.includes(o)?!1:o in r.props},ownKeys(r){return Reflect.ownKeys(r.props).filter(o=>!r.exclude.includes(o))}};function Kn(r,o,_){return new Proxy({props:r,exclude:o},hl)}function Ee(r,o,_,b){var e;var w=(_&wo)!==0,k=(_&Co)!==0,E=b,n=!0,a=()=>(n&&(n=!1,E=k?er(b):b),E),c;if(w){var f=dr in r||Po in r;c=((e=mr(r,o))==null?void 0:e.set)??(f&&o in r?s=>r[o]=s:void 0)}var l,d=!1;w?[l,d]=cl(()=>r[o]):l=r[o],l===void 0&&b!==void 0&&(l=a(),c&&(zo(),c(l)));var p;if(p=()=>{var s=r[o];return s===void 0?a():(n=!0,s)},(_&bo)===0)return p;if(c){var g=r.$$legacy;return(function(s,u){return arguments.length>0?((!u||g||d)&&c(u?p():s),s):p()})}var h=!1,t=((_&So)!==0?bi:dn)(()=>(h=!1,p()));w&&D(t);var i=ve;return(function(s,u){if(arguments.length>0){const m=u?D(t):w?Le(s):s;return q(t,m),h=!0,E!==void 0&&(E=m),s}return Yt&&h||(i.f&Pt)!==0?t.v:D(t)})}const di="wt-ssh-host";function ms(r){return r.repo?`${r.repo} #${r.number}`:`PR #${r.number}`}function Sr(r){return r instanceof Error?r.message:String(r)}var ul=ee('<a target="_blank" rel="noopener"> </a>'),dl=ee("<span> </span>");function qn(r,o){Re(o,!0);let _=Ee(o,"clickable",3,!1);function b(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=me(()=>ms(o.pr));var k=Zt(),E=De(k);{var n=c=>{var f=ul(),l=G(f);oe(d=>{ye(f,"href",o.pr.url),Me(f,1,`shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded-full no-underline hover:opacity-80 ${d??""}`),se(l,D(w))},[()=>b(o.pr.state)]),V(c,f)},a=c=>{var f=dl(),l=G(f);oe(d=>{Me(f,1,`shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded-full ${d??""}`),se(l,D(w))},[()=>b(o.pr.state)]),V(c,f)};ne(E,c=>{_()&&o.pr.url?c(n):c(a,!1)})}V(r,k),Ae()}var fl=ee('<a target="_blank" rel="noopener noreferrer" class="shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded-full no-underline hover:opacity-80"> </a>');function Vn(r,o){Re(o,!0);var _=fl(),b=G(_);oe(()=>{ye(_,"href",o.issue.url),Jr(_,`color: ${o.issue.state.color??""}; background: ${o.issue.state.color??""}20;`),ye(_,"title",`${o.issue.identifier??""} (${o.issue.state.name??""})`),se(b,o.issue.identifier)}),V(r,_),Ae()}var _l=yi('<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>'),vl=yi('<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>'),pl=yi('<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>'),gl=yi('<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>'),ml=ee("<span><!> </span>");function Sl(r,o){const _=f=>{var l=Zt(),d=De(l);{var p=i=>{var e=_l();oe(()=>{ye(e,"width",b()),ye(e,"height",b())}),V(i,e)},g=i=>{var e=vl();oe(()=>{ye(e,"width",b()),ye(e,"height",b())}),V(i,e)},h=i=>{var e=pl();oe(()=>{ye(e,"width",b()),ye(e,"height",b())}),V(i,e)},t=i=>{var e=gl();oe(()=>{ye(e,"width",b()),ye(e,"height",b())}),V(i,e)};ne(d,i=>{o.status==="working"?i(p):o.status==="waiting"?i(g,1):o.status==="done"?i(h,2):o.status==="error"&&i(t,3)})}V(f,l)};let b=Ee(o,"size",3,10),w=Ee(o,"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 E=Zt(),n=De(E);{var a=f=>{var l=ml(),d=G(l);_(d);var p=X(d);oe(g=>{Me(l,1,`text-xs px-2 py-0.5 rounded-xl flex items-center gap-1 ${g??""}`),se(p,` ${(o.status||"idle")??""}`)},[()=>k(o.status)]),V(f,l)},c=f=>{_(f)};ne(n,f=>{w()?f(a):f(c,!1)})}V(r,E)}var bl=ee('<span class="shrink-0 w-2 h-2 rounded-full bg-accent"></span>'),wl=ee("<span> </span>"),Cl=ee("<span> </span>"),yl=ee("<span> </span>"),xl=ee('<span class="flex gap-2 text-[11px] text-muted font-mono"></span>'),El=ee('<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>'),kl=ee('<ul class="list-none overflow-y-auto flex-1 p-2"></ul>');function Ll(r,o){Re(o,!0);var _=kl();Ge(_,21,()=>o.worktrees,b=>b.branch,(b,w)=>{const k=me(()=>D(w).branch===o.selected),E=me(()=>o.removing.has(D(w).branch));var n=El(),a=G(n),c=G(a),f=G(c),l=G(f),d=G(l),p=X(l,2),g=G(p);Sl(g,{get status(){return D(w).agent},size:14});var h=X(p,2);{var t=A=>{var H=bl();V(A,H)},i=me(()=>o.notifiedBranches.has(D(w).branch));ne(h,A=>{D(i)&&A(t)})}var e=X(f,2);Ge(e,17,()=>D(w).prs,A=>A.repo,(A,H)=>{qn(A,{get pr(){return D(H)}})});var s=X(e,2);{var u=A=>{Vn(A,{get issue(){return D(w).linearIssue}})};ne(s,A=>{D(w).linearIssue&&A(u)})}var m=X(c,2),S=G(m);{var C=A=>{var H=wl(),I=G(H);oe(()=>se(I,D(w).agentName)),V(A,H)};ne(S,A=>{D(w).agentName&&A(C)})}var v=X(S,2);{var x=A=>{var H=Cl(),I=G(H);oe(()=>se(I,D(w).profile)),V(A,H)};ne(v,A=>{D(w).profile&&A(x)})}var T=X(m,2);{var M=A=>{var H=xl();Ge(H,21,()=>D(w).services,Xr,(I,N)=>{var U=Zt(),$=De(U);{var y=R=>{var B=yl(),P=G(B);oe(()=>{Me(B,1,Wn(D(N).running?"text-success":"")),se(P,`${D(N).name??""}:${D(N).port??""}`)}),V(R,B)};ne($,R=>{D(N).port&&R(y)})}V(I,U)}),V(A,H)};ne(T,A=>{D(w).services.length>0&&A(M)})}var O=X(a,2);oe(()=>{Me(n,1,`mb-0.5 group relative ${D(E)?"opacity-40 pointer-events-none":""}`),Me(a,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 ${D(k)?"bg-active border-accent":"border-transparent"}`),se(d,D(w).branch)}),we("click",a,()=>o.onselect(D(w).branch)),we("click",O,A=>{A.stopPropagation(),o.onremove(D(w).branch)}),V(b,n)}),V(r,_),Ae()}pt(["click"]);var Dl=ee('<button type="button" title="View CI checks"><span></span> CI</button>');function Rl(r,o){Re(o,!0);function _(E){return E==="failed"?"bg-danger/20 text-danger":E==="success"?"bg-success/20 text-success":E==="pending"?"bg-warning/20 text-warning":"bg-muted/20 text-muted"}function b(E){return E==="failed"?"bg-danger":E==="success"?"bg-success":E==="pending"?"bg-warning animate-pulse":"bg-muted"}var w=Dl(),k=G(w);oe((E,n)=>{Me(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 ${E??""}`),Me(k,1,`inline-block w-1.5 h-1.5 rounded-full ${n??""}`)},[()=>_(o.pr.ciStatus),()=>b(o.pr.ciStatus)]),we("click",w,E=>{E.stopPropagation(),o.onclick(o.pr)}),V(r,w),Ae()}pt(["click"]);var Al=ee('<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 Tl(r,o){Re(o,!0);var _=Al(),b=X(G(_));oe(()=>se(b,` ${o.pr.comments.length??""} ${o.pr.comments.length===1?"comment":"comments"}`)),we("click",_,w=>{w.stopPropagation(),o.onclick(o.pr)}),V(r,_),Ae()}pt(["click"]);var Bl=ee("<button><!></button>");function je(r,o){let _=Ee(o,"variant",3,"default"),b=Ee(o,"small",3,!1),w=Ee(o,"class",3,""),k=Kn(o,["$$slots","$$events","$$legacy","variant","small","class","children"]);const E={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 a=Bl();zn(a,()=>({class:`rounded-md border cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed ${E[b()?"small":"normal"]??""} ${n[_()]??""} ${w()??""}`,...k}));var c=G(a);ps(c,()=>o.children),V(r,a)}var Ml=ee('<span class="text-success">&#10003;</span>'),Ol=ee('<span class="text-accent">&#9741;</span>'),Pl=ee('<span class="text-[10px] text-muted"> </span>'),Il=ee('<span class="text-xs text-accent truncate"> </span>'),Hl=ee('<span><!></span> <span class="flex flex-col gap-0.5 min-w-0"><span> </span> <!></span>',1);function Gn(r,o){Re(o,!0);let _=Ee(o,"showTimestamp",3,!1),b=Ee(o,"large",3,!1);var w=Hl(),k=De(w),E=G(k);{var n=h=>{var t=Ml();V(h,t)},a=h=>{var t=Ol();V(h,t)};ne(E,h=>{o.notification.type==="agent_stopped"?h(n):h(a,!1)})}var c=X(k,2),f=G(c),l=G(f),d=X(f,2);{var p=h=>{var t=Pl(),i=G(t);oe(e=>se(i,e),[()=>new Date(o.notification.timestamp).toLocaleTimeString()]),V(h,t)},g=h=>{var t=Il(),i=G(t);oe(()=>se(i,o.notification.url)),V(h,t)};ne(d,h=>{_()?h(p):o.notification.url&&h(g,1)})}oe(()=>{Me(k,1,`shrink-0 ${b()?"text-base":"text-sm"}`),Me(f,1,`${b()?"text-sm":"text-xs"} text-primary truncate`),se(l,o.notification.message)}),V(r,w),Ae()}var Fl=ee('<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>'),Nl=ee('<span class="text-[10px] px-1.5 py-0.5 rounded border border-warning/40 text-warning">dirty</span>'),Wl=ee("<!> <!> <!>",1),Ul=ee('<a target="_blank" rel="noopener"> </a>'),jl=ee('<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>'),zl=ee("<!> <!>",1),$l=ee("<!> <!>",1),Kl=ee('<span class="absolute -top-0.5 -right-0.5 w-4 h-4 rounded-full bg-accent text-white text-[10px] flex items-center justify-center leading-none"> </span>'),ql=ee('<div class="px-3 py-4 text-xs text-muted text-center">No notifications yet</div>'),Vl=ee('<li><button type="button" class="w-full px-3 py-2 text-left bg-transparent border-none text-inherit cursor-pointer hover:bg-hover flex items-center gap-2"><!></button></li>'),Gl=ee('<ul class="list-none max-h-64 overflow-y-auto"></ul>'),Xl=ee('<div class="bell-dropdown svelte-gwjq7z"><div class="text-xs font-semibold text-muted px-3 py-2 border-b border-edge">Notifications</div> <!></div>'),Jl=ee('<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 class="flex gap-2 items-center"><!> <div class="bell-container relative ml-3"><button type="button" class="relative p-1.5 rounded-md cursor-pointer bg-transparent border border-transparent text-muted hover:text-primary hover:border-edge" title="Notifications"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"></path><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"></path></svg> <!></button> <!></div></div></div>');function Yl(r,o){Re(o,!0);let _=Ee(o,"isMobile",3,!1),b=Ee(o,"notificationHistory",19,()=>[]),w=Ee(o,"unreadCount",3,0),k=ae(!1);function E(){var I;q(k,!D(k)),D(k)&&((I=o.onbellopen)==null||I.call(o))}function n(I){I.target.closest(".bell-container")||q(k,!1)}let a=me(()=>{var N;const I=(N=o.worktree)==null?void 0:N.dir;return I?o.sshHost?`cursor://vscode-remote/ssh-remote+${o.sshHost}${I}`:`cursor://file${I}`:null});var c=Jl();ii("click",Ji,n);var f=G(c),l=G(f);{var d=I=>{var N=Fl();we("click",N,function(...U){var $;($=o.ontogglesidebar)==null||$.apply(this,U)}),V(I,N)};ne(l,I=>{_()&&o.ontogglesidebar&&I(d)})}var p=X(l,2),g=G(p),h=X(p,2);{var t=I=>{var N=Nl();V(I,N)};ne(h,I=>{var N;(N=o.worktree)!=null&&N.dirty&&I(t)})}var i=X(h,2);{var e=I=>{Vn(I,{get issue(){return o.worktree.linearIssue}})};ne(i,I=>{var N;(N=o.worktree)!=null&&N.linearIssue&&I(e)})}var s=X(i,2);Ge(s,17,()=>{var I;return((I=o.worktree)==null?void 0:I.prs)??[]},I=>I.repo,(I,N)=>{var U=Wl(),$=De(U);qn($,{get pr(){return D(N)},clickable:!0});var y=X($,2);{var R=K=>{Rl(K,{get pr(){return D(N)},get onclick(){return o.onciclick}})};ne(y,K=>{D(N).ciChecks&&D(N).ciChecks.length>0&&K(R)})}var B=X(y,2);{var P=K=>{Tl(K,{get pr(){return D(N)},get onclick(){return o.onreviewsclick}})};ne(B,K=>{D(N).comments.length>0&&K(P)})}V(I,U)});var u=X(s,2);{var m=I=>{var N=zl(),U=De(N);Ge(U,17,()=>{var R;return((R=o.worktree)==null?void 0:R.services)??[]},Xr,(R,B)=>{var P=Zt(),K=De(P);{var J=Q=>{var ie=Ul(),F=G(ie);oe(()=>{ye(ie,"href",`${window.location.protocol??""}//${window.location.hostname??""}:${D(B).port??""}`),Me(ie,1,`text-[11px] px-1.5 py-0.5 rounded border font-mono no-underline hover:opacity-80 ${D(B).running?"text-success border-success/40":"text-muted border-edge pointer-events-none"}`),se(F,`${D(B).name??""} :${D(B).port??""}`)}),V(Q,ie)};ne(K,Q=>{D(B).port&&Q(J)})}V(R,P)});var $=X(U,2);{var y=R=>{var B=jl(),P=G(B),K=X(P);oe(()=>ye(P,"href",D(a))),we("click",K,function(...J){var Q;(Q=o.onsettings)==null||Q.apply(this,J)}),V(R,B)};ne($,R=>{D(a)&&R(y)})}V(I,N)};ne(u,I=>{_()||I(m)})}var S=X(f,2),C=G(S);{var v=I=>{var N=$l(),U=De(N);je(U,{variant:"accent-outline",get onclick(){return o.onmerge},title:"Merge worktree",children:(y,R)=>{var B=Fe();oe(()=>se(B,_()?"M":"Merge")),V(y,B)},$$slots:{default:!0}});var $=X(U,2);je($,{variant:"danger-outline",get onclick(){return o.onremove},title:"Remove worktree",children:(y,R)=>{var B=Fe();oe(()=>se(B,_()?"R":"Remove")),V(y,B)},$$slots:{default:!0}}),V(I,N)};ne(C,I=>{o.name&&I(v)})}var x=X(C,2),T=G(x),M=X(G(T),2);{var O=I=>{var N=Kl(),U=G(N);oe(()=>se(U,w()>9?"9+":w())),V(I,N)};ne(M,I=>{w()>0&&I(O)})}var A=X(T,2);{var H=I=>{var N=Xl(),U=X(G(N),2);{var $=R=>{var B=ql();V(R,B)},y=R=>{var B=Gl();Ge(B,21,b,P=>P.id,(P,K)=>{var J=Vl(),Q=G(J),ie=G(Q);Gn(ie,{get notification(){return D(K)},showTimestamp:!0}),we("click",Q,()=>{var F;(F=o.onnotificationselect)==null||F.call(o,D(K).branch),q(k,!1)}),V(P,J)}),V(R,B)};ne(U,R=>{b().length===0?R($):R(y,!1)})}V(I,N)};ne(A,I=>{D(k)&&I(H)})}oe(()=>se(g,o.name??"Select a worktree")),we("keydown",x,()=>{}),we("click",T,E),V(r,c),Ae()}pt(["click","keydown"]);var Mi={exports:{}},Ws;function Zl(){return Ws||(Ws=1,(function(r,o){(function(_,b){r.exports=b()})(globalThis,(()=>(()=>{var _={4567:function(E,n,a){var c=this&&this.__decorate||function(e,s,u,m){var S,C=arguments.length,v=C<3?s:m===null?m=Object.getOwnPropertyDescriptor(s,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,s,u,m);else for(var x=e.length-1;x>=0;x--)(S=e[x])&&(v=(C<3?S(v):C>3?S(s,u,v):S(s,u))||v);return C>3&&v&&Object.defineProperty(s,u,v),v},f=this&&this.__param||function(e,s){return function(u,m){s(u,m,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.AccessibilityManager=void 0;const l=a(9042),d=a(9924),p=a(844),g=a(4725),h=a(2585),t=a(3656);let i=n.AccessibilityManager=class extends p.Disposable{constructor(e,s,u,m){super(),this._terminal=e,this._coreBrowserService=u,this._renderService=m,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let 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,t.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(e){for(let s=0;s<e;s++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
4
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=l.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,s){this._liveRegionDebouncer.refresh(e,s,this._terminal.rows)}_renderRows(e,s){const u=this._terminal.buffer,m=u.lines.length.toString();for(let S=e;S<=s;S++){const C=u.lines.get(u.ydisp+S),v=[],x=(C==null?void 0:C.translateToString(!0,void 0,void 0,v))||"",T=(u.ydisp+S+1).toString(),M=this._rowElements[S];M&&(x.length===0?(M.innerText=" ",this._rowColumns.set(M,[0,1])):(M.textContent=x,this._rowColumns.set(M,v)),M.setAttribute("aria-posinset",T),M.setAttribute("aria-setsize",m))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,s){const u=e.target,m=this._rowElements[s===0?1:this._rowElements.length-2];if(u.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==m)return;let S,C;if(s===0?(S=u,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(S=this._rowElements.shift(),C=u,this._rowContainer.removeChild(S)),S.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){const v=this._createAccessibilityTreeNode();this._rowElements.unshift(v),this._rowContainer.insertAdjacentElement("afterbegin",v)}else{const v=this._createAccessibilityTreeNode();this._rowElements.push(v),this._rowContainer.appendChild(v)}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(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var x;if(this._rowElements.length===0)return;const e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let s={node:e.anchorNode,offset:e.anchorOffset},u={node:e.focusNode,offset:e.focusOffset};if((s.node.compareDocumentPosition(u.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===u.node&&s.offset>u.offset)&&([s,u]=[u,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(u.node.compareDocumentPosition(m)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(u={node:m,offset:((x=m.textContent)==null?void 0:x.length)??0}),!this._rowContainer.contains(u.node))return;const S=({node:T,offset:M})=>{const O=T instanceof Text?T.parentNode:T;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 H=this._rowColumns.get(O);if(!H)return console.warn("columns is null. Race condition?"),null;let I=M<H.length?H[M]:H.slice(-1)[0]+1;return I>=this._terminal.cols&&(++A,I=0),{row:A,column:I}},C=S(s),v=S(u);if(C&&v){if(C.row>v.row||C.row===v.row&&C.column>=v.column)throw new Error("invalid range");this._terminal.select(C.column,C.row,(v.row-C.row)*this._terminal.cols-C.column+v.column)}}_handleResize(e){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>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};n.AccessibilityManager=i=c([f(1,h.IInstantiationService),f(2,g.ICoreBrowserService),f(3,g.IRenderService)],i)},3614:(E,n)=>{function a(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,h){d=c(d=a(d),g.decPrivateModes.bracketedPasteMode&&h.rawOptions.ignoreBracketedPasteMode!==!0),g.triggerDataEvent(d,!0),p.value=""}function l(d,p,g){const h=g.getBoundingClientRect(),t=d.clientX-h.left-10,i=d.clientY-h.top-10;p.style.width="20px",p.style.height="20px",p.style.left=`${t}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=a,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,h){d.stopPropagation(),d.clipboardData&&f(d.clipboardData.getData("text/plain"),p,g,h)},n.paste=f,n.moveTextAreaUnderMouseCursor=l,n.rightClickHandler=function(d,p,g,h,t){l(d,p,g),t&&h.rightClickSelect(d),p.value=h.selectionText,p.select()}},7239:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ColorContrastCache=void 0;const c=a(1505);n.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(f,l,d){this._css.set(f,l,d)}getCss(f,l){return this._css.get(f,l)}setColor(f,l,d){this._color.set(f,l,d)}getColor(f,l){return this._color.get(f,l)}clear(){this._color.clear(),this._css.clear()}}},3656:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.addDisposableDomListener=void 0,n.addDisposableDomListener=function(a,c,f,l){a.addEventListener(c,f,l);let d=!1;return{dispose:()=>{d||(d=!0,a.removeEventListener(c,f,l))}}}},3551:function(E,n,a){var c=this&&this.__decorate||function(i,e,s,u){var m,S=arguments.length,C=S<3?e:u===null?u=Object.getOwnPropertyDescriptor(e,s):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(i,e,s,u);else for(var v=i.length-1;v>=0;v--)(m=i[v])&&(C=(S<3?m(C):S>3?m(e,s,C):m(e,s))||C);return S>3&&C&&Object.defineProperty(e,s,C),C},f=this&&this.__param||function(i,e){return function(s,u){e(s,u,i)}};Object.defineProperty(n,"__esModule",{value:!0}),n.Linkifier=void 0;const l=a(3656),d=a(8460),p=a(844),g=a(2585),h=a(4725);let t=n.Linkifier=class extends p.Disposable{get currentLink(){return this._currentLink}constructor(i,e,s,u,m){super(),this._element=i,this._mouseService=e,this._renderService=s,this._bufferService=u,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,l.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,l.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(i){this._lastMouseEvent=i;const e=this._positionFromMouseEvent(i,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;const s=i.composedPath();for(let u=0;u<s.length;u++){const m=s[u];if(m.classList.contains("xterm"))break;if(m.classList.contains("xterm-hover"))return}this._lastBufferCell&&e.x===this._lastBufferCell.x&&e.y===this._lastBufferCell.y||(this._handleHover(e),this._lastBufferCell=e)}_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,e){var u,m;this._activeProviderReplies&&e||((u=this._activeProviderReplies)==null||u.forEach((S=>{S==null||S.forEach((C=>{C.link.dispose&&C.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=i.y);let s=!1;for(const[S,C]of this._linkProviderService.linkProviders.entries())e?(m=this._activeProviderReplies)!=null&&m.get(S)&&(s=this._checkLinkProviderResult(S,i,s)):C.provideLinks(i.y,(v=>{var T,M;if(this._isMouseOut)return;const x=v==null?void 0:v.map((O=>({link:O})));(T=this._activeProviderReplies)==null||T.set(S,x),s=this._checkLinkProviderResult(S,i,s),((M=this._activeProviderReplies)==null?void 0:M.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(i.y,this._activeProviderReplies)}))}_removeIntersectingLinks(i,e){const s=new Set;for(let u=0;u<e.size;u++){const m=e.get(u);if(m)for(let S=0;S<m.length;S++){const C=m[S],v=C.link.range.start.y<i?0:C.link.range.start.x,x=C.link.range.end.y>i?this._bufferService.cols:C.link.range.end.x;for(let T=v;T<=x;T++){if(s.has(T)){m.splice(S--,1);break}s.add(T)}}}}_checkLinkProviderResult(i,e,s){var S;if(!this._activeProviderReplies)return s;const u=this._activeProviderReplies.get(i);let m=!1;for(let C=0;C<i;C++)this._activeProviderReplies.has(C)&&!this._activeProviderReplies.get(C)||(m=!0);if(!m&&u){const C=u.find((v=>this._linkAtPosition(v.link,e)));C&&(s=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let C=0;C<this._activeProviderReplies.size;C++){const v=(S=this._activeProviderReplies.get(C))==null?void 0:S.find((x=>this._linkAtPosition(x.link,e)));if(v){s=!0,this._handleNewLink(v);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(i){if(!this._currentLink)return;const e=this._positionFromMouseEvent(i,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(i,this._currentLink.link.text)}_clearCurrentLink(i,e){this._currentLink&&this._lastMouseEvent&&(!i||!e||this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=e)&&(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 e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(i.link,e)&&(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,u;return(u=(s=this._currentLink)==null?void 0:s.state)==null?void 0:u.decorations.pointerCursor},set:s=>{var u;(u=this._currentLink)!=null&&u.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,u;return(u=(s=this._currentLink)==null?void 0:s.state)==null?void 0:u.decorations.underline},set:s=>{var u,m,S;(u=this._currentLink)!=null&&u.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 u=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>=u&&this._currentLink.link.range.end.y<=m&&(this._clearCurrentLink(u,m),this._lastMouseEvent)){const S=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);S&&this._askForLink(S,!1)}}))))}_linkHover(i,e,s){var u;(u=this._currentLink)!=null&&u.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&i.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(s,e.text)}_fireUnderlineEvent(i,e){const s=i.range,u=this._bufferService.buffer.ydisp,m=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-u-1,s.end.x,s.end.y-u-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(m)}_linkLeave(i,e,s){var u;(u=this._currentLink)!=null&&u.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&i.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(s,e.text)}_linkAtPosition(i,e){const s=i.range.start.y*this._bufferService.cols+i.range.start.x,u=i.range.end.y*this._bufferService.cols+i.range.end.x,m=e.y*this._bufferService.cols+e.x;return s<=m&&m<=u}_positionFromMouseEvent(i,e,s){const u=s.getCoords(i,e,this._bufferService.cols,this._bufferService.rows);if(u)return{x:u[0],y:u[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(i,e,s,u,m){return{x1:i,y1:e,x2:s,y2:u,cols:this._bufferService.cols,fg:m}}};n.Linkifier=t=c([f(1,h.IMouseService),f(2,h.IRenderService),f(3,g.IBufferService),f(4,h.ILinkProviderService)],t)},9042:(E,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(E,n,a){var c=this&&this.__decorate||function(h,t,i,e){var s,u=arguments.length,m=u<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,i):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(h,t,i,e);else for(var S=h.length-1;S>=0;S--)(s=h[S])&&(m=(u<3?s(m):u>3?s(t,i,m):s(t,i))||m);return u>3&&m&&Object.defineProperty(t,i,m),m},f=this&&this.__param||function(h,t){return function(i,e){t(i,e,h)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkProvider=void 0;const l=a(511),d=a(2585);let p=n.OscLinkProvider=class{constructor(h,t,i){this._bufferService=h,this._optionsService=t,this._oscLinkService=i}provideLinks(h,t){var x;const i=this._bufferService.buffer.lines.get(h-1);if(!i)return void t(void 0);const e=[],s=this._optionsService.rawOptions.linkHandler,u=new l.CellData,m=i.getTrimmedLength();let S=-1,C=-1,v=!1;for(let T=0;T<m;T++)if(C!==-1||i.hasContent(T)){if(i.loadCell(T,u),u.hasExtendedAttrs()&&u.extended.urlId){if(C===-1){C=T,S=u.extended.urlId;continue}v=u.extended.urlId!==S}else C!==-1&&(v=!0);if(v||C!==-1&&T===m-1){const M=(x=this._oscLinkService.getLinkData(S))==null?void 0:x.uri;if(M){const O={start:{x:C+1,y:h},end:{x:T+(v||T!==m-1?0:1),y:h}};let A=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{const H=new URL(M);["http:","https:"].includes(H.protocol)||(A=!0)}catch{A=!0}A||e.push({text:M,range:O,activate:(H,I)=>s?s.activate(H,I,O):g(0,I),hover:(H,I)=>{var N;return(N=s==null?void 0:s.hover)==null?void 0:N.call(s,H,I,O)},leave:(H,I)=>{var N;return(N=s==null?void 0:s.leave)==null?void 0:N.call(s,H,I,O)}})}v=!1,u.hasExtendedAttrs()&&u.extended.urlId?(C=T,S=u.extended.urlId):(C=-1,S=-1)}}t(e)}};function g(h,t){if(confirm(`Do you want to navigate to ${t}?
5
+
6
+ WARNING: This link could potentially be dangerous`)){const i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}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:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.RenderDebouncer=void 0,n.RenderDebouncer=class{constructor(a,c){this._renderCallback=a,this._coreBrowserService=c,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(a){return this._refreshCallbacks.push(a),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(a,c,f){this._rowCount=f,a=a!==void 0?a:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,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 a=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,c),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const a of this._refreshCallbacks)a(0);this._refreshCallbacks=[]}}},3236:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Terminal=void 0;const c=a(3614),f=a(3656),l=a(3551),d=a(9042),p=a(3730),g=a(1680),h=a(3107),t=a(5744),i=a(2950),e=a(1296),s=a(428),u=a(4269),m=a(5114),S=a(8934),C=a(3230),v=a(9312),x=a(4725),T=a(6731),M=a(8055),O=a(8969),A=a(8460),H=a(844),I=a(6114),N=a(8437),U=a(2584),$=a(7399),y=a(5941),R=a(9074),B=a(2585),P=a(5435),K=a(4567),J=a(779);class Q 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(F={}){super(F),this.browser=I,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new H.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(B.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(J.LinkProviderService),this._instantiationService.setService(x.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,Y)=>this.refresh(L,Y)))),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,H.toDisposable)((()=>{var L,Y;this._customKeyEventHandler=void 0,(Y=(L=this.element)==null?void 0:L.parentNode)==null||Y.removeChild(this.element)})))}_handleColorEvent(F){if(this._themeService)for(const L of F){let Y,j="";switch(L.index){case 256:Y="foreground",j="10";break;case 257:Y="background",j="11";break;case 258:Y="cursor",j="12";break;default:Y="ansi",j="4;"+L.index}switch(L.type){case 0:const te=M.color.toColorRGB(Y==="ansi"?this._themeService.colors.ansi[L.index]:this._themeService.colors[Y]);this.coreService.triggerDataEvent(`${U.C0.ESC}]${j};${(0,y.toRgbString)(te)}${U.C1_ESCAPED.ST}`);break;case 1:if(Y==="ansi")this._themeService.modifyColors((Z=>Z.ansi[L.index]=M.channels.toColor(...L.color)));else{const Z=Y;this._themeService.modifyColors((ce=>ce[Z]=M.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(F){F?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(K.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(F){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(U.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var F;return(F=this.textarea)==null?void 0:F.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(U.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 F=this.buffer.ybase+this.buffer.y,L=this.buffer.lines.get(F);if(!L)return;const Y=Math.min(this.buffer.x,this.cols-1),j=this._renderService.dimensions.css.cell.height,te=L.getWidth(Y),Z=this._renderService.dimensions.css.cell.width*te,ce=this.buffer.y*this._renderService.dimensions.css.cell.height,_e=Y*this._renderService.dimensions.css.cell.width;this.textarea.style.left=_e+"px",this.textarea.style.top=ce+"px",this.textarea.style.width=Z+"px",this.textarea.style.height=j+"px",this.textarea.style.lineHeight=j+"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 F=L=>(0,c.handlePasteEvent)(L,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",F)),this.register((0,f.addDisposableDomListener)(this.element,"paste",F)),I.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)}))),I.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",(F=>this._keyUp(F)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(F=>this._keyDown(F)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(F=>this._keyPress(F)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(F=>this._compositionHelper.compositionupdate(F)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(F=>this._inputEvent(F)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(F){var Y;if(!F)throw new Error("Terminal requires a parent element.");if(F.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((Y=this.element)==null?void 0:Y.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=F.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"),F.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",(j=>this.updateCursorStyle(j)))),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),I.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,F.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(x.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(j=>this._handleTextAreaFocus(j)))),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(x.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(T.ThemeService),this._instantiationService.setService(x.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(u.CharacterJoinerService),this._instantiationService.setService(x.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(C.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(x.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((j=>this._onRender.fire(j)))),this.onResize((j=>this._renderService.resize(j.cols,j.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(x.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(l.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((j=>this.scrollLines(j.amount,j.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(v.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(x.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((j=>this.scrollLines(j.amount,j.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((j=>this._renderService.handleSelectionChanged(j.start,j.end,j.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((j=>{this.textarea.value=j,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((j=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(h.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(j=>this._selectionService.handleMouseDown(j)))),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(K.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(j=>this._handleScreenReaderModeOptionChange(j)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(t.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(j=>{!this._overviewRulerRenderer&&j&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(t.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(e.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const F=this,L=this.element;function Y(Z){const ce=F._mouseService.getMouseReportCoords(Z,F.screenElement);if(!ce)return!1;let _e,ge;switch(Z.overrideType||Z.type){case"mousemove":ge=32,Z.buttons===void 0?(_e=3,Z.button!==void 0&&(_e=Z.button<3?Z.button:3)):_e=1&Z.buttons?0:4&Z.buttons?1:2&Z.buttons?2:3;break;case"mouseup":ge=0,_e=Z.button<3?Z.button:3;break;case"mousedown":ge=1,_e=Z.button<3?Z.button:3;break;case"wheel":if(F._customWheelEventHandler&&F._customWheelEventHandler(Z)===!1||F.viewport.getLinesScrolled(Z)===0)return!1;ge=Z.deltaY<0?0:1,_e=4;break;default:return!1}return!(ge===void 0||_e===void 0||_e>4)&&F.coreMouseService.triggerMouseEvent({col:ce.col,row:ce.row,x:ce.x,y:ce.y,button:_e,action:ge,ctrl:Z.ctrlKey,alt:Z.altKey,shift:Z.shiftKey})}const j={mouseup:null,wheel:null,mousedrag:null,mousemove:null},te={mouseup:Z=>(Y(Z),Z.buttons||(this._document.removeEventListener("mouseup",j.mouseup),j.mousedrag&&this._document.removeEventListener("mousemove",j.mousedrag)),this.cancel(Z)),wheel:Z=>(Y(Z),this.cancel(Z,!0)),mousedrag:Z=>{Z.buttons&&Y(Z)},mousemove:Z=>{Z.buttons||Y(Z)}};this.register(this.coreMouseService.onProtocolChange((Z=>{Z?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(Z)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&Z?j.mousemove||(L.addEventListener("mousemove",te.mousemove),j.mousemove=te.mousemove):(L.removeEventListener("mousemove",j.mousemove),j.mousemove=null),16&Z?j.wheel||(L.addEventListener("wheel",te.wheel,{passive:!1}),j.wheel=te.wheel):(L.removeEventListener("wheel",j.wheel),j.wheel=null),2&Z?j.mouseup||(j.mouseup=te.mouseup):(this._document.removeEventListener("mouseup",j.mouseup),j.mouseup=null),4&Z?j.mousedrag||(j.mousedrag=te.mousedrag):(this._document.removeEventListener("mousemove",j.mousedrag),j.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(L,"mousedown",(Z=>{if(Z.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Z))return Y(Z),j.mouseup&&this._document.addEventListener("mouseup",j.mouseup),j.mousedrag&&this._document.addEventListener("mousemove",j.mousedrag),this.cancel(Z)}))),this.register((0,f.addDisposableDomListener)(L,"wheel",(Z=>{if(!j.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(Z)===!1)return!1;if(!this.buffer.hasScrollback){const ce=this.viewport.getLinesScrolled(Z);if(ce===0)return;const _e=U.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Z.deltaY<0?"A":"B");let ge="";for(let Te=0;Te<Math.abs(ce);Te++)ge+=_e;return this.coreService.triggerDataEvent(ge,!0),this.cancel(Z,!0)}return this.viewport.handleWheel(Z)?this.cancel(Z):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(L,"touchstart",(Z=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Z),this.cancel(Z)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(L,"touchmove",(Z=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Z)?void 0:this.cancel(Z)}),{passive:!1}))}refresh(F,L){var Y;(Y=this._renderService)==null||Y.refreshRows(F,L)}updateCursorStyle(F){var L;(L=this._selectionService)!=null&&L.shouldColumnSelect(F)?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(F,L,Y=0){var j;Y===1?(super.scrollLines(F,L,Y),this.refresh(0,this.rows-1)):(j=this.viewport)==null||j.scrollLines(F)}paste(F){(0,c.paste)(F,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(F){this._customKeyEventHandler=F}attachCustomWheelEventHandler(F){this._customWheelEventHandler=F}registerLinkProvider(F){return this._linkProviderService.registerLinkProvider(F)}registerCharacterJoiner(F){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const L=this._characterJoinerService.register(F);return this.refresh(0,this.rows-1),L}deregisterCharacterJoiner(F){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(F)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(F){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+F)}registerDecoration(F){return this._decorationService.registerDecoration(F)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(F,L,Y){this._selectionService.setSelection(F,L,Y)}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 F;(F=this._selectionService)==null||F.clearSelection()}selectAll(){var F;(F=this._selectionService)==null||F.selectAll()}selectLines(F,L){var Y;(Y=this._selectionService)==null||Y.selectLines(F,L)}_keyDown(F){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(F)===!1)return!1;const L=this.browser.isMac&&this.options.macOptionIsMeta&&F.altKey;if(!L&&!this._compositionHelper.keydown(F))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;L||F.key!=="Dead"&&F.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const Y=(0,$.evaluateKeyboardEvent)(F,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(F),Y.type===3||Y.type===2){const j=this.rows-1;return this.scrollLines(Y.type===2?-j:j),this.cancel(F,!0)}return Y.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,F)||(Y.cancel&&this.cancel(F,!0),!Y.key||!!(F.key&&!F.ctrlKey&&!F.altKey&&!F.metaKey&&F.key.length===1&&F.key.charCodeAt(0)>=65&&F.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(Y.key!==U.C0.ETX&&Y.key!==U.C0.CR||(this.textarea.value=""),this._onKey.fire({key:Y.key,domEvent:F}),this._showCursor(),this.coreService.triggerDataEvent(Y.key,!0),!this.optionsService.rawOptions.screenReaderMode||F.altKey||F.ctrlKey?this.cancel(F,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(F,L){const Y=F.isMac&&!this.options.macOptionIsMeta&&L.altKey&&!L.ctrlKey&&!L.metaKey||F.isWindows&&L.altKey&&L.ctrlKey&&!L.metaKey||F.isWindows&&L.getModifierState("AltGraph");return L.type==="keypress"?Y:Y&&(!L.keyCode||L.keyCode>47)}_keyUp(F){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(F)===!1||((function(L){return L.keyCode===16||L.keyCode===17||L.keyCode===18})(F)||this.focus(),this.updateCursorStyle(F),this._keyPressHandled=!1)}_keyPress(F){let L;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(F)===!1)return!1;if(this.cancel(F),F.charCode)L=F.charCode;else if(F.which===null||F.which===void 0)L=F.keyCode;else{if(F.which===0||F.charCode===0)return!1;L=F.which}return!(!L||(F.altKey||F.ctrlKey||F.metaKey)&&!this._isThirdLevelShift(this.browser,F)||(L=String.fromCharCode(L),this._onKey.fire({key:L,domEvent:F}),this._showCursor(),this.coreService.triggerDataEvent(L,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(F){if(F.data&&F.inputType==="insertText"&&(!F.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const L=F.data;return this.coreService.triggerDataEvent(L,!0),this.cancel(F),!0}return!1}resize(F,L){F!==this.cols||L!==this.rows?super.resize(F,L):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(F,L){var Y,j;(Y=this._charSizeService)==null||Y.measure(),(j=this.viewport)==null||j.syncScrollArea(!0)}clear(){var F;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(N.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(F=this.viewport)==null||F.reset(),this.refresh(0,this.rows-1)}}reset(){var L,Y;this.options.rows=this.rows,this.options.cols=this.cols;const F=this._customKeyEventHandler;this._setup(),super.reset(),(L=this._selectionService)==null||L.reset(),this._decorationService.reset(),(Y=this.viewport)==null||Y.reset(),this._customKeyEventHandler=F,this.refresh(0,this.rows-1)}clearTextureAtlas(){var F;(F=this._renderService)==null||F.clearTextureAtlas()}_reportFocus(){var F;(F=this.element)!=null&&F.classList.contains("focus")?this.coreService.triggerDataEvent(U.C0.ESC+"[I"):this.coreService.triggerDataEvent(U.C0.ESC+"[O")}_reportWindowsOptions(F){if(this._renderService)switch(F){case P.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const L=this._renderService.dimensions.css.canvas.width.toFixed(0),Y=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${U.C0.ESC}[4;${Y};${L}t`);break;case P.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const j=this._renderService.dimensions.css.cell.width.toFixed(0),te=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${U.C0.ESC}[6;${te};${j}t`)}}cancel(F,L){if(this.options.cancelEvents||L)return F.preventDefault(),F.stopPropagation(),!1}}n.Terminal=Q},9924:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TimeBasedDebouncer=void 0,n.TimeBasedDebouncer=class{constructor(a,c=1e3){this._renderCallback=a,this._debounceThresholdMS=c,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(a,c,f){this._rowCount=f,a=a!==void 0?a:0,c=c!==void 0?c:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,a):a,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,c):c;const l=Date.now();if(l-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=l,this._innerRefresh();else if(!this._additionalRefreshRequested){const d=l-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 a=Math.max(this._rowStart,0),c=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(a,c)}}},1680:function(E,n,a){var c=this&&this.__decorate||function(i,e,s,u){var m,S=arguments.length,C=S<3?e:u===null?u=Object.getOwnPropertyDescriptor(e,s):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(i,e,s,u);else for(var v=i.length-1;v>=0;v--)(m=i[v])&&(C=(S<3?m(C):S>3?m(e,s,C):m(e,s))||C);return S>3&&C&&Object.defineProperty(e,s,C),C},f=this&&this.__param||function(i,e){return function(s,u){e(s,u,i)}};Object.defineProperty(n,"__esModule",{value:!0}),n.Viewport=void 0;const l=a(3656),d=a(4725),p=a(8460),g=a(844),h=a(2585);let t=n.Viewport=class extends g.Disposable{constructor(i,e,s,u,m,S,C,v){super(),this._viewportElement=i,this._scrollArea=e,this._bufferService=s,this._optionsService=u,this._charSizeService=m,this._renderService=S,this._coreBrowserService=C,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new p.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((x=>this._activeBuffer=x.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((x=>this._renderDimensions=x))),this._handleThemeChange(v.colors),this.register(v.onChangeColors((x=>this._handleThemeChange(x)))),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 e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,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 e=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:e,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,e){const s=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(e<0&&this._viewportElement.scrollTop!==0||e>0&&s<this._lastRecordedBufferHeight)||(i.cancelable&&i.preventDefault(),!1)}handleWheel(i){const e=this._getPixelsScrolled(i);return e!==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+e:this._smoothScrollState.target+=e,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=e,this._bubbleScroll(i,e))}scrollLines(i){if(i!==0)if(this._optionsService.rawOptions.smoothScrollDuration){const e=i*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+e,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 e=this._applyScrollModifier(i.deltaY,i);return i.deltaMode===WheelEvent.DOM_DELTA_LINE?e*=this._currentRowHeight:i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._currentRowHeight*this._bufferService.rows),e}getBufferElements(i,e){var v;let s,u="";const m=[],S=e??this._bufferService.buffer.lines.length,C=this._bufferService.buffer.lines;for(let x=i;x<S;x++){const T=C.get(x);if(!T)continue;const M=(v=C.get(x+1))==null?void 0:v.isWrapped;if(u+=T.translateToString(!M),!M||x===C.length-1){const O=document.createElement("div");O.textContent=u,m.push(O),u.length>0&&(s=O),u=""}}return{bufferElements:m,cursorElement:s}}getLinesScrolled(i){if(i.deltaY===0||i.shiftKey)return 0;let e=this._applyScrollModifier(i.deltaY,i);return i.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(e/=this._currentRowHeight+0,this._wheelPartialScroll+=e,e=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(e*=this._bufferService.rows),e}_applyScrollModifier(i,e){const s=this._optionsService.rawOptions.fastScrollModifier;return s==="alt"&&e.altKey||s==="ctrl"&&e.ctrlKey||s==="shift"&&e.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 e=this._lastTouchY-i.touches[0].pageY;return this._lastTouchY=i.touches[0].pageY,e!==0&&(this._viewportElement.scrollTop+=e,this._bubbleScroll(i,e))}};n.Viewport=t=c([f(2,h.IBufferService),f(3,h.IOptionsService),f(4,d.ICharSizeService),f(5,d.IRenderService),f(6,d.ICoreBrowserService),f(7,d.IThemeService)],t)},3107:function(E,n,a){var c=this&&this.__decorate||function(h,t,i,e){var s,u=arguments.length,m=u<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,i):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(h,t,i,e);else for(var S=h.length-1;S>=0;S--)(s=h[S])&&(m=(u<3?s(m):u>3?s(t,i,m):s(t,i))||m);return u>3&&m&&Object.defineProperty(t,i,m),m},f=this&&this.__param||function(h,t){return function(i,e){t(i,e,h)}};Object.defineProperty(n,"__esModule",{value:!0}),n.BufferDecorationRenderer=void 0;const l=a(4725),d=a(844),p=a(2585);let g=n.BufferDecorationRenderer=class extends d.Disposable{constructor(h,t,i,e,s){super(),this._screenElement=h,this._bufferService=t,this._coreBrowserService=i,this._decorationService=e,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((u=>this._removeDecoration(u)))),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 h of this._decorationService.decorations)this._renderDecoration(h);this._dimensionsChanged=!1}_renderDecoration(h){this._refreshStyle(h),this._dimensionsChanged&&this._refreshXPosition(h)}_createElement(h){var e;const t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((e=h==null?void 0:h.options)==null?void 0:e.layer)==="top"),t.style.width=`${Math.round((h.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=(h.options.height||1)*this._renderService.dimensions.css.cell.height+"px",t.style.top=(h.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const i=h.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(h,t),t}_refreshStyle(h){const t=h.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)h.element&&(h.element.style.display="none",h.onRenderEmitter.fire(h.element));else{let i=this._decorationElements.get(h);i||(i=this._createElement(h),h.element=i,this._decorationElements.set(h,i),this._container.appendChild(i),h.onDispose((()=>{this._decorationElements.delete(h),i.remove()}))),i.style.top=t*this._renderService.dimensions.css.cell.height+"px",i.style.display=this._altBufferIsActive?"none":"block",h.onRenderEmitter.fire(i)}}_refreshXPosition(h,t=h.element){if(!t)return;const i=h.options.x??0;(h.options.anchor||"left")==="right"?t.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(h){var t;(t=this._decorationElements.get(h))==null||t.remove(),this._decorationElements.delete(h),h.dispose()}};n.BufferDecorationRenderer=g=c([f(1,p.IBufferService),f(2,l.ICoreBrowserService),f(3,p.IDecorationService),f(4,l.IRenderService)],g)},5871:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ColorZoneStore=void 0,n.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(a){if(a.options.overviewRulerOptions){for(const c of this._zones)if(c.color===a.options.overviewRulerOptions.color&&c.position===a.options.overviewRulerOptions.position){if(this._lineIntersectsZone(c,a.marker.line))return;if(this._lineAdjacentToZone(c,a.marker.line,a.options.overviewRulerOptions.position))return void this._addLineToZone(c,a.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return this._zonePool[this._zonePoolIndex].color=a.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=a.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=a.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=a.marker.line,void this._zones.push(this._zonePool[this._zonePoolIndex++]);this._zones.push({color:a.options.overviewRulerOptions.color,position:a.options.overviewRulerOptions.position,startBufferLine:a.marker.line,endBufferLine:a.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(a){this._linePadding=a}_lineIntersectsZone(a,c){return c>=a.startBufferLine&&c<=a.endBufferLine}_lineAdjacentToZone(a,c,f){return c>=a.startBufferLine-this._linePadding[f||"full"]&&c<=a.endBufferLine+this._linePadding[f||"full"]}_addLineToZone(a,c){a.startBufferLine=Math.min(a.startBufferLine,c),a.endBufferLine=Math.max(a.endBufferLine,c)}}},5744:function(E,n,a){var c=this&&this.__decorate||function(s,u,m,S){var C,v=arguments.length,x=v<3?u:S===null?S=Object.getOwnPropertyDescriptor(u,m):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(s,u,m,S);else for(var T=s.length-1;T>=0;T--)(C=s[T])&&(x=(v<3?C(x):v>3?C(u,m,x):C(u,m))||x);return v>3&&x&&Object.defineProperty(u,m,x),x},f=this&&this.__param||function(s,u){return function(m,S){u(m,S,s)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OverviewRulerRenderer=void 0;const l=a(5871),d=a(4725),p=a(844),g=a(2585),h={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0};let e=n.OverviewRulerRenderer=class extends p.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,u,m,S,C,v,x){var M;super(),this._viewportElement=s,this._screenElement=u,this._bufferService=m,this._decorationService=S,this._renderService=C,this._optionsService=v,this._coreBrowserService=x,this._colorZoneStore=new l.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(),(M=this._viewportElement.parentElement)==null||M.insertBefore(this._canvas,this._viewportElement);const T=this._canvas.getContext("2d");if(!T)throw new Error("Ctx cannot be null");this._ctx=T,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,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),u=Math.ceil(this._canvas.width/3);t.full=this._canvas.width,t.left=s,t.center=u,t.right=s,this._refreshDrawHeightConstants(),i.full=0,i.left=0,i.center=t.left,i.right=t.left+t.center}_refreshDrawHeightConstants(){h.full=Math.round(2*this._coreBrowserService.dpr);const s=this._canvas.height/this._bufferService.buffer.lines.length,u=Math.round(Math.max(Math.min(s,12),6)*this._coreBrowserService.dpr);h.left=u,h.center=u,h.right=u}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*h.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const u of this._decorationService.decorations)this._colorZoneStore.addDecoration(u);this._ctx.lineWidth=1;const s=this._colorZoneStore.zones;for(const u of s)u.position!=="full"&&this._renderColorZone(u);for(const u of s)u.position==="full"&&this._renderColorZone(u);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)-h[s.position||"full"]/2),t[s.position||"full"],Math.round((this._canvas.height-1)*((s.endBufferLine-s.startBufferLine)/this._bufferService.buffers.active.lines.length)+h[s.position||"full"]))}_queueRefresh(s,u){this._shouldUpdateDimensions=s||this._shouldUpdateDimensions,this._shouldUpdateAnchor=u||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};n.OverviewRulerRenderer=e=c([f(2,g.IBufferService),f(3,g.IDecorationService),f(4,d.IRenderService),f(5,g.IOptionsService),f(6,d.ICoreBrowserService)],e)},2950:function(E,n,a){var c=this&&this.__decorate||function(h,t,i,e){var s,u=arguments.length,m=u<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,i):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(h,t,i,e);else for(var S=h.length-1;S>=0;S--)(s=h[S])&&(m=(u<3?s(m):u>3?s(t,i,m):s(t,i))||m);return u>3&&m&&Object.defineProperty(t,i,m),m},f=this&&this.__param||function(h,t){return function(i,e){t(i,e,h)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CompositionHelper=void 0;const l=a(4725),d=a(2585),p=a(2584);let g=n.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(h,t,i,e,s,u){this._textarea=h,this._compositionView=t,this._bufferService=i,this._optionsService=e,this._coreService=s,this._renderService=u,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(h){this._compositionView.textContent=h.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(h){if(this._isComposing||this._isSendingComposition){if(h.keyCode===229||h.keyCode===16||h.keyCode===17||h.keyCode===18)return!1;this._finalizeComposition(!1)}return h.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(h){if(this._compositionView.classList.remove("active"),this._isComposing=!1,h){const t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let i;this._isSendingComposition=!1,t.start+=this._dataAlreadySent.length,i=this._isComposing?this._textarea.value.substring(t.start,t.end):this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}}),0)}else{this._isSendingComposition=!1;const t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){const h=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const t=this._textarea.value,i=t.replace(h,"");this._dataAlreadySent=i,t.length>h.length?this._coreService.triggerDataEvent(i,!0):t.length<h.length?this._coreService.triggerDataEvent(`${p.C0.DEL}`,!0):t.length===h.length&&t!==h&&this._coreService.triggerDataEvent(t,!0)}}),0)}updateCompositionElements(h){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,e=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=e+"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 u=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(u.width,1)+"px",this._textarea.style.height=Math.max(u.height,1)+"px",this._textarea.style.lineHeight=u.height+"px"}h||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};n.CompositionHelper=g=c([f(2,d.IBufferService),f(3,d.IOptionsService),f(4,d.ICoreService),f(5,l.IRenderService)],g)},9806:(E,n)=>{function a(c,f,l){const d=l.getBoundingClientRect(),p=c.getComputedStyle(l),g=parseInt(p.getPropertyValue("padding-left")),h=parseInt(p.getPropertyValue("padding-top"));return[f.clientX-d.left-g,f.clientY-d.top-h]}Object.defineProperty(n,"__esModule",{value:!0}),n.getCoords=n.getCoordsRelativeToElement=void 0,n.getCoordsRelativeToElement=a,n.getCoords=function(c,f,l,d,p,g,h,t,i){if(!g)return;const e=a(c,f,l);return e?(e[0]=Math.ceil((e[0]+(i?h/2:0))/h),e[1]=Math.ceil(e[1]/t),e[0]=Math.min(Math.max(e[0],1),d+(i?1:0)),e[1]=Math.min(Math.max(e[1],1),p),e):void 0}},9504:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.moveToCellSequence=void 0;const c=a(2584);function f(t,i,e,s){const u=t-l(t,e),m=i-l(i,e),S=Math.abs(u-m)-(function(C,v,x){let T=0;const M=C-l(C,x),O=v-l(v,x);for(let A=0;A<Math.abs(M-O);A++){const H=d(C,v)==="A"?-1:1,I=x.buffer.lines.get(M+H*A);I!=null&&I.isWrapped&&T++}return T})(t,i,e);return h(S,g(d(t,i),s))}function l(t,i){let e=0,s=i.buffer.lines.get(t),u=s==null?void 0:s.isWrapped;for(;u&&t>=0&&t<i.rows;)e++,s=i.buffer.lines.get(--t),u=s==null?void 0:s.isWrapped;return e}function d(t,i){return t>i?"A":"B"}function p(t,i,e,s,u,m){let S=t,C=i,v="";for(;S!==e||C!==s;)S+=u?1:-1,u&&S>m.cols-1?(v+=m.buffer.translateBufferLineToString(C,!1,t,S),S=0,t=0,C++):!u&&S<0&&(v+=m.buffer.translateBufferLineToString(C,!1,0,t+1),S=m.cols-1,t=S,C--);return v+m.buffer.translateBufferLineToString(C,!1,t,S)}function g(t,i){const e=i?"O":"[";return c.C0.ESC+e+t}function h(t,i){t=Math.floor(t);let e="";for(let s=0;s<t;s++)e+=i;return e}n.moveToCellSequence=function(t,i,e,s){const u=e.buffer.x,m=e.buffer.y;if(!e.buffer.hasScrollback)return(function(v,x,T,M,O,A){return f(x,M,O,A).length===0?"":h(p(v,x,v,x-l(x,O),!1,O).length,g("D",A))})(u,m,0,i,e,s)+f(m,i,e,s)+(function(v,x,T,M,O,A){let H;H=f(x,M,O,A).length>0?M-l(M,O):x;const I=M,N=(function(U,$,y,R,B,P){let K;return K=f(y,R,B,P).length>0?R-l(R,B):$,U<y&&K<=R||U>=y&&K<R?"C":"D"})(v,x,T,M,O,A);return h(p(v,H,T,I,N==="C",O).length,g(N,A))})(u,m,t,i,e,s);let S;if(m===i)return S=u>t?"D":"C",h(Math.abs(u-t),g(S,s));S=m>i?"D":"C";const C=Math.abs(m-i);return h((function(v,x){return x.cols-v})(m>i?t:u,e)+(C-1)*e.cols+1+((m>i?u:t)-1),g(S,s))}},1296:function(E,n,a){var c=this&&this.__decorate||function(A,H,I,N){var U,$=arguments.length,y=$<3?H:N===null?N=Object.getOwnPropertyDescriptor(H,I):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(A,H,I,N);else for(var R=A.length-1;R>=0;R--)(U=A[R])&&(y=($<3?U(y):$>3?U(H,I,y):U(H,I))||y);return $>3&&y&&Object.defineProperty(H,I,y),y},f=this&&this.__param||function(A,H){return function(I,N){H(I,N,A)}};Object.defineProperty(n,"__esModule",{value:!0}),n.DomRenderer=void 0;const l=a(3787),d=a(2550),p=a(2223),g=a(6171),h=a(6052),t=a(4725),i=a(8055),e=a(8460),s=a(844),u=a(2585),m="xterm-dom-renderer-owner-",S="xterm-rows",C="xterm-fg-",v="xterm-bg-",x="xterm-focus",T="xterm-selection";let M=1,O=n.DomRenderer=class extends s.Disposable{constructor(A,H,I,N,U,$,y,R,B,P,K,J,Q){super(),this._terminal=A,this._document=H,this._element=I,this._screenElement=N,this._viewportElement=U,this._helperContainer=$,this._linkifier2=y,this._charSizeService=B,this._optionsService=P,this._bufferService=K,this._coreBrowserService=J,this._themeService=Q,this._terminalClass=M++,this._rowElements=[],this._selectionRenderModel=(0,h.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new e.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(T),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((ie=>this._injectCss(ie)))),this._injectCss(this._themeService.colors),this._rowFactory=R.createInstance(l.DomRendererRowFactory,document),this._element.classList.add(m+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((ie=>this._handleLinkHover(ie)))),this.register(this._linkifier2.onHideLinkUnderline((ie=>this._handleLinkLeave(ie)))),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 I of this._rowElements)I.style.width=`${this.dimensions.css.canvas.width}px`,I.style.height=`${this.dimensions.css.cell.height}px`,I.style.lineHeight=`${this.dimensions.css.cell.height}px`,I.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const H=`${this._terminalSelector} .${S} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=H,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 H=`${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}`;H+=`${this._terminalSelector} .${S} .xterm-dim { color: ${i.color.multiplyOpacity(A.foreground,.5).css};}`,H+=`${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 I=`blink_underline_${this._terminalClass}`,N=`blink_bar_${this._terminalClass}`,U=`blink_block_${this._terminalClass}`;H+=`@keyframes ${I} { 50% { border-bottom-style: hidden; }}`,H+=`@keyframes ${N} { 50% { box-shadow: none; }}`,H+=`@keyframes ${U} { 0% { background-color: ${A.cursor.css}; color: ${A.cursorAccent.css}; } 50% { background-color: inherit; color: ${A.cursor.css}; }}`,H+=`${this._terminalSelector} .${S}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${I} 1s step-end infinite;}${this._terminalSelector} .${S}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${N} 1s step-end infinite;}${this._terminalSelector} .${S}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${U} 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);}`,H+=`${this._terminalSelector} .${T} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${T} div { position: absolute; background-color: ${A.selectionBackgroundOpaque.css};}${this._terminalSelector} .${T} div { position: absolute; background-color: ${A.selectionInactiveBackgroundOpaque.css};}`;for(const[$,y]of A.ansi.entries())H+=`${this._terminalSelector} .${C}${$} { color: ${y.css}; }${this._terminalSelector} .${C}${$}.xterm-dim { color: ${i.color.multiplyOpacity(y,.5).css}; }${this._terminalSelector} .${v}${$} { background-color: ${y.css}; }`;H+=`${this._terminalSelector} .${C}${p.INVERTED_DEFAULT_COLOR} { color: ${i.color.opaque(A.background).css}; }${this._terminalSelector} .${C}${p.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${i.color.multiplyOpacity(i.color.opaque(A.background),.5).css}; }${this._terminalSelector} .${v}${p.INVERTED_DEFAULT_COLOR} { background-color: ${A.foreground.css}; }`,this._themeStyleElement.textContent=H}_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,H){for(let I=this._rowElements.length;I<=H;I++){const N=this._document.createElement("div");this._rowContainer.appendChild(N),this._rowElements.push(N)}for(;this._rowElements.length>H;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(A,H){this._refreshRowElements(A,H),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(x),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(x),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(A,H,I){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(A,H,I),this.renderRows(0,this._bufferService.rows-1),!A||!H)return;this._selectionRenderModel.update(this._terminal,A,H,I);const N=this._selectionRenderModel.viewportStartRow,U=this._selectionRenderModel.viewportEndRow,$=this._selectionRenderModel.viewportCappedStartRow,y=this._selectionRenderModel.viewportCappedEndRow;if($>=this._bufferService.rows||y<0)return;const R=this._document.createDocumentFragment();if(I){const B=A[0]>H[0];R.appendChild(this._createSelectionElement($,B?H[0]:A[0],B?A[0]:H[0],y-$+1))}else{const B=N===$?A[0]:0,P=$===U?H[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement($,B,P));const K=y-$-1;if(R.appendChild(this._createSelectionElement($+1,0,this._bufferService.cols,K)),$!==y){const J=U===y?H[0]:this._bufferService.cols;R.appendChild(this._createSelectionElement(y,0,J))}}this._selectionContainer.appendChild(R)}_createSelectionElement(A,H,I,N=1){const U=this._document.createElement("div"),$=H*this.dimensions.css.cell.width;let y=this.dimensions.css.cell.width*(I-H);return $+y>this.dimensions.css.canvas.width&&(y=this.dimensions.css.canvas.width-$),U.style.height=N*this.dimensions.css.cell.height+"px",U.style.top=A*this.dimensions.css.cell.height+"px",U.style.left=`${$}px`,U.style.width=`${y}px`,U}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,H){const I=this._bufferService.buffer,N=I.ybase+I.y,U=Math.min(I.x,this._bufferService.cols-1),$=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,R=this._optionsService.rawOptions.cursorInactiveStyle;for(let B=A;B<=H;B++){const P=B+I.ydisp,K=this._rowElements[B],J=I.lines.get(P);if(!K||!J)break;K.replaceChildren(...this._rowFactory.createRow(J,P,P===N,y,R,U,$,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,H,I,N,U,$){I<0&&(A=0),N<0&&(H=0);const y=this._bufferService.rows-1;I=Math.max(Math.min(I,y),0),N=Math.max(Math.min(N,y),0),U=Math.min(U,this._bufferService.cols);const R=this._bufferService.buffer,B=R.ybase+R.y,P=Math.min(R.x,U-1),K=this._optionsService.rawOptions.cursorBlink,J=this._optionsService.rawOptions.cursorStyle,Q=this._optionsService.rawOptions.cursorInactiveStyle;for(let ie=I;ie<=N;++ie){const F=ie+R.ydisp,L=this._rowElements[ie],Y=R.lines.get(F);if(!L||!Y)break;L.replaceChildren(...this._rowFactory.createRow(Y,F,F===B,J,Q,P,K,this.dimensions.css.cell.width,this._widthCache,$?ie===I?A:0:-1,$?(ie===N?H:U)-1:-1))}}};n.DomRenderer=O=c([f(7,u.IInstantiationService),f(8,t.ICharSizeService),f(9,u.IOptionsService),f(10,u.IBufferService),f(11,t.ICoreBrowserService),f(12,t.IThemeService)],O)},3787:function(E,n,a){var c=this&&this.__decorate||function(S,C,v,x){var T,M=arguments.length,O=M<3?C:x===null?x=Object.getOwnPropertyDescriptor(C,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(S,C,v,x);else for(var A=S.length-1;A>=0;A--)(T=S[A])&&(O=(M<3?T(O):M>3?T(C,v,O):T(C,v))||O);return M>3&&O&&Object.defineProperty(C,v,O),O},f=this&&this.__param||function(S,C){return function(v,x){C(v,x,S)}};Object.defineProperty(n,"__esModule",{value:!0}),n.DomRendererRowFactory=void 0;const l=a(2223),d=a(643),p=a(511),g=a(2585),h=a(8055),t=a(4725),i=a(4269),e=a(6171),s=a(3734);let u=n.DomRendererRowFactory=class{constructor(S,C,v,x,T,M,O){this._document=S,this._characterJoinerService=C,this._optionsService=v,this._coreBrowserService=x,this._coreService=T,this._decorationService=M,this._themeService=O,this._workCell=new p.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(S,C,v){this._selectionStart=S,this._selectionEnd=C,this._columnSelectMode=v}createRow(S,C,v,x,T,M,O,A,H,I,N){const U=[],$=this._characterJoinerService.getJoinedCharacters(C),y=this._themeService.colors;let R,B=S.getNoBgTrimmedLength();v&&B<M+1&&(B=M+1);let P=0,K="",J=0,Q=0,ie=0,F=!1,L=0,Y=!1,j=0;const te=[],Z=I!==-1&&N!==-1;for(let ce=0;ce<B;ce++){S.loadCell(ce,this._workCell);let _e=this._workCell.getWidth();if(_e===0)continue;let ge=!1,Te=ce,le=this._workCell;if($.length>0&&ce===$[0][0]){ge=!0;const Se=$.shift();le=new i.JoinedCellData(this._workCell,S.translateToString(!0,Se[0],Se[1]),Se[1]-Se[0]),Te=Se[1]-1,_e=le.getWidth()}const Dt=this._isCellInSelection(ce,C),gt=v&&ce===M,Rt=Z&&ce>=I&&ce<=N;let At=!1;this._decorationService.forEachDecorationAtCell(ce,C,void 0,(Se=>{At=!0}));let Tt=le.getChars()||d.WHITESPACE_CELL_CHAR;if(Tt===" "&&(le.isUnderline()||le.isOverline())&&(Tt=" "),j=_e*A-H.get(Tt,le.isBold(),le.isItalic()),R){if(P&&(Dt&&Y||!Dt&&!Y&&le.bg===J)&&(Dt&&Y&&y.selectionForeground||le.fg===Q)&&le.extended.ext===ie&&Rt===F&&j===L&&!gt&&!ge&&!At){le.isInvisible()?K+=d.WHITESPACE_CELL_CHAR:K+=Tt,P++;continue}P&&(R.textContent=K),R=this._document.createElement("span"),P=0,K=""}else R=this._document.createElement("span");if(J=le.bg,Q=le.fg,ie=le.extended.ext,F=Rt,L=j,Y=Dt,ge&&M>=ce&&M<=Te&&(M=ce),!this._coreService.isCursorHidden&&gt&&this._coreService.isCursorInitialized){if(te.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&te.push("xterm-cursor-blink"),te.push(x==="bar"?"xterm-cursor-bar":x==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(T)switch(T){case"outline":te.push("xterm-cursor-outline");break;case"block":te.push("xterm-cursor-block");break;case"bar":te.push("xterm-cursor-bar");break;case"underline":te.push("xterm-cursor-underline")}}if(le.isBold()&&te.push("xterm-bold"),le.isItalic()&&te.push("xterm-italic"),le.isDim()&&te.push("xterm-dim"),K=le.isInvisible()?d.WHITESPACE_CELL_CHAR:le.getChars()||d.WHITESPACE_CELL_CHAR,le.isUnderline()&&(te.push(`xterm-underline-${le.extended.underlineStyle}`),K===" "&&(K=" "),!le.isUnderlineColorDefault()))if(le.isUnderlineColorRGB())R.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(le.getUnderlineColor()).join(",")})`;else{let Se=le.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&le.isBold()&&Se<8&&(Se+=8),R.style.textDecorationColor=y.ansi[Se].css}le.isOverline()&&(te.push("xterm-overline"),K===" "&&(K=" ")),le.isStrikethrough()&&te.push("xterm-strikethrough"),Rt&&(R.style.textDecoration="underline");let ze=le.getFgColor(),tr=le.getFgColorMode(),Ye=le.getBgColor(),rr=le.getBgColorMode();const gr=!!le.isInverse();if(gr){const Se=ze;ze=Ye,Ye=Se;const si=tr;tr=rr,rr=si}let mt,ir,St,Nt=!1;switch(this._decorationService.forEachDecorationAtCell(ce,C,void 0,(Se=>{Se.options.layer!=="top"&&Nt||(Se.backgroundColorRGB&&(rr=50331648,Ye=Se.backgroundColorRGB.rgba>>8&16777215,mt=Se.backgroundColorRGB),Se.foregroundColorRGB&&(tr=50331648,ze=Se.foregroundColorRGB.rgba>>8&16777215,ir=Se.foregroundColorRGB),Nt=Se.options.layer==="top")})),!Nt&&Dt&&(mt=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,Ye=mt.rgba>>8&16777215,rr=50331648,Nt=!0,y.selectionForeground&&(tr=50331648,ze=y.selectionForeground.rgba>>8&16777215,ir=y.selectionForeground)),Nt&&te.push("xterm-decoration-top"),rr){case 16777216:case 33554432:St=y.ansi[Ye],te.push(`xterm-bg-${Ye}`);break;case 50331648:St=h.channels.toColor(Ye>>16,Ye>>8&255,255&Ye),this._addStyle(R,`background-color:#${m((Ye>>>0).toString(16),"0",6)}`);break;default:gr?(St=y.foreground,te.push(`xterm-bg-${l.INVERTED_DEFAULT_COLOR}`)):St=y.background}switch(mt||le.isDim()&&(mt=h.color.multiplyOpacity(St,.5)),tr){case 16777216:case 33554432:le.isBold()&&ze<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ze+=8),this._applyMinimumContrast(R,St,y.ansi[ze],le,mt,void 0)||te.push(`xterm-fg-${ze}`);break;case 50331648:const Se=h.channels.toColor(ze>>16&255,ze>>8&255,255&ze);this._applyMinimumContrast(R,St,Se,le,mt,ir)||this._addStyle(R,`color:#${m(ze.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(R,St,y.foreground,le,mt,ir)||gr&&te.push(`xterm-fg-${l.INVERTED_DEFAULT_COLOR}`)}te.length&&(R.className=te.join(" "),te.length=0),gt||ge||At?R.textContent=K:P++,j!==this.defaultSpacing&&(R.style.letterSpacing=`${j}px`),U.push(R),ce=Te}return R&&P&&(R.textContent=K),U}_applyMinimumContrast(S,C,v,x,T,M){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(x.getCode()))return!1;const O=this._getContrastCache(x);let A;if(T||M||(A=O.getColor(C.rgba,v.rgba)),A===void 0){const H=this._optionsService.rawOptions.minimumContrastRatio/(x.isDim()?2:1);A=h.color.ensureContrastRatio(T||C,M||v,H),O.setColor((T||C).rgba,(M||v).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,C){S.setAttribute("style",`${S.getAttribute("style")||""}${C};`)}_isCellInSelection(S,C){const v=this._selectionStart,x=this._selectionEnd;return!(!v||!x)&&(this._columnSelectMode?v[0]<=x[0]?S>=v[0]&&C>=v[1]&&S<x[0]&&C<=x[1]:S<v[0]&&C>=v[1]&&S>=x[0]&&C<=x[1]:C>v[1]&&C<x[1]||v[1]===x[1]&&C===v[1]&&S>=v[0]&&S<x[0]||v[1]<x[1]&&C===x[1]&&S<x[0]||v[1]<x[1]&&C===v[1]&&S>=v[0])}};function m(S,C,v){for(;S.length<v;)S=C+S;return S}n.DomRendererRowFactory=u=c([f(1,t.ICharacterJoinerService),f(2,g.IOptionsService),f(3,t.ICoreBrowserService),f(4,g.ICoreService),f(5,g.IDecorationService),f(6,t.IThemeService)],u)},2550:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WidthCache=void 0,n.WidthCache=class{constructor(a,c){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=a.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const f=a.createElement("span");f.classList.add("xterm-char-measure-element");const l=a.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold";const d=a.createElement("span");d.classList.add("xterm-char-measure-element"),d.style.fontStyle="italic";const p=a.createElement("span");p.classList.add("xterm-char-measure-element"),p.style.fontWeight="bold",p.style.fontStyle="italic",this._measureElements=[f,l,d,p],this._container.appendChild(f),this._container.appendChild(l),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(a,c,f,l){a===this._font&&c===this._fontSize&&f===this._weight&&l===this._weightBold||(this._font=a,this._fontSize=c,this._weight=f,this._weightBold=l,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${f}`,this._measureElements[1].style.fontWeight=`${l}`,this._measureElements[2].style.fontWeight=`${f}`,this._measureElements[3].style.fontWeight=`${l}`,this.clear())}get(a,c,f){let l=0;if(!c&&!f&&a.length===1&&(l=a.charCodeAt(0))<256){if(this._flat[l]!==-9999)return this._flat[l];const g=this._measure(a,0);return g>0&&(this._flat[l]=g),g}let d=a;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(a,g),p>0&&this._holey.set(d,p)}return p}_measure(a,c){const f=this._measureElements[c];return f.textContent=a.repeat(32),f.offsetWidth/32}}},2223:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.TEXT_BASELINE=n.DIM_OPACITY=n.INVERTED_DEFAULT_COLOR=void 0;const c=a(6114);n.INVERTED_DEFAULT_COLOR=257,n.DIM_OPACITY=.5,n.TEXT_BASELINE=c.isFirefox||c.isLegacyEdge?"bottom":"ideographic"},6171:(E,n)=>{function a(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=a,n.isRestrictedPowerlineGlyph=function(f){return 57520<=f&&f<=57527},n.isEmoji=c,n.allowRescaling=function(f,l,d,p){return l===1&&d>Math.ceil(1.5*p)&&f!==void 0&&f>255&&!c(f)&&!a(f)&&!(function(g){return 57344<=g&&g<=63743})(f)},n.treatGlyphAsBackgroundColor=function(f){return a(f)||(function(l){return 9472<=l&&l<=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,l,d=0){return(f-(2*Math.round(l)-d))%(2*Math.round(l))}},6052:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(f,l,d,p=!1){if(this.selectionStart=l,this.selectionEnd=d,!l||!d||l[0]===d[0]&&l[1]===d[1])return void this.clear();const g=f.buffers.active.ydisp,h=l[1]-g,t=d[1]-g,i=Math.max(h,0),e=Math.min(t,f.rows-1);i>=f.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=p,this.viewportStartRow=h,this.viewportEndRow=t,this.viewportCappedStartRow=i,this.viewportCappedEndRow=e,this.startCol=l[0],this.endCol=d[0])}isCellSelected(f,l,d){return!!this.hasSelection&&(d-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?l>=this.startCol&&d>=this.viewportCappedStartRow&&l<this.endCol&&d<=this.viewportCappedEndRow:l<this.startCol&&d>=this.viewportCappedStartRow&&l>=this.endCol&&d<=this.viewportCappedEndRow:d>this.viewportStartRow&&d<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&d===this.viewportStartRow&&l>=this.startCol&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportEndRow&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&d===this.viewportStartRow&&l>=this.startCol)}}n.createSelectionRenderModel=function(){return new a}},456:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SelectionModel=void 0,n.SelectionModel=class{constructor(a){this._bufferService=a,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?a%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)-1]:[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[a,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const a=this.selectionStart[0]+this.selectionStartLength;return a>this._bufferService.cols?[a%this._bufferService.cols,this.selectionStart[1]+Math.floor(a/this._bufferService.cols)]:[Math.max(a,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const a=this.selectionStart,c=this.selectionEnd;return!(!a||!c)&&(a[1]>c[1]||a[1]===c[1]&&a[0]>c[0])}handleTrim(a){return this.selectionStart&&(this.selectionStart[1]-=a),this.selectionEnd&&(this.selectionEnd[1]-=a),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(E,n,a){var c=this&&this.__decorate||function(e,s,u,m){var S,C=arguments.length,v=C<3?s:m===null?m=Object.getOwnPropertyDescriptor(s,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,s,u,m);else for(var x=e.length-1;x>=0;x--)(S=e[x])&&(v=(C<3?S(v):C>3?S(s,u,v):S(s,u))||v);return C>3&&v&&Object.defineProperty(s,u,v),v},f=this&&this.__param||function(e,s){return function(u,m){s(u,m,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CharSizeService=void 0;const l=a(2585),d=a(8460),p=a(844);let g=n.CharSizeService=class extends p.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,s,u){super(),this._optionsService=u,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 t(e,s,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};n.CharSizeService=g=c([f(2,l.IOptionsService)],g);class h extends p.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(s,u){s!==void 0&&s>0&&u!==void 0&&u>0&&(this._result.width=s,this._result.height=u)}}class t extends h{constructor(s,u,m){super(),this._document=s,this._parentElement=u,this._optionsService=m,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class i extends h{constructor(s){super(),this._optionsService=s,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const u=this._ctx.measureText("W");if(!("width"in u&&"fontBoundingBoxAscent"in u&&"fontBoundingBoxDescent"in u))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const s=this._ctx.measureText("W");return this._validateAndSet(s.width,s.fontBoundingBoxAscent+s.fontBoundingBoxDescent),this._result}}},4269:function(E,n,a){var c=this&&this.__decorate||function(i,e,s,u){var m,S=arguments.length,C=S<3?e:u===null?u=Object.getOwnPropertyDescriptor(e,s):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(i,e,s,u);else for(var v=i.length-1;v>=0;v--)(m=i[v])&&(C=(S<3?m(C):S>3?m(e,s,C):m(e,s))||C);return S>3&&C&&Object.defineProperty(e,s,C),C},f=this&&this.__param||function(i,e){return function(s,u){e(s,u,i)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CharacterJoinerService=n.JoinedCellData=void 0;const l=a(3734),d=a(643),p=a(511),g=a(2585);class h extends l.AttributeData{constructor(e,s,u){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=s,this._width=u}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}n.JoinedCellData=h;let t=n.CharacterJoinerService=class Xn{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new p.CellData}register(e){const s={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(s),s.id}deregister(e){for(let s=0;s<this._characterJoiners.length;s++)if(this._characterJoiners[s].id===e)return this._characterJoiners.splice(s,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];const s=this._bufferService.buffer.lines.get(e);if(!s||s.length===0)return[];const u=[],m=s.translateToString(!0);let S=0,C=0,v=0,x=s.getFg(0),T=s.getBg(0);for(let M=0;M<s.getTrimmedLength();M++)if(s.loadCell(M,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==x||this._workCell.bg!==T){if(M-S>1){const O=this._getJoinedRanges(m,v,C,s,S);for(let A=0;A<O.length;A++)u.push(O[A])}S=M,v=C,x=this._workCell.fg,T=this._workCell.bg}C+=this._workCell.getChars().length||d.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-S>1){const M=this._getJoinedRanges(m,v,C,s,S);for(let O=0;O<M.length;O++)u.push(M[O])}return u}_getJoinedRanges(e,s,u,m,S){const C=e.substring(s,u);let v=[];try{v=this._characterJoiners[0].handler(C)}catch(x){console.error(x)}for(let x=1;x<this._characterJoiners.length;x++)try{const T=this._characterJoiners[x].handler(C);for(let M=0;M<T.length;M++)Xn._mergeRanges(v,T[M])}catch(T){console.error(T)}return this._stringRangesToCellRanges(v,m,S),v}_stringRangesToCellRanges(e,s,u){let m=0,S=!1,C=0,v=e[m];if(v){for(let x=u;x<this._bufferService.cols;x++){const T=s.getWidth(x),M=s.getString(x).length||d.WHITESPACE_CELL_CHAR.length;if(T!==0){if(!S&&v[0]<=C&&(v[0]=x,S=!0),v[1]<=C){if(v[1]=x,v=e[++m],!v)break;v[0]<=C?(v[0]=x,S=!0):S=!1}C+=M}}v&&(v[1]=this._bufferService.cols)}}static _mergeRanges(e,s){let u=!1;for(let m=0;m<e.length;m++){const S=e[m];if(u){if(s[1]<=S[0])return e[m-1][1]=s[1],e;if(s[1]<=S[1])return e[m-1][1]=Math.max(s[1],S[1]),e.splice(m,1),e;e.splice(m,1),m--}else{if(s[1]<=S[0])return e.splice(m,0,s),e;if(s[1]<=S[1])return S[0]=Math.min(s[0],S[0]),e;s[0]<S[1]&&(S[0]=Math.min(s[0],S[0]),u=!0)}}return u?e[e.length-1][1]=s[1]:e.push(s),e}};n.CharacterJoinerService=t=c([f(0,g.IBufferService)],t)},5114:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoreBrowserService=void 0;const c=a(844),f=a(8460),l=a(3656);class d extends c.Disposable{constructor(h,t,i){super(),this._textarea=h,this._window=t,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((e=>this._screenDprMonitor.setWindow(e)))),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(h){this._window!==h&&(this._window=h,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(h){super(),this._parentWindow=h,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(h){this._parentWindow=h,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,l.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var h;this._outerListener&&((h=this._resolutionMediaMatchList)==null||h.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:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.LinkProviderService=void 0;const c=a(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(E,n,a){var c=this&&this.__decorate||function(g,h,t,i){var e,s=arguments.length,u=s<3?h:i===null?i=Object.getOwnPropertyDescriptor(h,t):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(g,h,t,i);else for(var m=g.length-1;m>=0;m--)(e=g[m])&&(u=(s<3?e(u):s>3?e(h,t,u):e(h,t))||u);return s>3&&u&&Object.defineProperty(h,t,u),u},f=this&&this.__param||function(g,h){return function(t,i){h(t,i,g)}};Object.defineProperty(n,"__esModule",{value:!0}),n.MouseService=void 0;const l=a(4725),d=a(9806);let p=n.MouseService=class{constructor(g,h){this._renderService=g,this._charSizeService=h}getCoords(g,h,t,i,e){return(0,d.getCoords)(window,g,h,t,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(g,h){const t=(0,d.getCoordsRelativeToElement)(window,g,h);if(this._charSizeService.hasValidSize)return t[0]=Math.min(Math.max(t[0],0),this._renderService.dimensions.css.canvas.width-1),t[1]=Math.min(Math.max(t[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(t[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(t[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(t[0]),y:Math.floor(t[1])}}};n.MouseService=p=c([f(0,l.IRenderService),f(1,l.ICharSizeService)],p)},3230:function(E,n,a){var c=this&&this.__decorate||function(e,s,u,m){var S,C=arguments.length,v=C<3?s:m===null?m=Object.getOwnPropertyDescriptor(s,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,s,u,m);else for(var x=e.length-1;x>=0;x--)(S=e[x])&&(v=(C<3?S(v):C>3?S(s,u,v):S(s,u))||v);return C>3&&v&&Object.defineProperty(s,u,v),v},f=this&&this.__param||function(e,s){return function(u,m){s(u,m,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.RenderService=void 0;const l=a(6193),d=a(4725),p=a(8460),g=a(844),h=a(7226),t=a(2585);let i=n.RenderService=class extends g.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,s,u,m,S,C,v,x){super(),this._rowCount=e,this._charSizeService=m,this._renderer=this.register(new g.MutableDisposable),this._pausedResizeTask=new h.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 l.RenderDebouncer(((T,M)=>this._renderRows(T,M)),v),this.register(this._renderDebouncer),this.register(v.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(C.onResize((()=>this._fullRefresh()))),this.register(C.buffers.onBufferActivate((()=>{var T;return(T=this._renderer.value)==null?void 0:T.clear()}))),this.register(u.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(S.onDecorationRegistered((()=>this._fullRefresh()))),this.register(S.onDecorationRemoved((()=>this._fullRefresh()))),this.register(u.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(C.cols,C.rows),this._fullRefresh()}))),this.register(u.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(C.buffer.y,C.buffer.y,!0)))),this.register(x.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(v.window,s),this.register(v.onWindowChange((T=>this._registerIntersectionObserver(T,s))))}_registerIntersectionObserver(e,s){if("IntersectionObserver"in e){const u=new e.IntersectionObserver((m=>this._handleIntersectionChange(m[m.length-1])),{threshold:0});u.observe(s),this._observerDisposable.value=(0,g.toDisposable)((()=>u.disconnect()))}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,s,u=!1){this._isPaused?this._needsFullRefresh=!0:(u||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,s,this._rowCount))}_renderRows(e,s){this._renderer.value&&(e=Math.min(e,this._rowCount-1),s=Math.min(s,this._rowCount-1),this._renderer.value.renderRows(e,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:e,end:s}),this._onRender.fire({start:e,end:s}),this._isNextRenderRedrawOnly=!0)}resize(e,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(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw((s=>this.refreshRows(s.start,s.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,s;this._renderer.value&&((s=(e=this._renderer.value).clearTextureAtlas)==null||s.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,s){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var u;return(u=this._renderer.value)==null?void 0:u.handleResize(e,s)})):this._renderer.value.handleResize(e,s),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,s,u){var m;this._selectionState.start=e,this._selectionState.end=s,this._selectionState.columnSelectMode=u,(m=this._renderer.value)==null||m.handleSelectionChanged(e,s,u)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};n.RenderService=i=c([f(2,t.IOptionsService),f(3,d.ICharSizeService),f(4,t.IDecorationService),f(5,t.IBufferService),f(6,d.ICoreBrowserService),f(7,d.IThemeService)],i)},9312:function(E,n,a){var c=this&&this.__decorate||function(v,x,T,M){var O,A=arguments.length,H=A<3?x:M===null?M=Object.getOwnPropertyDescriptor(x,T):M;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(v,x,T,M);else for(var I=v.length-1;I>=0;I--)(O=v[I])&&(H=(A<3?O(H):A>3?O(x,T,H):O(x,T))||H);return A>3&&H&&Object.defineProperty(x,T,H),H},f=this&&this.__param||function(v,x){return function(T,M){x(T,M,v)}};Object.defineProperty(n,"__esModule",{value:!0}),n.SelectionService=void 0;const l=a(9806),d=a(9504),p=a(456),g=a(4725),h=a(8460),t=a(844),i=a(6114),e=a(4841),s=a(511),u=a(2585),m=" ",S=new RegExp(m,"g");let C=n.SelectionService=class extends t.Disposable{constructor(v,x,T,M,O,A,H,I,N){super(),this._element=v,this._screenElement=x,this._linkifier=T,this._bufferService=M,this._coreService=O,this._mouseService=A,this._optionsService=H,this._renderService=I,this._coreBrowserService=N,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 h.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new h.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new h.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new h.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=U=>this._handleMouseMove(U),this._mouseUpListener=U=>this._handleMouseUp(U),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((U=>this._handleTrim(U))),this.register(this._bufferService.buffers.onBufferActivate((U=>this._handleBufferActivate(U)))),this.enable(),this._model=new p.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,t.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 v=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!(!v||!x||v[0]===x[0]&&v[1]===x[1])}get selectionText(){const v=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;if(!v||!x)return"";const T=this._bufferService.buffer,M=[];if(this._activeSelectionMode===3){if(v[0]===x[0])return"";const O=v[0]<x[0]?v[0]:x[0],A=v[0]<x[0]?x[0]:v[0];for(let H=v[1];H<=x[1];H++){const I=T.translateBufferLineToString(H,!0,O,A);M.push(I)}}else{const O=v[1]===x[1]?x[0]:void 0;M.push(T.translateBufferLineToString(v[1],!0,v[0],O));for(let A=v[1]+1;A<=x[1]-1;A++){const H=T.lines.get(A),I=T.translateBufferLineToString(A,!0);H!=null&&H.isWrapped?M[M.length-1]+=I:M.push(I)}if(v[1]!==x[1]){const A=T.lines.get(x[1]),H=T.translateBufferLineToString(x[1],!0,0,x[0]);A&&A.isWrapped?M[M.length-1]+=H:M.push(H)}}return M.map((O=>O.replace(S," "))).join(i.isWindows?`\r
7
+ `:`
8
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(v){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),i.isLinux&&v&&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(v){const x=this._getMouseBufferCoords(v),T=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!!(T&&M&&x)&&this._areCoordsInSelection(x,T,M)}isCellInSelection(v,x){const T=this._model.finalSelectionStart,M=this._model.finalSelectionEnd;return!(!T||!M)&&this._areCoordsInSelection([v,x],T,M)}_areCoordsInSelection(v,x,T){return v[1]>x[1]&&v[1]<T[1]||x[1]===T[1]&&v[1]===x[1]&&v[0]>=x[0]&&v[0]<T[0]||x[1]<T[1]&&v[1]===T[1]&&v[0]<T[0]||x[1]<T[1]&&v[1]===x[1]&&v[0]>=x[0]}_selectWordAtCursor(v,x){var O,A;const T=(A=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:A.range;if(T)return this._model.selectionStart=[T.start.x-1,T.start.y-1],this._model.selectionStartLength=(0,e.getRangeLength)(T,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const M=this._getMouseBufferCoords(v);return!!M&&(this._selectWordAt(M,x),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(v,x){this._model.clearSelection(),v=Math.max(v,0),x=Math.min(x,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,v],this._model.selectionEnd=[this._bufferService.cols,x],this.refresh(),this._onSelectionChange.fire()}_handleTrim(v){this._model.handleTrim(v)&&this.refresh()}_getMouseBufferCoords(v){const x=this._mouseService.getCoords(v,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(x)return x[0]--,x[1]--,x[1]+=this._bufferService.buffer.ydisp,x}_getMouseEventScrollAmount(v){let x=(0,l.getCoordsRelativeToElement)(this._coreBrowserService.window,v,this._screenElement)[1];const T=this._renderService.dimensions.css.canvas.height;return x>=0&&x<=T?0:(x>T&&(x-=T),x=Math.min(Math.max(x,-50),50),x/=50,x/Math.abs(x)+Math.round(14*x))}shouldForceSelection(v){return i.isMac?v.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:v.shiftKey}handleMouseDown(v){if(this._mouseDownTimeStamp=v.timeStamp,(v.button!==2||!this.hasSelection)&&v.button===0){if(!this._enabled){if(!this.shouldForceSelection(v))return;v.stopPropagation()}v.preventDefault(),this._dragScrollAmount=0,this._enabled&&v.shiftKey?this._handleIncrementalClick(v):v.detail===1?this._handleSingleClick(v):v.detail===2?this._handleDoubleClick(v):v.detail===3&&this._handleTripleClick(v),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(v){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(v))}_handleSingleClick(v){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(v)?3:0,this._model.selectionStart=this._getMouseBufferCoords(v),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const x=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);x&&x.length!==this._model.selectionStart[0]&&x.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(v){this._selectWordAtCursor(v,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(v){const x=this._getMouseBufferCoords(v);x&&(this._activeSelectionMode=2,this._selectLineAt(x[1]))}shouldColumnSelect(v){return v.altKey&&!(i.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(v){if(v.stopImmediatePropagation(),!this._model.selectionStart)return;const x=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(v),!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(v),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const T=this._bufferService.buffer;if(this._model.selectionEnd[1]<T.lines.length){const M=T.lines.get(this._model.selectionEnd[1]);M&&M.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}x&&x[0]===this._model.selectionEnd[0]&&x[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 v=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(v.ydisp+this._bufferService.rows,v.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=v.ydisp),this.refresh()}}_handleMouseUp(v){const x=v.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&x<500&&v.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const T=this._mouseService.getCoords(v,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){const M=(0,d.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(M,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const v=this._model.finalSelectionStart,x=this._model.finalSelectionEnd,T=!(!v||!x||v[0]===x[0]&&v[1]===x[1]);T?v&&x&&(this._oldSelectionStart&&this._oldSelectionEnd&&v[0]===this._oldSelectionStart[0]&&v[1]===this._oldSelectionStart[1]&&x[0]===this._oldSelectionEnd[0]&&x[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(v,x,T)):this._oldHasSelection&&this._fireOnSelectionChange(v,x,T)}_fireOnSelectionChange(v,x,T){this._oldSelectionStart=v,this._oldSelectionEnd=x,this._oldHasSelection=T,this._onSelectionChange.fire()}_handleBufferActivate(v){this.clearSelection(),this._trimListener.dispose(),this._trimListener=v.activeBuffer.lines.onTrim((x=>this._handleTrim(x)))}_convertViewportColToCharacterIndex(v,x){let T=x;for(let M=0;x>=M;M++){const O=v.loadCell(M,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:O>1&&x!==M&&(T+=O-1)}return T}setSelection(v,x,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[v,x],this._model.selectionStartLength=T,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(v){this._isClickInSelection(v)||(this._selectWordAtCursor(v,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(v,x,T=!0,M=!0){if(v[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,A=O.lines.get(v[1]);if(!A)return;const H=O.translateBufferLineToString(v[1],!1);let I=this._convertViewportColToCharacterIndex(A,v[0]),N=I;const U=v[0]-I;let $=0,y=0,R=0,B=0;if(H.charAt(I)===" "){for(;I>0&&H.charAt(I-1)===" ";)I--;for(;N<H.length&&H.charAt(N+1)===" ";)N++}else{let J=v[0],Q=v[0];A.getWidth(J)===0&&($++,J--),A.getWidth(Q)===2&&(y++,Q++);const ie=A.getString(Q).length;for(ie>1&&(B+=ie-1,N+=ie-1);J>0&&I>0&&!this._isCharWordSeparator(A.loadCell(J-1,this._workCell));){A.loadCell(J-1,this._workCell);const F=this._workCell.getChars().length;this._workCell.getWidth()===0?($++,J--):F>1&&(R+=F-1,I-=F-1),I--,J--}for(;Q<A.length&&N+1<H.length&&!this._isCharWordSeparator(A.loadCell(Q+1,this._workCell));){A.loadCell(Q+1,this._workCell);const F=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,Q++):F>1&&(B+=F-1,N+=F-1),N++,Q++}}N++;let P=I+U-$+R,K=Math.min(this._bufferService.cols,N-I+$+y-R-B);if(x||H.slice(I,N).trim()!==""){if(T&&P===0&&A.getCodePoint(0)!==32){const J=O.lines.get(v[1]-1);if(J&&A.isWrapped&&J.getCodePoint(this._bufferService.cols-1)!==32){const Q=this._getWordAt([this._bufferService.cols-1,v[1]-1],!1,!0,!1);if(Q){const ie=this._bufferService.cols-Q.start;P-=ie,K+=ie}}}if(M&&P+K===this._bufferService.cols&&A.getCodePoint(this._bufferService.cols-1)!==32){const J=O.lines.get(v[1]+1);if(J!=null&&J.isWrapped&&J.getCodePoint(0)!==32){const Q=this._getWordAt([0,v[1]+1],!1,!1,!0);Q&&(K+=Q.length)}}return{start:P,length:K}}}_selectWordAt(v,x){const T=this._getWordAt(v,x);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,v[1]--;this._model.selectionStart=[T.start,v[1]],this._model.selectionStartLength=T.length}}_selectToWordAt(v){const x=this._getWordAt(v,!0);if(x){let T=v[1];for(;x.start<0;)x.start+=this._bufferService.cols,T--;if(!this._model.areSelectionValuesReversed())for(;x.start+x.length>this._bufferService.cols;)x.length-=this._bufferService.cols,T++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?x.start:x.start+x.length,T]}}_isCharWordSeparator(v){return v.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(v.getChars())>=0}_selectLineAt(v){const x=this._bufferService.buffer.getWrappedRangeForLine(v),T={start:{x:0,y:x.first},end:{x:this._bufferService.cols-1,y:x.last}};this._model.selectionStart=[0,x.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,e.getRangeLength)(T,this._bufferService.cols)}};n.SelectionService=C=c([f(3,u.IBufferService),f(4,u.ICoreService),f(5,g.IMouseService),f(6,u.IOptionsService),f(7,g.IRenderService),f(8,g.ICoreBrowserService)],C)},4725:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ILinkProviderService=n.IThemeService=n.ICharacterJoinerService=n.ISelectionService=n.IRenderService=n.IMouseService=n.ICoreBrowserService=n.ICharSizeService=void 0;const c=a(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(E,n,a){var c=this&&this.__decorate||function(C,v,x,T){var M,O=arguments.length,A=O<3?v:T===null?T=Object.getOwnPropertyDescriptor(v,x):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(C,v,x,T);else for(var H=C.length-1;H>=0;H--)(M=C[H])&&(A=(O<3?M(A):O>3?M(v,x,A):M(v,x))||A);return O>3&&A&&Object.defineProperty(v,x,A),A},f=this&&this.__param||function(C,v){return function(x,T){v(x,T,C)}};Object.defineProperty(n,"__esModule",{value:!0}),n.ThemeService=n.DEFAULT_ANSI_COLORS=void 0;const l=a(7239),d=a(8055),p=a(8460),g=a(844),h=a(2585),t=d.css.toColor("#ffffff"),i=d.css.toColor("#000000"),e=d.css.toColor("#ffffff"),s=d.css.toColor("#000000"),u={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};n.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const C=[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")],v=[0,95,135,175,215,255];for(let x=0;x<216;x++){const T=v[x/36%6|0],M=v[x/6%6|0],O=v[x%6];C.push({css:d.channels.toCss(T,M,O),rgba:d.channels.toRgba(T,M,O)})}for(let x=0;x<24;x++){const T=8+10*x;C.push({css:d.channels.toCss(T,T,T),rgba:d.channels.toRgba(T,T,T)})}return C})());let m=n.ThemeService=class extends g.Disposable{get colors(){return this._colors}constructor(C){super(),this._optionsService=C,this._contrastCache=new l.ColorContrastCache,this._halfContrastCache=new l.ColorContrastCache,this._onChangeColors=this.register(new p.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:t,background:i,cursor:e,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:u,selectionBackgroundOpaque:d.color.blend(i,u),selectionInactiveBackgroundTransparent:u,selectionInactiveBackgroundOpaque:d.color.blend(i,u),ansi:n.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(C={}){const v=this._colors;if(v.foreground=S(C.foreground,t),v.background=S(C.background,i),v.cursor=S(C.cursor,e),v.cursorAccent=S(C.cursorAccent,s),v.selectionBackgroundTransparent=S(C.selectionBackground,u),v.selectionBackgroundOpaque=d.color.blend(v.background,v.selectionBackgroundTransparent),v.selectionInactiveBackgroundTransparent=S(C.selectionInactiveBackground,v.selectionBackgroundTransparent),v.selectionInactiveBackgroundOpaque=d.color.blend(v.background,v.selectionInactiveBackgroundTransparent),v.selectionForeground=C.selectionForeground?S(C.selectionForeground,d.NULL_COLOR):void 0,v.selectionForeground===d.NULL_COLOR&&(v.selectionForeground=void 0),d.color.isOpaque(v.selectionBackgroundTransparent)&&(v.selectionBackgroundTransparent=d.color.opacity(v.selectionBackgroundTransparent,.3)),d.color.isOpaque(v.selectionInactiveBackgroundTransparent)&&(v.selectionInactiveBackgroundTransparent=d.color.opacity(v.selectionInactiveBackgroundTransparent,.3)),v.ansi=n.DEFAULT_ANSI_COLORS.slice(),v.ansi[0]=S(C.black,n.DEFAULT_ANSI_COLORS[0]),v.ansi[1]=S(C.red,n.DEFAULT_ANSI_COLORS[1]),v.ansi[2]=S(C.green,n.DEFAULT_ANSI_COLORS[2]),v.ansi[3]=S(C.yellow,n.DEFAULT_ANSI_COLORS[3]),v.ansi[4]=S(C.blue,n.DEFAULT_ANSI_COLORS[4]),v.ansi[5]=S(C.magenta,n.DEFAULT_ANSI_COLORS[5]),v.ansi[6]=S(C.cyan,n.DEFAULT_ANSI_COLORS[6]),v.ansi[7]=S(C.white,n.DEFAULT_ANSI_COLORS[7]),v.ansi[8]=S(C.brightBlack,n.DEFAULT_ANSI_COLORS[8]),v.ansi[9]=S(C.brightRed,n.DEFAULT_ANSI_COLORS[9]),v.ansi[10]=S(C.brightGreen,n.DEFAULT_ANSI_COLORS[10]),v.ansi[11]=S(C.brightYellow,n.DEFAULT_ANSI_COLORS[11]),v.ansi[12]=S(C.brightBlue,n.DEFAULT_ANSI_COLORS[12]),v.ansi[13]=S(C.brightMagenta,n.DEFAULT_ANSI_COLORS[13]),v.ansi[14]=S(C.brightCyan,n.DEFAULT_ANSI_COLORS[14]),v.ansi[15]=S(C.brightWhite,n.DEFAULT_ANSI_COLORS[15]),C.extendedAnsi){const x=Math.min(v.ansi.length-16,C.extendedAnsi.length);for(let T=0;T<x;T++)v.ansi[T+16]=S(C.extendedAnsi[T],n.DEFAULT_ANSI_COLORS[T+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(C){this._restoreColor(C),this._onChangeColors.fire(this.colors)}_restoreColor(C){if(C!==void 0)switch(C){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[C]=this._restoreColors.ansi[C]}else for(let v=0;v<this._restoreColors.ansi.length;++v)this._colors.ansi[v]=this._restoreColors.ansi[v]}modifyColors(C){C(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function S(C,v){if(C!==void 0)try{return d.css.toColor(C)}catch{}return v}n.ThemeService=m=c([f(0,h.IOptionsService)],m)},6349:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CircularList=void 0;const c=a(8460),f=a(844);class l 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 h=0;h<Math.min(p,this.length);h++)g[h]=this._array[this._getCyclicIndex(h)];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,...h){if(g){for(let t=p;t<this._length-g;t++)this._array[this._getCyclicIndex(t)]=this._array[this._getCyclicIndex(t+g)];this._length-=g,this.onDeleteEmitter.fire({index:p,amount:g})}for(let t=this._length-1;t>=p;t--)this._array[this._getCyclicIndex(t+h.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<h.length;t++)this._array[this._getCyclicIndex(p+t)]=h[t];if(h.length&&this.onInsertEmitter.fire({index:p,amount:h.length}),this._length+h.length>this._maxLength){const t=this._length+h.length-this._maxLength;this._startIndex+=t,this._length=this._maxLength,this.onTrimEmitter.fire(t)}else this._length+=h.length}trimStart(p){p>this._length&&(p=this._length),this._startIndex+=p,this._length-=p,this.onTrimEmitter.fire(p)}shiftElements(p,g,h){if(!(g<=0)){if(p<0||p>=this._length)throw new Error("start argument out of range");if(p+h<0)throw new Error("Cannot shift elements in list beyond index 0");if(h>0){for(let i=g-1;i>=0;i--)this.set(p+i+h,this.get(p+i));const t=p+g+h-this._length;if(t>0)for(this._length+=t;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let t=0;t<g;t++)this.set(p+t+h,this.get(p+t))}}_getCyclicIndex(p){return(this._startIndex+p)%this._maxLength}}n.CircularList=l},1439:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clone=void 0,n.clone=function a(c,f=5){if(typeof c!="object")return c;const l=Array.isArray(c)?[]:{};for(const d in c)l[d]=f<=1?c[d]:c[d]&&a(c[d],f-1);return l}},8055:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.contrastRatio=n.toPaddedHex=n.rgba=n.rgb=n.css=n.color=n.channels=n.NULL_COLOR=void 0;let a=0,c=0,f=0,l=0;var d,p,g,h,t;function i(s){const u=s.toString(16);return u.length<2?"0"+u:u}function e(s,u){return s<u?(u+.05)/(s+.05):(s+.05)/(u+.05)}n.NULL_COLOR={css:"#00000000",rgba:0},(function(s){s.toCss=function(u,m,S,C){return C!==void 0?`#${i(u)}${i(m)}${i(S)}${i(C)}`:`#${i(u)}${i(m)}${i(S)}`},s.toRgba=function(u,m,S,C=255){return(u<<24|m<<16|S<<8|C)>>>0},s.toColor=function(u,m,S,C){return{css:s.toCss(u,m,S,C),rgba:s.toRgba(u,m,S,C)}}})(d||(n.channels=d={})),(function(s){function u(m,S){return l=Math.round(255*S),[a,c,f]=t.toChannels(m.rgba),{css:d.toCss(a,c,f,l),rgba:d.toRgba(a,c,f,l)}}s.blend=function(m,S){if(l=(255&S.rgba)/255,l===1)return{css:S.css,rgba:S.rgba};const C=S.rgba>>24&255,v=S.rgba>>16&255,x=S.rgba>>8&255,T=m.rgba>>24&255,M=m.rgba>>16&255,O=m.rgba>>8&255;return a=T+Math.round((C-T)*l),c=M+Math.round((v-M)*l),f=O+Math.round((x-O)*l),{css:d.toCss(a,c,f),rgba:d.toRgba(a,c,f)}},s.isOpaque=function(m){return(255&m.rgba)==255},s.ensureContrastRatio=function(m,S,C){const v=t.ensureContrastRatio(m.rgba,S.rgba,C);if(v)return d.toColor(v>>24&255,v>>16&255,v>>8&255)},s.opaque=function(m){const S=(255|m.rgba)>>>0;return[a,c,f]=t.toChannels(S),{css:d.toCss(a,c,f),rgba:S}},s.opacity=u,s.multiplyOpacity=function(m,S){return l=255&m.rgba,u(m,l*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 u,m;try{const S=document.createElement("canvas");S.width=1,S.height=1;const C=S.getContext("2d",{willReadFrequently:!0});C&&(u=C,u.globalCompositeOperation="copy",m=u.createLinearGradient(0,0,1,1))}catch{}s.toColor=function(S){if(S.match(/#[\da-f]{3,8}/i))switch(S.length){case 4:return a=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(a,c,f);case 5:return a=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),l=parseInt(S.slice(4,5).repeat(2),16),d.toColor(a,c,f,l);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 C=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(C)return a=parseInt(C[1]),c=parseInt(C[2]),f=parseInt(C[3]),l=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),d.toColor(a,c,f,l);if(!u||!m)throw new Error("css.toColor: Unsupported css format");if(u.fillStyle=m,u.fillStyle=S,typeof u.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(u.fillRect(0,0,1,1),[a,c,f,l]=u.getImageData(0,0,1,1).data,l!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:d.toRgba(a,c,f,l),css:S}}})(g||(n.css=g={})),(function(s){function u(m,S,C){const v=m/255,x=S/255,T=C/255;return .2126*(v<=.03928?v/12.92:Math.pow((v+.055)/1.055,2.4))+.7152*(x<=.03928?x/12.92:Math.pow((x+.055)/1.055,2.4))+.0722*(T<=.03928?T/12.92:Math.pow((T+.055)/1.055,2.4))}s.relativeLuminance=function(m){return u(m>>16&255,m>>8&255,255&m)},s.relativeLuminance2=u})(h||(n.rgb=h={})),(function(s){function u(S,C,v){const x=S>>24&255,T=S>>16&255,M=S>>8&255;let O=C>>24&255,A=C>>16&255,H=C>>8&255,I=e(h.relativeLuminance2(O,A,H),h.relativeLuminance2(x,T,M));for(;I<v&&(O>0||A>0||H>0);)O-=Math.max(0,Math.ceil(.1*O)),A-=Math.max(0,Math.ceil(.1*A)),H-=Math.max(0,Math.ceil(.1*H)),I=e(h.relativeLuminance2(O,A,H),h.relativeLuminance2(x,T,M));return(O<<24|A<<16|H<<8|255)>>>0}function m(S,C,v){const x=S>>24&255,T=S>>16&255,M=S>>8&255;let O=C>>24&255,A=C>>16&255,H=C>>8&255,I=e(h.relativeLuminance2(O,A,H),h.relativeLuminance2(x,T,M));for(;I<v&&(O<255||A<255||H<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),A=Math.min(255,A+Math.ceil(.1*(255-A))),H=Math.min(255,H+Math.ceil(.1*(255-H))),I=e(h.relativeLuminance2(O,A,H),h.relativeLuminance2(x,T,M));return(O<<24|A<<16|H<<8|255)>>>0}s.blend=function(S,C){if(l=(255&C)/255,l===1)return C;const v=C>>24&255,x=C>>16&255,T=C>>8&255,M=S>>24&255,O=S>>16&255,A=S>>8&255;return a=M+Math.round((v-M)*l),c=O+Math.round((x-O)*l),f=A+Math.round((T-A)*l),d.toRgba(a,c,f)},s.ensureContrastRatio=function(S,C,v){const x=h.relativeLuminance(S>>8),T=h.relativeLuminance(C>>8);if(e(x,T)<v){if(T<x){const A=u(S,C,v),H=e(x,h.relativeLuminance(A>>8));if(H<v){const I=m(S,C,v);return H>e(x,h.relativeLuminance(I>>8))?A:I}return A}const M=m(S,C,v),O=e(x,h.relativeLuminance(M>>8));if(O<v){const A=u(S,C,v);return O>e(x,h.relativeLuminance(A>>8))?M:A}return M}},s.reduceLuminance=u,s.increaseLuminance=m,s.toChannels=function(S){return[S>>24&255,S>>16&255,S>>8&255,255&S]}})(t||(n.rgba=t={})),n.toPaddedHex=i,n.contrastRatio=e},8969:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoreTerminal=void 0;const c=a(844),f=a(2585),l=a(4348),d=a(7866),p=a(744),g=a(7302),h=a(6975),t=a(8460),i=a(1753),e=a(1480),s=a(7994),u=a(9282),m=a(5435),S=a(5981),C=a(2660);let v=!1;class x extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new t.EventEmitter),this._onScroll.event((M=>{var O;(O=this._onScrollApi)==null||O.fire(M.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(M){for(const O in M)this.optionsService.options[O]=M[O]}constructor(M){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new t.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new t.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new t.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new t.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new t.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new t.EventEmitter),this._instantiationService=new l.InstantiationService,this.optionsService=this.register(new g.OptionsService(M)),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(h.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(e.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(C.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,t.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,t.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,t.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,t.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,t.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(M,O){this._writeBuffer.write(M,O)}writeSync(M,O){this._logService.logLevel<=f.LogLevelEnum.WARN&&!v&&(this._logService.warn("writeSync is unreliable and will be removed soon."),v=!0),this._writeBuffer.writeSync(M,O)}input(M,O=!0){this.coreService.triggerDataEvent(M,O)}resize(M,O){isNaN(M)||isNaN(O)||(M=Math.max(M,p.MINIMUM_COLS),O=Math.max(O,p.MINIMUM_ROWS),this._bufferService.resize(M,O))}scroll(M,O=!1){this._bufferService.scroll(M,O)}scrollLines(M,O,A){this._bufferService.scrollLines(M,O,A)}scrollPages(M){this.scrollLines(M*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(M){const O=M-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(M,O){return this._inputHandler.registerEscHandler(M,O)}registerDcsHandler(M,O){return this._inputHandler.registerDcsHandler(M,O)}registerCsiHandler(M,O){return this._inputHandler.registerCsiHandler(M,O)}registerOscHandler(M,O){return this._inputHandler.registerOscHandler(M,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let M=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?M=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(M=!0),M?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const M=[];M.push(this.onLineFeed(u.updateWindowsModeWrappedState.bind(null,this._bufferService))),M.push(this.registerCsiHandler({final:"H"},(()=>((0,u.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(const O of M)O.dispose()}))}}}n.CoreTerminal=x},8460:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.runAndSubscribe=n.forwardEvent=n.EventEmitter=void 0,n.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let c=0;c<this._listeners.length;c++)if(this._listeners[c]===a)return void this._listeners.splice(c,1)}}})),this._event}fire(a,c){const f=[];for(let l=0;l<this._listeners.length;l++)f.push(this._listeners[l]);for(let l=0;l<f.length;l++)f[l].call(void 0,a,c)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},n.forwardEvent=function(a,c){return a((f=>c.fire(f)))},n.runAndSubscribe=function(a,c){return c(void 0),a((f=>c(f)))}},5435:function(E,n,a){var c=this&&this.__decorate||function($,y,R,B){var P,K=arguments.length,J=K<3?y:B===null?B=Object.getOwnPropertyDescriptor(y,R):B;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")J=Reflect.decorate($,y,R,B);else for(var Q=$.length-1;Q>=0;Q--)(P=$[Q])&&(J=(K<3?P(J):K>3?P(y,R,J):P(y,R))||J);return K>3&&J&&Object.defineProperty(y,R,J),J},f=this&&this.__param||function($,y){return function(R,B){y(R,B,$)}};Object.defineProperty(n,"__esModule",{value:!0}),n.InputHandler=n.WindowsOptionsReportType=void 0;const l=a(2584),d=a(7116),p=a(2015),g=a(844),h=a(482),t=a(8437),i=a(8460),e=a(643),s=a(511),u=a(3734),m=a(2585),S=a(1480),C=a(6242),v=a(6351),x=a(5941),T={"(":0,")":1,"*":2,"+":3,"-":1,".":2},M=131072;function O($,y){if($>24)return y.setWinLines||!1;switch($){case 1:return!!y.restoreWin;case 2:return!!y.minimizeWin;case 3:return!!y.setWinPosition;case 4:return!!y.setWinSizePixels;case 5:return!!y.raiseWin;case 6:return!!y.lowerWin;case 7:return!!y.refreshWin;case 8:return!!y.setWinSizeChars;case 9:return!!y.maximizeWin;case 10:return!!y.fullscreenWin;case 11:return!!y.getWinState;case 13:return!!y.getWinPosition;case 14:return!!y.getWinSizePixels;case 15:return!!y.getScreenSizePixels;case 16:return!!y.getCellSizePixels;case 18:return!!y.getWinSizeChars;case 19:return!!y.getScreenSizeChars;case 20:return!!y.getIconTitle;case 21:return!!y.getWinTitle;case 22:return!!y.pushTitle;case 23:return!!y.popTitle;case 24:return!!y.setWinLines}return!1}var 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 H=0;class I extends g.Disposable{getAttrData(){return this._curAttrData}constructor(y,R,B,P,K,J,Q,ie,F=new p.EscapeSequenceParser){super(),this._bufferService=y,this._charsetService=R,this._coreService=B,this._logService=P,this._optionsService=K,this._oscLinkService=J,this._coreMouseService=Q,this._unicodeService=ie,this._parser=F,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new h.StringToUtf32,this._utf8Decoder=new h.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=t.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=t.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 N(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._parser.setCsiHandlerFallback(((L,Y)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(L),params:Y.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,Y,j)=>{this._logService.debug("Unknown OSC code: ",{identifier:L,action:Y,data:j})})),this._parser.setDcsHandlerFallback(((L,Y,j)=>{Y==="HOOK"&&(j=j.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(L),action:Y,payload:j})})),this._parser.setPrintHandler(((L,Y,j)=>this.print(L,Y,j))),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(l.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(l.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(l.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(l.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(l.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(l.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(l.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(l.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(l.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(l.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new C.OscHandler((L=>(this.setTitle(L),this.setIconName(L),!0)))),this._parser.registerOscHandler(1,new C.OscHandler((L=>this.setIconName(L)))),this._parser.registerOscHandler(2,new C.OscHandler((L=>this.setTitle(L)))),this._parser.registerOscHandler(4,new C.OscHandler((L=>this.setOrReportIndexedColor(L)))),this._parser.registerOscHandler(8,new C.OscHandler((L=>this.setHyperlink(L)))),this._parser.registerOscHandler(10,new C.OscHandler((L=>this.setOrReportFgColor(L)))),this._parser.registerOscHandler(11,new C.OscHandler((L=>this.setOrReportBgColor(L)))),this._parser.registerOscHandler(12,new C.OscHandler((L=>this.setOrReportCursorColor(L)))),this._parser.registerOscHandler(104,new C.OscHandler((L=>this.restoreIndexedColor(L)))),this._parser.registerOscHandler(110,new C.OscHandler((L=>this.restoreFgColor(L)))),this._parser.registerOscHandler(111,new C.OscHandler((L=>this.restoreBgColor(L)))),this._parser.registerOscHandler(112,new C.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 v.DcsHandler(((L,Y)=>this.requestStatusString(L,Y))))}_preserveStack(y,R,B,P){this._parseStack.paused=!0,this._parseStack.cursorStartX=y,this._parseStack.cursorStartY=R,this._parseStack.decodedLength=B,this._parseStack.position=P}_logSlowResolvingAsync(y){this._logService.logLevel<=m.LogLevelEnum.WARN&&Promise.race([y,new Promise(((R,B)=>setTimeout((()=>B("#SLOW_TIMEOUT")),5e3)))]).catch((R=>{if(R!=="#SLOW_TIMEOUT")throw R;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(y,R){let B,P=this._activeBuffer.x,K=this._activeBuffer.y,J=0;const Q=this._parseStack.paused;if(Q){if(B=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,R))return this._logSlowResolvingAsync(B),B;P=this._parseStack.cursorStartX,K=this._parseStack.cursorStartY,this._parseStack.paused=!1,y.length>M&&(J=this._parseStack.position+M)}if(this._logService.logLevel<=m.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof y=="string"?` "${y}"`:` "${Array.prototype.map.call(y,(L=>String.fromCharCode(L))).join("")}"`),typeof y=="string"?y.split("").map((L=>L.charCodeAt(0))):y),this._parseBuffer.length<y.length&&this._parseBuffer.length<M&&(this._parseBuffer=new Uint32Array(Math.min(y.length,M))),Q||this._dirtyRowTracker.clearRange(),y.length>M)for(let L=J;L<y.length;L+=M){const Y=L+M<y.length?L+M:y.length,j=typeof y=="string"?this._stringDecoder.decode(y.substring(L,Y),this._parseBuffer):this._utf8Decoder.decode(y.subarray(L,Y),this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,j))return this._preserveStack(P,K,j,L),this._logSlowResolvingAsync(B),B}else if(!Q){const L=typeof y=="string"?this._stringDecoder.decode(y,this._parseBuffer):this._utf8Decoder.decode(y,this._parseBuffer);if(B=this._parser.parse(this._parseBuffer,L))return this._preserveStack(P,K,L,0),this._logSlowResolvingAsync(B),B}this._activeBuffer.x===P&&this._activeBuffer.y===K||this._onCursorMove.fire();const ie=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),F=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);F<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(F,this._bufferService.rows-1),Math.min(ie,this._bufferService.rows-1))}print(y,R,B){let P,K;const J=this._charsetService.charset,Q=this._optionsService.rawOptions.screenReaderMode,ie=this._bufferService.cols,F=this._coreService.decPrivateModes.wraparound,L=this._coreService.modes.insertMode,Y=this._curAttrData;let j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&B-R>0&&j.getWidth(this._activeBuffer.x-1)===2&&j.setCellFromCodepoint(this._activeBuffer.x-1,0,1,Y);let te=this._parser.precedingJoinState;for(let Z=R;Z<B;++Z){if(P=y[Z],P<127&&J){const Te=J[String.fromCharCode(P)];Te&&(P=Te.charCodeAt(0))}const ce=this._unicodeService.charProperties(P,te);K=S.UnicodeService.extractWidth(ce);const _e=S.UnicodeService.extractShouldJoin(ce),ge=_e?S.UnicodeService.extractWidth(te):0;if(te=ce,Q&&this._onA11yChar.fire((0,h.stringFromCodePoint)(P)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+K-ge>ie){if(F){const Te=j;let le=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),j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ge>0&&j instanceof t.BufferLine&&j.copyCellsFrom(Te,le,0,ge,!1);le<ie;)Te.setCellFromCodepoint(le++,0,1,Y)}else if(this._activeBuffer.x=ie-1,K===2)continue}if(_e&&this._activeBuffer.x){const Te=j.getWidth(this._activeBuffer.x-1)?1:2;j.addCodepointToCell(this._activeBuffer.x-Te,P,K);for(let le=K-ge;--le>=0;)j.setCellFromCodepoint(this._activeBuffer.x++,0,0,Y)}else if(L&&(j.insertCells(this._activeBuffer.x,K-ge,this._activeBuffer.getNullCell(Y)),j.getWidth(ie-1)===2&&j.setCellFromCodepoint(ie-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,Y)),j.setCellFromCodepoint(this._activeBuffer.x++,P,K,Y),K>0)for(;--K;)j.setCellFromCodepoint(this._activeBuffer.x++,0,0,Y)}this._parser.precedingJoinState=te,this._activeBuffer.x<ie&&B-R>0&&j.getWidth(this._activeBuffer.x)===0&&!j.hasContent(this._activeBuffer.x)&&j.setCellFromCodepoint(this._activeBuffer.x,0,1,Y),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(y,R){return y.final!=="t"||y.prefix||y.intermediates?this._parser.registerCsiHandler(y,R):this._parser.registerCsiHandler(y,(B=>!O(B.params[0],this._optionsService.rawOptions.windowOptions)||R(B)))}registerDcsHandler(y,R){return this._parser.registerDcsHandler(y,new v.DcsHandler(R))}registerEscHandler(y,R){return this._parser.registerEscHandler(y,R)}registerOscHandler(y,R){return this._parser.registerOscHandler(y,new C.OscHandler(R))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var y;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&y.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);R.hasWidth(this._activeBuffer.x)&&!R.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const y=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-y),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(y=this._bufferService.cols-1){this._activeBuffer.x=Math.min(y,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(y,R){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=y,this._activeBuffer.y=this._activeBuffer.scrollTop+R):(this._activeBuffer.x=y,this._activeBuffer.y=R),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(y,R){this._restrictCursor(),this._setCursor(this._activeBuffer.x+y,this._activeBuffer.y+R)}cursorUp(y){const R=this._activeBuffer.y-this._activeBuffer.scrollTop;return R>=0?this._moveCursor(0,-Math.min(R,y.params[0]||1)):this._moveCursor(0,-(y.params[0]||1)),!0}cursorDown(y){const R=this._activeBuffer.scrollBottom-this._activeBuffer.y;return R>=0?this._moveCursor(0,Math.min(R,y.params[0]||1)):this._moveCursor(0,y.params[0]||1),!0}cursorForward(y){return this._moveCursor(y.params[0]||1,0),!0}cursorBackward(y){return this._moveCursor(-(y.params[0]||1),0),!0}cursorNextLine(y){return this.cursorDown(y),this._activeBuffer.x=0,!0}cursorPrecedingLine(y){return this.cursorUp(y),this._activeBuffer.x=0,!0}cursorCharAbsolute(y){return this._setCursor((y.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(y){return this._setCursor(y.length>=2?(y.params[1]||1)-1:0,(y.params[0]||1)-1),!0}charPosAbsolute(y){return this._setCursor((y.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(y){return this._moveCursor(y.params[0]||1,0),!0}linePosAbsolute(y){return this._setCursor(this._activeBuffer.x,(y.params[0]||1)-1),!0}vPositionRelative(y){return this._moveCursor(0,y.params[0]||1),!0}hVPosition(y){return this.cursorPosition(y),!0}tabClear(y){const R=y.params[0];return R===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:R===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(y){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=y.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(y){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let R=y.params[0]||1;for(;R--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(y){const R=y.params[0];return R===1&&(this._curAttrData.bg|=536870912),R!==2&&R!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(y,R,B,P=!1,K=!1){const J=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);J.replaceCells(R,B,this._activeBuffer.getNullCell(this._eraseAttrData()),K),P&&(J.isWrapped=!1)}_resetBufferLine(y,R=!1){const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+y);B&&(B.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),R),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+y),B.isWrapped=!1)}eraseInDisplay(y,R=!1){let B;switch(this._restrictCursor(this._bufferService.cols),y.params[0]){case 0:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);B<this._bufferService.rows;B++)this._resetBufferLine(B,R);this._dirtyRowTracker.markDirty(B);break;case 1:for(B=this._activeBuffer.y,this._dirtyRowTracker.markDirty(B),this._eraseInBufferLine(B,0,this._activeBuffer.x+1,!0,R),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(B+1).isWrapped=!1);B--;)this._resetBufferLine(B,R);this._dirtyRowTracker.markDirty(0);break;case 2:for(B=this._bufferService.rows,this._dirtyRowTracker.markDirty(B-1);B--;)this._resetBufferLine(B,R);this._dirtyRowTracker.markDirty(0);break;case 3:const P=this._activeBuffer.lines.length-this._bufferService.rows;P>0&&(this._activeBuffer.lines.trimStart(P),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-P,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-P,0),this._onScroll.fire(0))}return!0}eraseInLine(y,R=!1){switch(this._restrictCursor(this._bufferService.cols),y.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,R);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,R);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,R)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(y){this._restrictCursor();let R=y.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y,P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,K=this._bufferService.rows-1+this._activeBuffer.ybase-P+1;for(;R--;)this._activeBuffer.lines.splice(K-1,1),this._activeBuffer.lines.splice(B,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(y){this._restrictCursor();let R=y.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const B=this._activeBuffer.ybase+this._activeBuffer.y;let P;for(P=this._bufferService.rows-1-this._activeBuffer.scrollBottom,P=this._bufferService.rows-1+this._activeBuffer.ybase-P;R--;)this._activeBuffer.lines.splice(B,1),this._activeBuffer.lines.splice(P,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(y){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.insertCells(this._activeBuffer.x,y.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(y){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.deleteCells(this._activeBuffer.x,y.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(y){let R=y.params[0]||1;for(;R--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(y){let R=y.params[0]||1;for(;R--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(t.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.deleteCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.insertCells(0,R,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.insertCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(y){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=y.params[0]||1;for(let B=this._activeBuffer.scrollTop;B<=this._activeBuffer.scrollBottom;++B){const P=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);P.deleteCells(this._activeBuffer.x,R,this._activeBuffer.getNullCell(this._eraseAttrData())),P.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(y){this._restrictCursor();const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return R&&(R.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(y.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(y){const R=this._parser.precedingJoinState;if(!R)return!0;const B=y.params[0]||1,P=S.UnicodeService.extractWidth(R),K=this._activeBuffer.x-P,J=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(K),Q=new Uint32Array(J.length*B);let ie=0;for(let L=0;L<J.length;){const Y=J.codePointAt(L)||0;Q[ie++]=Y,L+=Y>65535?2:1}let F=ie;for(let L=1;L<B;++L)Q.copyWithin(F,0,ie),F+=ie;return this.print(Q,0,F),!0}sendDeviceAttributesPrimary(y){return y.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(l.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(l.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(y){return y.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(l.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(l.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(y.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(l.C0.ESC+"[>83;40003;0c")),!0}_is(y){return(this._optionsService.rawOptions.termName+"").indexOf(y)===0}setMode(y){for(let R=0;R<y.length;R++)switch(y.params[R]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(y){for(let R=0;R<y.length;R++)switch(y.params[R]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,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(y){for(let R=0;R<y.length;R++)switch(y.params[R]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(y){for(let R=0;R<y.length;R++)switch(y.params[R]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),y.params[R]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(y,R){const B=this._coreService.decPrivateModes,{activeProtocol:P,activeEncoding:K}=this._coreMouseService,J=this._coreService,{buffers:Q,cols:ie}=this._bufferService,{active:F,alt:L}=Q,Y=this._optionsService.rawOptions,j=_e=>_e?1:2,te=y.params[0];return Z=te,ce=R?te===2?4:te===4?j(J.modes.insertMode):te===12?3:te===20?j(Y.convertEol):0:te===1?j(B.applicationCursorKeys):te===3?Y.windowOptions.setWinLines?ie===80?2:ie===132?1:0:0:te===6?j(B.origin):te===7?j(B.wraparound):te===8?3:te===9?j(P==="X10"):te===12?j(Y.cursorBlink):te===25?j(!J.isCursorHidden):te===45?j(B.reverseWraparound):te===66?j(B.applicationKeypad):te===67?4:te===1e3?j(P==="VT200"):te===1002?j(P==="DRAG"):te===1003?j(P==="ANY"):te===1004?j(B.sendFocus):te===1005?4:te===1006?j(K==="SGR"):te===1015?4:te===1016?j(K==="SGR_PIXELS"):te===1048?1:te===47||te===1047||te===1049?j(F===L):te===2004?j(B.bracketedPasteMode):0,J.triggerDataEvent(`${l.C0.ESC}[${R?"":"?"}${Z};${ce}$y`),!0;var Z,ce}_updateAttrColor(y,R,B,P,K){return R===2?(y|=50331648,y&=-16777216,y|=u.AttributeData.fromColorRGB([B,P,K])):R===5&&(y&=-50331904,y|=33554432|255&B),y}_extractColor(y,R,B){const P=[0,0,-1,0,0,0];let K=0,J=0;do{if(P[J+K]=y.params[R+J],y.hasSubParams(R+J)){const Q=y.getSubParams(R+J);let ie=0;do P[1]===5&&(K=1),P[J+ie+1+K]=Q[ie];while(++ie<Q.length&&ie+J+1+K<P.length);break}if(P[1]===5&&J+K>=2||P[1]===2&&J+K>=5)break;P[1]&&(K=1)}while(++J+R<y.length&&J+K<P.length);for(let Q=2;Q<P.length;++Q)P[Q]===-1&&(P[Q]=0);switch(P[0]){case 38:B.fg=this._updateAttrColor(B.fg,P[1],P[3],P[4],P[5]);break;case 48:B.bg=this._updateAttrColor(B.bg,P[1],P[3],P[4],P[5]);break;case 58:B.extended=B.extended.clone(),B.extended.underlineColor=this._updateAttrColor(B.extended.underlineColor,P[1],P[3],P[4],P[5])}return J}_processUnderline(y,R){R.extended=R.extended.clone(),(!~y||y>5)&&(y=1),R.extended.underlineStyle=y,R.fg|=268435456,y===0&&(R.fg&=-268435457),R.updateExtended()}_processSGR0(y){y.fg=t.DEFAULT_ATTR_DATA.fg,y.bg=t.DEFAULT_ATTR_DATA.bg,y.extended=y.extended.clone(),y.extended.underlineStyle=0,y.extended.underlineColor&=-67108864,y.updateExtended()}charAttributes(y){if(y.length===1&&y.params[0]===0)return this._processSGR0(this._curAttrData),!0;const R=y.length;let B;const P=this._curAttrData;for(let K=0;K<R;K++)B=y.params[K],B>=30&&B<=37?(P.fg&=-50331904,P.fg|=16777216|B-30):B>=40&&B<=47?(P.bg&=-50331904,P.bg|=16777216|B-40):B>=90&&B<=97?(P.fg&=-50331904,P.fg|=16777224|B-90):B>=100&&B<=107?(P.bg&=-50331904,P.bg|=16777224|B-100):B===0?this._processSGR0(P):B===1?P.fg|=134217728:B===3?P.bg|=67108864:B===4?(P.fg|=268435456,this._processUnderline(y.hasSubParams(K)?y.getSubParams(K)[0]:1,P)):B===5?P.fg|=536870912:B===7?P.fg|=67108864:B===8?P.fg|=1073741824:B===9?P.fg|=2147483648:B===2?P.bg|=134217728:B===21?this._processUnderline(2,P):B===22?(P.fg&=-134217729,P.bg&=-134217729):B===23?P.bg&=-67108865:B===24?(P.fg&=-268435457,this._processUnderline(0,P)):B===25?P.fg&=-536870913:B===27?P.fg&=-67108865:B===28?P.fg&=-1073741825:B===29?P.fg&=2147483647:B===39?(P.fg&=-67108864,P.fg|=16777215&t.DEFAULT_ATTR_DATA.fg):B===49?(P.bg&=-67108864,P.bg|=16777215&t.DEFAULT_ATTR_DATA.bg):B===38||B===48||B===58?K+=this._extractColor(y,K,P):B===53?P.bg|=1073741824:B===55?P.bg&=-1073741825:B===59?(P.extended=P.extended.clone(),P.extended.underlineColor=-1,P.updateExtended()):B===100?(P.fg&=-67108864,P.fg|=16777215&t.DEFAULT_ATTR_DATA.fg,P.bg&=-67108864,P.bg|=16777215&t.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",B);return!0}deviceStatus(y){switch(y.params[0]){case 5:this._coreService.triggerDataEvent(`${l.C0.ESC}[0n`);break;case 6:const R=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[${R};${B}R`)}return!0}deviceStatusPrivate(y){if(y.params[0]===6){const R=this._activeBuffer.y+1,B=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[?${R};${B}R`)}return!0}softReset(y){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=t.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(y){const R=y.params[0]||1;switch(R){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const B=R%2==1;return this._optionsService.options.cursorBlink=B,!0}setScrollRegion(y){const R=y.params[0]||1;let B;return(y.length<2||(B=y.params[1])>this._bufferService.rows||B===0)&&(B=this._bufferService.rows),B>R&&(this._activeBuffer.scrollTop=R-1,this._activeBuffer.scrollBottom=B-1,this._setCursor(0,0)),!0}windowOptions(y){if(!O(y.params[0],this._optionsService.rawOptions.windowOptions))return!0;const R=y.length>1?y.params[1]:0;switch(y.params[0]){case 14:R!==2&&this._onRequestWindowsOptionsReport.fire(A.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(A.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${l.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:R!==0&&R!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),R!==0&&R!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:R!==0&&R!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),R!==0&&R!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(y){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(y){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(y){return this._windowTitle=y,this._onTitleChange.fire(y),!0}setIconName(y){return this._iconName=y,!0}setOrReportIndexedColor(y){const R=[],B=y.split(";");for(;B.length>1;){const P=B.shift(),K=B.shift();if(/^\d+$/.exec(P)){const J=parseInt(P);if(U(J))if(K==="?")R.push({type:0,index:J});else{const Q=(0,x.parseColor)(K);Q&&R.push({type:1,index:J,color:Q})}}}return R.length&&this._onColor.fire(R),!0}setHyperlink(y){const R=y.split(";");return!(R.length<2)&&(R[1]?this._createHyperlink(R[0],R[1]):!R[0]&&this._finishHyperlink())}_createHyperlink(y,R){this._getCurrentLinkId()&&this._finishHyperlink();const B=y.split(":");let P;const K=B.findIndex((J=>J.startsWith("id=")));return K!==-1&&(P=B[K].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:P,uri:R}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(y,R){const B=y.split(";");for(let P=0;P<B.length&&!(R>=this._specialColors.length);++P,++R)if(B[P]==="?")this._onColor.fire([{type:0,index:this._specialColors[R]}]);else{const K=(0,x.parseColor)(B[P]);K&&this._onColor.fire([{type:1,index:this._specialColors[R],color:K}])}return!0}setOrReportFgColor(y){return this._setOrReportSpecialColor(y,0)}setOrReportBgColor(y){return this._setOrReportSpecialColor(y,1)}setOrReportCursorColor(y){return this._setOrReportSpecialColor(y,2)}restoreIndexedColor(y){if(!y)return this._onColor.fire([{type:2}]),!0;const R=[],B=y.split(";");for(let P=0;P<B.length;++P)if(/^\d+$/.exec(B[P])){const K=parseInt(B[P]);U(K)&&R.push({type:2,index:K})}return R.length&&this._onColor.fire(R),!0}restoreFgColor(y){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(y){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(y){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,d.DEFAULT_CHARSET),!0}selectCharset(y){return y.length!==2?(this.selectDefaultCharset(),!0):(y[0]==="/"||this._charsetService.setgCharset(T[y[0]],d.CHARSETS[y[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 y=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,y,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=t.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=t.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(y){return this._charsetService.setgLevel(y),!0}screenAlignmentPattern(){const y=new s.CellData;y.content=4194373,y.fg=this._curAttrData.fg,y.bg=this._curAttrData.bg,this._setCursor(0,0);for(let R=0;R<this._bufferService.rows;++R){const B=this._activeBuffer.ybase+this._activeBuffer.y+R,P=this._activeBuffer.lines.get(B);P&&(P.fill(y),P.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(y,R){const B=this._bufferService.buffer,P=this._optionsService.rawOptions;return(K=>(this._coreService.triggerDataEvent(`${l.C0.ESC}${K}${l.C0.ESC}\\`),!0))(y==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:y==='"p'?'P1$r61;1"p':y==="r"?`P1$r${B.scrollTop+1};${B.scrollBottom+1}r`:y==="m"?"P1$r0m":y===" q"?`P1$r${{block:2,underline:4,bar:6}[P.cursorStyle]-(P.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(y,R){this._dirtyRowTracker.markRangeDirty(y,R)}}n.InputHandler=I;let N=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($,y){$>y&&(H=$,$=y,y=H),$<this.start&&(this.start=$),y>this.end&&(this.end=y)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function U($){return 0<=$&&$<256}N=c([f(0,m.IBufferService)],N)},844:(E,n)=>{function a(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=a,n.getDisposeArrayDisposable=function(c){return{dispose:()=>a(c)}}},1505:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.FourKeyMap=n.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(f,l,d){this._data[f]||(this._data[f]={}),this._data[f][l]=d}get(f,l){return this._data[f]?this._data[f][l]:void 0}clear(){this._data={}}}n.TwoKeyMap=a,n.FourKeyMap=class{constructor(){this._data=new a}set(c,f,l,d,p){this._data.get(c,f)||this._data.set(c,f,new a),this._data.get(c,f).set(l,d,p)}get(c,f,l,d){var p;return(p=this._data.get(c,f))==null?void 0:p.get(l,d)}clear(){this._data.clear()}}},6114:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.isChromeOS=n.isLinux=n.isWindows=n.isIphone=n.isIpad=n.isMac=n.getSafariVersion=n.isSafari=n.isLegacyEdge=n.isFirefox=n.isNode=void 0,n.isNode=typeof process<"u"&&"title"in process;const a=n.isNode?"node":navigator.userAgent,c=n.isNode?"node":navigator.platform;n.isFirefox=a.includes("Firefox"),n.isLegacyEdge=a.includes("Edge"),n.isSafari=/^((?!chrome|android).)*safari/i.test(a),n.getSafariVersion=function(){if(!n.isSafari)return 0;const f=a.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(a)},6106:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.SortedList=void 0;let a=0;n.SortedList=class{constructor(c){this._getKey=c,this._array=[]}clear(){this._array.length=0}insert(c){this._array.length!==0?(a=this._search(this._getKey(c)),this._array.splice(a,0,c)):this._array.push(c)}delete(c){if(this._array.length===0)return!1;const f=this._getKey(c);if(f===void 0||(a=this._search(f),a===-1)||this._getKey(this._array[a])!==f)return!1;do if(this._array[a]===c)return this._array.splice(a,1),!0;while(++a<this._array.length&&this._getKey(this._array[a])===f);return!1}*getKeyIterator(c){if(this._array.length!==0&&(a=this._search(c),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===c))do yield this._array[a];while(++a<this._array.length&&this._getKey(this._array[a])===c)}forEachByKey(c,f){if(this._array.length!==0&&(a=this._search(c),!(a<0||a>=this._array.length)&&this._getKey(this._array[a])===c))do f(this._array[a]);while(++a<this._array.length&&this._getKey(this._array[a])===c)}values(){return[...this._array].values()}_search(c){let f=0,l=this._array.length-1;for(;l>=f;){let d=f+l>>1;const p=this._getKey(this._array[d]);if(p>c)l=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:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DebouncedIdleTask=n.IdleTaskQueue=n.PriorityTaskQueue=void 0;const c=a(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,h=0,t=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),h=Math.max(g,h),i=p.timeRemaining(),1.5*h>i)return t-g<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(t-g))}ms`),void this._start();t=i}this.clear()}}class l 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=l,n.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(d){return requestIdleCallback(d)}_cancelCallback(d){cancelIdleCallback(d)}}:l,n.DebouncedIdleTask=class{constructor(){this._queue=new n.IdleTaskQueue}set(d){this._queue.clear(),this._queue.enqueue(d)}flush(){this._queue.flush()}}},9282:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.updateWindowsModeWrappedState=void 0;const c=a(643);n.updateWindowsModeWrappedState=function(f){const l=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),d=l==null?void 0:l.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:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ExtendedAttrs=n.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new c}static toColorRGB(l){return[l>>>16&255,l>>>8&255,255&l]}static fromColorRGB(l){return(255&l[0])<<16|(255&l[1])<<8|255&l[2]}clone(){const l=new a;return l.fg=this.fg,l.bg=this.bg,l.extended=this.extended.clone(),l}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}n.AttributeData=a;class c{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(l){this._ext=l}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(l){this._ext&=-469762049,this._ext|=l<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(l){this._ext&=-67108864,this._ext|=67108863&l}get urlId(){return this._urlId}set urlId(l){this._urlId=l}get underlineVariantOffset(){const l=(3758096384&this._ext)>>29;return l<0?4294967288^l:l}set underlineVariantOffset(l){this._ext&=536870911,this._ext|=l<<29&3758096384}constructor(l=0,d=0){this._ext=0,this._urlId=0,this._ext=l,this._urlId=d}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}n.ExtendedAttrs=c},9092:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Buffer=n.MAX_BUFFER_SIZE=void 0;const c=a(6349),f=a(7226),l=a(3734),d=a(8437),p=a(4634),g=a(511),h=a(643),t=a(4863),i=a(7116);n.MAX_BUFFER_SIZE=4294967295,n.Buffer=class{constructor(e,s,u){this._hasScrollback=e,this._optionsService=s,this._bufferService=u,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=d.DEFAULT_ATTR_DATA.clone(),this.savedCharset=i.DEFAULT_CHARSET,this.markers=[],this._nullCell=g.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]),this._whitespaceCell=g.CellData.fromCharData([0,h.WHITESPACE_CELL_CHAR,h.WHITESPACE_CELL_WIDTH,h.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(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new l.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new l.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,s){return new d.BufferLine(this._bufferService.cols,this.getNullCell(e),s)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;const s=e+this._optionsService.rawOptions.scrollback;return s>n.MAX_BUFFER_SIZE?n.MAX_BUFFER_SIZE:s}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=d.DEFAULT_ATTR_DATA);let s=this._rows;for(;s--;)this.lines.push(this.getBlankLine(e))}}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(e,s){const u=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<e)for(let v=0;v<this.lines.length;v++)m+=+this.lines.get(v).resize(e,u);let C=0;if(this._rows<s)for(let v=this._rows;v<s;v++)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(e,u)):this.ybase>0&&this.lines.length<=this.ybase+this.y+C+1?(this.ybase--,C++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(e,u)));else for(let v=this._rows;v>s;v--)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 v=this.lines.length-S;v>0&&(this.lines.trimStart(v),this.ybase=Math.max(this.ybase-v,0),this.ydisp=Math.max(this.ydisp-v,0),this.savedY=Math.max(this.savedY-v,0)),this.lines.maxLength=S}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,s-1),C&&(this.y+=C),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(e,s),this._cols>e))for(let C=0;C<this.lines.length;C++)m+=+this.lines.get(C).resize(e,u);this._cols=e,this._rows=s,this._memoryCleanupQueue.clear(),m>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let s=0;for(;this._memoryCleanupPosition<this.lines.length;)if(s+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),s>100)return!0;return e}get _isReflowEnabled(){const e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,s){this._cols!==e&&(e>this._cols?this._reflowLarger(e,s):this._reflowSmaller(e,s))}_reflowLarger(e,s){const u=(0,p.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA));if(u.length>0){const m=(0,p.reflowLargerCreateNewLayout)(this.lines,u);(0,p.reflowLargerApplyNewLayout)(this.lines,m.layout),this._reflowLargerAdjustViewport(e,s,m.countRemoved)}}_reflowLargerAdjustViewport(e,s,u){const m=this.getNullCell(d.DEFAULT_ATTR_DATA);let S=u;for(;S-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new d.BufferLine(e,m))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-u,0)}_reflowSmaller(e,s){const u=this.getNullCell(d.DEFAULT_ATTR_DATA),m=[];let S=0;for(let C=this.lines.length-1;C>=0;C--){let v=this.lines.get(C);if(!v||!v.isWrapped&&v.getTrimmedLength()<=e)continue;const x=[v];for(;v.isWrapped&&C>0;)v=this.lines.get(--C),x.unshift(v);const T=this.ybase+this.y;if(T>=C&&T<C+x.length)continue;const M=x[x.length-1].getTrimmedLength(),O=(0,p.reflowSmallerGetNewLineLengths)(x,this._cols,e),A=O.length-x.length;let H;H=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 I=[];for(let B=0;B<A;B++){const P=this.getBlankLine(d.DEFAULT_ATTR_DATA,!0);I.push(P)}I.length>0&&(m.push({start:C+x.length+S,newLines:I}),S+=I.length),x.push(...I);let N=O.length-1,U=O[N];U===0&&(N--,U=O[N]);let $=x.length-A-1,y=M;for(;$>=0;){const B=Math.min(y,U);if(x[N]===void 0)break;if(x[N].copyCellsFrom(x[$],y-B,U-B,B,!0),U-=B,U===0&&(N--,U=O[N]),y-=B,y===0){$--;const P=Math.max($,0);y=(0,p.getWrappedLineTrimmedLength)(x,P,this._cols)}}for(let B=0;B<x.length;B++)O[B]<e&&x[B].setCell(O[B],u);let R=A-H;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 C=[],v=[];for(let N=0;N<this.lines.length;N++)v.push(this.lines.get(N));const x=this.lines.length;let T=x-1,M=0,O=m[M];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+S);let A=0;for(let N=Math.min(this.lines.maxLength-1,x+S-1);N>=0;N--)if(O&&O.start>T+A){for(let U=O.newLines.length-1;U>=0;U--)this.lines.set(N--,O.newLines[U]);N++,C.push({index:T+1,amount:O.newLines.length}),A+=O.newLines.length,O=m[++M]}else this.lines.set(N,v[T--]);let H=0;for(let N=C.length-1;N>=0;N--)C[N].index+=H,this.lines.onInsertEmitter.fire(C[N]),H+=C[N].amount;const I=Math.max(0,x+S-this.lines.maxLength);I>0&&this.lines.onTrimEmitter.fire(I)}}translateBufferLineToString(e,s,u=0,m){const S=this.lines.get(e);return S?S.translateToString(s,u,m):""}getWrappedRangeForLine(e){let s=e,u=e;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;u+1<this.lines.length&&this.lines.get(u+1).isWrapped;)u++;return{first:s,last:u}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let s=0;s<this.markers.length;s++)this.markers[s].line===e&&(this.markers[s].dispose(),this.markers.splice(s--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){const s=new t.Marker(e);return this.markers.push(s),s.register(this.lines.onTrim((u=>{s.line-=u,s.line<0&&s.dispose()}))),s.register(this.lines.onInsert((u=>{s.line>=u.index&&(s.line+=u.amount)}))),s.register(this.lines.onDelete((u=>{s.line>=u.index&&s.line<u.index+u.amount&&s.dispose(),s.line>u.index&&(s.line-=u.amount)}))),s.register(s.onDispose((()=>this._removeMarker(s)))),s}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLine=n.DEFAULT_ATTR_DATA=void 0;const c=a(3734),f=a(511),l=a(643),d=a(482);n.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let p=0;class g{constructor(t,i,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*t);const s=i||f.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]);for(let u=0;u<t;++u)this.setCell(u,s);this.length=t}get(t){const i=this._data[3*t+0],e=2097151&i;return[this._data[3*t+1],2097152&i?this._combined[t]:e?(0,d.stringFromCodePoint)(e):"",i>>22,2097152&i?this._combined[t].charCodeAt(this._combined[t].length-1):e]}set(t,i){this._data[3*t+1]=i[l.CHAR_DATA_ATTR_INDEX],i[l.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[t]=i[1],this._data[3*t+0]=2097152|t|i[l.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*t+0]=i[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|i[l.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(t){return this._data[3*t+0]>>22}hasWidth(t){return 12582912&this._data[3*t+0]}getFg(t){return this._data[3*t+1]}getBg(t){return this._data[3*t+2]}hasContent(t){return 4194303&this._data[3*t+0]}getCodePoint(t){const i=this._data[3*t+0];return 2097152&i?this._combined[t].charCodeAt(this._combined[t].length-1):2097151&i}isCombined(t){return 2097152&this._data[3*t+0]}getString(t){const i=this._data[3*t+0];return 2097152&i?this._combined[t]:2097151&i?(0,d.stringFromCodePoint)(2097151&i):""}isProtected(t){return 536870912&this._data[3*t+2]}loadCell(t,i){return p=3*t,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[t]),268435456&i.bg&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){2097152&i.content&&(this._combined[t]=i.combinedData),268435456&i.bg&&(this._extendedAttrs[t]=i.extended),this._data[3*t+0]=i.content,this._data[3*t+1]=i.fg,this._data[3*t+2]=i.bg}setCellFromCodepoint(t,i,e,s){268435456&s.bg&&(this._extendedAttrs[t]=s.extended),this._data[3*t+0]=i|e<<22,this._data[3*t+1]=s.fg,this._data[3*t+2]=s.bg}addCodepointToCell(t,i,e){let s=this._data[3*t+0];2097152&s?this._combined[t]+=(0,d.stringFromCodePoint)(i):2097151&s?(this._combined[t]=(0,d.stringFromCodePoint)(2097151&s)+(0,d.stringFromCodePoint)(i),s&=-2097152,s|=2097152):s=i|4194304,e&&(s&=-12582913,s|=e<<22),this._data[3*t+0]=s}insertCells(t,i,e){if((t%=this.length)&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,e),i<this.length-t){const s=new f.CellData;for(let u=this.length-t-i-1;u>=0;--u)this.setCell(t+i+u,this.loadCell(t+u,s));for(let u=0;u<i;++u)this.setCell(t+u,e)}else for(let s=t;s<this.length;++s)this.setCell(s,e);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,e)}deleteCells(t,i,e){if(t%=this.length,i<this.length-t){const s=new f.CellData;for(let u=0;u<this.length-t-i;++u)this.setCell(t+u,this.loadCell(t+i+u,s));for(let u=this.length-i;u<this.length;++u)this.setCell(u,e)}else for(let s=t;s<this.length;++s)this.setCell(s,e);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,e),this.getWidth(t)!==0||this.hasContent(t)||this.setCellFromCodepoint(t,0,1,e)}replaceCells(t,i,e,s=!1){if(s)for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,e),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,e);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,e),t++;else for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,e),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,e);t<i&&t<this.length;)this.setCell(t++,e)}resize(t,i){if(t===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const e=3*t;if(t>this.length){if(this._data.buffer.byteLength>=4*e)this._data=new Uint32Array(this._data.buffer,0,e);else{const s=new Uint32Array(e);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,i)}else{this._data=this._data.subarray(0,e);const s=Object.keys(this._combined);for(let m=0;m<s.length;m++){const S=parseInt(s[m],10);S>=t&&delete this._combined[S]}const u=Object.keys(this._extendedAttrs);for(let m=0;m<u.length;m++){const S=parseInt(u[m],10);S>=t&&delete this._extendedAttrs[S]}}return this.length=t,4*e*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i)for(let e=0;e<this.length;++e)this.isProtected(e)||this.setCell(e,t);else{this._combined={},this._extendedAttrs={};for(let e=0;e<this.length;++e)this.setCell(e,t)}}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(const i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(const i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){const t=new g(0);t._data=new Uint32Array(this._data),t.length=this.length;for(const i in this._combined)t._combined[i]=this._combined[i];for(const i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(4194303&this._data[3*t+0])return t+(this._data[3*t+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(4194303&this._data[3*t+0]||50331648&this._data[3*t+2])return t+(this._data[3*t+0]>>22);return 0}copyCellsFrom(t,i,e,s,u){const m=t._data;if(u)for(let C=s-1;C>=0;C--){for(let v=0;v<3;v++)this._data[3*(e+C)+v]=m[3*(i+C)+v];268435456&m[3*(i+C)+2]&&(this._extendedAttrs[e+C]=t._extendedAttrs[i+C])}else for(let C=0;C<s;C++){for(let v=0;v<3;v++)this._data[3*(e+C)+v]=m[3*(i+C)+v];268435456&m[3*(i+C)+2]&&(this._extendedAttrs[e+C]=t._extendedAttrs[i+C])}const S=Object.keys(t._combined);for(let C=0;C<S.length;C++){const v=parseInt(S[C],10);v>=i&&(this._combined[v-i+e]=t._combined[v])}}translateToString(t,i,e,s){i=i??0,e=e??this.length,t&&(e=Math.min(e,this.getTrimmedLength())),s&&(s.length=0);let u="";for(;i<e;){const m=this._data[3*i+0],S=2097151&m,C=2097152&m?this._combined[i]:S?(0,d.stringFromCodePoint)(S):l.WHITESPACE_CELL_CHAR;if(u+=C,s)for(let v=0;v<C.length;++v)s.push(i);i+=m>>22||1}return s&&s.push(i),u}}n.BufferLine=g},4841:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.getRangeLength=void 0,n.getRangeLength=function(a,c){if(a.start.y>a.end.y)throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);return c*(a.end.y-a.start.y)+(a.end.x-a.start.x+1)}},4634:(E,n)=>{function a(c,f,l){if(f===c.length-1)return c[f].getTrimmedLength();const d=!c[f].hasContent(l-1)&&c[f].getWidth(l-1)===1,p=c[f+1].getWidth(0)===2;return d&&p?l-1:l}Object.defineProperty(n,"__esModule",{value:!0}),n.getWrappedLineTrimmedLength=n.reflowSmallerGetNewLineLengths=n.reflowLargerApplyNewLayout=n.reflowLargerCreateNewLayout=n.reflowLargerGetLinesToRemove=void 0,n.reflowLargerGetLinesToRemove=function(c,f,l,d,p){const g=[];for(let h=0;h<c.length-1;h++){let t=h,i=c.get(++t);if(!i.isWrapped)continue;const e=[c.get(h)];for(;t<c.length&&i.isWrapped;)e.push(i),i=c.get(++t);if(d>=h&&d<t){h+=e.length-1;continue}let s=0,u=a(e,s,f),m=1,S=0;for(;m<e.length;){const v=a(e,m,f),x=v-S,T=l-u,M=Math.min(x,T);e[s].copyCellsFrom(e[m],S,u,M,!1),u+=M,u===l&&(s++,u=0),S+=M,S===v&&(m++,S=0),u===0&&s!==0&&e[s-1].getWidth(l-1)===2&&(e[s].copyCellsFrom(e[s-1],l-1,u++,1,!1),e[s-1].setCell(l-1,p))}e[s].replaceCells(u,l,p);let C=0;for(let v=e.length-1;v>0&&(v>s||e[v].getTrimmedLength()===0);v--)C++;C>0&&(g.push(h+e.length-C),g.push(C)),h+=e.length-1}return g},n.reflowLargerCreateNewLayout=function(c,f){const l=[];let d=0,p=f[d],g=0;for(let h=0;h<c.length;h++)if(p===h){const t=f[++d];c.onDeleteEmitter.fire({index:h-g,amount:t}),h+=t-1,g+=t,p=f[++d]}else l.push(h);return{layout:l,countRemoved:g}},n.reflowLargerApplyNewLayout=function(c,f){const l=[];for(let d=0;d<f.length;d++)l.push(c.get(f[d]));for(let d=0;d<l.length;d++)c.set(d,l[d]);c.length=f.length},n.reflowSmallerGetNewLineLengths=function(c,f,l){const d=[],p=c.map(((i,e)=>a(c,e,f))).reduce(((i,e)=>i+e));let g=0,h=0,t=0;for(;t<p;){if(p-t<l){d.push(p-t);break}g+=l;const i=a(c,h,f);g>i&&(g-=i,h++);const e=c[h].getWidth(g-1)===2;e&&g--;const s=e?l-1:l;d.push(s),t+=s}return d},n.getWrappedLineTrimmedLength=a},5295:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferSet=void 0;const c=a(8460),f=a(844),l=a(9092);class d extends f.Disposable{constructor(g,h){super(),this._optionsService=g,this._bufferService=h,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 l.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new l.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,h){this._normal.resize(g,h),this._alt.resize(g,h),this.setupTabStops(g)}setupTabStops(g){this._normal.setupTabStops(g),this._alt.setupTabStops(g)}}n.BufferSet=d},511:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CellData=void 0;const c=a(482),f=a(643),l=a(3734);class d extends l.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new l.ExtendedAttrs,this.combinedData=""}static fromCharData(g){const h=new d;return h.setFromCharData(g),h}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 h=!1;if(g[f.CHAR_DATA_CHAR_INDEX].length>2)h=!0;else if(g[f.CHAR_DATA_CHAR_INDEX].length===2){const t=g[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=t&&t<=56319){const i=g[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(t-55296)+i-56320+65536|g[f.CHAR_DATA_WIDTH_INDEX]<<22:h=!0}else h=!0}else this.content=g[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|g[f.CHAR_DATA_WIDTH_INDEX]<<22;h&&(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:(E,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:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Marker=void 0;const c=a(8460),f=a(844);class l{get id(){return this._id}constructor(p){this.line=p,this.isDisposed=!1,this._disposables=[],this._id=l._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=l,l._nextId=1},7116:(E,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:(E,n)=>{var a,c,f;Object.defineProperty(n,"__esModule",{value:!0}),n.C1_ESCAPED=n.C1=n.C0=void 0,(function(l){l.NUL="\0",l.SOH="",l.STX="",l.ETX="",l.EOT="",l.ENQ="",l.ACK="",l.BEL="\x07",l.BS="\b",l.HT=" ",l.LF=`
9
+ `,l.VT="\v",l.FF="\f",l.CR="\r",l.SO="",l.SI="",l.DLE="",l.DC1="",l.DC2="",l.DC3="",l.DC4="",l.NAK="",l.SYN="",l.ETB="",l.CAN="",l.EM="",l.SUB="",l.ESC="\x1B",l.FS="",l.GS="",l.RS="",l.US="",l.SP=" ",l.DEL=""})(a||(n.C0=a={})),(function(l){l.PAD="€",l.HOP="",l.BPH="‚",l.NBH="ƒ",l.IND="„",l.NEL="…",l.SSA="†",l.ESA="‡",l.HTS="ˆ",l.HTJ="‰",l.VTS="Š",l.PLD="‹",l.PLU="Œ",l.RI="",l.SS2="Ž",l.SS3="",l.DCS="",l.PU1="‘",l.PU2="’",l.STS="“",l.CCH="”",l.MW="•",l.SPA="–",l.EPA="—",l.SOS="˜",l.SGCI="™",l.SCI="š",l.CSI="›",l.ST="œ",l.OSC="",l.PM="ž",l.APC="Ÿ"})(c||(n.C1=c={})),(function(l){l.ST=`${a.ESC}\\`})(f||(n.C1_ESCAPED=f={}))},7399:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.evaluateKeyboardEvent=void 0;const c=a(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(l,d,p,g){const h={type:0,cancel:!1,key:void 0},t=(l.shiftKey?1:0)|(l.altKey?2:0)|(l.ctrlKey?4:0)|(l.metaKey?8:0);switch(l.keyCode){case 0:l.key==="UIKeyInputUpArrow"?h.key=d?c.C0.ESC+"OA":c.C0.ESC+"[A":l.key==="UIKeyInputLeftArrow"?h.key=d?c.C0.ESC+"OD":c.C0.ESC+"[D":l.key==="UIKeyInputRightArrow"?h.key=d?c.C0.ESC+"OC":c.C0.ESC+"[C":l.key==="UIKeyInputDownArrow"&&(h.key=d?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:h.key=l.ctrlKey?"\b":c.C0.DEL,l.altKey&&(h.key=c.C0.ESC+h.key);break;case 9:if(l.shiftKey){h.key=c.C0.ESC+"[Z";break}h.key=c.C0.HT,h.cancel=!0;break;case 13:h.key=l.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,h.cancel=!0;break;case 27:h.key=c.C0.ESC,l.altKey&&(h.key=c.C0.ESC+c.C0.ESC),h.cancel=!0;break;case 37:if(l.metaKey)break;t?(h.key=c.C0.ESC+"[1;"+(t+1)+"D",h.key===c.C0.ESC+"[1;3D"&&(h.key=c.C0.ESC+(p?"b":"[1;5D"))):h.key=d?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(l.metaKey)break;t?(h.key=c.C0.ESC+"[1;"+(t+1)+"C",h.key===c.C0.ESC+"[1;3C"&&(h.key=c.C0.ESC+(p?"f":"[1;5C"))):h.key=d?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(l.metaKey)break;t?(h.key=c.C0.ESC+"[1;"+(t+1)+"A",p||h.key!==c.C0.ESC+"[1;3A"||(h.key=c.C0.ESC+"[1;5A")):h.key=d?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(l.metaKey)break;t?(h.key=c.C0.ESC+"[1;"+(t+1)+"B",p||h.key!==c.C0.ESC+"[1;3B"||(h.key=c.C0.ESC+"[1;5B")):h.key=d?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:l.shiftKey||l.ctrlKey||(h.key=c.C0.ESC+"[2~");break;case 46:h.key=t?c.C0.ESC+"[3;"+(t+1)+"~":c.C0.ESC+"[3~";break;case 36:h.key=t?c.C0.ESC+"[1;"+(t+1)+"H":d?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:h.key=t?c.C0.ESC+"[1;"+(t+1)+"F":d?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:l.shiftKey?h.type=2:l.ctrlKey?h.key=c.C0.ESC+"[5;"+(t+1)+"~":h.key=c.C0.ESC+"[5~";break;case 34:l.shiftKey?h.type=3:l.ctrlKey?h.key=c.C0.ESC+"[6;"+(t+1)+"~":h.key=c.C0.ESC+"[6~";break;case 112:h.key=t?c.C0.ESC+"[1;"+(t+1)+"P":c.C0.ESC+"OP";break;case 113:h.key=t?c.C0.ESC+"[1;"+(t+1)+"Q":c.C0.ESC+"OQ";break;case 114:h.key=t?c.C0.ESC+"[1;"+(t+1)+"R":c.C0.ESC+"OR";break;case 115:h.key=t?c.C0.ESC+"[1;"+(t+1)+"S":c.C0.ESC+"OS";break;case 116:h.key=t?c.C0.ESC+"[15;"+(t+1)+"~":c.C0.ESC+"[15~";break;case 117:h.key=t?c.C0.ESC+"[17;"+(t+1)+"~":c.C0.ESC+"[17~";break;case 118:h.key=t?c.C0.ESC+"[18;"+(t+1)+"~":c.C0.ESC+"[18~";break;case 119:h.key=t?c.C0.ESC+"[19;"+(t+1)+"~":c.C0.ESC+"[19~";break;case 120:h.key=t?c.C0.ESC+"[20;"+(t+1)+"~":c.C0.ESC+"[20~";break;case 121:h.key=t?c.C0.ESC+"[21;"+(t+1)+"~":c.C0.ESC+"[21~";break;case 122:h.key=t?c.C0.ESC+"[23;"+(t+1)+"~":c.C0.ESC+"[23~";break;case 123:h.key=t?c.C0.ESC+"[24;"+(t+1)+"~":c.C0.ESC+"[24~";break;default:if(!l.ctrlKey||l.shiftKey||l.altKey||l.metaKey)if(p&&!g||!l.altKey||l.metaKey)!p||l.altKey||l.ctrlKey||l.shiftKey||!l.metaKey?l.key&&!l.ctrlKey&&!l.altKey&&!l.metaKey&&l.keyCode>=48&&l.key.length===1?h.key=l.key:l.key&&l.ctrlKey&&(l.key==="_"&&(h.key=c.C0.US),l.key==="@"&&(h.key=c.C0.NUL)):l.keyCode===65&&(h.type=1);else{const i=f[l.keyCode],e=i==null?void 0:i[l.shiftKey?1:0];if(e)h.key=c.C0.ESC+e;else if(l.keyCode>=65&&l.keyCode<=90){const s=l.ctrlKey?l.keyCode-64:l.keyCode+32;let u=String.fromCharCode(s);l.shiftKey&&(u=u.toUpperCase()),h.key=c.C0.ESC+u}else if(l.keyCode===32)h.key=c.C0.ESC+(l.ctrlKey?c.C0.NUL:" ");else if(l.key==="Dead"&&l.code.startsWith("Key")){let s=l.code.slice(3,4);l.shiftKey||(s=s.toLowerCase()),h.key=c.C0.ESC+s,h.cancel=!0}}else l.keyCode>=65&&l.keyCode<=90?h.key=String.fromCharCode(l.keyCode-64):l.keyCode===32?h.key=c.C0.NUL:l.keyCode>=51&&l.keyCode<=55?h.key=String.fromCharCode(l.keyCode-51+27):l.keyCode===56?h.key=c.C0.DEL:l.keyCode===219?h.key=c.C0.ESC:l.keyCode===220?h.key=c.C0.FS:l.keyCode===221&&(h.key=c.C0.GS)}return h}},482:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Utf8ToUtf32=n.StringToUtf32=n.utf32ToString=n.stringFromCodePoint=void 0,n.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},n.utf32ToString=function(a,c=0,f=a.length){let l="";for(let d=c;d<f;++d){let p=a[d];p>65535?(p-=65536,l+=String.fromCharCode(55296+(p>>10))+String.fromCharCode(p%1024+56320)):l+=String.fromCharCode(p)}return l},n.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,c){const f=a.length;if(!f)return 0;let l=0,d=0;if(this._interim){const p=a.charCodeAt(d++);56320<=p&&p<=57343?c[l++]=1024*(this._interim-55296)+p-56320+65536:(c[l++]=this._interim,c[l++]=p),this._interim=0}for(let p=d;p<f;++p){const g=a.charCodeAt(p);if(55296<=g&&g<=56319){if(++p>=f)return this._interim=g,l;const h=a.charCodeAt(p);56320<=h&&h<=57343?c[l++]=1024*(g-55296)+h-56320+65536:(c[l++]=g,c[l++]=h)}else g!==65279&&(c[l++]=g)}return l}},n.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,c){const f=a.length;if(!f)return 0;let l,d,p,g,h=0,t=0,i=0;if(this.interim[0]){let u=!1,m=this.interim[0];m&=(224&m)==192?31:(240&m)==224?15:7;let S,C=0;for(;(S=63&this.interim[++C])&&C<4;)m<<=6,m|=S;const v=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,x=v-C;for(;i<x;){if(i>=f)return 0;if(S=a[i++],(192&S)!=128){i--,u=!0;break}this.interim[C++]=S,m<<=6,m|=63&S}u||(v===2?m<128?i--:c[h++]=m:v===3?m<2048||m>=55296&&m<=57343||m===65279||(c[h++]=m):m<65536||m>1114111||(c[h++]=m)),this.interim.fill(0)}const e=f-4;let s=i;for(;s<f;){for(;!(!(s<e)||128&(l=a[s])||128&(d=a[s+1])||128&(p=a[s+2])||128&(g=a[s+3]));)c[h++]=l,c[h++]=d,c[h++]=p,c[h++]=g,s+=4;if(l=a[s++],l<128)c[h++]=l;else if((224&l)==192){if(s>=f)return this.interim[0]=l,h;if(d=a[s++],(192&d)!=128){s--;continue}if(t=(31&l)<<6|63&d,t<128){s--;continue}c[h++]=t}else if((240&l)==224){if(s>=f)return this.interim[0]=l,h;if(d=a[s++],(192&d)!=128){s--;continue}if(s>=f)return this.interim[0]=l,this.interim[1]=d,h;if(p=a[s++],(192&p)!=128){s--;continue}if(t=(15&l)<<12|(63&d)<<6|63&p,t<2048||t>=55296&&t<=57343||t===65279)continue;c[h++]=t}else if((248&l)==240){if(s>=f)return this.interim[0]=l,h;if(d=a[s++],(192&d)!=128){s--;continue}if(s>=f)return this.interim[0]=l,this.interim[1]=d,h;if(p=a[s++],(192&p)!=128){s--;continue}if(s>=f)return this.interim[0]=l,this.interim[1]=d,this.interim[2]=p,h;if(g=a[s++],(192&g)!=128){s--;continue}if(t=(7&l)<<18|(63&d)<<12|(63&p)<<6|63&g,t<65536||t>1114111)continue;c[h++]=t}}return h}}},225:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeV6=void 0;const c=a(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]],l=[[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,h){let t,i=0,e=h.length-1;if(g<h[0][0]||g>h[e][1])return!1;for(;e>=i;)if(t=i+e>>1,g>h[t][1])i=t+1;else{if(!(g<h[t][0]))return!0;e=t-1}return!1})(p,l)?0:p>=131072&&p<=196605||p>=196608&&p<=262141?2:1}charProperties(p,g){let h=this.wcwidth(p),t=h===0&&g!==0;if(t){const i=c.UnicodeService.extractWidth(g);i===0?t=!1:i>h&&(h=i)}return c.UnicodeService.createPropertyValue(0,h,t)}}},5981:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WriteBuffer=void 0;const c=a(8460),f=a(844);class l 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 h;for(this._isSyncWriting=!0;h=this._writeBuffer.shift();){this._action(h);const t=this._callbacks.shift();t&&t()}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 h=p||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const t=this._writeBuffer[this._bufferOffset],i=this._action(t,g);if(i){const s=u=>Date.now()-h>=12?setTimeout((()=>this._innerWrite(0,u))):this._innerWrite(h,u);return void i.catch((u=>(queueMicrotask((()=>{throw u})),Promise.resolve(!1)))).then(s)}const e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=t.length,Date.now()-h>=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=l},5941:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.toRgbString=n.parseColor=void 0;const a=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,c=/^[\da-f]+$/;function f(l,d){const p=l.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(l){if(!l)return;let d=l.toLowerCase();if(d.indexOf("rgb:")===0){d=d.slice(4);const p=a.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 h=0;h<3;++h){const t=parseInt(d.slice(p*h,p*h+p),16);g[h]=p===1?t<<4:p===2?t:p===3?t>>4:t>>8}return g}},n.toRgbString=function(l,d=16){const[p,g,h]=l;return`rgb:${f(p,d)}/${f(g,d)}/${f(h,d)}`}},5770:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.PAYLOAD_LIMIT=void 0,n.PAYLOAD_LIMIT=1e7},6351:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DcsHandler=n.DcsParser=void 0;const c=a(482),f=a(8742),l=a(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,h){this._handlers[g]===void 0&&(this._handlers[g]=[]);const t=this._handlers[g];return t.push(h),{dispose:()=>{const i=t.indexOf(h);i!==-1&&t.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,h){if(this.reset(),this._ident=g,this._active=this._handlers[g]||d,this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].hook(h);else this._handlerFb(this._ident,"HOOK",h)}put(g,h,t){if(this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].put(g,h,t);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(g,h,t))}unhook(g,h=!0){if(this._active.length){let t=!1,i=this._active.length-1,e=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,t=h,e=this._stack.fallThrough,this._stack.paused=!1),!e&&t===!1){for(;i>=0&&(t=this._active[i].unhook(g),t!==!0);i--)if(t instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,t;i--}for(;i>=0;i--)if(t=this._active[i].unhook(!1),t instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,t}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,h,t){this._hitLimit||(this._data+=(0,c.utf32ToString)(g,h,t),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(g){let h=!1;if(this._hitLimit)h=!1;else if(g&&(h=this._handler(this._data,this._params),h instanceof Promise))return h.then((t=>(this._params=p,this._data="",this._hitLimit=!1,t)));return this._params=p,this._data="",this._hitLimit=!1,h}}},2015:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.EscapeSequenceParser=n.VT500_TRANSITION_TABLE=n.TransitionTable=void 0;const c=a(844),f=a(8742),l=a(6242),d=a(6351);class p{constructor(i){this.table=new Uint8Array(i)}setDefault(i,e){this.table.fill(i<<4|e)}add(i,e,s,u){this.table[e<<8|i]=s<<4|u}addMany(i,e,s,u){for(let m=0;m<i.length;m++)this.table[e<<8|i[m]]=s<<4|u}}n.TransitionTable=p;const g=160;n.VT500_TRANSITION_TABLE=(function(){const t=new p(4095),i=Array.apply(null,Array(256)).map(((C,v)=>v)),e=(C,v)=>i.slice(C,v),s=e(32,127),u=e(0,24);u.push(25),u.push.apply(u,e(28,32));const m=e(0,14);let S;for(S in t.setDefault(1,0),t.addMany(s,0,2,0),m)t.addMany([24,26,153,154],S,3,0),t.addMany(e(128,144),S,3,0),t.addMany(e(144,152),S,3,0),t.add(156,S,0,0),t.add(27,S,11,1),t.add(157,S,4,8),t.addMany([152,158,159],S,0,7),t.add(155,S,11,3),t.add(144,S,11,9);return t.addMany(u,0,3,0),t.addMany(u,1,3,1),t.add(127,1,0,1),t.addMany(u,8,0,8),t.addMany(u,3,3,3),t.add(127,3,0,3),t.addMany(u,4,3,4),t.add(127,4,0,4),t.addMany(u,6,3,6),t.addMany(u,5,3,5),t.add(127,5,0,5),t.addMany(u,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(s,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(e(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(s,7,0,7),t.addMany(u,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(e(64,127),3,7,0),t.addMany(e(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(e(48,60),4,8,4),t.addMany(e(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(e(32,64),6,0,6),t.add(127,6,0,6),t.addMany(e(64,127),6,0,0),t.addMany(e(32,48),3,9,5),t.addMany(e(32,48),5,9,5),t.addMany(e(48,64),5,0,6),t.addMany(e(64,127),5,7,0),t.addMany(e(32,48),4,9,5),t.addMany(e(32,48),1,9,2),t.addMany(e(32,48),2,9,2),t.addMany(e(48,127),2,10,0),t.addMany(e(48,80),1,10,0),t.addMany(e(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(e(96,127),1,10,0),t.add(80,1,11,9),t.addMany(u,9,0,9),t.add(127,9,0,9),t.addMany(e(28,32),9,0,9),t.addMany(e(32,48),9,9,12),t.addMany(e(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(u,11,0,11),t.addMany(e(32,128),11,0,11),t.addMany(e(28,32),11,0,11),t.addMany(u,10,0,10),t.add(127,10,0,10),t.addMany(e(28,32),10,0,10),t.addMany(e(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(e(32,48),10,9,12),t.addMany(u,12,0,12),t.add(127,12,0,12),t.addMany(e(28,32),12,0,12),t.addMany(e(32,48),12,9,12),t.addMany(e(48,64),12,0,11),t.addMany(e(64,127),12,12,13),t.addMany(e(64,127),10,12,13),t.addMany(e(64,127),9,12,13),t.addMany(u,13,13,13),t.addMany(s,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(g,0,2,0),t.add(g,8,5,8),t.add(g,6,0,6),t.add(g,11,0,11),t.add(g,13,13,13),t})();class h 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=(e,s,u)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,s)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,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 l.OscParser),this._dcsParser=this.register(new d.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(i,e=[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 u=i.final.charCodeAt(0);if(e[0]>u||u>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return s<<=8,s|=u,s}identToString(i){const e=[];for(;i;)e.push(String.fromCharCode(255&i)),i>>=8;return e.reverse().join("")}setPrintHandler(i){this._printHandler=i}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(i,e){const s=this._identifier(i,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);const u=this._escHandlers[s];return u.push(e),{dispose:()=>{const m=u.indexOf(e);m!==-1&&u.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,e){this._executeHandlers[i.charCodeAt(0)]=e}clearExecuteHandler(i){this._executeHandlers[i.charCodeAt(0)]&&delete this._executeHandlers[i.charCodeAt(0)]}setExecuteHandlerFallback(i){this._executeHandlerFb=i}registerCsiHandler(i,e){const s=this._identifier(i);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);const u=this._csiHandlers[s];return u.push(e),{dispose:()=>{const m=u.indexOf(e);m!==-1&&u.splice(m,1)}}}clearCsiHandler(i){this._csiHandlers[this._identifier(i)]&&delete this._csiHandlers[this._identifier(i)]}setCsiHandlerFallback(i){this._csiHandlerFb=i}registerDcsHandler(i,e){return this._dcsParser.registerHandler(this._identifier(i),e)}clearDcsHandler(i){this._dcsParser.clearHandler(this._identifier(i))}setDcsHandlerFallback(i){this._dcsParser.setHandlerFallback(i)}registerOscHandler(i,e){return this._oscParser.registerHandler(i,e)}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,e,s,u,m){this._parseStack.state=i,this._parseStack.handlers=e,this._parseStack.handlerPos=s,this._parseStack.transition=u,this._parseStack.chunkPos=m}parse(i,e,s){let u,m=0,S=0,C=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,C=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 v=this._parseStack.handlers;let x=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&x>-1){for(;x>=0&&(u=v[x](this._params),u!==!0);x--)if(u instanceof Promise)return this._parseStack.handlerPos=x,u}this._parseStack.handlers=[];break;case 4:if(s===!1&&x>-1){for(;x>=0&&(u=v[x](),u!==!0);x--)if(u instanceof Promise)return this._parseStack.handlerPos=x,u}this._parseStack.handlers=[];break;case 6:if(m=i[this._parseStack.chunkPos],u=this._dcsParser.unhook(m!==24&&m!==26,s),u)return u;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],u=this._oscParser.end(m!==24&&m!==26,s),u)return u;m===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,C=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let v=C;v<e;++v){switch(m=i[v],S=this._transitions.table[this.currentState<<8|(m<160?m:g)],S>>4){case 2:for(let A=v+1;;++A){if(A>=e||(m=i[A])<32||m>126&&m<g){this._printHandler(i,v,A),v=A-1;break}if(++A>=e||(m=i[A])<32||m>126&&m<g){this._printHandler(i,v,A),v=A-1;break}if(++A>=e||(m=i[A])<32||m>126&&m<g){this._printHandler(i,v,A),v=A-1;break}if(++A>=e||(m=i[A])<32||m>126&&m<g){this._printHandler(i,v,A),v=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:v,code:m,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const x=this._csiHandlers[this._collect<<8|m];let T=x?x.length-1:-1;for(;T>=0&&(u=x[T](this._params),u!==!0);T--)if(u instanceof Promise)return this._preserveStack(3,x,T,S,v),u;T<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(++v<e&&(m=i[v])>47&&m<60);v--;break;case 9:this._collect<<=8,this._collect|=m;break;case 10:const M=this._escHandlers[this._collect<<8|m];let O=M?M.length-1:-1;for(;O>=0&&(u=M[O](),u!==!0);O--)if(u instanceof Promise)return this._preserveStack(4,M,O,S,v),u;O<0&&this._escHandlerFb(this._collect<<8|m),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|m,this._params);break;case 13:for(let A=v+1;;++A)if(A>=e||(m=i[A])===24||m===26||m===27||m>127&&m<g){this._dcsParser.put(i,v,A),v=A-1;break}break;case 14:if(u=this._dcsParser.unhook(m!==24&&m!==26),u)return this._preserveStack(6,[],0,S,v),u;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=v+1;;A++)if(A>=e||(m=i[A])<32||m>127&&m<g){this._oscParser.put(i,v,A),v=A-1;break}break;case 6:if(u=this._oscParser.end(m!==24&&m!==26),u)return this._preserveStack(5,[],0,S,v),u;m===27&&(S|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&S}}}n.EscapeSequenceParser=h},6242:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OscHandler=n.OscParser=void 0;const c=a(5770),f=a(482),l=[];n.OscParser=class{constructor(){this._state=0,this._active=l,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 h=g.indexOf(p);h!==-1&&g.splice(h,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=l}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=l,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||l,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 h=this._active.length-1;h>=0;h--)this._active[h].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 h=d[p++];if(h===59){this._state=2,this._start();break}if(h<48||57<h)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+h-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,h=this._active.length-1,t=!1;if(this._stack.paused&&(h=this._stack.loopPosition-1,g=p,t=this._stack.fallThrough,this._stack.paused=!1),!t&&g===!1){for(;h>=0&&(g=this._active[h].end(d),g!==!0);h--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!1,g;h--}for(;h>=0;h--)if(g=this._active[h].end(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=h,this._stack.fallThrough=!0,g}else this._handlerFb(this._id,"END",d);this._active=l,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:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Params=void 0;const a=2147483647;class c{static fromArray(l){const d=new c;if(!l.length)return d;for(let p=Array.isArray(l[0])?1:0;p<l.length;++p){const g=l[p];if(Array.isArray(g))for(let h=0;h<g.length;++h)d.addSubParam(g[h]);else d.addParam(g)}return d}constructor(l=32,d=32){if(this.maxLength=l,this.maxSubParamsLength=d,d>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(l),this.length=0,this._subParams=new Int32Array(d),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(l),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const l=new c(this.maxLength,this.maxSubParamsLength);return l.params.set(this.params),l.length=this.length,l._subParams.set(this._subParams),l._subParamsLength=this._subParamsLength,l._subParamsIdx.set(this._subParamsIdx),l._rejectDigits=this._rejectDigits,l._rejectSubDigits=this._rejectSubDigits,l._digitIsSub=this._digitIsSub,l}toArray(){const l=[];for(let d=0;d<this.length;++d){l.push(this.params[d]);const p=this._subParamsIdx[d]>>8,g=255&this._subParamsIdx[d];g-p>0&&l.push(Array.prototype.slice.call(this._subParams,p,g))}return l}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(l){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=l>a?a:l}}addSubParam(l){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(l<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=l>a?a:l,this._subParamsIdx[this.length-1]++}}hasSubParams(l){return(255&this._subParamsIdx[l])-(this._subParamsIdx[l]>>8)>0}getSubParams(l){const d=this._subParamsIdx[l]>>8,p=255&this._subParamsIdx[l];return p-d>0?this._subParams.subarray(d,p):null}getSubParamsAll(){const l={};for(let d=0;d<this.length;++d){const p=this._subParamsIdx[d]>>8,g=255&this._subParamsIdx[d];g-p>0&&(l[d]=this._subParams.slice(p,g))}return l}addDigit(l){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+l,a):l}}n.Params=c},5741:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.AddonManager=void 0,n.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let a=this._addons.length-1;a>=0;a--)this._addons[a].instance.dispose()}loadAddon(a,c){const f={instance:c,dispose:c.dispose,isDisposed:!1};this._addons.push(f),c.dispose=()=>this._wrappedAddonDispose(f),c.activate(a)}_wrappedAddonDispose(a){if(a.isDisposed)return;let c=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===a){c=f;break}if(c===-1)throw new Error("Could not dispose an addon that has not been loaded");a.isDisposed=!0,a.dispose.apply(a.instance),this._addons.splice(c,1)}}},8771:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferApiView=void 0;const c=a(3785),f=a(511);n.BufferApiView=class{constructor(l,d){this._buffer=l,this.type=d}init(l){return this._buffer=l,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(l){const d=this._buffer.lines.get(l);if(d)return new c.BufferLineApiView(d)}getNullCell(){return new f.CellData}}},3785:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLineApiView=void 0;const c=a(511);n.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,l){if(!(f<0||f>=this._line.length))return l?(this._line.loadCell(f,l),l):this._line.loadCell(f,new c.CellData)}translateToString(f,l,d){return this._line.translateToString(f,l,d)}}},8285:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferNamespaceApi=void 0;const c=a(8771),f=a(8460),l=a(844);class d extends l.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:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ParserApi=void 0,n.ParserApi=class{constructor(a){this._core=a}registerCsiHandler(a,c){return this._core.registerCsiHandler(a,(f=>c(f.toArray())))}addCsiHandler(a,c){return this.registerCsiHandler(a,c)}registerDcsHandler(a,c){return this._core.registerDcsHandler(a,((f,l)=>c(f,l.toArray())))}addDcsHandler(a,c){return this.registerDcsHandler(a,c)}registerEscHandler(a,c){return this._core.registerEscHandler(a,c)}addEscHandler(a,c){return this.registerEscHandler(a,c)}registerOscHandler(a,c){return this._core.registerOscHandler(a,c)}addOscHandler(a,c){return this.registerOscHandler(a,c)}}},7090:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeApi=void 0,n.UnicodeApi=class{constructor(a){this._core=a}register(a){this._core.unicodeService.register(a)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(a){this._core.unicodeService.activeVersion=a}}},744:function(E,n,a){var c=this&&this.__decorate||function(t,i,e,s){var u,m=arguments.length,S=m<3?i:s===null?s=Object.getOwnPropertyDescriptor(i,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(t,i,e,s);else for(var C=t.length-1;C>=0;C--)(u=t[C])&&(S=(m<3?u(S):m>3?u(i,e,S):u(i,e))||S);return m>3&&S&&Object.defineProperty(i,e,S),S},f=this&&this.__param||function(t,i){return function(e,s){i(e,s,t)}};Object.defineProperty(n,"__esModule",{value:!0}),n.BufferService=n.MINIMUM_ROWS=n.MINIMUM_COLS=void 0;const l=a(8460),d=a(844),p=a(5295),g=a(2585);n.MINIMUM_COLS=2,n.MINIMUM_ROWS=1;let h=n.BufferService=class extends d.Disposable{get buffer(){return this.buffers.active}constructor(t){super(),this.isUserScrolling=!1,this._onResize=this.register(new l.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new l.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(t.rawOptions.cols||0,n.MINIMUM_COLS),this.rows=Math.max(t.rawOptions.rows||0,n.MINIMUM_ROWS),this.buffers=this.register(new p.BufferSet(t,this))}resize(t,i){this.cols=t,this.rows=i,this.buffers.resize(t,i),this._onResize.fire({cols:t,rows:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(t,i=!1){const e=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===t.fg&&s.getBg(0)===t.bg||(s=e.getBlankLine(t,i),this._cachedBlankLine=s),s.isWrapped=i;const u=e.ybase+e.scrollTop,m=e.ybase+e.scrollBottom;if(e.scrollTop===0){const S=e.lines.isFull;m===e.lines.length-1?S?e.lines.recycle().copyFrom(s):e.lines.push(s.clone()):e.lines.splice(m+1,0,s.clone()),S?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{const S=m-u+1;e.lines.shiftElements(u+1,S-1,-1),e.lines.set(m,s.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(t,i,e){const s=this.buffer;if(t<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else t+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const u=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+t,s.ybase),0),u!==s.ydisp&&(i||this._onScroll.fire(s.ydisp))}};n.BufferService=h=c([f(0,g.IOptionsService)],h)},7994:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CharsetService=void 0,n.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(a){this.glevel=a,this.charset=this._charsets[a]}setgCharset(a,c){this._charsets[a]=c,this.glevel===a&&(this.charset=c)}}},1753:function(E,n,a){var c=this&&this.__decorate||function(s,u,m,S){var C,v=arguments.length,x=v<3?u:S===null?S=Object.getOwnPropertyDescriptor(u,m):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(s,u,m,S);else for(var T=s.length-1;T>=0;T--)(C=s[T])&&(x=(v<3?C(x):v>3?C(u,m,x):C(u,m))||x);return v>3&&x&&Object.defineProperty(u,m,x),x},f=this&&this.__param||function(s,u){return function(m,S){u(m,S,s)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreMouseService=void 0;const l=a(2585),d=a(8460),p=a(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 h(s,u){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||u||(m|=3)),m}const t=String.fromCharCode,i={DEFAULT:s=>{const u=[h(s,!1)+32,s.col+32,s.row+32];return u[0]>255||u[1]>255||u[2]>255?"":`\x1B[M${t(u[0])}${t(u[1])}${t(u[2])}`},SGR:s=>{const u=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${h(s,!0)};${s.col};${s.row}${u}`},SGR_PIXELS:s=>{const u=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${h(s,!0)};${s.x};${s.y}${u}`}};let e=n.CoreMouseService=class extends p.Disposable{constructor(s,u){super(),this._bufferService=s,this._coreService=u,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,u){this._protocols[s]=u}addEncoding(s,u){this._encodings[s]=u}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 u=this._encodings[this._activeEncoding](s);return u&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(u):this._coreService.triggerDataEvent(u,!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,u,m){if(m){if(s.x!==u.x||s.y!==u.y)return!1}else if(s.col!==u.col||s.row!==u.row)return!1;return s.button===u.button&&s.action===u.action&&s.ctrl===u.ctrl&&s.alt===u.alt&&s.shift===u.shift}};n.CoreMouseService=e=c([f(0,l.IBufferService),f(1,l.ICoreService)],e)},6975:function(E,n,a){var c=this&&this.__decorate||function(e,s,u,m){var S,C=arguments.length,v=C<3?s:m===null?m=Object.getOwnPropertyDescriptor(s,u):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,s,u,m);else for(var x=e.length-1;x>=0;x--)(S=e[x])&&(v=(C<3?S(v):C>3?S(s,u,v):S(s,u))||v);return C>3&&v&&Object.defineProperty(s,u,v),v},f=this&&this.__param||function(e,s){return function(u,m){s(u,m,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreService=void 0;const l=a(1439),d=a(8460),p=a(844),g=a(2585),h=Object.freeze({insertMode:!1}),t=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(e,s,u){super(),this._bufferService=e,this._logService=s,this._optionsService=u,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,l.clone)(h),this.decPrivateModes=(0,l.clone)(t)}reset(){this.modes=(0,l.clone)(h),this.decPrivateModes=(0,l.clone)(t)}triggerDataEvent(e,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const u=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&u.ybase!==u.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split("").map((m=>m.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split("").map((s=>s.charCodeAt(0))))),this._onBinary.fire(e))}};n.CoreService=i=c([f(0,g.IBufferService),f(1,g.ILogService),f(2,g.IOptionsService)],i)},9074:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DecorationService=void 0;const c=a(8055),f=a(8460),l=a(844),d=a(6106);let p=0,g=0;class h extends l.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new d.SortedList((e=>e==null?void 0:e.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,l.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;const s=new t(e);if(s){const u=s.marker.onDispose((()=>s.dispose()));s.onDispose((()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),u.dispose())})),this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(const e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,s,u){let m=0,S=0;for(const C of this._decorations.getKeyIterator(s))m=C.options.x??0,S=m+(C.options.width??1),e>=m&&e<S&&(!u||(C.options.layer??"bottom")===u)&&(yield C)}forEachDecorationAtCell(e,s,u,m){this._decorations.forEachByKey(s,(S=>{p=S.options.x??0,g=p+(S.options.width??1),e>=p&&e<g&&(!u||(S.options.layer??"bottom")===u)&&m(S)}))}}n.DecorationService=h;class t extends l.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(e){super(),this.options=e,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=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.InstantiationService=n.ServiceCollection=void 0;const c=a(2585),f=a(8343);class l{constructor(...p){this._entries=new Map;for(const[g,h]of p)this.set(g,h)}set(p,g){const h=this._entries.get(p);return this._entries.set(p,g),h}forEach(p){for(const[g,h]of this._entries.entries())p(g,h)}has(p){return this._entries.has(p)}get(p){return this._entries.get(p)}}n.ServiceCollection=l,n.InstantiationService=class{constructor(){this._services=new l,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,e)=>i.index-e.index)),h=[];for(const i of g){const e=this._services.get(i.id);if(!e)throw new Error(`[createInstance] ${d.name} depends on UNKNOWN service ${i.id}.`);h.push(e)}const t=g.length>0?g[0].index:p.length;if(p.length!==t)throw new Error(`[createInstance] First service dependency of ${d.name} at position ${t+1} conflicts with ${p.length} static arguments`);return new d(...p,...h)}}},7866:function(E,n,a){var c=this&&this.__decorate||function(t,i,e,s){var u,m=arguments.length,S=m<3?i:s===null?s=Object.getOwnPropertyDescriptor(i,e):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(t,i,e,s);else for(var C=t.length-1;C>=0;C--)(u=t[C])&&(S=(m<3?u(S):m>3?u(i,e,S):u(i,e))||S);return m>3&&S&&Object.defineProperty(i,e,S),S},f=this&&this.__param||function(t,i){return function(e,s){i(e,s,t)}};Object.defineProperty(n,"__esModule",{value:!0}),n.traceCall=n.setTraceLogger=n.LogService=void 0;const l=a(844),d=a(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,h=n.LogService=class extends l.Disposable{get logLevel(){return this._logLevel}constructor(t){super(),this._optionsService=t,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(t){for(let i=0;i<t.length;i++)typeof t[i]=="function"&&(t[i]=t[i]())}_log(t,i,e){this._evalLazyOptionalParams(e),t.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...e)}trace(t,...i){var e;this._logLevel<=d.LogLevelEnum.TRACE&&this._log(((e=this._optionsService.options.logger)==null?void 0:e.trace.bind(this._optionsService.options.logger))??console.log,t,i)}debug(t,...i){var e;this._logLevel<=d.LogLevelEnum.DEBUG&&this._log(((e=this._optionsService.options.logger)==null?void 0:e.debug.bind(this._optionsService.options.logger))??console.log,t,i)}info(t,...i){var e;this._logLevel<=d.LogLevelEnum.INFO&&this._log(((e=this._optionsService.options.logger)==null?void 0:e.info.bind(this._optionsService.options.logger))??console.info,t,i)}warn(t,...i){var e;this._logLevel<=d.LogLevelEnum.WARN&&this._log(((e=this._optionsService.options.logger)==null?void 0:e.warn.bind(this._optionsService.options.logger))??console.warn,t,i)}error(t,...i){var e;this._logLevel<=d.LogLevelEnum.ERROR&&this._log(((e=this._optionsService.options.logger)==null?void 0:e.error.bind(this._optionsService.options.logger))??console.error,t,i)}};n.LogService=h=c([f(0,d.IOptionsService)],h),n.setTraceLogger=function(t){g=t},n.traceCall=function(t,i,e){if(typeof e.value!="function")throw new Error("not supported");const s=e.value;e.value=function(...u){if(g.logLevel!==d.LogLevelEnum.TRACE)return s.apply(this,u);g.trace(`GlyphRenderer#${s.name}(${u.map((S=>JSON.stringify(S))).join(", ")})`);const m=s.apply(this,u);return g.trace(`GlyphRenderer#${s.name} return`,m),m}}},7302:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OptionsService=n.DEFAULT_OPTIONS=void 0;const c=a(8460),f=a(844),l=a(6114);n.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:l.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(h){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;const t={...n.DEFAULT_OPTIONS};for(const i in h)if(i in t)try{const e=h[i];t[i]=this._sanitizeAndValidateOption(i,e)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(h,t){return this.onOptionChange((i=>{i===h&&t(this.rawOptions[h])}))}onMultipleOptionChange(h,t){return this.onOptionChange((i=>{h.indexOf(i)!==-1&&t()}))}_setupOptions(){const h=i=>{if(!(i in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,e)=>{if(!(i in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${i}"`);e=this._sanitizeAndValidateOption(i,e),this.rawOptions[i]!==e&&(this.rawOptions[i]=e,this._onOptionChange.fire(i))};for(const i in this.rawOptions){const e={get:h.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,e)}}_sanitizeAndValidateOption(h,t){switch(h){case"cursorStyle":if(t||(t=n.DEFAULT_OPTIONS[h]),!(function(i){return i==="block"||i==="underline"||i==="bar"})(t))throw new Error(`"${t}" is not a valid value for ${h}`);break;case"wordSeparator":t||(t=n.DEFAULT_OPTIONS[h]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=d.includes(t)?t:n.DEFAULT_OPTIONS[h];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${h} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(10*t)/10));break;case"scrollback":if((t=Math.min(t,4294967295))<0)throw new Error(`${h} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${h} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${h} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{}}return t}}n.OptionsService=p},2660:function(E,n,a){var c=this&&this.__decorate||function(p,g,h,t){var i,e=arguments.length,s=e<3?g:t===null?t=Object.getOwnPropertyDescriptor(g,h):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(p,g,h,t);else for(var u=p.length-1;u>=0;u--)(i=p[u])&&(s=(e<3?i(s):e>3?i(g,h,s):i(g,h))||s);return e>3&&s&&Object.defineProperty(g,h,s),s},f=this&&this.__param||function(p,g){return function(h,t){g(h,t,p)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkService=void 0;const l=a(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 u=g.addMarker(g.ybase+g.y),m={data:p,id:this._nextId++,lines:[u]};return u.onDispose((()=>this._removeMarkerFromLink(m,u))),this._dataByLinkId.set(m.id,m),m.id}const h=p,t=this._getEntryIdKey(h),i=this._entriesWithId.get(t);if(i)return this.addLineToLink(i.id,g.ybase+g.y),i.id;const e=g.addMarker(g.ybase+g.y),s={id:this._nextId++,key:this._getEntryIdKey(h),data:h,lines:[e]};return e.onDispose((()=>this._removeMarkerFromLink(s,e))),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(p,g){const h=this._dataByLinkId.get(p);if(h&&h.lines.every((t=>t.line!==g))){const t=this._bufferService.buffer.addMarker(g);h.lines.push(t),t.onDispose((()=>this._removeMarkerFromLink(h,t)))}}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 h=p.lines.indexOf(g);h!==-1&&(p.lines.splice(h,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,l.IBufferService)],d)},8343:(E,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createDecorator=n.getServiceDependencies=n.serviceRegistry=void 0;const a="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 l=function(d,p,g){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(h,t,i){t[a]===t?t[c].push({id:h,index:i}):(t[c]=[{id:h,index:i}],t[a]=t)})(l,d,g)};return l.toString=()=>f,n.serviceRegistry.set(f,l),l}},2585:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.IDecorationService=n.IUnicodeService=n.IOscLinkService=n.IOptionsService=n.ILogService=n.LogLevelEnum=n.IInstantiationService=n.ICharsetService=n.ICoreService=n.ICoreMouseService=n.IBufferService=void 0;const c=a(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(l){l[l.TRACE=0]="TRACE",l[l.DEBUG=1]="DEBUG",l[l.INFO=2]="INFO",l[l.WARN=3]="WARN",l[l.ERROR=4]="ERROR",l[l.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:(E,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeService=void 0;const c=a(8460),f=a(225);class l{static extractShouldJoin(p){return(1&p)!=0}static extractWidth(p){return p>>1&3}static extractCharKind(p){return p>>3}static createPropertyValue(p,g,h=!1){return(16777215&p)<<3|(3&g)<<1|(h?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,h=0;const t=p.length;for(let i=0;i<t;++i){let e=p.charCodeAt(i);if(55296<=e&&e<=56319){if(++i>=t)return g+this.wcwidth(e);const m=p.charCodeAt(i);56320<=m&&m<=57343?e=1024*(e-55296)+m-56320+65536:g+=this.wcwidth(m)}const s=this.charProperties(e,h);let u=l.extractWidth(s);l.extractShouldJoin(s)&&(u-=l.extractWidth(h)),g+=u,h=s}return g}charProperties(p,g){return this._activeProvider.charProperties(p,g)}}n.UnicodeService=l}},b={};function w(E){var n=b[E];if(n!==void 0)return n.exports;var a=b[E]={exports:{}};return _[E].call(a.exports,a,a.exports,w),a.exports}var k={};return(()=>{var E=k;Object.defineProperty(E,"__esModule",{value:!0}),E.Terminal=void 0;const n=w(9042),a=w(3236),c=w(844),f=w(5741),l=w(8285),d=w(7975),p=w(7090),g=["cols","rows"];class h extends c.Disposable{constructor(i){super(),this._core=this.register(new a.Terminal(i)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};const e=u=>this._core.options[u],s=(u,m)=>{this._checkReadonlyOptions(u),this._core.options[u]=m};for(const u in this._core.options){const m={get:e.bind(this,u),set:s.bind(this,u)};Object.defineProperty(this._publicOptions,u,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 l.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const i=this._core.coreService.decPrivateModes;let e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any"}return{applicationCursorKeysMode:i.applicationCursorKeys,applicationKeypadMode:i.applicationKeypad,bracketedPasteMode:i.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:i.origin,reverseWraparoundMode:i.reverseWraparound,sendFocusMode:i.sendFocus,wraparoundMode:i.wraparound}}get options(){return this._publicOptions}set options(i){for(const e in i)this._publicOptions[e]=i[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(i,e=!0){this._core.input(i,e)}resize(i,e){this._verifyIntegers(i,e),this._core.resize(i,e)}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,e,s){this._verifyIntegers(i,e,s),this._core.select(i,e,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(i,e){this._verifyIntegers(i,e),this._core.selectLines(i,e)}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,e){this._core.write(i,e)}writeln(i,e){this._core.write(i),this._core.write(`\r
10
+ `,e)}paste(i){this._core.paste(i)}refresh(i,e){this._verifyIntegers(i,e),this._core.refresh(i,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(i){this._addonManager.loadAddon(this,i)}static get strings(){return n}_verifyIntegers(...i){for(const e of i)if(e===1/0||isNaN(e)||e%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...i){for(const e of i)if(e&&(e===1/0||isNaN(e)||e%1!=0||e<0))throw new Error("This API only accepts positive integers")}}E.Terminal=h})(),k})()))})(Mi)),Mi.exports}var Ql=Zl(),Oi={exports:{}},Us;function ec(){return Us||(Us=1,(function(r,o){(function(_,b){r.exports=b()})(self,(()=>(()=>{var _={};return(()=>{var b=_;Object.defineProperty(b,"__esModule",{value:!0}),b.FitAddon=void 0,b.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 E=this._terminal.options.scrollback===0?0:w.viewport.scrollBarWidth,n=window.getComputedStyle(this._terminal.element.parentElement),a=parseInt(n.getPropertyValue("height")),c=Math.max(0,parseInt(n.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),l=a-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),d=c-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-E;return{cols:Math.max(2,Math.floor(d/k.css.cell.width)),rows:Math.max(1,Math.floor(l/k.css.cell.height))}}}})(),_})()))})(Oi)),Oi.exports}var tc=ec(),Pi={exports:{}},js;function rc(){return js||(js=1,(function(r,o){(function(_,b){r.exports=b()})(self,(()=>(()=>{var _={6:(E,n)=>{function a(f){try{const l=new URL(f),d=l.password&&l.username?`${l.protocol}//${l.username}:${l.password}@${l.host}`:l.username?`${l.protocol}//${l.username}@${l.host}`:`${l.protocol}//${l.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,l,d,p={}){this._terminal=f,this._regex=l,this._handler=d,this._options=p}provideLinks(f,l){const d=c.computeLink(f,this._regex,this._terminal,this._handler);l(this._addCallbacks(d))}_addCallbacks(f){return f.map((l=>(l.leave=this._options.leave,l.hover=(d,p)=>{if(this._options.hover){const{range:g}=l;this._options.hover(d,p,g)}},l)))}};class c{static computeLink(l,d,p,g){const h=new RegExp(d.source,(d.flags||"")+"g"),[t,i]=c._getWindowedLineStrings(l-1,p),e=t.join("");let s;const u=[];for(;s=h.exec(e);){const m=s[0];if(!a(m))continue;const[S,C]=c._mapStrIdx(p,i,0,s.index),[v,x]=c._mapStrIdx(p,S,C,m.length);if(S===-1||C===-1||v===-1||x===-1)continue;const T={start:{x:C+1,y:S+1},end:{x,y:v+1}};u.push({range:T,text:m,activate:g})}return u}static _getWindowedLineStrings(l,d){let p,g=l,h=l,t=0,i="";const e=[];if(p=d.buffer.active.getLine(l)){const s=p.translateToString(!0);if(p.isWrapped&&s[0]!==" "){for(t=0;(p=d.buffer.active.getLine(--g))&&t<2048&&(i=p.translateToString(!0),t+=i.length,e.push(i),p.isWrapped&&i.indexOf(" ")===-1););e.reverse()}for(e.push(s),t=0;(p=d.buffer.active.getLine(++h))&&p.isWrapped&&t<2048&&(i=p.translateToString(!0),t+=i.length,e.push(i),i.indexOf(" ")===-1););}return[e,g]}static _mapStrIdx(l,d,p,g){const h=l.buffer.active,t=h.getNullCell();let i=p;for(;g;){const e=h.getLine(d);if(!e)return[-1,-1];for(let s=i;s<e.length;++s){e.getCell(s,t);const u=t.getChars();if(t.getWidth()&&(g-=u.length||1,s===e.length-1&&u==="")){const m=h.getLine(d+1);m&&m.isWrapped&&(m.getCell(0,t),t.getWidth()===2&&(g+=1))}if(g<0)return[d,s]}d++,i=0}return[d,i]}}n.LinkComputer=c}},b={};function w(E){var n=b[E];if(n!==void 0)return n.exports;var a=b[E]={exports:{}};return _[E](a,a.exports,w),a.exports}var k={};return(()=>{var E=k;Object.defineProperty(E,"__esModule",{value:!0}),E.WebLinksAddon=void 0;const n=w(6),a=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function c(f,l){const d=window.open();if(d){try{d.opener=null}catch{}d.location.href=l}else console.warn("Opening link blocked as opener could not be cleared")}E.WebLinksAddon=class{constructor(f=c,l={}){this._handler=f,this._options=l}activate(f){this._terminal=f;const l=this._options,d=l.urlRegex||a;this._linkProvider=this._terminal.registerLinkProvider(new n.WebLinkProvider(this._terminal,d,this._handler,l))}dispose(){var f;(f=this._linkProvider)==null||f.dispose()}}})(),k})()))})(Pi)),Pi.exports}var ic=rc(),sc=ee('<div class="flex-1 min-h-0 w-full p-1 overflow-hidden"></div>');function nc(r,o){Re(o,!0);let _=Ee(o,"isMobile",3,!1),b,w,k,E,n,a;function c(g){var t;if((t=navigator.clipboard)!=null&&t.writeText){navigator.clipboard.writeText(g).catch(()=>{});return}const h=document.createElement("textarea");h.value=g,h.style.position="fixed",h.style.opacity="0",document.body.appendChild(h),h.select(),document.execCommand("copy"),document.body.removeChild(h)}function f(g){(E==null?void 0:E.readyState)===WebSocket.OPEN&&E.send(JSON.stringify({type:"selectPane",pane:g}))}function l(g){(E==null?void 0:E.readyState)===WebSocket.OPEN&&E.send(JSON.stringify({type:"input",data:g}))}gs(()=>{w=new Ql.Terminal({cursorBlink:!0,theme:{background:"#0d1117",foreground:"#e6edf3",cursor:"#58a6ff",selectionBackground:"#264f78"},fontFamily:"'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo, monospace",fontSize:_()?13:11,scrollback:1e4}),k=new tc.FitAddon,w.loadAddon(k),w.loadAddon(new ic.WebLinksAddon),w.open(b),b.addEventListener("contextmenu",h=>h.preventDefault()),w.parser.registerOscHandler(52,h=>{const t=h.indexOf(";");if(t!==-1){const i=h.slice(t+1);try{c(atob(i))}catch{}}return!0}),w.onSelectionChange(()=>{const h=w.getSelection();h&&c(h)}),w.attachCustomKeyEventHandler(h=>{if(h.type!=="keydown")return!0;const t=h.metaKey||h.ctrlKey;return t&&(h.key==="c"||h.key==="C")?w.hasSelection()?(c(w.getSelection()),w.clearSelection(),!1):!0:!(t&&(h.key==="ArrowUp"||h.key==="ArrowDown")||t&&(h.key==="k"||h.key==="K")||t&&(h.key==="m"||h.key==="M")||t&&(h.key==="d"||h.key==="D"))}),requestAnimationFrame(()=>{k.fit(),w.focus()});const g=location.protocol==="https:"?"wss:":"ws:";E=new WebSocket(`${g}//${location.host}/ws/${encodeURIComponent(o.worktree)}`),E.onmessage=h=>{const t=h.data,i=t[0];if(i==="o"||i==="s"){w.write(t.slice(1));return}try{const e=JSON.parse(t);switch(e.type){case"exit":w.writeln(`\r
11
+ \x1B[33m[Process exited with code ${e.exitCode}]\x1B[0m`);break;case"error":w.writeln(`\r
12
+ \x1B[31m[Error: ${e.message}]\x1B[0m`);break}}catch{}},E.onopen=()=>{k.fit();const h={type:"resize",cols:w.cols,rows:w.rows};_()&&o.initialPane!==void 0&&(h.initialPane=o.initialPane),E.send(JSON.stringify(h))},E.onclose=()=>{w.writeln(`\r
13
+ \x1B[90m[Disconnected]\x1B[0m`)},w.onData(h=>{E.readyState===WebSocket.OPEN&&E.send(JSON.stringify({type:"input",data:h}))}),n=new ResizeObserver(()=>{clearTimeout(a),a=setTimeout(()=>{k.fit(),E.readyState===WebSocket.OPEN&&E.send(JSON.stringify({type:"resize",cols:w.cols,rows:w.rows}))},150)}),n.observe(b)}),Ka(()=>{clearTimeout(a),n==null||n.disconnect(),E==null||E.close(),w==null||w.dispose()});var d={sendSelectPane:f,sendInput:l},p=sc();return Ei(p,g=>b=g,()=>b),V(r,p),Ae(d)}var oc=ee("<dialog><!></dialog>");function Wr(r,o){Re(o,!0);let _=Ee(o,"wide",3,!1),b;Nr(()=>{b==null||b.showModal()});var w=oc(),k=G(w);ps(k,()=>o.children),Ei(w,E=>b=E,()=>b),oe(()=>Me(w,1,`bg-sidebar text-primary border border-edge rounded-xl p-6 w-[90%] ${_()?"max-w-[560px]":"max-w-[380px]"}`)),ii("close",w,function(...E){var n;(n=o.onclose)==null||n.apply(this,E)}),V(r,w),Ae()}var ac=ee('<p class="text-[12px] text-danger mb-4 -mt-2 whitespace-pre-wrap"> </p>'),lc=ee('<span class="spinner"></span>'),cc=ee("<!> ",1),hc=ee('<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 zs(r,o){Re(o,!0);let _=Ee(o,"loading",3,!1),b=Ee(o,"error",3,""),w=Ee(o,"confirmLabel",3,"Remove"),k=Ee(o,"variant",3,"danger");Wr(r,{get onclose(){return o.oncancel},children:(E,n)=>{var a=hc(),c=X(G(a),2),f=G(c),l=X(c,2);{var d=t=>{var i=ac(),e=G(i);oe(()=>se(e,b())),V(t,i)};ne(l,t=>{b()&&t(d)})}var p=X(l,2),g=G(p);je(g,{type:"button",get onclick(){return o.oncancel},get disabled(){return _()},children:(t,i)=>{var e=Fe("Cancel");V(t,e)},$$slots:{default:!0}});var h=X(g,2);{let t=me(()=>k()==="accent"?"cta":"danger");je(h,{type:"submit",get variant(){return D(t)},class:"flex items-center gap-1.5",get disabled(){return _()},autofocus:!0,children:(i,e)=>{var s=cc(),u=De(s);{var m=C=>{var v=lc();V(C,v)};ne(u,C=>{_()&&C(m)})}var S=X(u);oe(()=>se(S,` ${w()??""}`)),V(i,s)},$$slots:{default:!0}})}oe(()=>se(f,o.message)),ii("submit",a,t=>{t.preventDefault(),o.onconfirm()}),V(E,a)},$$slots:{default:!0}}),Ae()}var uc=ee('<label><input type="radio" name="agent" class="accent-[var(--accent)]"/> </label>'),dc=ee('<label><input type="radio" name="profile" class="accent-[var(--accent)]"/> </label>'),fc=ee('<div class="flex flex-col gap-2 mb-6"></div>'),_c=ee('<span class="spinner"></span>'),vc=ee("<!> Create",1),pc=ee('<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 gc(r,o){Re(o,!0);let _=Ee(o,"loading",3,!1),b=Ee(o,"profiles",19,()=>[]),w=Ee(o,"initialBranch",3,""),k=Ee(o,"initialPrompt",3,"");const E=[{value:"claude",label:"Claude"},{value:"codex",label:"Codex"}],n="wt-default-profile",a="wt-default-agent",c=localStorage.getItem(n),f=localStorage.getItem(a);let l=me(()=>{var e;return c??((e=b()[0])==null?void 0:e.name)??"Full"}),d=ae(Le(w())),p=ae(Le(k())),g=ae(Le(f??"claude")),h=ae(Le(c??"Full")),t=ae(!1);function i(e){e.focus()}Nr(()=>{b().some(e=>e.name===D(h))||q(h,D(l),!0)}),Wr(r,{get onclose(){return o.oncancel},children:(e,s)=>{var u=pc(),m=X(G(u),2),S=X(G(m),2);Ya(S,U=>i==null?void 0:i(U)),ei(()=>rs(S,()=>D(p),U=>q(p,U)));var C=X(m,2),v=X(G(C),2),x=X(C,2);Ge(x,21,()=>E,Xr,(U,$)=>{var y=uc(),R=G(y),B=X(R);oe(()=>{Me(y,1,`flex-1 flex items-center justify-center gap-2 p-2.5 rounded-lg border cursor-pointer text-[13px] transition-colors
14
+ ${D(g)===D($).value?"border-accent bg-accent/10":"border-edge hover:bg-hover"}`),Hs(R,D($).value),ts(R,D(g)===D($).value),se(B,` ${D($).label??""}`)}),we("change",R,()=>q(g,D($).value,!0)),V(U,y)});var T=X(x,2);{var M=U=>{var $=fc();Ge($,21,b,Xr,(y,R)=>{var B=dc(),P=G(B),K=X(P);oe(()=>{Me(B,1,`flex items-center gap-2.5 p-2.5 rounded-lg border cursor-pointer text-[13px] transition-colors
15
+ ${D(h)===D(R).name?"border-accent bg-accent/10":"border-edge hover:bg-hover"}`),Hs(P,D(R).name),ts(P,D(h)===D(R).name),se(K,` ${D(R).name??""}`)}),we("change",P,()=>q(h,D(R).name,!0)),V(y,B)}),V(U,$)};ne(T,U=>{b().length>1&&U(M)})}var O=X(T,2),A=G(O),H=X(O,2),I=G(H);je(I,{type:"button",get onclick(){return o.oncancel},get disabled(){return _()},children:(U,$)=>{var y=Fe("Cancel");V(U,y)},$$slots:{default:!0}});var N=X(I,2);je(N,{type:"submit",variant:"cta",class:"flex items-center gap-1.5",get disabled(){return _()},children:(U,$)=>{var y=vc(),R=De(y);{var B=P=>{var K=_c();V(P,K)};ne(R,P=>{_()&&P(B)})}V(U,y)},$$slots:{default:!0}}),ii("submit",u,U=>{U.preventDefault(),D(t)?(localStorage.setItem(n,D(h)),localStorage.setItem(a,D(g))):(localStorage.removeItem(n),localStorage.removeItem(a)),o.oncreate(D(d).trim(),D(h),D(g),D(p).trim())}),we("keydown",S,U=>{var $;U.key==="Enter"&&!U.shiftKey&&(U.preventDefault(),($=U.currentTarget.form)==null||$.requestSubmit())}),rs(v,()=>D(d),U=>q(d,U)),ll(A,()=>D(t),U=>q(t,U)),V(e,u)},$$slots:{default:!0}}),Ae()}pt(["keydown","change"]);var mc=ee('<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 Sc(r,o){Re(o,!0);let _=ae(Le(localStorage.getItem(di)??"")),b;Nr(()=>{b==null||b.focus()});function w(){const k=D(_).trim();k?localStorage.setItem(di,k):localStorage.removeItem(di),o.onsave(k)}Wr(r,{get onclose(){return o.onclose},children:(k,E)=>{var n=mc(),a=X(G(n),2),c=X(G(a),2);Ei(c,p=>b=p,()=>b);var f=X(a,2),l=G(f);je(l,{type:"button",get onclick(){return o.onclose},children:(p,g)=>{var h=Fe("Cancel");V(p,h)},$$slots:{default:!0}});var d=X(l,2);je(d,{type:"submit",variant:"cta",children:(p,g)=>{var h=Fe("Save");V(p,h)},$$slots:{default:!0}}),ii("submit",n,p=>{p.preventDefault(),w()}),rs(c,()=>D(_),p=>q(_,p)),V(k,n)},$$slots:{default:!0}}),Ae()}async function Ft(r,o){const _=await fetch(`/api/${r}`,{headers:{"Content-Type":"application/json"},...o}),b=await _.json();if(!_.ok)throw new Error(b.error||`HTTP ${_.status}`);return b}function bc(){return Ft("config")}let Ii=null,Hi=null;async function wc(){const r={};Ii&&(r["If-None-Match"]=Ii);const o=await fetch("/api/worktrees",{headers:r});if(o.status===304&&Hi)return Hi;if(!o.ok){const b=await o.json();throw new Error(b.error||`HTTP ${o.status}`)}const _=await o.json();return Ii=o.headers.get("etag"),Hi=_,_}function Cc(r,o,_,b){return Ft("worktrees",{method:"POST",body:JSON.stringify({...r?{branch:r}:{},profile:o,agent:_,...b?{prompt:b}:{}})})}function yc(r){return Ft(`worktrees/${encodeURIComponent(r)}`,{method:"DELETE"})}function xc(r){return Ft(`worktrees/${encodeURIComponent(r)}/open`,{method:"POST"})}function Ec(r){return Ft(`worktrees/${encodeURIComponent(r)}/merge`,{method:"POST"})}function kc(){return Ft("linear/issues")}async function Lc(r){return(await Ft(`ci-logs/${r}`)).logs}async function Jn(r,o,_){await Ft(`worktrees/${encodeURIComponent(r)}/send`,{method:"POST",body:JSON.stringify({text:o,..._?{preamble:_}:{}})})}function Dc(r,o,_){const b=new EventSource("/api/notifications/stream");return b.addEventListener("initial",w=>{try{const k=JSON.parse(w.data);_==null||_(k)}catch{}}),b.addEventListener("notification",w=>{try{const k=JSON.parse(w.data);r(k)}catch{}}),b.addEventListener("dismiss",w=>{try{const{id:k}=JSON.parse(w.data);o(k)}catch{}}),()=>b.close()}async function Rc(r){await Ft(`notifications/${r}/dismiss`,{method:"POST"})}function Ac(r){return r.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g,"").replace(/\x1B[@-_]/g,"")}function Yn(r,o=3e4){const b=Ac(r).replace(/\r\n/g,`
16
+ `).replace(/\r/g,`
17
+ `).replace(/[^\x09\x0A\x20-\x7E]/g,"");return b.length>o?`[... truncated]
18
+ `+b.slice(-o):b}var Tc=ee("<button><!></button>");function is(r,o){let _=Kn(o,["$$slots","$$events","$$legacy","children"]);var b=Tc();zn(b,()=>({type:"button",class:"text-[11px] text-accent cursor-pointer bg-transparent border-none p-0 hover:underline disabled:opacity-50 disabled:cursor-not-allowed",..._}));var w=G(b);ps(w,()=>o.children),V(r,b)}var Bc=ee('<a target="_blank" rel="noopener" class="text-[11px] text-muted hover:text-primary no-underline hover:underline">GitHub &nearr;</a>'),Mc=ee('<div class="text-[12px] text-muted py-2">Loading logs...</div>'),Oc=ee('<div class="text-[12px] text-danger py-2"> </div>'),Pc=ee('<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),Ic=ee('<div class="text-[12px] text-danger py-1.5"> </div>'),Hc=ee('<div class="mt-2"><!> <!></div>'),Fc=ee('<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>'),Nc=ee('<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 Wc(r,o){Re(o,!0);let _=ae(null),b=ae(""),w=ae(!1),k=ae(""),E=ae(!1),n=ae(null),a=ae(""),c=me(()=>ms(o.pr));async function f(h){if(D(_)===h){q(_,null);return}q(_,h,!0),q(b,""),q(k,""),q(w,!0),q(E,!1),q(a,"");try{q(b,await Lc(h),!0)}catch(t){q(k,Sr(t),!0)}finally{q(w,!1)}}async function l(h){if(!o.branch)return;q(a,""),q(n,D(_)??-1,!0);const t=["Fix the failing CI check.",`PR: ${D(c)}`,`Check: ${h}`,"","Logs:"].join(`
19
+ `)+`
20
+ `,i=Yn(D(b));try{await Jn(o.branch,i,t),o.onfixsuccess()}catch(e){q(a,Sr(e),!0)}finally{q(n,null)}}async function d(){await navigator.clipboard.writeText(D(b)),q(E,!0),setTimeout(()=>{q(E,!1)},2e3)}function p(h){return h==="success"?"✓":h==="failed"?"✗":h==="skipped"?"—":"○"}function g(h){return h==="success"?"text-success":h==="failed"?"text-danger":h==="pending"?"text-warning":"text-muted"}Wr(r,{get onclose(){return o.onclose},wide:!0,children:(h,t)=>{var i=Nc(),e=De(i),s=G(e),u=X(e,2);Ge(u,21,()=>o.pr.ciChecks,C=>C.name+C.runId,(C,v)=>{var x=Fc(),T=G(x),M=G(T),O=G(M),A=X(M,2),H=G(A),I=X(A,2),N=G(I),U=X(T,2),$=G(U);{var y=J=>{is(J,{onclick:()=>f(D(v).runId),children:(Q,ie)=>{var F=Fe();oe(()=>se(F,D(_)===D(v).runId?"Hide logs":"View logs")),V(Q,F)},$$slots:{default:!0}})};ne($,J=>{D(v).status==="failed"&&D(v).runId&&J(y)})}var R=X($,2);{var B=J=>{var Q=Bc();oe(()=>ye(Q,"href",D(v).url)),V(J,Q)};ne(R,J=>{D(v).url&&J(B)})}var P=X(U,2);{var K=J=>{var Q=Hc(),ie=G(Q);{var F=Z=>{var ce=Mc();V(Z,ce)},L=Z=>{var ce=Oc(),_e=G(ce);oe(()=>se(_e,D(k))),V(Z,ce)},Y=Z=>{var ce=Pc(),_e=De(ce),ge=G(_e),Te=X(_e,2),le=G(Te);is(le,{onclick:d,children:(gt,Rt)=>{var At=Fe();oe(()=>se(At,D(E)?"Copied!":"Copy logs")),V(gt,At)},$$slots:{default:!0}});var Dt=X(le,2);{let gt=me(()=>!o.branch||!D(b)||D(w)||D(n)!==null);je(Dt,{variant:"cta",small:!0,get disabled(){return D(gt)},onclick:()=>l(D(v).name),children:(Rt,At)=>{var Tt=Fe();oe(()=>se(Tt,D(n)!==null?"Asking agent...":"Ask agent to fix")),V(Rt,Tt)},$$slots:{default:!0}})}oe(()=>se(ge,D(b))),V(Z,ce)};ne(ie,Z=>{D(w)?Z(F):D(k)?Z(L,1):D(b)&&Z(Y,2)})}var j=X(ie,2);{var te=Z=>{var ce=Ic(),_e=G(ce);oe(()=>se(_e,D(a))),V(Z,ce)};ne(j,Z=>{D(a)&&Z(te)})}V(J,Q)};ne(P,J=>{D(_)===D(v).runId&&J(K)})}oe((J,Q,ie)=>{Me(M,1,`text-sm font-bold ${J??""}`),se(O,Q),se(H,D(v).name),Me(I,1,`text-[11px] ${ie??""}`),se(N,D(v).status)},[()=>g(D(v).status),()=>p(D(v).status),()=>g(D(v).status)]),V(C,x)});var m=X(u,2),S=G(m);je(S,{type:"button",get onclick(){return o.onclose},children:(C,v)=>{var x=Fe("Close");V(C,x)},$$slots:{default:!0}}),oe(()=>se(s,`CI Checks — ${D(c)??""}`)),V(h,i)},$$slots:{default:!0}}),Ae()}var Uc=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],jc=["difference","intersection","symmetricDifference","union"],$s=!1,Dr,ut,$t,pi,Pr,Zn,Qn;const gi=class gi extends Set{constructor(_){super();he(this,Pr);he(this,Dr,new Map);he(this,ut,ae(0));he(this,$t,ae(0));he(this,pi,Ht||-1);if(_){for(var b of _)super.add(b);W(this,$t).v=super.size}$s||Ce(this,Pr,Qn).call(this)}has(_){var b=super.has(_),w=W(this,Dr),k=w.get(_);if(k===void 0){if(!b)return D(W(this,ut)),!1;k=Ce(this,Pr,Zn).call(this,!0),w.set(_,k)}return D(k),b}add(_){return super.has(_)||(super.add(_),q(W(this,$t),super.size),Xt(W(this,ut))),this}delete(_){var b=super.delete(_),w=W(this,Dr),k=w.get(_);return k!==void 0&&(w.delete(_),q(k,!1)),b&&(q(W(this,$t),super.size),Xt(W(this,ut))),b}clear(){if(super.size!==0){super.clear();var _=W(this,Dr);for(var b of _.values())q(b,!1);_.clear(),q(W(this,$t),0),Xt(W(this,ut))}}keys(){return this.values()}values(){return D(W(this,ut)),super.values()}entries(){return D(W(this,ut)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return D(W(this,$t))}};Dr=new WeakMap,ut=new WeakMap,$t=new WeakMap,pi=new WeakMap,Pr=new WeakSet,Zn=function(_){return Ht===W(this,pi)?ae(_):Jt(_)},Qn=function(){$s=!0;var _=gi.prototype,b=Set.prototype;for(const w of Uc)_[w]=function(...k){return D(W(this,ut)),b[w].apply(this,k)};for(const w of jc)_[w]=function(...k){D(W(this,ut));var E=b[w].apply(this,k);return new gi(E)}};let fi=gi;var zc=ee('<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>'),$c=ee('<div class="text-[12px] text-danger mb-3"> </div>'),Kc=ee('<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 qc(r,o){Re(o,!0);let _=ae(Le(new fi)),b=ae(!1),w=ae("");Nr(()=>{q(_,new fi(o.pr.comments.map((l,d)=>d)),!0)});let k=me(()=>ms(o.pr)),E=me(()=>D(_).size===o.pr.comments.length),n=me(()=>D(_).size===0);function a(){if(D(E))D(_).clear();else for(let l=0;l<o.pr.comments.length;l++)D(_).add(l)}function c(l){D(_).has(l)?D(_).delete(l):D(_).add(l)}async function f(){if(!o.branch||D(n))return;q(b,!0),q(w,"");const l=["Review the PR comments and elaborate a plan to address them.",`PR: ${D(k)}`,"","Comments:"].join(`
21
+ `)+`
22
+ `,d=o.pr.comments.filter((p,g)=>D(_).has(g)).map((p,g)=>`[${g+1}] @${p.author} (${p.createdAt.slice(0,10)}):
23
+ ${p.body}`).join(`
24
+
25
+ `);try{await Jn(o.branch,Yn(d,2e4),l),o.onsendsuccess()}catch(p){q(w,Sr(p),!0)}finally{q(b,!1)}}Wr(r,{get onclose(){return o.onclose},wide:!0,children:(l,d)=>{var p=Kc(),g=De(p),h=G(g),t=X(g,2),i=G(t);is(i,{onclick:a,children:(T,M)=>{var O=Fe();oe(()=>se(O,D(E)?"Deselect all":"Select all")),V(T,O)},$$slots:{default:!0}});var e=X(i,2),s=G(e),u=X(t,2);Ge(u,21,()=>o.pr.comments,Xr,(T,M,O)=>{var A=zc(),H=G(A),I=G(H),N=X(I,2),U=G(N),$=G(U),y=G($),R=X($),B=X(U,2),P=G(B);oe((K,J)=>{ts(I,K),se(y,`@${D(M).author??""}`),se(R,` · ${J??""}`),se(P,D(M).body)},[()=>D(_).has(O),()=>D(M).createdAt.slice(0,10)]),we("change",I,()=>c(O)),V(T,A)});var m=X(u,2);{var S=T=>{var M=$c(),O=G(M);oe(()=>se(O,D(w))),V(T,M)};ne(m,T=>{D(w)&&T(S)})}var C=X(m,2),v=G(C);je(v,{type:"button",get onclick(){return o.onclose},children:(T,M)=>{var O=Fe("Cancel");V(T,O)},$$slots:{default:!0}});var x=X(v,2);{let T=me(()=>D(n)||D(b));je(x,{variant:"cta",small:!0,get disabled(){return D(T)},onclick:f,children:(M,O)=>{var A=Fe();oe(()=>se(A,D(b)?"Sending...":`Send ${D(_).size} to agent`)),V(M,A)},$$slots:{default:!0}})}oe(()=>{se(h,`PR Comments — ${D(k)??""}`),se(s,`${D(_).size??""} of ${o.pr.comments.length??""} selected`)}),V(l,p)},$$slots:{default:!0}}),Ae()}pt(["change"]);var Vc=ee('<button type="button"> </button>'),Gc=ee('<nav class="flex items-stretch bg-topbar border-t border-edge pane-bar svelte-19vlwaa"></nav>');function Xc(r,o){Re(o,!0);var _=Gc();Ge(_,21,()=>o.panes,b=>b.index,(b,w)=>{var k=Vc(),E=G(k);oe(()=>{Me(k,1,`flex-1 py-3 text-sm font-medium cursor-pointer border-none bg-transparent ${o.activePane===D(w).index?"text-accent pane-active":"text-muted"}`,"svelte-19vlwaa"),se(E,D(w).label)}),we("click",k,()=>o.onselect(D(w).index)),V(b,k)}),V(r,_),Ae()}pt(["click"]);var Jc=ee('<div class="toast svelte-1974bvt" role="alert"><button type="button" class="flex-1 flex items-center gap-2 text-left bg-transparent border-none text-inherit cursor-pointer p-0"><!></button> <button type="button" class="shrink-0 w-6 h-6 flex items-center justify-center text-muted hover:text-primary cursor-pointer bg-transparent border-none text-sm">&times;</button></div>'),Yc=ee('<div class="fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm"></div>');function Zc(r,o){Re(o,!0);var _=Zt(),b=De(_);{var w=k=>{var E=Yc();Ge(E,21,()=>o.notifications,n=>n.id,(n,a)=>{var c=Jc(),f=G(c),l=G(f);Gn(l,{get notification(){return D(a)},large:!0});var d=X(f,2);we("click",f,()=>{o.ondismiss(D(a).id),o.onselect(D(a).branch)}),we("click",d,()=>o.ondismiss(D(a).id)),V(n,c)}),V(k,E)};ne(b,k=>{o.notifications.length>0&&k(w)})}V(r,_),Ae()}pt(["click"]);var Qc=ee('<li class="mb-1 p-2 rounded-md border border-transparent hover:bg-hover text-[12px]"><div class="flex items-center gap-1.5 mb-0.5"><span class="shrink-0 w-2 h-2 rounded-full"></span> <a target="_blank" rel="noopener noreferrer" class="font-mono text-[11px] text-accent no-underline hover:underline"> </a> <span class="text-[10px] text-muted"> </span></div> <button type="button" class="truncate text-primary mb-1 text-left bg-transparent border-none p-0 cursor-pointer hover:underline w-full"> </button> <div class="flex items-center justify-between gap-2"><span class="text-[10px] text-muted truncate"> <!></span> <!></div></li>'),eh=ee('<ul class="list-none overflow-y-auto max-h-64 px-2 pb-2"></ul>'),th=ee('<div class="border-t border-edge"><button type="button" class="w-full flex items-center justify-between px-4 py-2 text-xs text-muted cursor-pointer bg-transparent border-none hover:bg-hover"><span class="font-semibold"> </span> <span class="text-[10px]"> </span></button> <!></div>');function rh(r,o){Re(o,!0);let _=ae(!0);var b=th(),w=G(b),k=G(w),E=G(k),n=X(k,2),a=G(n),c=X(w,2);{var f=l=>{var d=eh();Ge(d,21,()=>o.issues,p=>p.id,(p,g)=>{var h=Qc(),t=G(h),i=G(t),e=X(i,2),s=G(e),u=X(e,2),m=G(u),S=X(t,2),C=G(S),v=X(S,2),x=G(v),T=G(x),M=X(T);{var O=H=>{var I=Fe();oe(()=>se(I,`· ${D(g).project??""}`)),V(H,I)};ne(M,H=>{D(g).project&&H(O)})}var A=X(x,2);je(A,{small:!0,variant:"accent-outline",onclick:()=>o.onassign(D(g)),children:(H,I)=>{var N=Fe("Assign");V(H,N)},$$slots:{default:!0}}),oe(()=>{Jr(i,`background: ${D(g).state.color??""};`),ye(i,"title",D(g).state.name),ye(e,"href",D(g).url),se(s,D(g).identifier),se(m,D(g).priorityLabel),ye(S,"title",D(g).title),se(C,D(g).title),se(T,D(g).team.key)}),we("click",S,()=>o.onselect(D(g))),V(p,h)}),V(l,d)};ne(c,l=>{D(_)||l(f)})}oe(()=>{se(E,`Linear (${o.issues.length??""})`),se(a,D(_)?"▸":"▾")}),we("click",w,()=>q(_,!D(_))),V(r,b),Ae()}pt(["click"]);var ih=ee('<div class="text-[13px] text-secondary whitespace-pre-wrap max-h-64 overflow-y-auto mb-4 leading-relaxed"> </div>'),sh=ee('<p class="text-[13px] text-muted italic mb-4">No description</p>'),nh=ee("<span> </span>"),oh=ee('<span class="px-1.5 py-0.5 rounded-full text-[10px]"> </span>'),ah=ee("<span> </span>"),lh=ee('<div class="flex items-center gap-2 mb-1"><span class="shrink-0 w-2.5 h-2.5 rounded-full"></span> <a target="_blank" rel="noopener noreferrer" class="font-mono text-xs text-accent no-underline hover:underline"> </a> <span class="text-[11px] text-muted"> </span> <span class="text-[11px] text-muted"> </span></div> <h2 class="text-base font-semibold mb-3"> </h2> <!> <div class="flex items-center gap-3 text-[11px] text-muted mb-4"><span> </span> <!> <!> <!></div> <div class="flex justify-end gap-2"><!> <!></div>',1);function ch(r,o){Re(o,!0),Wr(r,{get onclose(){return o.onclose},wide:!0,children:(_,b)=>{var w=lh(),k=De(w),E=G(k),n=X(E,2),a=G(n),c=X(n,2),f=G(c),l=X(c,2),d=G(l),p=X(k,2),g=G(p),h=X(p,2);{var t=H=>{var I=ih(),N=G(I);oe(()=>se(N,o.issue.description)),V(H,I)},i=H=>{var I=sh();V(H,I)};ne(h,H=>{o.issue.description?H(t):H(i,!1)})}var e=X(h,2),s=G(e),u=G(s),m=X(s,2);{var S=H=>{var I=nh(),N=G(I);oe(()=>se(N,`· ${o.issue.project??""}`)),V(H,I)};ne(m,H=>{o.issue.project&&H(S)})}var C=X(m,2);{var v=H=>{var I=Zt(),N=De(I);Ge(N,17,()=>o.issue.labels,U=>U.name,(U,$)=>{var y=oh(),R=G(y);oe(()=>{Jr(y,`color: ${D($).color??""}; background: ${D($).color??""}20;`),se(R,D($).name)}),V(U,y)}),V(H,I)};ne(C,H=>{o.issue.labels.length>0&&H(v)})}var x=X(C,2);{var T=H=>{var I=ah(),N=G(I);oe(()=>se(N,`Due ${o.issue.dueDate??""}`)),V(H,I)};ne(x,H=>{o.issue.dueDate&&H(T)})}var M=X(e,2),O=G(M);je(O,{get onclick(){return o.onclose},children:(H,I)=>{var N=Fe("Close");V(H,N)},$$slots:{default:!0}});var A=X(O,2);je(A,{variant:"accent-outline",onclick:()=>o.onassign(o.issue),children:(H,I)=>{var N=Fe("Assign");V(H,N)},$$slots:{default:!0}}),oe(()=>{Jr(E,`background: ${o.issue.state.color??""};`),ye(E,"title",o.issue.state.name),ye(n,"href",o.issue.url),se(a,o.issue.identifier),se(f,o.issue.state.name),se(d,`· ${o.issue.priorityLabel??""}`),se(g,o.issue.title),se(u,o.issue.team.key)}),V(_,w)},$$slots:{default:!0}}),Ae()}var hh=ee('<div class="fixed inset-0 bg-black/50 z-40"></div>'),uh=ee('<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>'),dh=ee('<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>'),fh=ee('<!> <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),_h=ee('<div class="flex-1 flex items-center justify-center text-muted text-sm"><p>Select a worktree from the sidebar to connect</p></div>'),vh=ee('<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 ph(r,o){Re(o,!0);let _=ae(Le({services:[],profiles:{default:{name:"default"}},autoName:!1})),b=ae(Le([])),w=ae(null),k=ae(null),E=ae(null),n=ae(Le(new Set)),a=ae(!1),c=ae(!1),f=ae(null),l=ae(null),d=ae(!1),p=ae(Le(localStorage.getItem(di)??"")),g=ae(Le([])),h=ae(null),t=ae(null),i=0;const e=3e5;let s=ae(Le([])),u=ae(Le([])),m=ae(0);const S=4e3,C=10;let v=ae(Le(new Set));function x(z){q(s,[...D(s),z],!0),q(v,new Set([...D(v),z.branch]),!0),q(u,[z,...D(u)].slice(0,C),!0),ga(m),setTimeout(()=>{q(s,D(s).filter(re=>re.id!==z.id),!0)},S),document.hidden&&Notification.permission==="granted"&&new Notification(z.message,{body:z.url??z.branch,tag:`wm-${z.id}`})}function T(z){D(u).some(re=>re.id===z.id)||q(u,[z,...D(u)].slice(0,C),!0)}function M(z){q(s,D(s).filter(re=>re.id!==z),!0),Rc(z).catch(()=>{})}function O(z){q(s,D(s).filter(re=>re.id!==z),!0)}function A(){q(m,0)}let H=ae(!1),I=ae(!1),N=ae(0),U=ae(void 0);const $=200;let y=me(()=>D(b).filter(z=>z.mux==="✓")),R=me(()=>D(y).find(z=>z.branch===D(w))),B=me(()=>!!D(w));Nr(()=>{!D(w)&&D(y).length>0&&q(w,D(y)[0].branch,!0)});let P=me(()=>{var re;const z=((re=D(R))==null?void 0:re.paneCount)??0;return z<2?[]:Array.from({length:z},(pe,Be)=>({index:Be,label:String(Be+1)}))}),K=me(()=>D(H)&&D(B)&&D(P).length>0);function J(){const z=Date.now();z-i<e||(i=z,kc().then(re=>{q(g,re,!0)}).catch(re=>console.warn("[linear]",re)))}async function Q(){try{q(b,await wc(),!0)}catch(z){console.error("Failed to refresh:",z)}J()}function ie(z){q(h,z,!0),q(a,!0)}async function F(z,re,pe,Be){q(d,!0);try{const be=await Cc(z||void 0,re,pe,Be||void 0);await xc(be.branch),q(a,!1),q(h,null),await Q(),q(w,be.branch,!0),D(H)&&q(I,!1)}catch(be){alert(`Failed to create: ${Sr(be)}`)}finally{q(d,!1)}}function L(z){if(D(w)!==z)return;const re=D(y).findIndex(Be=>Be.branch===z),pe=D(y)[re-1]??D(y)[re+1];q(w,pe?pe.branch:null,!0)}async function Y(){const z=D(k);if(z){q(k,null),L(z),q(n,new Set([...D(n),z]),!0);try{await yc(z),await Q()}catch(re){alert(`Failed to remove: ${Sr(re)}`)}finally{q(n,new Set([...D(n)].filter(re=>re!==z)),!0)}}}async function j(){const z=D(E);if(z){q(E,null),L(z),q(n,new Set([...D(n),z]),!0);try{await Ec(z),await Q()}catch(re){alert(`Failed to merge: ${Sr(re)}`)}finally{q(n,new Set([...D(n)].filter(re=>re!==z)),!0)}}}function te(z){const re=D(y).filter(be=>!D(n).has(be.branch));if(re.length===0)return;if(!D(w)){q(w,re[z===1?0:re.length-1].branch,!0);return}const Be=re.findIndex(be=>be.branch===D(w))+z;Be>=0&&Be<re.length&&q(w,re[Be].branch,!0)}function Z(z){D(a)||D(k)||D(E)||!(z.metaKey||z.ctrlKey)||(z.key==="ArrowUp"?(z.preventDefault(),te(-1)):z.key==="ArrowDown"?(z.preventDefault(),te(1)):z.key==="k"||z.key==="K"?(z.preventDefault(),D(d)||q(a,!0)):z.key==="m"||z.key==="M"?(z.preventDefault(),D(w)&&q(E,D(w),!0)):(z.key==="d"||z.key==="D")&&(z.preventDefault(),D(w)&&q(k,D(w),!0)))}function ce(z){var re;q(N,z,!0),(re=D(U))==null||re.sendSelectPane(z)}gs(()=>{bc().then(be=>{q(_,be,!0)}).catch(()=>{}),Q(),J();const z=setInterval(Q,5e3);window.addEventListener("keydown",Z);const re=Dc(x,O,T);Notification.permission==="default"&&Notification.requestPermission().catch(()=>{});const pe=window.matchMedia("(max-width: 768px)");q(H,pe.matches,!0),D(H)&&q(I,!0);function Be(be){q(H,be.matches,!0)}return pe.addEventListener("change",Be),()=>{clearInterval(z),window.removeEventListener("keydown",Z),pe.removeEventListener("change",Be),re()}});var _e=vh(),ge=De(_e),Te=G(ge);{var le=z=>{var re=fh(),pe=De(re);{var Be=ke=>{var rt=hh();we("click",rt,()=>q(I,!1)),we("keydown",rt,ho=>{ho.key==="Escape"&&q(I,!1)}),V(ke,rt)};ne(pe,ke=>{D(H)&&ke(Be)})}var be=X(pe,2),ni=G(be),so=X(G(ni),2),ki=G(so),no=X(ki,2);{var oo=ke=>{var rt=uh();we("click",rt,()=>q(I,!1)),V(ke,rt)};ne(no,ke=>{D(H)&&ke(oo)})}var Cs=X(ni,2);Ll(Cs,{get worktrees(){return D(y)},get selected(){return D(w)},get removing(){return D(n)},get notifiedBranches(){return D(v)},onselect:ke=>{q(w,ke,!0),q(v,new Set([...D(v)].filter(rt=>rt!==ke)),!0),D(H)&&q(I,!1)},onremove:ke=>q(k,ke,!0)});var ys=X(Cs,2);{var ao=ke=>{rh(ke,{get issues(){return D(g)},onassign:ie,onselect:rt=>q(t,rt,!0)})};ne(ys,ke=>{D(g).length>0&&ke(ao)})}var lo=X(ys,2);{var co=ke=>{var rt=dh();V(ke,rt)};ne(lo,ke=>{D(H)||ke(co)})}oe(()=>{Me(be,1,`${D(H)?"fixed inset-0 z-50 w-full":"w-[220px] min-w-[220px]"} bg-sidebar border-r border-edge flex flex-col overflow-hidden`),ki.disabled=D(d)}),we("click",ki,()=>q(a,!0)),V(z,re)};ne(Te,z=>{(!D(H)||D(I))&&z(le)})}var Dt=X(Te,2),gt=G(Dt);Yl(gt,{get name(){return D(w)},get worktree(){return D(R)},get sshHost(){return D(p)},get isMobile(){return D(H)},get notificationHistory(){return D(u)},get unreadCount(){return D(m)},ontogglesidebar:()=>q(I,!D(I)),onmerge:()=>{D(w)&&q(E,D(w),!0)},onremove:()=>{D(w)&&q(k,D(w),!0)},onsettings:()=>q(c,!0),onciclick:z=>q(f,z,!0),onreviewsclick:z=>q(l,z,!0),onbellopen:A,onnotificationselect:z=>{q(w,z,!0),q(v,new Set([...D(v)].filter(re=>re!==z)),!0),D(H)&&q(I,!1)}});var Rt=X(gt,2);{var At=z=>{var re=Zt(),pe=De(re);Va(pe,()=>D(w),Be=>{{let be=me(()=>D(H)?D(N):void 0);Ei(nc(Be,{get worktree(){return D(w)},get isMobile(){return D(H)},get initialPane(){return D(be)}}),ni=>q(U,ni,!0),()=>D(U))}}),V(z,re)},Tt=z=>{var re=_h();V(z,re)};ne(Rt,z=>{D(B)?z(At):z(Tt,!1)})}var ze=X(Rt,2);{var tr=z=>{Xc(z,{get activePane(){return D(N)},get panes(){return D(P)},onselect:ce})};ne(ze,z=>{D(K)&&z(tr)})}var Ye=X(ge,2);{var rr=z=>{{let re=me(()=>[D(_).profiles.default,...D(_).profiles.sandbox?[D(_).profiles.sandbox]:[]]),pe=me(()=>{var be;return((be=D(h))==null?void 0:be.branchName)??""}),Be=me(()=>{var be;return((be=D(h))==null?void 0:be.title)??""});gc(z,{get loading(){return D(d)},get profiles(){return D(re)},get initialBranch(){return D(pe)},get initialPrompt(){return D(Be)},oncreate:F,oncancel:()=>{q(a,!1),q(h,null)}})}};ne(Ye,z=>{D(a)&&z(rr)})}var gr=X(Ye,2);{var mt=z=>{{let re=me(()=>`Remove worktree "${D(k)}"? This action cannot be undone.`);zs(z,{get message(){return D(re)},onconfirm:Y,oncancel:()=>q(k,null)})}};ne(gr,z=>{D(k)&&z(mt)})}var ir=X(gr,2);{var St=z=>{{let re=me(()=>`Merge worktree "${D(E)}" into main? The worktree will be removed after merging.`);zs(z,{get message(){return D(re)},confirmLabel:"Merge",variant:"accent",onconfirm:j,oncancel:()=>q(E,null)})}};ne(ir,z=>{D(E)&&z(St)})}var Nt=X(ir,2);{var Se=z=>{Sc(z,{onsave:re=>{q(p,re,!0),q(c,!1)},onclose:()=>q(c,!1)})};ne(Nt,z=>{D(c)&&z(Se)})}var si=X(Nt,2);{var eo=z=>{{let re=me(()=>{var pe;return((pe=D(R))==null?void 0:pe.branch)??""});Wc(z,{get pr(){return D(f)},get branch(){return D(re)},onclose:()=>q(f,null),onfixsuccess:()=>{q(f,null),setTimeout(()=>{var pe;return(pe=D(U))==null?void 0:pe.sendInput("\r")},$)}})}};ne(si,z=>{D(f)&&z(eo)})}var bs=X(si,2);{var to=z=>{{let re=me(()=>{var pe;return((pe=D(R))==null?void 0:pe.branch)??""});qc(z,{get pr(){return D(l)},get branch(){return D(re)},onclose:()=>q(l,null),onsendsuccess:()=>{q(l,null),setTimeout(()=>{var pe;return(pe=D(U))==null?void 0:pe.sendInput("\r")},$)}})}};ne(bs,z=>{D(l)&&z(to)})}var ws=X(bs,2);{var ro=z=>{ch(z,{get issue(){return D(t)},onassign:re=>{q(t,null),ie(re)},onclose:()=>q(t,null)})};ne(ws,z=>{D(t)&&z(ro)})}var io=X(ws,2);Zc(io,{get notifications(){return D(s)},ondismiss:M,onselect:z=>{q(w,z,!0),q(v,new Set([...D(v)].filter(re=>re!==z)),!0),D(H)&&q(I,!1)}}),V(r,_e),Ae()}pt(["click","keydown"]);ja(ph,{target:document.getElementById("app")});