webmux 0.12.0 → 0.13.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.
- package/backend/dist/server.js +124 -32
- package/bin/webmux.js +171 -36
- package/frontend/dist/assets/index-Bi9DHlpD.js +34 -0
- package/frontend/dist/assets/index-FwEUWC9Q.css +32 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/index-DIWwx16E.css +0 -32
- package/frontend/dist/assets/index-Pz_SK2_d.js +0 -32
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var Uo=Object.defineProperty;var en=t=>{throw TypeError(t)};var jo=(t,o,_)=>o in t?Uo(t,o,{enumerable:!0,configurable:!0,writable:!0,value:_}):t[o]=_;var Dt=(t,o,_)=>jo(t,typeof o!="symbol"?o+"":o,_),ns=(t,o,_)=>o.has(t)||en("Cannot "+_);var W=(t,o,_)=>(ns(t,o,"read from private field"),_?_.call(t):o.get(t)),ue=(t,o,_)=>o.has(t)?en("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(t):o.set(t,_),_e=(t,o,_,b)=>(ns(t,o,"write to private field"),b?b.call(t,_):o.set(t,_),_),Oe=(t,o,_)=>(ns(t,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 L of w)if(L.type==="childList")for(const k of L.addedNodes)k.tagName==="LINK"&&k.rel==="modulepreload"&&b(k)}).observe(document,{childList:!0,subtree:!0});function _(w){const L={};return w.integrity&&(L.integrity=w.integrity),w.referrerPolicy&&(L.referrerPolicy=w.referrerPolicy),w.crossOrigin==="use-credentials"?L.credentials="include":w.crossOrigin==="anonymous"?L.credentials="omit":L.credentials="same-origin",L}function b(w){if(w.ep)return;w.ep=!0;const L=_(w);fetch(w.href,L)}})();const zo="5";var xn;typeof window<"u"&&((xn=window.__svelte??(window.__svelte={})).v??(xn.v=new Set)).add(zo);const $o=1,Ko=2,Ln=4,qo=8,Vo=16,Go=1,Jo=4,Xo=8,Yo=16,Zo=1,Qo=2,Ke=Symbol(),Dn="http://www.w3.org/1999/xhtml",ea="@attach",ta=!1;var Os=Array.isArray,ra=Array.prototype.indexOf,qr=Array.prototype.includes,$i=Array.from,ia=Object.defineProperty,Pr=Object.getOwnPropertyDescriptor,sa=Object.getOwnPropertyDescriptors,na=Object.prototype,oa=Array.prototype,Rn=Object.getPrototypeOf,tn=Object.isExtensible;const aa=()=>{};function la(t){for(var o=0;o<t.length;o++)t[o]()}function An(){var t,o,_=new Promise((b,w)=>{t=b,o=w});return{promise:_,resolve:t,reject:o}}const Ve=2,Vr=4,Ki=8,Is=1<<24,fr=16,Pt=32,Cr=64,vs=128,St=512,qe=1024,Ye=2048,Ot=4096,dt=8192,bt=16384,kr=32768,ps=1<<25,yr=65536,rn=1<<17,ca=1<<18,ei=1<<19,ha=1<<20,zt=1<<25,xr=65536,gs=1<<21,Hs=1<<22,lr=1<<23,br=Symbol("$state"),ua=Symbol("legacy props"),da=Symbol(""),Vt=new class extends Error{constructor(){super(...arguments);Dt(this,"name","StaleReactionError");Dt(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};var En;const Fs=!!((En=globalThis.document)!=null&&En.contentType)&&globalThis.document.contentType.includes("xml");function Bn(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function fa(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function _a(t,o,_){throw new Error("https://svelte.dev/e/each_key_duplicate")}function va(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function pa(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function ga(t){throw new Error("https://svelte.dev/e/effect_orphan")}function ma(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Sa(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function ba(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function wa(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Ca(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function ya(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function xa(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function Ea(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function Tn(t){return t===this.v}function ka(t,o){return t!=t?o==o:t!==o||t!==null&&typeof t=="object"||typeof t=="function"}function Mn(t){return!ka(t,this.v)}let La=!1,rt=null;function Gr(t){rt=t}function Ne(t,o=!1,_){rt={p:rt,i:!1,c:null,e:null,s:t,x:null,r:be,l:null}}function We(t){var o=rt,_=o.e;if(_!==null){o.e=null;for(var b of _)to(b)}return t!==void 0&&(o.x=t),o.i=!0,rt=o.p,t??{}}function Pn(){return!0}let _r=[];function On(){var t=_r;_r=[],la(t)}function Yt(t){if(_r.length===0&&!hi){var o=_r;queueMicrotask(()=>{o===_r&&On()})}_r.push(t)}function Da(){for(;_r.length>0;)On()}function In(t){var o=be;if(o===null)return pe.f|=lr,t;if((o.f&kr)===0&&(o.f&Vr)===0)throw t;ar(t,o)}function ar(t,o){for(;o!==null;){if((o.f&vs)!==0){if((o.f&kr)===0)throw t;try{o.b.error(t);return}catch(_){t=_}}o=o.parent}throw t}const Ra=-7169;function He(t,o){t.f=t.f&Ra|o}function Ns(t){(t.f&St)!==0||t.deps===null?He(t,qe):He(t,Ot)}function Hn(t){if(t!==null)for(const o of t)(o.f&Ve)===0||(o.f&xr)===0||(o.f^=xr,Hn(o.deps))}function Fn(t,o,_){(t.f&Ye)!==0?o.add(t):(t.f&Ot)!==0&&_.add(t),Hn(t.deps),He(t,qe)}let Ai=!1;function Aa(t){var o=Ai;try{return Ai=!1,[t(),Ai]}finally{Ai=o}}const ni=new Set;let fe=null,Ge=null,ms=null,hi=!1,os=!1,Mr=null,Ti=null;var sn=0;let Ba=1;var Ir,Hr,Fr,Nr,vi,gt,Wr,sr,Ft,Ur,Qe,Ss,bs,ws,Cs,Nn;const Ni=class Ni{constructor(){ue(this,Qe);Dt(this,"id",Ba++);Dt(this,"current",new Map);Dt(this,"previous",new Map);ue(this,Ir,new Set);ue(this,Hr,new Set);ue(this,Fr,0);ue(this,Nr,0);ue(this,vi,null);ue(this,gt,[]);ue(this,Wr,new Set);ue(this,sr,new Set);ue(this,Ft,new Map);Dt(this,"is_fork",!1);ue(this,Ur,!1)}skip_effect(o){W(this,Ft).has(o)||W(this,Ft).set(o,{d:[],m:[]})}unskip_effect(o){var _=W(this,Ft).get(o);if(_){W(this,Ft).delete(o);for(var b of _.d)He(b,Ye),this.schedule(b);for(b of _.m)He(b,Ot),this.schedule(b)}}capture(o,_){_!==Ke&&!this.previous.has(o)&&this.previous.set(o,_),(o.f&lr)===0&&(this.current.set(o,o.v),Ge==null||Ge.set(o,o.v))}activate(){fe=this}deactivate(){fe=null,Ge=null}flush(){try{if(os=!0,fe=this,!Oe(this,Qe,Ss).call(this)){for(const o of W(this,Wr))W(this,sr).delete(o),He(o,Ye),this.schedule(o);for(const o of W(this,sr))He(o,Ot),this.schedule(o)}Oe(this,Qe,bs).call(this)}finally{sn=0,ms=null,Mr=null,Ti=null,os=!1,fe=null,Ge=null,cr.clear()}}discard(){for(const o of W(this,Hr))o(this);W(this,Hr).clear()}increment(o){_e(this,Fr,W(this,Fr)+1),o&&_e(this,Nr,W(this,Nr)+1)}decrement(o,_){_e(this,Fr,W(this,Fr)-1),o&&_e(this,Nr,W(this,Nr)-1),!(W(this,Ur)||_)&&(_e(this,Ur,!0),Yt(()=>{_e(this,Ur,!1),this.flush()}))}oncommit(o){W(this,Ir).add(o)}ondiscard(o){W(this,Hr).add(o)}settled(){return(W(this,vi)??_e(this,vi,An())).promise}static ensure(){if(fe===null){const o=fe=new Ni;os||(ni.add(fe),hi||Yt(()=>{fe===o&&o.flush()}))}return fe}apply(){}schedule(o){var w;if(ms=o,(w=o.b)!=null&&w.is_pending&&(o.f&(Vr|Ki|Is))!==0&&(o.f&kr)===0){o.b.defer_effect(o);return}for(var _=o;_.parent!==null;){_=_.parent;var b=_.f;if(Mr!==null&&_===be&&(pe===null||(pe.f&Ve)===0))return;if((b&(Cr|Pt))!==0){if((b&qe)===0)return;_.f^=qe}}W(this,gt).push(_)}};Ir=new WeakMap,Hr=new WeakMap,Fr=new WeakMap,Nr=new WeakMap,vi=new WeakMap,gt=new WeakMap,Wr=new WeakMap,sr=new WeakMap,Ft=new WeakMap,Ur=new WeakMap,Qe=new WeakSet,Ss=function(){return this.is_fork||W(this,Nr)>0},bs=function(){var n,a;sn++>1e3&&Ma();const o=W(this,gt);_e(this,gt,[]),this.apply();var _=Mr=[],b=[],w=Ti=[];for(const c of o)Oe(this,Qe,ws).call(this,c,_,b);if(fe=null,w.length>0){var L=Ni.ensure();for(const c of w)L.schedule(c)}if(Mr=null,Ti=null,Oe(this,Qe,Ss).call(this)){Oe(this,Qe,Cs).call(this,b),Oe(this,Qe,Cs).call(this,_);for(const[c,f]of W(this,Ft))jn(c,f)}else{W(this,Wr).clear(),W(this,sr).clear();for(const c of W(this,Ir))c(this);W(this,Ir).clear(),nn(b),nn(_),W(this,Fr)===0&&Oe(this,Qe,Nn).call(this),(n=W(this,vi))==null||n.resolve()}var k=fe;if(W(this,gt).length>0){const c=k??(k=this);W(c,gt).push(...W(this,gt).filter(f=>!W(c,gt).includes(f)))}k!==null&&(ni.add(k),Oe(a=k,Qe,bs).call(a))},ws=function(o,_,b){o.f^=qe;for(var w=o.first;w!==null;){var L=w.f,k=(L&(Pt|Cr))!==0,n=k&&(L&qe)!==0,a=n||(L&dt)!==0||W(this,Ft).has(w);if(!a&&w.fn!==null){k?w.f^=qe:(L&Vr)!==0?_.push(w):wi(w)&&((L&fr)!==0&&W(this,sr).add(w),Yr(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}}},Cs=function(o){for(var _=0;_<o.length;_+=1)Fn(o[_],W(this,Wr),W(this,sr))},Nn=function(){var w;if(ni.size>1){this.previous.clear();var o=fe,_=Ge,b=!0;for(const L of ni){if(L===this){b=!1;continue}const k=[];for(const[a,c]of this.current){if(L.current.has(a))if(b&&c!==L.current.get(a))L.current.set(a,c);else continue;k.push(a)}if(k.length===0)continue;const n=[...L.current.keys()].filter(a=>!this.current.has(a));if(n.length>0){L.activate();const a=new Set,c=new Map;for(const f of k)Wn(f,n,a,c);if(W(L,gt).length>0){L.apply();for(const f of W(L,gt))Oe(w=L,Qe,ws).call(w,f,[],[])}L.deactivate()}}fe=o,Ge=_}W(this,Ft).clear(),ni.delete(this)};let Er=Ni;function Ta(t){var o=hi;hi=!0;try{for(var _;;){if(Da(),fe===null)return _;fe.flush()}}finally{hi=o}}function Ma(){try{ma()}catch(t){ar(t,ms)}}let Rt=null;function nn(t){var o=t.length;if(o!==0){for(var _=0;_<o;){var b=t[_++];if((b.f&(bt|dt))===0&&wi(b)&&(Rt=new Set,Yr(b),b.deps===null&&b.first===null&&b.nodes===null&&b.teardown===null&&b.ac===null&&so(b),(Rt==null?void 0:Rt.size)>0)){cr.clear();for(const w of Rt){if((w.f&(bt|dt))!==0)continue;const L=[w];let k=w.parent;for(;k!==null;)Rt.has(k)&&(Rt.delete(k),L.push(k)),k=k.parent;for(let n=L.length-1;n>=0;n--){const a=L[n];(a.f&(bt|dt))===0&&Yr(a)}}Rt.clear()}}Rt=null}}function Wn(t,o,_,b){if(!_.has(t)&&(_.add(t),t.reactions!==null))for(const w of t.reactions){const L=w.f;(L&Ve)!==0?Wn(w,o,_,b):(L&(Hs|fr))!==0&&(L&Ye)===0&&Un(w,o,b)&&(He(w,Ye),Ws(w))}}function Un(t,o,_){const b=_.get(t);if(b!==void 0)return b;if(t.deps!==null)for(const w of t.deps){if(qr.call(o,w))return!0;if((w.f&Ve)!==0&&Un(w,o,_))return _.set(w,!0),!0}return _.set(t,!1),!1}function Ws(t){fe.schedule(t)}function jn(t,o){if(!((t.f&Pt)!==0&&(t.f&qe)!==0)){(t.f&Ye)!==0?o.d.push(t):(t.f&Ot)!==0&&o.m.push(t),He(t,qe);for(var _=t.first;_!==null;)jn(_,o),_=_.next}}function Pa(t){let o=0,_=ur(0),b;return()=>{js()&&(y(_),Gi(()=>(o===0&&(b=er(()=>t(()=>hr(_)))),o+=1,()=>{Yt(()=>{o-=1,o===0&&(b==null||b(),b=void 0,hr(_))})})))}}var Oa=yr|ei;function Ia(t,o,_,b){new Ha(t,o,_,b)}var mt,Ps,Nt,gr,it,Wt,ht,At,Jt,mr,nr,jr,zr,$r,Xt,Wi,$e,Fa,Na,Wa,ys,Mi,Pi,xs;class Ha{constructor(o,_,b,w){ue(this,$e);Dt(this,"parent");Dt(this,"is_pending",!1);Dt(this,"transform_error");ue(this,mt);ue(this,Ps,null);ue(this,Nt);ue(this,gr);ue(this,it);ue(this,Wt,null);ue(this,ht,null);ue(this,At,null);ue(this,Jt,null);ue(this,mr,0);ue(this,nr,0);ue(this,jr,!1);ue(this,zr,new Set);ue(this,$r,new Set);ue(this,Xt,null);ue(this,Wi,Pa(()=>(_e(this,Xt,ur(W(this,mr))),()=>{_e(this,Xt,null)})));var L;_e(this,mt,o),_e(this,Nt,_),_e(this,gr,k=>{var n=be;n.b=this,n.f|=vs,b(k)}),this.parent=be.b,this.transform_error=w??((L=this.parent)==null?void 0:L.transform_error)??(k=>k),_e(this,it,bi(()=>{Oe(this,$e,ys).call(this)},Oa))}defer_effect(o){Fn(o,W(this,zr),W(this,$r))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!W(this,Nt).pending}update_pending_count(o,_){Oe(this,$e,xs).call(this,o,_),_e(this,mr,W(this,mr)+o),!(!W(this,Xt)||W(this,jr))&&(_e(this,jr,!0),Yt(()=>{_e(this,jr,!1),W(this,Xt)&&Jr(W(this,Xt),W(this,mr))}))}get_effect_pending(){return W(this,Wi).call(this),y(W(this,Xt))}error(o){var _=W(this,Nt).onerror;let b=W(this,Nt).failed;if(!_&&!b)throw o;W(this,Wt)&&(Je(W(this,Wt)),_e(this,Wt,null)),W(this,ht)&&(Je(W(this,ht)),_e(this,ht,null)),W(this,At)&&(Je(W(this,At)),_e(this,At,null));var w=!1,L=!1;const k=()=>{if(w){Ea();return}w=!0,L&&ya(),W(this,At)!==null&&wr(W(this,At),()=>{_e(this,At,null)}),Oe(this,$e,Pi).call(this,()=>{Oe(this,$e,ys).call(this)})},n=a=>{try{L=!0,_==null||_(a,k),L=!1}catch(c){ar(c,W(this,it)&&W(this,it).parent)}b&&_e(this,At,Oe(this,$e,Pi).call(this,()=>{try{return nt(()=>{var c=be;c.b=this,c.f|=vs,b(W(this,mt),()=>a,()=>k)})}catch(c){return ar(c,W(this,it).parent),null}}))};Yt(()=>{var a;try{a=this.transform_error(o)}catch(c){ar(c,W(this,it)&&W(this,it).parent);return}a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(n,c=>ar(c,W(this,it)&&W(this,it).parent)):n(a)})}}mt=new WeakMap,Ps=new WeakMap,Nt=new WeakMap,gr=new WeakMap,it=new WeakMap,Wt=new WeakMap,ht=new WeakMap,At=new WeakMap,Jt=new WeakMap,mr=new WeakMap,nr=new WeakMap,jr=new WeakMap,zr=new WeakMap,$r=new WeakMap,Xt=new WeakMap,Wi=new WeakMap,$e=new WeakSet,Fa=function(){try{_e(this,Wt,nt(()=>W(this,gr).call(this,W(this,mt))))}catch(o){this.error(o)}},Na=function(o){const _=W(this,Nt).failed;_&&_e(this,At,nt(()=>{_(W(this,mt),()=>o,()=>()=>{})}))},Wa=function(){const o=W(this,Nt).pending;if(o){this.is_pending=!0,_e(this,ht,nt(()=>o(W(this,mt))));var _=fe;Yt(()=>{var b=_e(this,Jt,document.createDocumentFragment()),w=Zt();b.append(w),_e(this,Wt,Oe(this,$e,Pi).call(this,()=>nt(()=>W(this,gr).call(this,w)))),W(this,nr)===0&&(W(this,mt).before(b),_e(this,Jt,null),wr(W(this,ht),()=>{_e(this,ht,null)}),Oe(this,$e,Mi).call(this,_))})}},ys=function(){var o=fe;try{if(this.is_pending=this.has_pending_snippet(),_e(this,nr,0),_e(this,mr,0),_e(this,Wt,nt(()=>{W(this,gr).call(this,W(this,mt))})),W(this,nr)>0){var _=_e(this,Jt,document.createDocumentFragment());qs(W(this,Wt),_);const b=W(this,Nt).pending;_e(this,ht,nt(()=>b(W(this,mt))))}else Oe(this,$e,Mi).call(this,o)}catch(b){this.error(b)}},Mi=function(o){this.is_pending=!1;for(const _ of W(this,zr))He(_,Ye),o.schedule(_);for(const _ of W(this,$r))He(_,Ot),o.schedule(_);W(this,zr).clear(),W(this,$r).clear()},Pi=function(o){var _=be,b=pe,w=rt;$t(W(this,it)),Ct(W(this,it)),Gr(W(this,it).ctx);try{return Er.ensure(),o()}catch(L){return In(L),null}finally{$t(_),Ct(b),Gr(w)}},xs=function(o,_){var b;if(!this.has_pending_snippet()){this.parent&&Oe(b=this.parent,$e,xs).call(b,o,_);return}_e(this,nr,W(this,nr)+o),W(this,nr)===0&&(Oe(this,$e,Mi).call(this,_),W(this,ht)&&wr(W(this,ht),()=>{_e(this,ht,null)}),W(this,Jt)&&(W(this,mt).before(W(this,Jt)),_e(this,Jt,null)))};function zn(t,o,_,b){const w=qi;var L=t.filter(h=>!h.settled);if(_.length===0&&L.length===0){b(o.map(w));return}var k=be,n=Ua(),a=L.length===1?L[0].promise:L.length>1?Promise.all(L.map(h=>h.promise)):null;function c(h){n();try{b(h)}catch(v){(k.f&bt)===0&&ar(v,k)}Hi()}if(_.length===0){a.then(()=>c(o.map(w)));return}var f=$n();function l(){Promise.all(_.map(h=>ja(h))).then(h=>c([...o.map(w),...h])).catch(h=>ar(h,k)).finally(()=>f())}a?a.then(()=>{n(),l(),Hi()}):l()}function Ua(){var t=be,o=pe,_=rt,b=fe;return function(L=!0){$t(t),Ct(o),Gr(_),L&&(t.f&bt)===0&&(b==null||b.activate(),b==null||b.apply())}}function Hi(t=!0){$t(null),Ct(null),Gr(null),t&&(fe==null||fe.deactivate())}function $n(){var t=be.b,o=fe,_=t.is_rendered();return t.update_pending_count(1,o),o.increment(_),(b=!1)=>{t.update_pending_count(-1,o),o.decrement(_,b)}}function qi(t){var o=Ve|Ye,_=pe!==null&&(pe.f&Ve)!==0?pe:null;return be!==null&&(be.f|=ei),{ctx:rt,deps:null,effects:null,equals:Tn,f:o,fn:t,reactions:null,rv:0,v:Ke,wv:0,parent:_??be,ac:null}}function ja(t,o,_){let b=be;b===null&&fa();var w=void 0,L=ur(Ke),k=!pe,n=new Map;return sl(()=>{var v;var a=be,c=An();w=c.promise;try{Promise.resolve(t()).then(c.resolve,c.reject).finally(Hi)}catch(g){c.reject(g),Hi()}var f=fe;if(k){if((a.f&kr)!==0)var l=$n();if(b.b.is_rendered())(v=n.get(f))==null||v.reject(Vt),n.delete(f);else{for(const g of n.values())g.reject(Vt);n.clear()}n.set(f,c)}const h=(g,u=void 0)=>{if(l){var r=u===Vt;l(r)}if(!(u===Vt||(a.f&bt)!==0)){if(f.activate(),u)L.f|=lr,Jr(L,u);else{(L.f&lr)!==0&&(L.f^=lr),Jr(L,g);for(const[i,e]of n){if(n.delete(i),i===f)break;e.reject(Vt)}}f.deactivate()}};c.promise.then(h,g=>h(null,g||"unknown"))}),zs(()=>{for(const a of n.values())a.reject(Vt)}),new Promise(a=>{function c(f){function l(){f===w?a(L):c(w)}f.then(l,l)}c(w)})}function he(t){const o=qi(t);return ao(o),o}function Kn(t){const o=qi(t);return o.equals=Mn,o}function za(t){var o=t.effects;if(o!==null){t.effects=null;for(var _=0;_<o.length;_+=1)Je(o[_])}}function $a(t){for(var o=t.parent;o!==null;){if((o.f&Ve)===0)return(o.f&bt)===0?o:null;o=o.parent}return null}function Us(t){var o,_=be;$t($a(t));try{t.f&=~xr,za(t),o=uo(t)}finally{$t(_)}return o}function qn(t){var o=Us(t);if(!t.equals(o)&&(t.wv=co(),(!(fe!=null&&fe.is_fork)||t.deps===null)&&(t.v=o,t.deps===null))){He(t,qe);return}dr||(Ge!==null?(js()||fe!=null&&fe.is_fork)&&Ge.set(t,o):Ns(t))}function Ka(t){var o,_;if(t.effects!==null)for(const b of t.effects)(b.teardown||b.ac)&&((o=b.teardown)==null||o.call(b),(_=b.ac)==null||_.abort(Vt),b.teardown=aa,b.ac=null,ui(b,0),$s(b))}function Vn(t){if(t.effects!==null)for(const o of t.effects)o.teardown&&Yr(o)}let Es=new Set;const cr=new Map;let Gn=!1;function ur(t,o){var _={f:0,v:t,reactions:null,equals:Tn,rv:0,wv:0};return _}function ae(t,o){const _=ur(t);return ao(_),_}function qa(t,o=!1,_=!0){const b=ur(t);return o||(b.equals=Mn),b}function N(t,o,_=!1){pe!==null&&(!Mt||(pe.f&rn)!==0)&&Pn()&&(pe.f&(Ve|fr|Hs|rn))!==0&&(wt===null||!qr.call(wt,t))&&Ca();let b=_?Me(o):o;return Jr(t,b,Ti)}function Jr(t,o,_=null){if(!t.equals(o)){var b=t.v;dr?cr.set(t,o):cr.set(t,b),t.v=o;var w=Er.ensure();if(w.capture(t,b),(t.f&Ve)!==0){const L=t;(t.f&Ye)!==0&&Us(L),Ns(L)}t.wv=co(),Jn(t,Ye,_),be!==null&&(be.f&qe)!==0&&(be.f&(Pt|Cr))===0&&(pt===null?al([t]):pt.push(t)),!w.is_fork&&Es.size>0&&!Gn&&Va()}return o}function Va(){Gn=!1;for(const t of Es)(t.f&qe)!==0&&He(t,Ot),wi(t)&&Yr(t);Es.clear()}function Ga(t,o=1){var _=y(t),b=o===1?_++:_--;return N(t,_),b}function hr(t){N(t,t.v+1)}function Jn(t,o,_){var b=t.reactions;if(b!==null)for(var w=b.length,L=0;L<w;L++){var k=b[L],n=k.f,a=(n&Ye)===0;if(a&&He(k,o),(n&Ve)!==0){var c=k;Ge==null||Ge.delete(c),(n&xr)===0&&(n&St&&(k.f|=xr),Jn(c,Ot,_))}else if(a){var f=k;(n&fr)!==0&&Rt!==null&&Rt.add(f),_!==null?_.push(f):Ws(f)}}}function Me(t){if(typeof t!="object"||t===null||br in t)return t;const o=Rn(t);if(o!==na&&o!==oa)return t;var _=new Map,b=Os(t),w=ae(0),L=Qt,k=n=>{if(Qt===L)return n();var a=pe,c=Qt;Ct(null),cn(L);var f=n();return Ct(a),cn(c),f};return b&&_.set("length",ae(t.length)),new Proxy(t,{defineProperty(n,a,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&ba();var f=_.get(a);return f===void 0?k(()=>{var l=ae(c.value);return _.set(a,l),l}):N(f,c.value,!0),!0},deleteProperty(n,a){var c=_.get(a);if(c===void 0){if(a in n){const f=k(()=>ae(Ke));_.set(a,f),hr(w)}}else N(c,Ke),hr(w);return!0},get(n,a,c){var v;if(a===br)return t;var f=_.get(a),l=a in n;if(f===void 0&&(!l||(v=Pr(n,a))!=null&&v.writable)&&(f=k(()=>{var g=Me(l?n[a]:Ke),u=ae(g);return u}),_.set(a,f)),f!==void 0){var h=y(f);return h===Ke?void 0:h}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=y(f))}else if(c===void 0){var l=_.get(a),h=l==null?void 0:l.v;if(l!==void 0&&h!==Ke)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(n,a){var h;if(a===br)return!0;var c=_.get(a),f=c!==void 0&&c.v!==Ke||Reflect.has(n,a);if(c!==void 0||be!==null&&(!f||(h=Pr(n,a))!=null&&h.writable)){c===void 0&&(c=k(()=>{var v=f?Me(n[a]):Ke,g=ae(v);return g}),_.set(a,c));var l=y(c);if(l===Ke)return!1}return f},set(n,a,c,f){var s;var l=_.get(a),h=a in n;if(b&&a==="length")for(var v=c;v<l.v;v+=1){var g=_.get(v+"");g!==void 0?N(g,Ke):v in n&&(g=k(()=>ae(Ke)),_.set(v+"",g))}if(l===void 0)(!h||(s=Pr(n,a))!=null&&s.writable)&&(l=k(()=>ae(void 0)),N(l,Me(c)),_.set(a,l));else{h=l.v!==Ke;var u=k(()=>Me(c));N(l,u)}var r=Reflect.getOwnPropertyDescriptor(n,a);if(r!=null&&r.set&&r.set.call(f,c),!h){if(b&&typeof a=="string"){var i=_.get("length"),e=Number(a);Number.isInteger(e)&&e>=i.v&&N(i,e+1)}hr(w)}return!0},ownKeys(n){y(w);var a=Reflect.ownKeys(n).filter(l=>{var h=_.get(l);return h===void 0||h.v!==Ke});for(var[c,f]of _)f.v!==Ke&&!(c in n)&&a.push(c);return a},setPrototypeOf(){wa()}})}function on(t){try{if(t!==null&&typeof t=="object"&&br in t)return t[br]}catch{}return t}function Ja(t,o){return Object.is(on(t),on(o))}var ks,Xn,Yn,Zn;function Xa(){if(ks===void 0){ks=window,Xn=/Firefox/.test(navigator.userAgent);var t=Element.prototype,o=Node.prototype,_=Text.prototype;Yn=Pr(o,"firstChild").get,Zn=Pr(o,"nextSibling").get,tn(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),tn(_)&&(_.__t=void 0)}}function Zt(t=""){return document.createTextNode(t)}function Xr(t){return Yn.call(t)}function mi(t){return Zn.call(t)}function $(t,o){return Xr(t)}function Re(t,o=!1){{var _=Xr(t);return _ instanceof Comment&&_.data===""?mi(_):_}}function V(t,o=1,_=!1){let b=t;for(;o--;)b=mi(b);return b}function Ya(t){t.textContent=""}function Qn(){return!1}function Za(t,o,_){return document.createElementNS(Dn,t,void 0)}function Qa(t,o){if(o){const _=document.body;t.autofocus=!0,Yt(()=>{document.activeElement===_&&t.focus()})}}let an=!1;function el(){an||(an=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var o;if(!t.defaultPrevented)for(const _ of t.target.elements)(o=_.__on_r)==null||o.call(_)})},{capture:!0}))}function Vi(t){var o=pe,_=be;Ct(null),$t(null);try{return t()}finally{Ct(o),$t(_)}}function eo(t,o,_,b=_){t.addEventListener(o,()=>Vi(_));const w=t.__on_r;w?t.__on_r=()=>{w(),b(!0)}:t.__on_r=()=>b(!0),el()}function tl(t){be===null&&(pe===null&&ga(),pa()),dr&&va()}function rl(t,o){var _=o.last;_===null?o.last=o.first=t:(_.next=t,t.prev=_,o.last=t)}function Kt(t,o){var _=be;_!==null&&(_.f&dt)!==0&&(t|=dt);var b={ctx:rt,deps:null,nodes:null,f:t|Ye|St,first:null,fn:o,last:null,next:null,parent:_,b:_&&_.b,prev:null,teardown:null,wv:0,ac:null},w=b;if((t&Vr)!==0)Mr!==null?Mr.push(b):Er.ensure().schedule(b);else if(o!==null){try{Yr(b)}catch(k){throw Je(b),k}w.deps===null&&w.teardown===null&&w.nodes===null&&w.first===w.last&&(w.f&ei)===0&&(w=w.first,(t&fr)!==0&&(t&yr)!==0&&w!==null&&(w.f|=yr))}if(w!==null&&(w.parent=_,_!==null&&rl(w,_),pe!==null&&(pe.f&Ve)!==0&&(t&Cr)===0)){var L=pe;(L.effects??(L.effects=[])).push(w)}return b}function js(){return pe!==null&&!Mt}function zs(t){const o=Kt(Ki,null);return He(o,qe),o.teardown=t,o}function jt(t){tl();var o=be.f,_=!pe&&(o&Pt)!==0&&(o&kr)===0;if(_){var b=rt;(b.e??(b.e=[])).push(t)}else return to(t)}function to(t){return Kt(Vr|ha,t)}function il(t){Er.ensure();const o=Kt(Cr|ei,t);return(_={})=>new Promise(b=>{_.outro?wr(o,()=>{Je(o),b(void 0)}):(Je(o),b(void 0))})}function Si(t){return Kt(Vr,t)}function sl(t){return Kt(Hs|ei,t)}function Gi(t,o=0){return Kt(Ki|o,t)}function oe(t,o=[],_=[],b=[]){zn(b,o,_,w=>{Kt(Ki,()=>t(...w.map(y)))})}function bi(t,o=0){var _=Kt(fr|o,t);return _}function ro(t,o=0){var _=Kt(Is|o,t);return _}function nt(t){return Kt(Pt|ei,t)}function io(t){var o=t.teardown;if(o!==null){const _=dr,b=pe;ln(!0),Ct(null);try{o.call(null)}finally{ln(_),Ct(b)}}}function $s(t,o=!1){var _=t.first;for(t.first=t.last=null;_!==null;){const w=_.ac;w!==null&&Vi(()=>{w.abort(Vt)});var b=_.next;(_.f&Cr)!==0?_.parent=null:Je(_,o),_=b}}function nl(t){for(var o=t.first;o!==null;){var _=o.next;(o.f&Pt)===0&&Je(o),o=_}}function Je(t,o=!0){var _=!1;(o||(t.f&ca)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(ol(t.nodes.start,t.nodes.end),_=!0),He(t,ps),$s(t,o&&!_),ui(t,0);var b=t.nodes&&t.nodes.t;if(b!==null)for(const L of b)L.stop();io(t),t.f^=ps,t.f|=bt;var w=t.parent;w!==null&&w.first!==null&&so(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=null}function ol(t,o){for(;t!==null;){var _=t===o?null:mi(t);t.remove(),t=_}}function so(t){var o=t.parent,_=t.prev,b=t.next;_!==null&&(_.next=b),b!==null&&(b.prev=_),o!==null&&(o.first===t&&(o.first=b),o.last===t&&(o.last=_))}function wr(t,o,_=!0){var b=[];no(t,b,!0);var w=()=>{_&&Je(t),o&&o()},L=b.length;if(L>0){var k=()=>--L||w();for(var n of b)n.out(k)}else w()}function no(t,o,_){if((t.f&dt)===0){t.f^=dt;var b=t.nodes&&t.nodes.t;if(b!==null)for(const n of b)(n.is_global||_)&&o.push(n);for(var w=t.first;w!==null;){var L=w.next,k=(w.f&yr)!==0||(w.f&Pt)!==0&&(t.f&fr)!==0;no(w,o,k?_:!1),w=L}}}function Ks(t){oo(t,!0)}function oo(t,o){if((t.f&dt)!==0){t.f^=dt,(t.f&qe)===0&&(He(t,Ye),Er.ensure().schedule(t));for(var _=t.first;_!==null;){var b=_.next,w=(_.f&yr)!==0||(_.f&Pt)!==0;oo(_,w?o:!1),_=b}var L=t.nodes&&t.nodes.t;if(L!==null)for(const k of L)(k.is_global||o)&&k.in()}}function qs(t,o){if(t.nodes)for(var _=t.nodes.start,b=t.nodes.end;_!==null;){var w=_===b?null:mi(_);o.append(_),_=w}}let Oi=!1,dr=!1;function ln(t){dr=t}let pe=null,Mt=!1;function Ct(t){pe=t}let be=null;function $t(t){be=t}let wt=null;function ao(t){pe!==null&&(wt===null?wt=[t]:wt.push(t))}let st=null,ct=0,pt=null;function al(t){pt=t}let lo=1,vr=0,Qt=vr;function cn(t){Qt=t}function co(){return++lo}function wi(t){var o=t.f;if((o&Ye)!==0)return!0;if(o&Ve&&(t.f&=~xr),(o&Ot)!==0){for(var _=t.deps,b=_.length,w=0;w<b;w++){var L=_[w];if(wi(L)&&qn(L),L.wv>t.wv)return!0}(o&St)!==0&&Ge===null&&He(t,qe)}return!1}function ho(t,o,_=!0){var b=t.reactions;if(b!==null&&!(wt!==null&&qr.call(wt,t)))for(var w=0;w<b.length;w++){var L=b[w];(L.f&Ve)!==0?ho(L,o,!1):o===L&&(_?He(L,Ye):(L.f&qe)!==0&&He(L,Ot),Ws(L))}}function uo(t){var u;var o=st,_=ct,b=pt,w=pe,L=wt,k=rt,n=Mt,a=Qt,c=t.f;st=null,ct=0,pt=null,pe=(c&(Pt|Cr))===0?t:null,wt=null,Gr(t.ctx),Mt=!1,Qt=++vr,t.ac!==null&&(Vi(()=>{t.ac.abort(Vt)}),t.ac=null);try{t.f|=gs;var f=t.fn,l=f();t.f|=kr;var h=t.deps,v=fe==null?void 0:fe.is_fork;if(st!==null){var g;if(v||ui(t,ct),h!==null&&ct>0)for(h.length=ct+st.length,g=0;g<st.length;g++)h[ct+g]=st[g];else t.deps=h=st;if(js()&&(t.f&St)!==0)for(g=ct;g<h.length;g++)((u=h[g]).reactions??(u.reactions=[])).push(t)}else!v&&h!==null&&ct<h.length&&(ui(t,ct),h.length=ct);if(Pn()&&pt!==null&&!Mt&&h!==null&&(t.f&(Ve|Ot|Ye))===0)for(g=0;g<pt.length;g++)ho(pt[g],t);if(w!==null&&w!==t){if(vr++,w.deps!==null)for(let r=0;r<_;r+=1)w.deps[r].rv=vr;if(o!==null)for(const r of o)r.rv=vr;pt!==null&&(b===null?b=pt:b.push(...pt))}return(t.f&lr)!==0&&(t.f^=lr),l}catch(r){return In(r)}finally{t.f^=gs,st=o,ct=_,pt=b,pe=w,wt=L,Gr(k),Mt=n,Qt=a}}function ll(t,o){let _=o.reactions;if(_!==null){var b=ra.call(_,t);if(b!==-1){var w=_.length-1;w===0?_=o.reactions=null:(_[b]=_[w],_.pop())}}if(_===null&&(o.f&Ve)!==0&&(st===null||!qr.call(st,o))){var L=o;(L.f&St)!==0&&(L.f^=St,L.f&=~xr),Ns(L),Ka(L),ui(L,0)}}function ui(t,o){var _=t.deps;if(_!==null)for(var b=o;b<_.length;b++)ll(t,_[b])}function Yr(t){var o=t.f;if((o&bt)===0){He(t,qe);var _=be,b=Oi;be=t,Oi=!0;try{(o&(fr|Is))!==0?nl(t):$s(t),io(t);var w=uo(t);t.teardown=typeof w=="function"?w:null,t.wv=lo;var L;ta&&La&&(t.f&Ye)!==0&&t.deps}finally{Oi=b,be=_}}}async function cl(){await Promise.resolve(),Ta()}function y(t){var o=t.f,_=(o&Ve)!==0;if(pe!==null&&!Mt){var b=be!==null&&(be.f&bt)!==0;if(!b&&(wt===null||!qr.call(wt,t))){var w=pe.deps;if((pe.f&gs)!==0)t.rv<vr&&(t.rv=vr,st===null&&w!==null&&w[ct]===t?ct++:st===null?st=[t]:st.push(t));else{(pe.deps??(pe.deps=[])).push(t);var L=t.reactions;L===null?t.reactions=[pe]:qr.call(L,pe)||L.push(pe)}}}if(dr&&cr.has(t))return cr.get(t);if(_){var k=t;if(dr){var n=k.v;return((k.f&qe)===0&&k.reactions!==null||_o(k))&&(n=Us(k)),cr.set(k,n),n}var a=(k.f&St)===0&&!Mt&&pe!==null&&(Oi||(pe.f&St)!==0),c=(k.f&kr)===0;wi(k)&&(a&&(k.f|=St),qn(k)),a&&!c&&(Vn(k),fo(k))}if(Ge!=null&&Ge.has(t))return Ge.get(t);if((t.f&lr)!==0)throw t.v;return t.v}function fo(t){if(t.f|=St,t.deps!==null)for(const o of t.deps)(o.reactions??(o.reactions=[])).push(t),(o.f&Ve)!==0&&(o.f&St)===0&&(Vn(o),fo(o))}function _o(t){if(t.v===Ke)return!0;if(t.deps===null)return!1;for(const o of t.deps)if(cr.has(o)||(o.f&Ve)!==0&&_o(o))return!0;return!1}function er(t){var o=Mt;try{return Mt=!0,t()}finally{Mt=o}}const pr=Symbol("events"),vo=new Set,Ls=new Set;function po(t,o,_,b={}){function w(L){if(b.capture||Ds.call(o,L),!L.cancelBubble)return Vi(()=>_==null?void 0:_.call(this,L))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Yt(()=>{o.addEventListener(t,w,b)}):o.addEventListener(t,w,b),w}function Ci(t,o,_,b,w){var L={capture:b,passive:w},k=po(t,o,_,L);(o===document.body||o===window||o===document||o instanceof HTMLMediaElement)&&zs(()=>{o.removeEventListener(t,k,L)})}function Se(t,o,_){(o[pr]??(o[pr]={}))[t]=_}function ft(t){for(var o=0;o<t.length;o++)vo.add(t[o]);for(var _ of Ls)_(t)}let hn=null;function Ds(t){var r,i;var o=this,_=o.ownerDocument,b=t.type,w=((r=t.composedPath)==null?void 0:r.call(t))||[],L=w[0]||t.target;hn=t;var k=0,n=hn===t&&t[pr];if(n){var a=w.indexOf(n);if(a!==-1&&(o===document||o===window)){t[pr]=o;return}var c=w.indexOf(o);if(c===-1)return;a<=c&&(k=a)}if(L=w[k]||t.target,L!==o){ia(t,"currentTarget",{configurable:!0,get(){return L||_}});var f=pe,l=be;Ct(null),$t(null);try{for(var h,v=[];L!==null;){var g=L.assignedSlot||L.parentNode||L.host||null;try{var u=(i=L[pr])==null?void 0:i[b];u!=null&&(!L.disabled||t.target===L)&&u.call(L,t)}catch(e){h?v.push(e):h=e}if(t.cancelBubble||g===o||g===null)break;L=g}if(h){for(let e of v)queueMicrotask(()=>{throw e});throw h}}finally{t[pr]=o,delete t.currentTarget,Ct(f),$t(l)}}}var kn;const as=((kn=globalThis==null?void 0:globalThis.window)==null?void 0:kn.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function hl(t){return(as==null?void 0:as.createHTML(t))??t}function go(t){var o=Za("template");return o.innerHTML=hl(t.replaceAll("<!>","<!---->")),o.content}function di(t,o){var _=be;_.nodes===null&&(_.nodes={start:t,end:o,a:null,t:null})}function Y(t,o){var _=(o&Zo)!==0,b=(o&Qo)!==0,w,L=!t.startsWith("<!>");return()=>{w===void 0&&(w=go(L?t:"<!>"+t),_||(w=Xr(w)));var k=b||Xn?document.importNode(w,!0):w.cloneNode(!0);if(_){var n=Xr(k),a=k.lastChild;di(n,a)}else di(k,k);return k}}function ul(t,o,_="svg"){var b=!t.startsWith("<!>"),w=`<${_}>${b?t:"<!>"+t}</${_}>`,L;return()=>{if(!L){var k=go(w),n=Xr(k);L=Xr(n)}var a=L.cloneNode(!0);return di(a,a),a}}function Ji(t,o){return ul(t,o,"svg")}function ze(t=""){{var o=Zt(t+"");return di(o,o),o}}function It(){var t=document.createDocumentFragment(),o=document.createComment(""),_=Zt();return t.append(o,_),di(o,_),t}function K(t,o){t!==null&&t.before(o)}function dl(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const fl=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function _l(t){return fl.includes(t)}const vl={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 pl(t){return t=t.toLowerCase(),vl[t]??t}const gl=["touchstart","touchmove"];function ml(t){return gl.includes(t)}function se(t,o){var _=o==null?"":typeof o=="object"?`${o}`:o;_!==(t.__t??(t.__t=t.nodeValue))&&(t.__t=_,t.nodeValue=`${_}`)}function Sl(t,o){return bl(t,o)}const Bi=new Map;function bl(t,{target:o,anchor:_,props:b={},events:w,context:L,intro:k=!0,transformError:n}){Xa();var a=void 0,c=il(()=>{var f=_??o.appendChild(Zt());Ia(f,{pending:()=>{}},v=>{Ne({});var g=rt;L&&(g.c=L),w&&(b.$$events=w),a=t(v,b)||{},We()},n);var l=new Set,h=v=>{for(var g=0;g<v.length;g++){var u=v[g];if(!l.has(u)){l.add(u);var r=ml(u);for(const s of[o,document]){var i=Bi.get(s);i===void 0&&(i=new Map,Bi.set(s,i));var e=i.get(u);e===void 0?(s.addEventListener(u,Ds,{passive:r}),i.set(u,1)):i.set(u,e+1)}}}};return h($i(vo)),Ls.add(h),()=>{var r;for(var v of l)for(const i of[o,document]){var g=Bi.get(i),u=g.get(v);--u==0?(i.removeEventListener(v,Ds),g.delete(v),g.size===0&&Bi.delete(i)):g.set(v,u)}Ls.delete(h),f!==_&&((r=f.parentNode)==null||r.removeChild(f))}});return wl.set(a,c),a}let wl=new WeakMap;var Bt,Ut,ut,Sr,pi,gi,Ui;class Vs{constructor(o,_=!0){Dt(this,"anchor");ue(this,Bt,new Map);ue(this,Ut,new Map);ue(this,ut,new Map);ue(this,Sr,new Set);ue(this,pi,!0);ue(this,gi,o=>{if(W(this,Bt).has(o)){var _=W(this,Bt).get(o),b=W(this,Ut).get(_);if(b)Ks(b),W(this,Sr).delete(_);else{var w=W(this,ut).get(_);w&&(W(this,Ut).set(_,w.effect),W(this,ut).delete(_),w.fragment.lastChild.remove(),this.anchor.before(w.fragment),b=w.effect)}for(const[L,k]of W(this,Bt)){if(W(this,Bt).delete(L),L===o)break;const n=W(this,ut).get(k);n&&(Je(n.effect),W(this,ut).delete(k))}for(const[L,k]of W(this,Ut)){if(L===_||W(this,Sr).has(L))continue;const n=()=>{if(Array.from(W(this,Bt).values()).includes(L)){var c=document.createDocumentFragment();qs(k,c),c.append(Zt()),W(this,ut).set(L,{effect:k,fragment:c})}else Je(k);W(this,Sr).delete(L),W(this,Ut).delete(L)};W(this,pi)||!b?(W(this,Sr).add(L),wr(k,n,!1)):n()}}});ue(this,Ui,o=>{W(this,Bt).delete(o);const _=Array.from(W(this,Bt).values());for(const[b,w]of W(this,ut))_.includes(b)||(Je(w.effect),W(this,ut).delete(b))});this.anchor=o,_e(this,pi,_)}ensure(o,_){var b=fe,w=Qn();if(_&&!W(this,Ut).has(o)&&!W(this,ut).has(o))if(w){var L=document.createDocumentFragment(),k=Zt();L.append(k),W(this,ut).set(o,{effect:nt(()=>_(k)),fragment:L})}else W(this,Ut).set(o,nt(()=>_(this.anchor)));if(W(this,Bt).set(b,o),w){for(const[n,a]of W(this,Ut))n===o?b.unskip_effect(a):b.skip_effect(a);for(const[n,a]of W(this,ut))n===o?b.unskip_effect(a.effect):b.skip_effect(a.effect);b.oncommit(W(this,gi)),b.ondiscard(W(this,Ui))}else W(this,gi).call(this,b)}}Bt=new WeakMap,Ut=new WeakMap,ut=new WeakMap,Sr=new WeakMap,pi=new WeakMap,gi=new WeakMap,Ui=new WeakMap;function Gs(t,o,..._){var b=new Vs(t);bi(()=>{const w=o()??null;b.ensure(w,w&&(L=>w(L,..._)))},yr)}function Js(t){rt===null&&Bn(),jt(()=>{const o=er(t);if(typeof o=="function")return o})}function Cl(t){rt===null&&Bn(),Js(()=>()=>er(t))}function ne(t,o,_=!1){var b=new Vs(t),w=_?yr:0;function L(k,n){b.ensure(k,n)}bi(()=>{var k=!1;o((n,a=0)=>{k=!0,L(a,n)}),k||L(-1,null)},w)}const yl=Symbol("NaN");function xl(t,o,_){var b=new Vs(t);bi(()=>{var w=o();w!==w&&(w=yl),b.ensure(w,_)})}function fi(t,o){return o}function El(t,o,_){for(var b=[],w=o.length,L,k=o.length,n=0;n<w;n++){let l=o[n];wr(l,()=>{if(L){if(L.pending.delete(l),L.done.add(l),L.pending.size===0){var h=t.outrogroups;Rs(t,$i(L.done)),h.delete(L),h.size===0&&(t.outrogroups=null)}}else k-=1},!1)}if(k===0){var a=b.length===0&&_!==null;if(a){var c=_,f=c.parentNode;Ya(f),f.append(c),t.items.clear()}Rs(t,o,!a)}else L={pending:new Set(o),done:new Set},(t.outrogroups??(t.outrogroups=new Set)).add(L)}function Rs(t,o,_=!0){var b;if(t.pending.size>0){b=new Set;for(const k of t.pending.values())for(const n of k)b.add(t.items.get(n).e)}for(var w=0;w<o.length;w++){var L=o[w];if(b!=null&&b.has(L)){L.f|=zt;const k=document.createDocumentFragment();qs(L,k)}else Je(o[w],_)}}var un;function Xe(t,o,_,b,w,L=null){var k=t,n=new Map,a=(o&Ln)!==0;if(a){var c=t;k=c.appendChild(Zt())}var f=null,l=Kn(()=>{var s=_();return Os(s)?s:s==null?[]:$i(s)}),h,v=new Map,g=!0;function u(s){(e.effect.f&bt)===0&&(e.pending.delete(s),e.fallback=f,kl(e,h,k,o,b),f!==null&&(h.length===0?(f.f&zt)===0?Ks(f):(f.f^=zt,ci(f,null,k)):wr(f,()=>{f=null})))}function r(s){e.pending.delete(s)}var i=bi(()=>{h=y(l);for(var s=h.length,d=new Set,m=fe,S=Qn(),C=0;C<s;C+=1){var p=h[C],x=b(p,C),T=g?null:n.get(x);T?(T.v&&Jr(T.v,p),T.i&&Jr(T.i,C),S&&m.unskip_effect(T.e)):(T=Ll(n,g?k:un??(un=Zt()),p,x,C,w,o,_),g||(T.e.f|=zt),n.set(x,T)),d.add(x)}if(s===0&&L&&!f&&(g?f=nt(()=>L(k)):(f=nt(()=>L(un??(un=Zt()))),f.f|=zt)),s>d.size&&_a(),!g)if(v.set(m,d),S){for(const[P,O]of n)d.has(P)||m.skip_effect(O.e);m.oncommit(u),m.ondiscard(r)}else u(m);y(l)}),e={effect:i,items:n,pending:v,outrogroups:null,fallback:f};g=!1}function oi(t){for(;t!==null&&(t.f&Pt)===0;)t=t.next;return t}function kl(t,o,_,b,w){var T,P,O,B,H,U,J,Q,X;var L=(b&qo)!==0,k=o.length,n=t.items,a=oi(t.effect.first),c,f=null,l,h=[],v=[],g,u,r,i;if(L)for(i=0;i<k;i+=1)g=o[i],u=w(g,i),r=n.get(u).e,(r.f&zt)===0&&((P=(T=r.nodes)==null?void 0:T.a)==null||P.measure(),(l??(l=new Set)).add(r));for(i=0;i<k;i+=1){if(g=o[i],u=w(g,i),r=n.get(u).e,t.outrogroups!==null)for(const E of t.outrogroups)E.pending.delete(r),E.done.delete(r);if((r.f&zt)!==0)if(r.f^=zt,r===a)ci(r,null,_);else{var e=f?f.next:a;r===t.effect.last&&(t.effect.last=r.prev),r.prev&&(r.prev.next=r.next),r.next&&(r.next.prev=r.prev),ir(t,f,r),ir(t,r,e),ci(r,e,_),f=r,h=[],v=[],a=oi(f.next);continue}if((r.f&dt)!==0&&(Ks(r),L&&((B=(O=r.nodes)==null?void 0:O.a)==null||B.unfix(),(l??(l=new Set)).delete(r))),r!==a){if(c!==void 0&&c.has(r)){if(h.length<v.length){var s=v[0],d;f=s.prev;var m=h[0],S=h[h.length-1];for(d=0;d<h.length;d+=1)ci(h[d],s,_);for(d=0;d<v.length;d+=1)c.delete(v[d]);ir(t,m.prev,S.next),ir(t,f,m),ir(t,S,s),a=s,f=S,i-=1,h=[],v=[]}else c.delete(r),ci(r,a,_),ir(t,r.prev,r.next),ir(t,r,f===null?t.effect.first:f.next),ir(t,f,r),f=r;continue}for(h=[],v=[];a!==null&&a!==r;)(c??(c=new Set)).add(a),v.push(a),a=oi(a.next);if(a===null)continue}(r.f&zt)===0&&h.push(r),f=r,a=oi(r.next)}if(t.outrogroups!==null){for(const E of t.outrogroups)E.pending.size===0&&(Rs(t,$i(E.done)),(H=t.outrogroups)==null||H.delete(E));t.outrogroups.size===0&&(t.outrogroups=null)}if(a!==null||c!==void 0){var C=[];if(c!==void 0)for(r of c)(r.f&dt)===0&&C.push(r);for(;a!==null;)(a.f&dt)===0&&a!==t.fallback&&C.push(a),a=oi(a.next);var p=C.length;if(p>0){var x=(b&Ln)!==0&&k===0?_:null;if(L){for(i=0;i<p;i+=1)(J=(U=C[i].nodes)==null?void 0:U.a)==null||J.measure();for(i=0;i<p;i+=1)(X=(Q=C[i].nodes)==null?void 0:Q.a)==null||X.fix()}El(t,C,x)}}L&&Yt(()=>{var E,A;if(l!==void 0)for(r of l)(A=(E=r.nodes)==null?void 0:E.a)==null||A.apply()})}function Ll(t,o,_,b,w,L,k,n){var a=(k&$o)!==0?(k&Vo)===0?qa(_,!1,!1):ur(_):null,c=(k&Ko)!==0?ur(w):null;return{v:a,i:c,e:nt(()=>(L(o,a??_,c??w,n),()=>{t.delete(b)}))}}function ci(t,o,_){if(t.nodes)for(var b=t.nodes.start,w=t.nodes.end,L=o&&(o.f&zt)===0?o.nodes.start:_;b!==null;){var k=mi(b);if(L.before(b),b===w)return;b=k}}function ir(t,o,_){o===null?t.effect.first=_:o.next=_,_===null?t.effect.last=o:_.prev=o}function Dl(t,o,_){Si(()=>{var b=er(()=>o(t,_==null?void 0:_())||{});if(b!=null&&b.destroy)return()=>b.destroy()})}function Rl(t,o){var _=void 0,b;ro(()=>{_!==(_=o())&&(b&&(Je(b),b=null),_&&(b=nt(()=>{Si(()=>_(t))})))})}function mo(t){var o,_,b="";if(typeof t=="string"||typeof t=="number")b+=t;else if(typeof t=="object")if(Array.isArray(t)){var w=t.length;for(o=0;o<w;o++)t[o]&&(_=mo(t[o]))&&(b&&(b+=" "),b+=_)}else for(_ in t)t[_]&&(b&&(b+=" "),b+=_);return b}function Al(){for(var t,o,_=0,b="",w=arguments.length;_<w;_++)(t=arguments[_])&&(o=mo(t))&&(b&&(b+=" "),b+=o);return b}function Xs(t){return typeof t=="object"?Al(t):t??""}const dn=[...`
|
|
2
|
+
\r\f \v\uFEFF`];function Bl(t,o,_){var b=t==null?"":""+t;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 L=w.length,k=0;(k=b.indexOf(w,k))>=0;){var n=k+L;(k===0||dn.includes(b[k-1]))&&(n===b.length||dn.includes(b[n]))?b=(k===0?"":b.substring(0,k))+b.substring(n+1):k=n}}return b===""?null:b}function fn(t,o=!1){var _=o?" !important;":";",b="";for(var w of Object.keys(t)){var L=t[w];L!=null&&L!==""&&(b+=" "+w+": "+L+_)}return b}function ls(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function Tl(t,o){if(o){var _="",b,w;if(Array.isArray(o)?(b=o[0],w=o[1]):b=o,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var L=!1,k=0,n=!1,a=[];b&&a.push(...Object.keys(b).map(ls)),w&&a.push(...Object.keys(w).map(ls));var c=0,f=-1;const u=t.length;for(var l=0;l<u;l++){var h=t[l];if(n?h==="/"&&t[l-1]==="*"&&(n=!1):L?L===h&&(L=!1):h==="/"&&t[l+1]==="*"?n=!0:h==='"'||h==="'"?L=h:h==="("?k++:h===")"&&k--,!n&&L===!1&&k===0){if(h===":"&&f===-1)f=l;else if(h===";"||l===u-1){if(f!==-1){var v=ls(t.substring(c,f).trim());if(!a.includes(v)){h!==";"&&l++;var g=t.substring(c,l).trim();_+=" "+g+";"}}c=l+1,f=-1}}}}return b&&(_+=fn(b)),w&&(_+=fn(w,!0)),_=_.trim(),_===""?null:_}return t==null?null:String(t)}function Fe(t,o,_,b,w,L){var k=t.__className;if(k!==_||k===void 0){var n=Bl(_,b,L);n==null?t.removeAttribute("class"):o?t.className=n:t.setAttribute("class",n),t.__className=_}else if(L&&w!==L)for(var a in L){var c=!!L[a];(w==null||c!==!!w[a])&&t.classList.toggle(a,c)}return L}function cs(t,o={},_,b){for(var w in _){var L=_[w];o[w]!==L&&(_[w]==null?t.style.removeProperty(w):t.style.setProperty(w,L,b))}}function _i(t,o,_,b){var w=t.__style;if(w!==o){var L=Tl(o,b);L==null?t.removeAttribute("style"):t.style.cssText=L,t.__style=o}else b&&(Array.isArray(b)?(cs(t,_==null?void 0:_[0],b[0]),cs(t,_==null?void 0:_[1],b[1],"important")):cs(t,_,b));return b}function As(t,o,_=!1){if(t.multiple){if(o==null)return;if(!Os(o))return xa();for(var b of t.options)b.selected=o.includes(_n(b));return}for(b of t.options){var w=_n(b);if(Ja(w,o)){b.selected=!0;return}}(!_||o!==void 0)&&(t.selectedIndex=-1)}function Ml(t){var o=new MutationObserver(()=>{As(t,t.__value)});o.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),zs(()=>{o.disconnect()})}function _n(t){return"__value"in t?t.__value:t.value}const ai=Symbol("class"),li=Symbol("style"),So=Symbol("is custom element"),bo=Symbol("is html"),Pl=Fs?"option":"OPTION",Ol=Fs?"select":"SELECT",Il=Fs?"progress":"PROGRESS";function vn(t,o){var _=Xi(t);_.value===(_.value=o??void 0)||t.value===o&&(o!==0||t.nodeName!==Il)||(t.value=o??"")}function Fi(t,o){var _=Xi(t);_.checked!==(_.checked=o??void 0)&&(t.checked=o)}function Hl(t,o){o?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function De(t,o,_,b){var w=Xi(t);w[o]!==(w[o]=_)&&(o==="loading"&&(t[da]=_),_==null?t.removeAttribute(o):typeof _!="string"&&Co(t).includes(o)?t[o]=_:t.setAttribute(o,_))}function Fl(t,o,_,b,w=!1,L=!1){var k=Xi(t),n=k[So],a=!k[bo],c=o||{},f=t.nodeName===Pl;for(var l in o)l in _||(_[l]=null);_.class?_.class=Xs(_.class):_[ai]&&(_.class=null),_[li]&&(_.style??(_.style=null));var h=Co(t);for(const d in _){let m=_[d];if(f&&d==="value"&&m==null){t.value=t.__value="",c[d]=m;continue}if(d==="class"){var v=t.namespaceURI==="http://www.w3.org/1999/xhtml";Fe(t,v,m,b,o==null?void 0:o[ai],_[ai]),c[d]=m,c[ai]=_[ai];continue}if(d==="style"){_i(t,m,o==null?void 0:o[li],_[li]),c[d]=m,c[li]=_[li];continue}var g=c[d];if(!(m===g&&!(m===void 0&&t.hasAttribute(d)))){c[d]=m;var u=d[0]+d[1];if(u!=="$$")if(u==="on"){const S={},C="$$"+d;let p=d.slice(2);var r=_l(p);if(dl(p)&&(p=p.slice(0,-7),S.capture=!0),!r&&g){if(m!=null)continue;t.removeEventListener(p,c[C],S),c[C]=null}if(r)Se(p,t,m),ft([p]);else if(m!=null){let x=function(T){c[d].call(this,T)};var s=x;c[C]=po(p,t,x,S)}}else if(d==="style")De(t,d,m);else if(d==="autofocus")Qa(t,!!m);else if(!n&&(d==="__value"||d==="value"&&m!=null))t.value=t.__value=m;else if(d==="selected"&&f)Hl(t,m);else{var i=d;a||(i=pl(i));var e=i==="defaultValue"||i==="defaultChecked";if(m==null&&!n&&!e)if(k[d]=null,i==="value"||i==="checked"){let S=t;const C=o===void 0;if(i==="value"){let p=S.defaultValue;S.removeAttribute(i),S.defaultValue=p,S.value=S.__value=C?p:null}else{let p=S.defaultChecked;S.removeAttribute(i),S.defaultChecked=p,S.checked=C?p:!1}}else t.removeAttribute(d);else e||h.includes(i)&&(n||typeof m!="string")?(t[i]=m,i in k&&(k[i]=Ke)):typeof m!="function"&&De(t,i,m)}}}return c}function wo(t,o,_=[],b=[],w=[],L,k=!1,n=!1){zn(w,_,b,a=>{var c=void 0,f={},l=t.nodeName===Ol,h=!1;if(ro(()=>{var g=o(...a.map(y)),u=Fl(t,c,g,L,k,n);h&&l&&"value"in g&&As(t,g.value);for(let i of Object.getOwnPropertySymbols(f))g[i]||Je(f[i]);for(let i of Object.getOwnPropertySymbols(g)){var r=g[i];i.description===ea&&(!c||r!==c[i])&&(f[i]&&Je(f[i]),f[i]=nt(()=>Rl(t,()=>r))),u[i]=r}c=u}),l){var v=t;Si(()=>{As(v,c.value,!0),Ml(v)})}h=!0})}function Xi(t){return t.__attributes??(t.__attributes={[So]:t.nodeName.includes("-"),[bo]:t.namespaceURI===Dn})}var pn=new Map;function Co(t){var o=t.getAttribute("is")||t.nodeName,_=pn.get(o);if(_)return _;pn.set(o,_=[]);for(var b,w=t,L=Element.prototype;L!==w;){b=sa(w);for(var k in b)b[k].set&&_.push(k);w=Rn(w)}return _}function Or(t,o,_=o){var b=new WeakSet;eo(t,"input",async w=>{var L=w?t.defaultValue:t.value;if(L=hs(t)?us(L):L,_(L),fe!==null&&b.add(fe),await cl(),L!==(L=o())){var k=t.selectionStart,n=t.selectionEnd,a=t.value.length;if(t.value=L??"",n!==null){var c=t.value.length;k===n&&n===a&&c>a?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=k,t.selectionEnd=Math.min(n,c))}}}),er(o)==null&&t.value&&(_(hs(t)?us(t.value):t.value),fe!==null&&b.add(fe)),Gi(()=>{var w=o();if(t===document.activeElement){var L=fe;if(b.has(L))return}hs(t)&&w===us(t.value)||t.type==="date"&&!w&&!t.value||w!==t.value&&(t.value=w??"")})}function Nl(t,o,_=o){eo(t,"change",b=>{var w=b?t.defaultChecked:t.checked;_(w)}),er(o)==null&&_(t.checked),Gi(()=>{var b=o();t.checked=!!b})}function hs(t){var o=t.type;return o==="number"||o==="range"}function us(t){return t===""?null:+t}function gn(t,o){return t===o||(t==null?void 0:t[br])===o}function Zr(t={},o,_,b){var w=rt.r,L=be;return Si(()=>{var k,n;return Gi(()=>{k=n,n=[],er(()=>{t!==_(...n)&&(o(t,...n),k&&gn(_(...k),t)&&o(null,...k))})}),()=>{let a=L;for(;a!==w&&a.parent!==null&&a.parent.f&ps;)a=a.parent;const c=()=>{n&&gn(_(...n),t)&&o(null,...n)},f=a.teardown;a.teardown=()=>{c(),f==null||f()}}}),t}const Wl={get(t,o){if(!t.exclude.includes(o))return t.props[o]},set(t,o){return!1},getOwnPropertyDescriptor(t,o){if(!t.exclude.includes(o)&&o in t.props)return{enumerable:!0,configurable:!0,value:t.props[o]}},has(t,o){return t.exclude.includes(o)?!1:o in t.props},ownKeys(t){return Reflect.ownKeys(t.props).filter(o=>!t.exclude.includes(o))}};function yo(t,o,_){return new Proxy({props:t,exclude:o},Wl)}function we(t,o,_,b){var e;var w=(_&Xo)!==0,L=(_&Yo)!==0,k=b,n=!0,a=()=>(n&&(n=!1,k=L?er(b):b),k);let c;if(w){var f=br in t||ua in t;c=((e=Pr(t,o))==null?void 0:e.set)??(f&&o in t?s=>t[o]=s:void 0)}var l,h=!1;w?[l,h]=Aa(()=>t[o]):l=t[o],l===void 0&&b!==void 0&&(l=a(),c&&(Sa(),c(l)));var v;if(v=()=>{var s=t[o];return s===void 0?a():(n=!0,s)},(_&Jo)===0)return v;if(c){var g=t.$$legacy;return(function(s,d){return arguments.length>0?((!d||g||h)&&c(d?v():s),s):v()})}var u=!1,r=((_&Go)!==0?qi:Kn)(()=>(u=!1,v()));w&&y(r);var i=be;return(function(s,d){if(arguments.length>0){const m=d?y(r):w?Me(s):s;return N(r,m),u=!0,k!==void 0&&(k=m),s}return dr&&u||(i.f&bt)!==0?r.v:y(r)})}const Ii="wt-ssh-host";function Ys(t){return t.repo?`${t.repo} #${t.number}`:`PR #${t.number}`}function Gt(t){return t instanceof Error?t.message:String(t)}function Bs(t,o){return o.toLowerCase().includes(t.toLowerCase())}function xo(t){switch(t){case"creating_worktree":return"Creating worktree";case"preparing_runtime":return"Preparing runtime";case"running_post_create_hook":return"Running post-create hook";case"starting_session":return"Starting session";case"reconciling":return"Reconciling";default:return"Creating"}}var Ul=Y('<a target="_blank" rel="noopener"> </a>'),jl=Y("<span> </span>");function Eo(t,o){Ne(o,!0);let _=we(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=he(()=>Ys(o.pr));var L=It(),k=Re(L);{var n=c=>{var f=Ul(),l=$(f);oe(h=>{De(f,"href",o.pr.url),Fe(f,1,`shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded-full no-underline hover:opacity-80 ${h??""}`),se(l,y(w))},[()=>b(o.pr.state)]),K(c,f)},a=c=>{var f=jl(),l=$(f);oe(h=>{Fe(f,1,`shrink-0 text-[10px] font-medium px-1.5 py-0.5 rounded-full ${h??""}`),se(l,y(w))},[()=>b(o.pr.state)]),K(c,f)};ne(k,c=>{_()&&o.pr.url?c(n):c(a,-1)})}K(t,L),We()}var zl=Y('<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 ko(t,o){Ne(o,!0);var _=zl(),b=$(_);oe(()=>{De(_,"href",o.issue.url),_i(_,`color: ${o.issue.state.color??""}; background: ${o.issue.state.color??""}20;`),De(_,"title",`${o.issue.identifier??""} (${o.issue.state.name??""})`),se(b,o.issue.identifier)}),K(t,_),We()}var $l=Ji('<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>'),Kl=Ji('<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>'),ql=Ji('<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>'),Vl=Ji('<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>'),Gl=Y("<span><!> </span>");function Jl(t,o){const _=f=>{var l=It(),h=Re(l);{var v=i=>{var e=$l();oe(()=>{De(e,"width",b()),De(e,"height",b())}),K(i,e)},g=i=>{var e=Kl();oe(()=>{De(e,"width",b()),De(e,"height",b())}),K(i,e)},u=i=>{var e=ql();oe(()=>{De(e,"width",b()),De(e,"height",b())}),K(i,e)},r=i=>{var e=Vl();oe(()=>{De(e,"width",b()),De(e,"height",b())}),K(i,e)};ne(h,i=>{o.status==="working"?i(v):o.status==="waiting"?i(g,1):o.status==="done"?i(u,2):o.status==="error"&&i(r,3)})}K(f,l)};let b=we(o,"size",3,10),w=we(o,"pill",3,!1);function L(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 k=It(),n=Re(k);{var a=f=>{var l=Gl(),h=$(l);_(h);var v=V(h);oe(g=>{Fe(l,1,`text-xs px-2 py-0.5 rounded-xl flex items-center gap-1 ${g??""}`),se(v,` ${(o.status||"idle")??""}`)},[()=>L(o.status)]),K(f,l)},c=f=>{_(f)};ne(n,f=>{w()?f(a):f(c,-1)})}K(t,k)}var Xl=Y('<span class="shrink-0 inline-flex items-center gap-1 text-[10px] text-muted"><span class="spinner"></span> </span>'),Yl=Y('<span class="shrink-0 text-[10px] text-muted">opening...</span>'),Zl=Y('<span class="shrink-0 text-[10px] text-muted">closed</span>'),Ql=Y('<span class="shrink-0"><!></span>'),ec=Y('<span class="shrink-0 w-2 h-2 rounded-full bg-accent"></span>'),tc=Y("<span> </span>"),rc=Y("<span> </span>"),ic=Y("<span> </span>"),sc=Y('<span class="flex gap-2 text-[11px] text-muted font-mono"></span>'),nc=Y('<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> <!> <!></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">×</button></li>'),oc=Y('<ul class="list-none overflow-y-auto flex-1 p-2"></ul>');function ac(t,o){Ne(o,!0);var _=oc();Xe(_,21,()=>o.worktrees,b=>b.branch,(b,w)=>{const L=he(()=>y(w).branch===o.selected),k=he(()=>o.removing.has(y(w).branch)),n=he(()=>y(w).mux!=="✓"),a=he(()=>o.initializing.has(y(w).branch)),c=he(()=>y(w).creating),f=he(()=>y(k)||y(a));var l=nc(),h=$(l),v=$(h),g=$(v),u=$(g),r=$(u),i=V(u,2);{var e=A=>{var R=Xl(),M=V($(R));oe(z=>se(M,` ${z??""}...`),[()=>xo(y(w).creationPhase)]),K(A,R)},s=A=>{var R=Yl();K(A,R)},d=A=>{var R=Zl();K(A,R)},m=A=>{var R=Ql(),M=$(R);Jl(M,{get status(){return y(w).agent},size:14}),K(A,R)};ne(i,A=>{y(c)?A(e):y(a)?A(s,1):y(n)?A(d,2):A(m,-1)})}var S=V(i,2);{var C=A=>{var R=ec();K(A,R)},p=he(()=>o.notifiedBranches.has(y(w).branch));ne(S,A=>{y(p)&&A(C)})}var x=V(g,2);Xe(x,17,()=>y(w).prs,A=>A.repo,(A,R)=>{Eo(A,{get pr(){return y(R)}})});var T=V(x,2);{var P=A=>{ko(A,{get issue(){return y(w).linearIssue}})};ne(T,A=>{y(w).linearIssue&&A(P)})}var O=V(v,2),B=$(O);{var H=A=>{var R=tc(),M=$(R);oe(()=>se(M,y(w).agentName)),K(A,R)};ne(B,A=>{y(w).agentName&&A(H)})}var U=V(B,2);{var J=A=>{var R=rc(),M=$(R);oe(()=>se(M,y(w).profile)),K(A,R)};ne(U,A=>{y(w).profile&&A(J)})}var Q=V(O,2);{var X=A=>{var R=sc();Xe(R,21,()=>y(w).services,fi,(M,z)=>{var q=It(),te=Re(q);{var re=I=>{var D=ic(),G=$(D);oe(()=>{Fe(D,1,Xs(y(z).running?"text-success":"")),se(G,`${y(z).name??""}:${y(z).port??""}`)}),K(I,D)};ne(te,I=>{y(z).port&&I(re)})}K(M,q)}),K(A,R)};ne(Q,A=>{y(w).services.length>0&&A(X)})}var E=V(h,2);oe(()=>{Fe(l,1,`mb-0.5 group relative ${y(f)?"opacity-40 pointer-events-none":""}`),h.disabled=y(f),Fe(h,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 ${y(L)?"bg-active border-accent":"border-transparent"} ${y(n)&&!y(a)&&!y(c)?"opacity-50":""}`),se(r,y(w).branch),E.disabled=y(f)}),Se("click",h,()=>o.onselect(y(w).branch)),Se("click",E,A=>{A.stopPropagation(),o.onremove(y(w).branch)}),K(b,l)}),K(t,_),We()}ft(["click"]);var lc=Y('<button type="button" title="View CI checks"><span></span> CI</button>');function cc(t,o){Ne(o,!0);function _(k){return k==="failed"?"bg-danger/20 text-danger":k==="success"?"bg-success/20 text-success":k==="pending"?"bg-warning/20 text-warning":"bg-muted/20 text-muted"}function b(k){return k==="failed"?"bg-danger":k==="success"?"bg-success":k==="pending"?"bg-warning animate-pulse":"bg-muted"}var w=lc(),L=$(w);oe((k,n)=>{Fe(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 ${k??""}`),Fe(L,1,`inline-block w-1.5 h-1.5 rounded-full ${n??""}`)},[()=>_(o.pr.ciStatus),()=>b(o.pr.ciStatus)]),Se("click",w,k=>{k.stopPropagation(),o.onclick(o.pr)}),K(t,w),We()}ft(["click"]);var hc=Y('<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 uc(t,o){Ne(o,!0);var _=hc(),b=V($(_));oe(()=>se(b,` ${o.pr.comments.length??""} ${o.pr.comments.length===1?"comment":"comments"}`)),Se("click",_,w=>{w.stopPropagation(),o.onclick(o.pr)}),K(t,_),We()}ft(["click"]);var dc=Y('<span class="shrink-0 text-[10px] font-medium text-muted"> </span>'),fc=Y("<!> <!> <!>",1),_c=Y('<a target="_blank" rel="noopener"> </a>'),vc=Y('<button type="button" class="shrink-0 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="13" height="13" 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>'),pc=Y('<a class="shrink-0 text-[9px] px-1.5 py-0.5 rounded border border-accent/40 text-accent font-medium no-underline hover:opacity-80" title="Open in Cursor">Cursor</a> <!>',1),gc=Y('<div class="flex items-center gap-2 min-w-0"><!> <!> <!> <!></div>');function mn(t,o){let _=we(o,"services",19,()=>[]),b=we(o,"cursorUrl",3,null),w=we(o,"showSettings",3,!1);var L=gc(),k=$(L);{var n=h=>{var v=dc(),g=$(v);oe(()=>se(g,`${o.label??""}:`)),K(h,v)};ne(k,h=>{o.label&&h(n)})}var a=V(k,2);Xe(a,17,()=>o.prs,h=>`${h.repo}#${h.number}`,(h,v)=>{var g=fc(),u=Re(g);Eo(u,{get pr(){return y(v)},clickable:!0});var r=V(u,2);{var i=d=>{cc(d,{get pr(){return y(v)},get onclick(){return o.onciclick}})};ne(r,d=>{y(v).ciChecks&&y(v).ciChecks.length>0&&d(i)})}var e=V(r,2);{var s=d=>{uc(d,{get pr(){return y(v)},get onclick(){return o.onreviewsclick}})};ne(e,d=>{y(v).comments.length>0&&d(s)})}K(h,g)});var c=V(a,2);Xe(c,17,_,fi,(h,v)=>{var g=It(),u=Re(g);{var r=i=>{var e=_c(),s=$(e);oe(()=>{De(e,"href",`${window.location.protocol??""}//${window.location.hostname??""}:${y(v).port??""}`),Fe(e,1,`shrink-0 text-[11px] px-1.5 py-0.5 rounded border font-mono no-underline hover:opacity-80 ${y(v).running?"text-success border-success/40":"text-muted border-edge pointer-events-none"}`),se(s,`${y(v).name??""} :${y(v).port??""}`)}),K(i,e)};ne(u,i=>{y(v).port&&i(r)})}K(h,g)});var f=V(c,2);{var l=h=>{var v=pc(),g=Re(v),u=V(g,2);{var r=i=>{var e=vc();Se("click",e,function(...s){var d;(d=o.onsettings)==null||d.apply(this,s)}),K(i,e)};ne(u,i=>{w()&&o.onsettings&&i(r)})}oe(()=>De(g,"href",b())),K(h,v)};ne(f,h=>{b()&&h(l)})}K(t,L)}ft(["click"]);var mc=Y("<button><!></button>");function Ze(t,o){let _=we(o,"variant",3,"default"),b=we(o,"small",3,!1),w=we(o,"class",3,""),L=yo(o,["$$slots","$$events","$$legacy","variant","small","class","children"]);const k={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=mc();wo(a,()=>({class:`rounded-md border cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed ${k[b()?"small":"normal"]??""} ${n[_()]??""} ${w()??""}`,...L}));var c=$(a);Gs(c,()=>o.children),K(t,a)}var Sc=Y('<span class="text-success">✓</span>'),bc=Y('<span class="text-accent">☍</span>'),wc=Y('<span class="text-[10px] text-muted"> </span>'),Cc=Y('<span class="text-xs text-accent truncate"> </span>'),yc=Y('<span><!></span> <span class="flex flex-col gap-0.5 min-w-0"><span> </span> <!></span>',1);function Lo(t,o){Ne(o,!0);let _=we(o,"showTimestamp",3,!1),b=we(o,"large",3,!1);var w=yc(),L=Re(w),k=$(L);{var n=u=>{var r=Sc();K(u,r)},a=u=>{var r=bc();K(u,r)};ne(k,u=>{o.notification.type==="agent_stopped"?u(n):u(a,-1)})}var c=V(L,2),f=$(c),l=$(f),h=V(f,2);{var v=u=>{var r=wc(),i=$(r);oe(e=>se(i,e),[()=>new Date(o.notification.timestamp).toLocaleTimeString()]),K(u,r)},g=u=>{var r=Cc(),i=$(r);oe(()=>se(i,o.notification.url)),K(u,r)};ne(h,u=>{_()?u(v):o.notification.url&&u(g,1)})}oe(()=>{Fe(L,1,`shrink-0 ${b()?"text-base":"text-sm"}`),Fe(f,1,`${b()?"text-sm":"text-xs"} text-primary truncate`),se(l,o.notification.message)}),K(t,w),We()}var xc=Y('<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>'),Ec=Y('<span class="shrink-0 text-[10px] px-1.5 py-0.5 rounded border border-warning/40 text-warning">dirty</span>'),kc=Y("<!> <!> <!>",1),Lc=Y('<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>'),Dc=Y('<div class="px-3 py-4 text-xs text-muted text-center">No notifications yet</div>'),Rc=Y('<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>'),Ac=Y('<ul class="list-none max-h-64 overflow-y-auto"></ul>'),Bc=Y('<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>'),Tc=Y('<div class="flex items-stretch bg-topbar border-b border-edge min-h-12"><div class="flex-1 min-w-0 flex flex-col justify-center px-4 py-2.5 gap-1.5"><div class="flex items-center gap-3 min-w-0"><!> <span class="text-sm font-semibold truncate"> </span> <!> <!> <!></div> <!></div> <div class="shrink-0 flex gap-2 items-center px-4"><!> <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 Mc(t,o){Ne(o,!0);let _=we(o,"linkedRepos",19,()=>[]),b=we(o,"isMobile",3,!1),w=we(o,"notificationHistory",19,()=>[]),L=we(o,"unreadCount",3,0),k=ae(!1);function n(){var R;N(k,!y(k)),y(k)&&((R=o.onbellopen)==null||R.call(o))}function a(R){R.target.closest(".bell-container")||N(k,!1)}function c(R){return R?o.sshHost?`cursor://vscode-remote/ssh-remote+${o.sshHost}${R}`:`cursor://file${R}`:null}let f=he(()=>{var R;return c((R=o.worktree)==null?void 0:R.dir)}),l=he(()=>{var R;return(((R=o.worktree)==null?void 0:R.prs)??[]).filter(M=>!M.repo||!_().some(z=>z.alias===M.repo))}),h=he(()=>_().map(R=>{var M;return{alias:R.alias,dir:R.dir,cursorUrl:c(R.dir&&o.name?`${R.dir}/${o.name}`:null),prs:(((M=o.worktree)==null?void 0:M.prs)??[]).filter(z=>z.repo===R.alias)}}).filter(R=>R.prs.length>0||R.cursorUrl));var v=Tc();Ci("click",ks,a);var g=$(v),u=$(g),r=$(u);{var i=R=>{var M=xc();Se("click",M,function(...z){var q;(q=o.ontogglesidebar)==null||q.apply(this,z)}),K(R,M)};ne(r,R=>{b()&&o.ontogglesidebar&&R(i)})}var e=V(r,2),s=$(e),d=V(e,2);{var m=R=>{var M=Ec();K(R,M)};ne(d,R=>{var M;(M=o.worktree)!=null&&M.dirty&&R(m)})}var S=V(d,2);{var C=R=>{ko(R,{get issue(){return o.worktree.linearIssue}})};ne(S,R=>{var M;(M=o.worktree)!=null&&M.linearIssue&&R(C)})}var p=V(S,2);{var x=R=>{{let M=he(()=>{var z;return((z=o.worktree)==null?void 0:z.services)??[]});mn(R,{get prs(){return y(l)},get services(){return y(M)},get cursorUrl(){return y(f)},showSettings:!0,get onciclick(){return o.onciclick},get onreviewsclick(){return o.onreviewsclick},get onsettings(){return o.onsettings}})}};ne(p,R=>{b()||R(x)})}var T=V(u,2);{var P=R=>{var M=It(),z=Re(M);Xe(z,17,()=>y(h),q=>q.alias,(q,te)=>{mn(q,{get label(){return y(te).alias},get prs(){return y(te).prs},get cursorUrl(){return y(te).cursorUrl},get onciclick(){return o.onciclick},get onreviewsclick(){return o.onreviewsclick}})}),K(R,M)};ne(T,R=>{b()||R(P)})}var O=V(g,2),B=$(O);{var H=R=>{var M=kc(),z=Re(M);{var q=I=>{Ze(I,{variant:"default",get onclick(){return o.onclose},title:"Close worktree window",children:(D,G)=>{var F=ze();oe(()=>se(F,b()?"C":"Close")),K(D,F)},$$slots:{default:!0}})};ne(z,I=>{o.worktree.mux==="✓"&&I(q)})}var te=V(z,2);Ze(te,{variant:"accent-outline",get onclick(){return o.onmerge},title:"Merge worktree",children:(I,D)=>{var G=ze();oe(()=>se(G,b()?"M":"Merge")),K(I,G)},$$slots:{default:!0}});var re=V(te,2);Ze(re,{variant:"danger-outline",get onclick(){return o.onremove},title:"Remove worktree",children:(I,D)=>{var G=ze();oe(()=>se(G,b()?"R":"Remove")),K(I,G)},$$slots:{default:!0}}),K(R,M)};ne(B,R=>{o.worktree&&R(H)})}var U=V(B,2),J=$(U),Q=V($(J),2);{var X=R=>{var M=Lc(),z=$(M);oe(()=>se(z,L()>9?"9+":L())),K(R,M)};ne(Q,R=>{L()>0&&R(X)})}var E=V(J,2);{var A=R=>{var M=Bc(),z=V($(M),2);{var q=re=>{var I=Dc();K(re,I)},te=re=>{var I=Ac();Xe(I,21,w,D=>D.id,(D,G)=>{var F=Rc(),ie=$(F),Z=$(ie);Lo(Z,{get notification(){return y(G)},showTimestamp:!0}),Se("click",ie,()=>{var ce;(ce=o.onnotificationselect)==null||ce.call(o,y(G).branch),N(k,!1)}),K(D,F)}),K(re,I)};ne(z,re=>{w().length===0?re(q):re(te,-1)})}K(R,M)};ne(E,R=>{y(k)&&R(A)})}oe(()=>se(s,o.name??"Select a worktree")),Se("keydown",U,()=>{}),Se("click",J,n),K(t,v),We()}ft(["click","keydown"]);var ds={exports:{}},Sn;function Pc(){return Sn||(Sn=1,(function(t,o){(function(_,b){t.exports=b()})(globalThis,(()=>(()=>{var _={4567:function(k,n,a){var c=this&&this.__decorate||function(e,s,d,m){var S,C=arguments.length,p=C<3?s:m===null?m=Object.getOwnPropertyDescriptor(s,d):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,d,m);else for(var x=e.length-1;x>=0;x--)(S=e[x])&&(p=(C<3?S(p):C>3?S(s,d,p):S(s,d))||p);return C>3&&p&&Object.defineProperty(s,d,p),p},f=this&&this.__param||function(e,s){return function(d,m){s(d,m,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.AccessibilityManager=void 0;const l=a(9042),h=a(9924),v=a(844),g=a(4725),u=a(2585),r=a(3656);let i=n.AccessibilityManager=class extends v.Disposable{constructor(e,s,d,m){super(),this._terminal=e,this._coreBrowserService=d,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 h.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,r.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,v.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(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 d=this._terminal.buffer,m=d.lines.length.toString();for(let S=e;S<=s;S++){const C=d.lines.get(d.ydisp+S),p=[],x=(C==null?void 0:C.translateToString(!0,void 0,void 0,p))||"",T=(d.ydisp+S+1).toString(),P=this._rowElements[S];P&&(x.length===0?(P.innerText=" ",this._rowColumns.set(P,[0,1])):(P.textContent=x,this._rowColumns.set(P,p)),P.setAttribute("aria-posinset",T),P.setAttribute("aria-setsize",m))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,s){const d=e.target,m=this._rowElements[s===0?1:this._rowElements.length-2];if(d.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==m)return;let S,C;if(s===0?(S=d,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(S=this._rowElements.shift(),C=d,this._rowContainer.removeChild(S)),S.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){const p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{const p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}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},d={node:e.focusNode,offset:e.focusOffset};if((s.node.compareDocumentPosition(d.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===d.node&&s.offset>d.offset)&&([s,d]=[d,s]),s.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(s={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(s.node))return;const m=this._rowElements.slice(-1)[0];if(d.node.compareDocumentPosition(m)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(d={node:m,offset:((x=m.textContent)==null?void 0:x.length)??0}),!this._rowContainer.contains(d.node))return;const S=({node:T,offset:P})=>{const O=T instanceof Text?T.parentNode:T;let B=parseInt(O==null?void 0:O.getAttribute("aria-posinset"),10)-1;if(isNaN(B))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 U=P<H.length?H[P]:H.slice(-1)[0]+1;return U>=this._terminal.cols&&(++B,U=0),{row:B,column:U}},C=S(s),p=S(d);if(C&&p){if(C.row>p.row||C.row===p.row&&C.column>=p.column)throw new Error("invalid range");this._terminal.select(C.column,C.row,(p.row-C.row)*this._terminal.cols-C.column+p.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,u.IInstantiationService),f(2,g.ICoreBrowserService),f(3,g.IRenderService)],i)},3614:(k,n)=>{function a(h){return h.replace(/\r?\n/g,"\r")}function c(h,v){return v?"\x1B[200~"+h+"\x1B[201~":h}function f(h,v,g,u){h=c(h=a(h),g.decPrivateModes.bracketedPasteMode&&u.rawOptions.ignoreBracketedPasteMode!==!0),g.triggerDataEvent(h,!0),v.value=""}function l(h,v,g){const u=g.getBoundingClientRect(),r=h.clientX-u.left-10,i=h.clientY-u.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${r}px`,v.style.top=`${i}px`,v.style.zIndex="1000",v.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(h,v){h.clipboardData&&h.clipboardData.setData("text/plain",v.selectionText),h.preventDefault()},n.handlePasteEvent=function(h,v,g,u){h.stopPropagation(),h.clipboardData&&f(h.clipboardData.getData("text/plain"),v,g,u)},n.paste=f,n.moveTextAreaUnderMouseCursor=l,n.rightClickHandler=function(h,v,g,u,r){l(h,v,g),r&&u.rightClickSelect(h),v.value=u.selectionText,v.select()}},7239:(k,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,h){this._css.set(f,l,h)}getCss(f,l){return this._css.get(f,l)}setColor(f,l,h){this._color.set(f,l,h)}getColor(f,l){return this._color.get(f,l)}clear(){this._color.clear(),this._css.clear()}}},3656:(k,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.addDisposableDomListener=void 0,n.addDisposableDomListener=function(a,c,f,l){a.addEventListener(c,f,l);let h=!1;return{dispose:()=>{h||(h=!0,a.removeEventListener(c,f,l))}}}},3551:function(k,n,a){var c=this&&this.__decorate||function(i,e,s,d){var m,S=arguments.length,C=S<3?e:d===null?d=Object.getOwnPropertyDescriptor(e,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(i,e,s,d);else for(var p=i.length-1;p>=0;p--)(m=i[p])&&(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,d){e(s,d,i)}};Object.defineProperty(n,"__esModule",{value:!0}),n.Linkifier=void 0;const l=a(3656),h=a(8460),v=a(844),g=a(2585),u=a(4725);let r=n.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(i,e,s,d,m){super(),this._element=i,this._mouseService=e,this._renderService=s,this._bufferService=d,this._linkProviderService=m,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new h.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new h.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.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 d=0;d<s.length;d++){const m=s[d];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 d,m;this._activeProviderReplies&&e||((d=this._activeProviderReplies)==null||d.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,(p=>{var T,P;if(this._isMouseOut)return;const x=p==null?void 0:p.map((O=>({link:O})));(T=this._activeProviderReplies)==null||T.set(S,x),s=this._checkLinkProviderResult(S,i,s),((P=this._activeProviderReplies)==null?void 0:P.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(i.y,this._activeProviderReplies)}))}_removeIntersectingLinks(i,e){const s=new Set;for(let d=0;d<e.size;d++){const m=e.get(d);if(m)for(let S=0;S<m.length;S++){const C=m[S],p=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=p;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 d=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&&d){const C=d.find((p=>this._linkAtPosition(p.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 p=(S=this._activeProviderReplies.get(C))==null?void 0:S.find((x=>this._linkAtPosition(x.link,e)));if(p){s=!0,this._handleNewLink(p);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,v.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,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.pointerCursor},set:s=>{var d;(d=this._currentLink)!=null&&d.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>{var s,d;return(d=(s=this._currentLink)==null?void 0:s.state)==null?void 0:d.decorations.underline},set:s=>{var d,m,S;(d=this._currentLink)!=null&&d.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 d=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>=d&&this._currentLink.link.range.end.y<=m&&(this._clearCurrentLink(d,m),this._lastMouseEvent)){const S=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);S&&this._askForLink(S,!1)}}))))}_linkHover(i,e,s){var d;(d=this._currentLink)!=null&&d.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,d=this._bufferService.buffer.ydisp,m=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-d-1,s.end.x,s.end.y-d-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(m)}_linkLeave(i,e,s){var d;(d=this._currentLink)!=null&&d.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,d=i.range.end.y*this._bufferService.cols+i.range.end.x,m=e.y*this._bufferService.cols+e.x;return s<=m&&m<=d}_positionFromMouseEvent(i,e,s){const d=s.getCoords(i,e,this._bufferService.cols,this._bufferService.rows);if(d)return{x:d[0],y:d[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(i,e,s,d,m){return{x1:i,y1:e,x2:s,y2:d,cols:this._bufferService.cols,fg:m}}};n.Linkifier=r=c([f(1,u.IMouseService),f(2,u.IRenderService),f(3,g.IBufferService),f(4,u.ILinkProviderService)],r)},9042:(k,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(k,n,a){var c=this&&this.__decorate||function(u,r,i,e){var s,d=arguments.length,m=d<3?r:e===null?e=Object.getOwnPropertyDescriptor(r,i):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(u,r,i,e);else for(var S=u.length-1;S>=0;S--)(s=u[S])&&(m=(d<3?s(m):d>3?s(r,i,m):s(r,i))||m);return d>3&&m&&Object.defineProperty(r,i,m),m},f=this&&this.__param||function(u,r){return function(i,e){r(i,e,u)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkProvider=void 0;const l=a(511),h=a(2585);let v=n.OscLinkProvider=class{constructor(u,r,i){this._bufferService=u,this._optionsService=r,this._oscLinkService=i}provideLinks(u,r){var x;const i=this._bufferService.buffer.lines.get(u-1);if(!i)return void r(void 0);const e=[],s=this._optionsService.rawOptions.linkHandler,d=new l.CellData,m=i.getTrimmedLength();let S=-1,C=-1,p=!1;for(let T=0;T<m;T++)if(C!==-1||i.hasContent(T)){if(i.loadCell(T,d),d.hasExtendedAttrs()&&d.extended.urlId){if(C===-1){C=T,S=d.extended.urlId;continue}p=d.extended.urlId!==S}else C!==-1&&(p=!0);if(p||C!==-1&&T===m-1){const P=(x=this._oscLinkService.getLinkData(S))==null?void 0:x.uri;if(P){const O={start:{x:C+1,y:u},end:{x:T+(p||T!==m-1?0:1),y:u}};let B=!1;if(!(s!=null&&s.allowNonHttpProtocols))try{const H=new URL(P);["http:","https:"].includes(H.protocol)||(B=!0)}catch{B=!0}B||e.push({text:P,range:O,activate:(H,U)=>s?s.activate(H,U,O):g(0,U),hover:(H,U)=>{var J;return(J=s==null?void 0:s.hover)==null?void 0:J.call(s,H,U,O)},leave:(H,U)=>{var J;return(J=s==null?void 0:s.leave)==null?void 0:J.call(s,H,U,O)}})}p=!1,d.hasExtendedAttrs()&&d.extended.urlId?(C=T,S=d.extended.urlId):(C=-1,S=-1)}}r(e)}};function g(u,r){if(confirm(`Do you want to navigate to ${r}?
|
|
5
|
+
|
|
6
|
+
WARNING: This link could potentially be dangerous`)){const i=window.open();if(i){try{i.opener=null}catch{}i.location.href=r}else console.warn("Opening link blocked as opener could not be cleared")}}n.OscLinkProvider=v=c([f(0,h.IBufferService),f(1,h.IOptionsService),f(2,h.IOscLinkService)],v)},6193:(k,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:(k,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Terminal=void 0;const c=a(3614),f=a(3656),l=a(3551),h=a(9042),v=a(3730),g=a(1680),u=a(3107),r=a(5744),i=a(2950),e=a(1296),s=a(428),d=a(4269),m=a(5114),S=a(8934),C=a(3230),p=a(9312),x=a(4725),T=a(6731),P=a(8055),O=a(8969),B=a(8460),H=a(844),U=a(6114),J=a(8437),Q=a(2584),X=a(7399),E=a(5941),A=a(9074),R=a(2585),M=a(5435),z=a(4567),q=a(779);class te extends O.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(I={}){super(I),this.browser=U,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new H.MutableDisposable),this._onCursorMove=this.register(new B.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new B.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new B.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new B.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new B.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new B.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new B.EventEmitter),this._onBlur=this.register(new B.EventEmitter),this._onA11yCharEmitter=this.register(new B.EventEmitter),this._onA11yTabEmitter=this.register(new B.EventEmitter),this._onWillOpen=this.register(new B.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(R.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(q.LinkProviderService),this._instantiationService.setService(x.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(v.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((D,G)=>this.refresh(D,G)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((D=>this._reportWindowsOptions(D)))),this.register(this._inputHandler.onColor((D=>this._handleColorEvent(D)))),this.register((0,B.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,B.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,B.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((D=>this._afterResize(D.cols,D.rows)))),this.register((0,H.toDisposable)((()=>{var D,G;this._customKeyEventHandler=void 0,(G=(D=this.element)==null?void 0:D.parentNode)==null||G.removeChild(this.element)})))}_handleColorEvent(I){if(this._themeService)for(const D of I){let G,F="";switch(D.index){case 256:G="foreground",F="10";break;case 257:G="background",F="11";break;case 258:G="cursor",F="12";break;default:G="ansi",F="4;"+D.index}switch(D.type){case 0:const ie=P.color.toColorRGB(G==="ansi"?this._themeService.colors.ansi[D.index]:this._themeService.colors[G]);this.coreService.triggerDataEvent(`${Q.C0.ESC}]${F};${(0,E.toRgbString)(ie)}${Q.C1_ESCAPED.ST}`);break;case 1:if(G==="ansi")this._themeService.modifyColors((Z=>Z.ansi[D.index]=P.channels.toColor(...D.color)));else{const Z=G;this._themeService.modifyColors((ce=>ce[Z]=P.channels.toColor(...D.color)))}break;case 2:this._themeService.restoreColor(D.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(I){I?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(z.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(I){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var I;return(I=this.textarea)==null?void 0:I.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const I=this.buffer.ybase+this.buffer.y,D=this.buffer.lines.get(I);if(!D)return;const G=Math.min(this.buffer.x,this.cols-1),F=this._renderService.dimensions.css.cell.height,ie=D.getWidth(G),Z=this._renderService.dimensions.css.cell.width*ie,ce=this.buffer.y*this._renderService.dimensions.css.cell.height,me=G*this._renderService.dimensions.css.cell.width;this.textarea.style.left=me+"px",this.textarea.style.top=ce+"px",this.textarea.style.width=Z+"px",this.textarea.style.height=F+"px",this.textarea.style.lineHeight=F+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,f.addDisposableDomListener)(this.element,"copy",(D=>{this.hasSelection()&&(0,c.copyHandler)(D,this._selectionService)})));const I=D=>(0,c.handlePasteEvent)(D,this.textarea,this.coreService,this.optionsService);this.register((0,f.addDisposableDomListener)(this.textarea,"paste",I)),this.register((0,f.addDisposableDomListener)(this.element,"paste",I)),U.isFirefox?this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(D=>{D.button===2&&(0,c.rightClickHandler)(D,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,f.addDisposableDomListener)(this.element,"contextmenu",(D=>{(0,c.rightClickHandler)(D,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),U.isLinux&&this.register((0,f.addDisposableDomListener)(this.element,"auxclick",(D=>{D.button===1&&(0,c.moveTextAreaUnderMouseCursor)(D,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,f.addDisposableDomListener)(this.textarea,"keyup",(I=>this._keyUp(I)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keydown",(I=>this._keyDown(I)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"keypress",(I=>this._keyPress(I)),!0)),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionupdate",(I=>this._compositionHelper.compositionupdate(I)))),this.register((0,f.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,f.addDisposableDomListener)(this.textarea,"input",(I=>this._inputEvent(I)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(I){var G;if(!I)throw new Error("Terminal requires a parent element.");if(I.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((G=this.element)==null?void 0:G.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=I.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),I.appendChild(this.element);const D=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),D.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",(F=>this.updateCursorStyle(F)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),D.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",h.promptLabel),U.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(m.CoreBrowserService,this.textarea,I.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(x.ICoreBrowserService,this._coreBrowserService),this.register((0,f.addDisposableDomListener)(this.textarea,"focus",(F=>this._handleTextAreaFocus(F)))),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(d.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((F=>this._onRender.fire(F)))),this.onResize((F=>this._renderService.resize(F.cols,F.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(D);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((F=>this.scrollLines(F.amount,F.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(p.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(x.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((F=>this.scrollLines(F.amount,F.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((F=>this._renderService.handleSelectionChanged(F.start,F.end,F.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((F=>{this.textarea.value=F,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((F=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(u.BufferDecorationRenderer,this.screenElement)),this.register((0,f.addDisposableDomListener)(this.element,"mousedown",(F=>this._selectionService.handleMouseDown(F)))),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(z.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(F=>this._handleScreenReaderModeOptionChange(F)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(r.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(F=>{!this._overviewRulerRenderer&&F&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(r.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 I=this,D=this.element;function G(Z){const ce=I._mouseService.getMouseReportCoords(Z,I.screenElement);if(!ce)return!1;let me,Ce;switch(Z.overrideType||Z.type){case"mousemove":Ce=32,Z.buttons===void 0?(me=3,Z.button!==void 0&&(me=Z.button<3?Z.button:3)):me=1&Z.buttons?0:4&Z.buttons?1:2&Z.buttons?2:3;break;case"mouseup":Ce=0,me=Z.button<3?Z.button:3;break;case"mousedown":Ce=1,me=Z.button<3?Z.button:3;break;case"wheel":if(I._customWheelEventHandler&&I._customWheelEventHandler(Z)===!1||I.viewport.getLinesScrolled(Z)===0)return!1;Ce=Z.deltaY<0?0:1,me=4;break;default:return!1}return!(Ce===void 0||me===void 0||me>4)&&I.coreMouseService.triggerMouseEvent({col:ce.col,row:ce.row,x:ce.x,y:ce.y,button:me,action:Ce,ctrl:Z.ctrlKey,alt:Z.altKey,shift:Z.shiftKey})}const F={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ie={mouseup:Z=>(G(Z),Z.buttons||(this._document.removeEventListener("mouseup",F.mouseup),F.mousedrag&&this._document.removeEventListener("mousemove",F.mousedrag)),this.cancel(Z)),wheel:Z=>(G(Z),this.cancel(Z,!0)),mousedrag:Z=>{Z.buttons&&G(Z)},mousemove:Z=>{Z.buttons||G(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?F.mousemove||(D.addEventListener("mousemove",ie.mousemove),F.mousemove=ie.mousemove):(D.removeEventListener("mousemove",F.mousemove),F.mousemove=null),16&Z?F.wheel||(D.addEventListener("wheel",ie.wheel,{passive:!1}),F.wheel=ie.wheel):(D.removeEventListener("wheel",F.wheel),F.wheel=null),2&Z?F.mouseup||(F.mouseup=ie.mouseup):(this._document.removeEventListener("mouseup",F.mouseup),F.mouseup=null),4&Z?F.mousedrag||(F.mousedrag=ie.mousedrag):(this._document.removeEventListener("mousemove",F.mousedrag),F.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,f.addDisposableDomListener)(D,"mousedown",(Z=>{if(Z.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(Z))return G(Z),F.mouseup&&this._document.addEventListener("mouseup",F.mouseup),F.mousedrag&&this._document.addEventListener("mousemove",F.mousedrag),this.cancel(Z)}))),this.register((0,f.addDisposableDomListener)(D,"wheel",(Z=>{if(!F.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 me=Q.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(Z.deltaY<0?"A":"B");let Ce="";for(let Ie=0;Ie<Math.abs(ce);Ie++)Ce+=me;return this.coreService.triggerDataEvent(Ce,!0),this.cancel(Z,!0)}return this.viewport.handleWheel(Z)?this.cancel(Z):void 0}}),{passive:!1})),this.register((0,f.addDisposableDomListener)(D,"touchstart",(Z=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(Z),this.cancel(Z)}),{passive:!0})),this.register((0,f.addDisposableDomListener)(D,"touchmove",(Z=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(Z)?void 0:this.cancel(Z)}),{passive:!1}))}refresh(I,D){var G;(G=this._renderService)==null||G.refreshRows(I,D)}updateCursorStyle(I){var D;(D=this._selectionService)!=null&&D.shouldColumnSelect(I)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(I,D,G=0){var F;G===1?(super.scrollLines(I,D,G),this.refresh(0,this.rows-1)):(F=this.viewport)==null||F.scrollLines(I)}paste(I){(0,c.paste)(I,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(I){this._customKeyEventHandler=I}attachCustomWheelEventHandler(I){this._customWheelEventHandler=I}registerLinkProvider(I){return this._linkProviderService.registerLinkProvider(I)}registerCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const D=this._characterJoinerService.register(I);return this.refresh(0,this.rows-1),D}deregisterCharacterJoiner(I){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(I)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(I){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+I)}registerDecoration(I){return this._decorationService.registerDecoration(I)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(I,D,G){this._selectionService.setSelection(I,D,G)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var I;(I=this._selectionService)==null||I.clearSelection()}selectAll(){var I;(I=this._selectionService)==null||I.selectAll()}selectLines(I,D){var G;(G=this._selectionService)==null||G.selectLines(I,D)}_keyDown(I){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;const D=this.browser.isMac&&this.options.macOptionIsMeta&&I.altKey;if(!D&&!this._compositionHelper.keydown(I))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;D||I.key!=="Dead"&&I.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const G=(0,X.evaluateKeyboardEvent)(I,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(I),G.type===3||G.type===2){const F=this.rows-1;return this.scrollLines(G.type===2?-F:F),this.cancel(I,!0)}return G.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,I)||(G.cancel&&this.cancel(I,!0),!G.key||!!(I.key&&!I.ctrlKey&&!I.altKey&&!I.metaKey&&I.key.length===1&&I.key.charCodeAt(0)>=65&&I.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(G.key!==Q.C0.ETX&&G.key!==Q.C0.CR||(this.textarea.value=""),this._onKey.fire({key:G.key,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(G.key,!0),!this.optionsService.rawOptions.screenReaderMode||I.altKey||I.ctrlKey?this.cancel(I,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(I,D){const G=I.isMac&&!this.options.macOptionIsMeta&&D.altKey&&!D.ctrlKey&&!D.metaKey||I.isWindows&&D.altKey&&D.ctrlKey&&!D.metaKey||I.isWindows&&D.getModifierState("AltGraph");return D.type==="keypress"?G:G&&(!D.keyCode||D.keyCode>47)}_keyUp(I){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1||((function(D){return D.keyCode===16||D.keyCode===17||D.keyCode===18})(I)||this.focus(),this.updateCursorStyle(I),this._keyPressHandled=!1)}_keyPress(I){let D;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(I)===!1)return!1;if(this.cancel(I),I.charCode)D=I.charCode;else if(I.which===null||I.which===void 0)D=I.keyCode;else{if(I.which===0||I.charCode===0)return!1;D=I.which}return!(!D||(I.altKey||I.ctrlKey||I.metaKey)&&!this._isThirdLevelShift(this.browser,I)||(D=String.fromCharCode(D),this._onKey.fire({key:D,domEvent:I}),this._showCursor(),this.coreService.triggerDataEvent(D,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(I){if(I.data&&I.inputType==="insertText"&&(!I.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const D=I.data;return this.coreService.triggerDataEvent(D,!0),this.cancel(I),!0}return!1}resize(I,D){I!==this.cols||D!==this.rows?super.resize(I,D):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(I,D){var G,F;(G=this._charSizeService)==null||G.measure(),(F=this.viewport)==null||F.syncScrollArea(!0)}clear(){var I;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let D=1;D<this.rows;D++)this.buffer.lines.push(this.buffer.getBlankLine(J.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(I=this.viewport)==null||I.reset(),this.refresh(0,this.rows-1)}}reset(){var D,G;this.options.rows=this.rows,this.options.cols=this.cols;const I=this._customKeyEventHandler;this._setup(),super.reset(),(D=this._selectionService)==null||D.reset(),this._decorationService.reset(),(G=this.viewport)==null||G.reset(),this._customKeyEventHandler=I,this.refresh(0,this.rows-1)}clearTextureAtlas(){var I;(I=this._renderService)==null||I.clearTextureAtlas()}_reportFocus(){var I;(I=this.element)!=null&&I.classList.contains("focus")?this.coreService.triggerDataEvent(Q.C0.ESC+"[I"):this.coreService.triggerDataEvent(Q.C0.ESC+"[O")}_reportWindowsOptions(I){if(this._renderService)switch(I){case M.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const D=this._renderService.dimensions.css.canvas.width.toFixed(0),G=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.C0.ESC}[4;${G};${D}t`);break;case M.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const F=this._renderService.dimensions.css.cell.width.toFixed(0),ie=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Q.C0.ESC}[6;${ie};${F}t`)}}cancel(I,D){if(this.options.cancelEvents||D)return I.preventDefault(),I.stopPropagation(),!1}}n.Terminal=te},9924:(k,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 h=l-this._lastRefreshMs,v=this._debounceThresholdMS-h;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),v)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const 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(k,n,a){var c=this&&this.__decorate||function(i,e,s,d){var m,S=arguments.length,C=S<3?e:d===null?d=Object.getOwnPropertyDescriptor(e,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(i,e,s,d);else for(var p=i.length-1;p>=0;p--)(m=i[p])&&(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,d){e(s,d,i)}};Object.defineProperty(n,"__esModule",{value:!0}),n.Viewport=void 0;const l=a(3656),h=a(4725),v=a(8460),g=a(844),u=a(2585);let r=n.Viewport=class extends g.Disposable{constructor(i,e,s,d,m,S,C,p){super(),this._viewportElement=i,this._scrollArea=e,this._bufferService=s,this._optionsService=d,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 v.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(p.colors),this.register(p.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 p;let s,d="";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 P=(p=C.get(x+1))==null?void 0:p.isWrapped;if(d+=T.translateToString(!P),!P||x===C.length-1){const O=document.createElement("div");O.textContent=d,m.push(O),d.length>0&&(s=O),d=""}}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=r=c([f(2,u.IBufferService),f(3,u.IOptionsService),f(4,h.ICharSizeService),f(5,h.IRenderService),f(6,h.ICoreBrowserService),f(7,h.IThemeService)],r)},3107:function(k,n,a){var c=this&&this.__decorate||function(u,r,i,e){var s,d=arguments.length,m=d<3?r:e===null?e=Object.getOwnPropertyDescriptor(r,i):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(u,r,i,e);else for(var S=u.length-1;S>=0;S--)(s=u[S])&&(m=(d<3?s(m):d>3?s(r,i,m):s(r,i))||m);return d>3&&m&&Object.defineProperty(r,i,m),m},f=this&&this.__param||function(u,r){return function(i,e){r(i,e,u)}};Object.defineProperty(n,"__esModule",{value:!0}),n.BufferDecorationRenderer=void 0;const l=a(4725),h=a(844),v=a(2585);let g=n.BufferDecorationRenderer=class extends h.Disposable{constructor(u,r,i,e,s){super(),this._screenElement=u,this._bufferService=r,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((d=>this._removeDecoration(d)))),this.register((0,h.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const u of this._decorationService.decorations)this._renderDecoration(u);this._dimensionsChanged=!1}_renderDecoration(u){this._refreshStyle(u),this._dimensionsChanged&&this._refreshXPosition(u)}_createElement(u){var e;const r=this._coreBrowserService.mainDocument.createElement("div");r.classList.add("xterm-decoration"),r.classList.toggle("xterm-decoration-top-layer",((e=u==null?void 0:u.options)==null?void 0:e.layer)==="top"),r.style.width=`${Math.round((u.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,r.style.height=(u.options.height||1)*this._renderService.dimensions.css.cell.height+"px",r.style.top=(u.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",r.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const i=u.options.x??0;return i&&i>this._bufferService.cols&&(r.style.display="none"),this._refreshXPosition(u,r),r}_refreshStyle(u){const r=u.marker.line-this._bufferService.buffers.active.ydisp;if(r<0||r>=this._bufferService.rows)u.element&&(u.element.style.display="none",u.onRenderEmitter.fire(u.element));else{let i=this._decorationElements.get(u);i||(i=this._createElement(u),u.element=i,this._decorationElements.set(u,i),this._container.appendChild(i),u.onDispose((()=>{this._decorationElements.delete(u),i.remove()}))),i.style.top=r*this._renderService.dimensions.css.cell.height+"px",i.style.display=this._altBufferIsActive?"none":"block",u.onRenderEmitter.fire(i)}}_refreshXPosition(u,r=u.element){if(!r)return;const i=u.options.x??0;(u.options.anchor||"left")==="right"?r.style.right=i?i*this._renderService.dimensions.css.cell.width+"px":"":r.style.left=i?i*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(u){var r;(r=this._decorationElements.get(u))==null||r.remove(),this._decorationElements.delete(u),u.dispose()}};n.BufferDecorationRenderer=g=c([f(1,v.IBufferService),f(2,l.ICoreBrowserService),f(3,v.IDecorationService),f(4,l.IRenderService)],g)},5871:(k,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(k,n,a){var c=this&&this.__decorate||function(s,d,m,S){var C,p=arguments.length,x=p<3?d:S===null?S=Object.getOwnPropertyDescriptor(d,m):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(s,d,m,S);else for(var T=s.length-1;T>=0;T--)(C=s[T])&&(x=(p<3?C(x):p>3?C(d,m,x):C(d,m))||x);return p>3&&x&&Object.defineProperty(d,m,x),x},f=this&&this.__param||function(s,d){return function(m,S){d(m,S,s)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OverviewRulerRenderer=void 0;const l=a(5871),h=a(4725),v=a(844),g=a(2585),u={full:0,left:0,center:0,right:0},r={full:0,left:0,center:0,right:0},i={full:0,left:0,center:0,right:0};let e=n.OverviewRulerRenderer=class extends v.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(s,d,m,S,C,p,x){var P;super(),this._viewportElement=s,this._screenElement=d,this._bufferService=m,this._decorationService=S,this._renderService=C,this._optionsService=p,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(),(P=this._viewportElement.parentElement)==null||P.insertBefore(this._canvas,this._viewportElement);const T=this._canvas.getContext("2d");if(!T)throw new Error("Ctx cannot be null");this._ctx=T,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,v.toDisposable)((()=>{var O;(O=this._canvas)==null||O.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const s=Math.floor(this._canvas.width/3),d=Math.ceil(this._canvas.width/3);r.full=this._canvas.width,r.left=s,r.center=d,r.right=s,this._refreshDrawHeightConstants(),i.full=0,i.left=0,i.center=r.left,i.right=r.left+r.center}_refreshDrawHeightConstants(){u.full=Math.round(2*this._coreBrowserService.dpr);const s=this._canvas.height/this._bufferService.buffer.lines.length,d=Math.round(Math.max(Math.min(s,12),6)*this._coreBrowserService.dpr);u.left=d,u.center=d,u.right=d}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const d of this._decorationService.decorations)this._colorZoneStore.addDecoration(d);this._ctx.lineWidth=1;const s=this._colorZoneStore.zones;for(const d of s)d.position!=="full"&&this._renderColorZone(d);for(const d of s)d.position==="full"&&this._renderColorZone(d);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(s){this._ctx.fillStyle=s.color,this._ctx.fillRect(i[s.position||"full"],Math.round((this._canvas.height-1)*(s.startBufferLine/this._bufferService.buffers.active.lines.length)-u[s.position||"full"]/2),r[s.position||"full"],Math.round((this._canvas.height-1)*((s.endBufferLine-s.startBufferLine)/this._bufferService.buffers.active.lines.length)+u[s.position||"full"]))}_queueRefresh(s,d){this._shouldUpdateDimensions=s||this._shouldUpdateDimensions,this._shouldUpdateAnchor=d||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};n.OverviewRulerRenderer=e=c([f(2,g.IBufferService),f(3,g.IDecorationService),f(4,h.IRenderService),f(5,g.IOptionsService),f(6,h.ICoreBrowserService)],e)},2950:function(k,n,a){var c=this&&this.__decorate||function(u,r,i,e){var s,d=arguments.length,m=d<3?r:e===null?e=Object.getOwnPropertyDescriptor(r,i):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(u,r,i,e);else for(var S=u.length-1;S>=0;S--)(s=u[S])&&(m=(d<3?s(m):d>3?s(r,i,m):s(r,i))||m);return d>3&&m&&Object.defineProperty(r,i,m),m},f=this&&this.__param||function(u,r){return function(i,e){r(i,e,u)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CompositionHelper=void 0;const l=a(4725),h=a(2585),v=a(2584);let g=n.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(u,r,i,e,s,d){this._textarea=u,this._compositionView=r,this._bufferService=i,this._optionsService=e,this._coreService=s,this._renderService=d,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(u){this._compositionView.textContent=u.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(u){if(this._isComposing||this._isSendingComposition){if(u.keyCode===229||u.keyCode===16||u.keyCode===17||u.keyCode===18)return!1;this._finalizeComposition(!1)}return u.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(u){if(this._compositionView.classList.remove("active"),this._isComposing=!1,u){const r={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let i;this._isSendingComposition=!1,r.start+=this._dataAlreadySent.length,i=this._isComposing?this._textarea.value.substring(r.start,r.end):this._textarea.value.substring(r.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}}),0)}else{this._isSendingComposition=!1;const r=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(r,!0)}}_handleAnyTextareaChanges(){const u=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const r=this._textarea.value,i=r.replace(u,"");this._dataAlreadySent=i,r.length>u.length?this._coreService.triggerDataEvent(i,!0):r.length<u.length?this._coreService.triggerDataEvent(`${v.C0.DEL}`,!0):r.length===u.length&&r!==u&&this._coreService.triggerDataEvent(r,!0)}}),0)}updateCompositionElements(u){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const r=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=r*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 d=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=e+"px",this._textarea.style.width=Math.max(d.width,1)+"px",this._textarea.style.height=Math.max(d.height,1)+"px",this._textarea.style.lineHeight=d.height+"px"}u||setTimeout((()=>this.updateCompositionElements(!0)),0)}}};n.CompositionHelper=g=c([f(2,h.IBufferService),f(3,h.IOptionsService),f(4,h.ICoreService),f(5,l.IRenderService)],g)},9806:(k,n)=>{function a(c,f,l){const h=l.getBoundingClientRect(),v=c.getComputedStyle(l),g=parseInt(v.getPropertyValue("padding-left")),u=parseInt(v.getPropertyValue("padding-top"));return[f.clientX-h.left-g,f.clientY-h.top-u]}Object.defineProperty(n,"__esModule",{value:!0}),n.getCoords=n.getCoordsRelativeToElement=void 0,n.getCoordsRelativeToElement=a,n.getCoords=function(c,f,l,h,v,g,u,r,i){if(!g)return;const e=a(c,f,l);return e?(e[0]=Math.ceil((e[0]+(i?u/2:0))/u),e[1]=Math.ceil(e[1]/r),e[0]=Math.min(Math.max(e[0],1),h+(i?1:0)),e[1]=Math.min(Math.max(e[1],1),v),e):void 0}},9504:(k,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.moveToCellSequence=void 0;const c=a(2584);function f(r,i,e,s){const d=r-l(r,e),m=i-l(i,e),S=Math.abs(d-m)-(function(C,p,x){let T=0;const P=C-l(C,x),O=p-l(p,x);for(let B=0;B<Math.abs(P-O);B++){const H=h(C,p)==="A"?-1:1,U=x.buffer.lines.get(P+H*B);U!=null&&U.isWrapped&&T++}return T})(r,i,e);return u(S,g(h(r,i),s))}function l(r,i){let e=0,s=i.buffer.lines.get(r),d=s==null?void 0:s.isWrapped;for(;d&&r>=0&&r<i.rows;)e++,s=i.buffer.lines.get(--r),d=s==null?void 0:s.isWrapped;return e}function h(r,i){return r>i?"A":"B"}function v(r,i,e,s,d,m){let S=r,C=i,p="";for(;S!==e||C!==s;)S+=d?1:-1,d&&S>m.cols-1?(p+=m.buffer.translateBufferLineToString(C,!1,r,S),S=0,r=0,C++):!d&&S<0&&(p+=m.buffer.translateBufferLineToString(C,!1,0,r+1),S=m.cols-1,r=S,C--);return p+m.buffer.translateBufferLineToString(C,!1,r,S)}function g(r,i){const e=i?"O":"[";return c.C0.ESC+e+r}function u(r,i){r=Math.floor(r);let e="";for(let s=0;s<r;s++)e+=i;return e}n.moveToCellSequence=function(r,i,e,s){const d=e.buffer.x,m=e.buffer.y;if(!e.buffer.hasScrollback)return(function(p,x,T,P,O,B){return f(x,P,O,B).length===0?"":u(v(p,x,p,x-l(x,O),!1,O).length,g("D",B))})(d,m,0,i,e,s)+f(m,i,e,s)+(function(p,x,T,P,O,B){let H;H=f(x,P,O,B).length>0?P-l(P,O):x;const U=P,J=(function(Q,X,E,A,R,M){let z;return z=f(E,A,R,M).length>0?A-l(A,R):X,Q<E&&z<=A||Q>=E&&z<A?"C":"D"})(p,x,T,P,O,B);return u(v(p,H,T,U,J==="C",O).length,g(J,B))})(d,m,r,i,e,s);let S;if(m===i)return S=d>r?"D":"C",u(Math.abs(d-r),g(S,s));S=m>i?"D":"C";const C=Math.abs(m-i);return u((function(p,x){return x.cols-p})(m>i?r:d,e)+(C-1)*e.cols+1+((m>i?d:r)-1),g(S,s))}},1296:function(k,n,a){var c=this&&this.__decorate||function(B,H,U,J){var Q,X=arguments.length,E=X<3?H:J===null?J=Object.getOwnPropertyDescriptor(H,U):J;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(B,H,U,J);else for(var A=B.length-1;A>=0;A--)(Q=B[A])&&(E=(X<3?Q(E):X>3?Q(H,U,E):Q(H,U))||E);return X>3&&E&&Object.defineProperty(H,U,E),E},f=this&&this.__param||function(B,H){return function(U,J){H(U,J,B)}};Object.defineProperty(n,"__esModule",{value:!0}),n.DomRenderer=void 0;const l=a(3787),h=a(2550),v=a(2223),g=a(6171),u=a(6052),r=a(4725),i=a(8055),e=a(8460),s=a(844),d=a(2585),m="xterm-dom-renderer-owner-",S="xterm-rows",C="xterm-fg-",p="xterm-bg-",x="xterm-focus",T="xterm-selection";let P=1,O=n.DomRenderer=class extends s.Disposable{constructor(B,H,U,J,Q,X,E,A,R,M,z,q,te){super(),this._terminal=B,this._document=H,this._element=U,this._screenElement=J,this._viewportElement=Q,this._helperContainer=X,this._linkifier2=E,this._charSizeService=R,this._optionsService=M,this._bufferService=z,this._coreBrowserService=q,this._themeService=te,this._terminalClass=P++,this._rowElements=[],this._selectionRenderModel=(0,u.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((re=>this._injectCss(re)))),this._injectCss(this._themeService.colors),this._rowFactory=A.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((re=>this._handleLinkHover(re)))),this.register(this._linkifier2.onHideLinkUnderline((re=>this._handleLinkLeave(re)))),this.register((0,s.toDisposable)((()=>{this._element.classList.remove(m+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new h.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 B=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*B,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*B),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/B),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/B),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 U of this._rowElements)U.style.width=`${this.dimensions.css.canvas.width}px`,U.style.height=`${this.dimensions.css.cell.height}px`,U.style.lineHeight=`${this.dimensions.css.cell.height}px`,U.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(B){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let H=`${this._terminalSelector} .${S} { color: ${B.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(B.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 U=`blink_underline_${this._terminalClass}`,J=`blink_bar_${this._terminalClass}`,Q=`blink_block_${this._terminalClass}`;H+=`@keyframes ${U} { 50% { border-bottom-style: hidden; }}`,H+=`@keyframes ${J} { 50% { box-shadow: none; }}`,H+=`@keyframes ${Q} { 0% { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css}; } 50% { background-color: inherit; color: ${B.cursor.css}; }}`,H+=`${this._terminalSelector} .${S}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${U} 1s step-end infinite;}${this._terminalSelector} .${S}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${J} 1s step-end infinite;}${this._terminalSelector} .${S}.${x} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-block { background-color: ${B.cursor.css}; color: ${B.cursorAccent.css};}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${B.cursor.css} !important; color: ${B.cursorAccent.css} !important;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${B.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${B.cursor.css} inset;}${this._terminalSelector} .${S} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${B.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: ${B.selectionBackgroundOpaque.css};}${this._terminalSelector} .${T} div { position: absolute; background-color: ${B.selectionInactiveBackgroundOpaque.css};}`;for(const[X,E]of B.ansi.entries())H+=`${this._terminalSelector} .${C}${X} { color: ${E.css}; }${this._terminalSelector} .${C}${X}.xterm-dim { color: ${i.color.multiplyOpacity(E,.5).css}; }${this._terminalSelector} .${p}${X} { background-color: ${E.css}; }`;H+=`${this._terminalSelector} .${C}${v.INVERTED_DEFAULT_COLOR} { color: ${i.color.opaque(B.background).css}; }${this._terminalSelector} .${C}${v.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${i.color.multiplyOpacity(i.color.opaque(B.background),.5).css}; }${this._terminalSelector} .${p}${v.INVERTED_DEFAULT_COLOR} { background-color: ${B.foreground.css}; }`,this._themeStyleElement.textContent=H}_setDefaultSpacing(){const B=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${B}px`,this._rowFactory.defaultSpacing=B}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(B,H){for(let U=this._rowElements.length;U<=H;U++){const J=this._document.createElement("div");this._rowContainer.appendChild(J),this._rowElements.push(J)}for(;this._rowElements.length>H;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(B,H){this._refreshRowElements(B,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(B,H,U){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(B,H,U),this.renderRows(0,this._bufferService.rows-1),!B||!H)return;this._selectionRenderModel.update(this._terminal,B,H,U);const J=this._selectionRenderModel.viewportStartRow,Q=this._selectionRenderModel.viewportEndRow,X=this._selectionRenderModel.viewportCappedStartRow,E=this._selectionRenderModel.viewportCappedEndRow;if(X>=this._bufferService.rows||E<0)return;const A=this._document.createDocumentFragment();if(U){const R=B[0]>H[0];A.appendChild(this._createSelectionElement(X,R?H[0]:B[0],R?B[0]:H[0],E-X+1))}else{const R=J===X?B[0]:0,M=X===Q?H[0]:this._bufferService.cols;A.appendChild(this._createSelectionElement(X,R,M));const z=E-X-1;if(A.appendChild(this._createSelectionElement(X+1,0,this._bufferService.cols,z)),X!==E){const q=Q===E?H[0]:this._bufferService.cols;A.appendChild(this._createSelectionElement(E,0,q))}}this._selectionContainer.appendChild(A)}_createSelectionElement(B,H,U,J=1){const Q=this._document.createElement("div"),X=H*this.dimensions.css.cell.width;let E=this.dimensions.css.cell.width*(U-H);return X+E>this.dimensions.css.canvas.width&&(E=this.dimensions.css.canvas.width-X),Q.style.height=J*this.dimensions.css.cell.height+"px",Q.style.top=B*this.dimensions.css.cell.height+"px",Q.style.left=`${X}px`,Q.style.width=`${E}px`,Q}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 B of this._rowElements)B.replaceChildren()}renderRows(B,H){const U=this._bufferService.buffer,J=U.ybase+U.y,Q=Math.min(U.x,this._bufferService.cols-1),X=this._optionsService.rawOptions.cursorBlink,E=this._optionsService.rawOptions.cursorStyle,A=this._optionsService.rawOptions.cursorInactiveStyle;for(let R=B;R<=H;R++){const M=R+U.ydisp,z=this._rowElements[R],q=U.lines.get(M);if(!z||!q)break;z.replaceChildren(...this._rowFactory.createRow(q,M,M===J,E,A,Q,X,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${m}${this._terminalClass}`}_handleLinkHover(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!0)}_handleLinkLeave(B){this._setCellUnderline(B.x1,B.x2,B.y1,B.y2,B.cols,!1)}_setCellUnderline(B,H,U,J,Q,X){U<0&&(B=0),J<0&&(H=0);const E=this._bufferService.rows-1;U=Math.max(Math.min(U,E),0),J=Math.max(Math.min(J,E),0),Q=Math.min(Q,this._bufferService.cols);const A=this._bufferService.buffer,R=A.ybase+A.y,M=Math.min(A.x,Q-1),z=this._optionsService.rawOptions.cursorBlink,q=this._optionsService.rawOptions.cursorStyle,te=this._optionsService.rawOptions.cursorInactiveStyle;for(let re=U;re<=J;++re){const I=re+A.ydisp,D=this._rowElements[re],G=A.lines.get(I);if(!D||!G)break;D.replaceChildren(...this._rowFactory.createRow(G,I,I===R,q,te,M,z,this.dimensions.css.cell.width,this._widthCache,X?re===U?B:0:-1,X?(re===J?H:Q)-1:-1))}}};n.DomRenderer=O=c([f(7,d.IInstantiationService),f(8,r.ICharSizeService),f(9,d.IOptionsService),f(10,d.IBufferService),f(11,r.ICoreBrowserService),f(12,r.IThemeService)],O)},3787:function(k,n,a){var c=this&&this.__decorate||function(S,C,p,x){var T,P=arguments.length,O=P<3?C:x===null?x=Object.getOwnPropertyDescriptor(C,p):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(S,C,p,x);else for(var B=S.length-1;B>=0;B--)(T=S[B])&&(O=(P<3?T(O):P>3?T(C,p,O):T(C,p))||O);return P>3&&O&&Object.defineProperty(C,p,O),O},f=this&&this.__param||function(S,C){return function(p,x){C(p,x,S)}};Object.defineProperty(n,"__esModule",{value:!0}),n.DomRendererRowFactory=void 0;const l=a(2223),h=a(643),v=a(511),g=a(2585),u=a(8055),r=a(4725),i=a(4269),e=a(6171),s=a(3734);let d=n.DomRendererRowFactory=class{constructor(S,C,p,x,T,P,O){this._document=S,this._characterJoinerService=C,this._optionsService=p,this._coreBrowserService=x,this._coreService=T,this._decorationService=P,this._themeService=O,this._workCell=new v.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(S,C,p){this._selectionStart=S,this._selectionEnd=C,this._columnSelectMode=p}createRow(S,C,p,x,T,P,O,B,H,U,J){const Q=[],X=this._characterJoinerService.getJoinedCharacters(C),E=this._themeService.colors;let A,R=S.getNoBgTrimmedLength();p&&R<P+1&&(R=P+1);let M=0,z="",q=0,te=0,re=0,I=!1,D=0,G=!1,F=0;const ie=[],Z=U!==-1&&J!==-1;for(let ce=0;ce<R;ce++){S.loadCell(ce,this._workCell);let me=this._workCell.getWidth();if(me===0)continue;let Ce=!1,Ie=ce,le=this._workCell;if(X.length>0&&ce===X[0][0]){Ce=!0;const Le=X.shift();le=new i.JoinedCellData(this._workCell,S.translateToString(!0,Le[0],Le[1]),Le[1]-Le[0]),Ie=Le[1]-1,me=le.getWidth()}const _t=this._isCellInSelection(ce,C),ot=p&&ce===P,xt=Z&&ce>=U&&ce<=J;let Et=!1;this._decorationService.forEachDecorationAtCell(ce,C,void 0,(Le=>{Et=!0}));let at=le.getChars()||h.WHITESPACE_CELL_CHAR;if(at===" "&&(le.isUnderline()||le.isOverline())&&(at=" "),F=me*B-H.get(at,le.isBold(),le.isItalic()),A){if(M&&(_t&&G||!_t&&!G&&le.bg===q)&&(_t&&G&&E.selectionForeground||le.fg===te)&&le.extended.ext===re&&xt===I&&F===D&&!ot&&!Ce&&!Et){le.isInvisible()?z+=h.WHITESPACE_CELL_CHAR:z+=at,M++;continue}M&&(A.textContent=z),A=this._document.createElement("span"),M=0,z=""}else A=this._document.createElement("span");if(q=le.bg,te=le.fg,re=le.extended.ext,I=xt,D=F,G=_t,Ce&&P>=ce&&P<=Ie&&(P=ce),!this._coreService.isCursorHidden&&ot&&this._coreService.isCursorInitialized){if(ie.push("xterm-cursor"),this._coreBrowserService.isFocused)O&&ie.push("xterm-cursor-blink"),ie.push(x==="bar"?"xterm-cursor-bar":x==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(T)switch(T){case"outline":ie.push("xterm-cursor-outline");break;case"block":ie.push("xterm-cursor-block");break;case"bar":ie.push("xterm-cursor-bar");break;case"underline":ie.push("xterm-cursor-underline")}}if(le.isBold()&&ie.push("xterm-bold"),le.isItalic()&&ie.push("xterm-italic"),le.isDim()&&ie.push("xterm-dim"),z=le.isInvisible()?h.WHITESPACE_CELL_CHAR:le.getChars()||h.WHITESPACE_CELL_CHAR,le.isUnderline()&&(ie.push(`xterm-underline-${le.extended.underlineStyle}`),z===" "&&(z=" "),!le.isUnderlineColorDefault()))if(le.isUnderlineColorRGB())A.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(le.getUnderlineColor()).join(",")})`;else{let Le=le.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&le.isBold()&&Le<8&&(Le+=8),A.style.textDecorationColor=E.ansi[Le].css}le.isOverline()&&(ie.push("xterm-overline"),z===" "&&(z=" ")),le.isStrikethrough()&&ie.push("xterm-strikethrough"),xt&&(A.style.textDecoration="underline");let Ae=le.getFgColor(),de=le.getFgColorMode(),ge=le.getBgColor(),ye=le.getBgColorMode();const xe=!!le.isInverse();if(xe){const Le=Ae;Ae=ge,ge=Le;const Lr=de;de=ye,ye=Lr}let ke,lt,et,Ht=!1;switch(this._decorationService.forEachDecorationAtCell(ce,C,void 0,(Le=>{Le.options.layer!=="top"&&Ht||(Le.backgroundColorRGB&&(ye=50331648,ge=Le.backgroundColorRGB.rgba>>8&16777215,ke=Le.backgroundColorRGB),Le.foregroundColorRGB&&(de=50331648,Ae=Le.foregroundColorRGB.rgba>>8&16777215,lt=Le.foregroundColorRGB),Ht=Le.options.layer==="top")})),!Ht&&_t&&(ke=this._coreBrowserService.isFocused?E.selectionBackgroundOpaque:E.selectionInactiveBackgroundOpaque,ge=ke.rgba>>8&16777215,ye=50331648,Ht=!0,E.selectionForeground&&(de=50331648,Ae=E.selectionForeground.rgba>>8&16777215,lt=E.selectionForeground)),Ht&&ie.push("xterm-decoration-top"),ye){case 16777216:case 33554432:et=E.ansi[ge],ie.push(`xterm-bg-${ge}`);break;case 50331648:et=u.channels.toColor(ge>>16,ge>>8&255,255&ge),this._addStyle(A,`background-color:#${m((ge>>>0).toString(16),"0",6)}`);break;default:xe?(et=E.foreground,ie.push(`xterm-bg-${l.INVERTED_DEFAULT_COLOR}`)):et=E.background}switch(ke||le.isDim()&&(ke=u.color.multiplyOpacity(et,.5)),de){case 16777216:case 33554432:le.isBold()&&Ae<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(Ae+=8),this._applyMinimumContrast(A,et,E.ansi[Ae],le,ke,void 0)||ie.push(`xterm-fg-${Ae}`);break;case 50331648:const Le=u.channels.toColor(Ae>>16&255,Ae>>8&255,255&Ae);this._applyMinimumContrast(A,et,Le,le,ke,lt)||this._addStyle(A,`color:#${m(Ae.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(A,et,E.foreground,le,ke,lt)||xe&&ie.push(`xterm-fg-${l.INVERTED_DEFAULT_COLOR}`)}ie.length&&(A.className=ie.join(" "),ie.length=0),ot||Ce||Et?A.textContent=z:M++,F!==this.defaultSpacing&&(A.style.letterSpacing=`${F}px`),Q.push(A),ce=Ie}return A&&M&&(A.textContent=z),Q}_applyMinimumContrast(S,C,p,x,T,P){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,e.treatGlyphAsBackgroundColor)(x.getCode()))return!1;const O=this._getContrastCache(x);let B;if(T||P||(B=O.getColor(C.rgba,p.rgba)),B===void 0){const H=this._optionsService.rawOptions.minimumContrastRatio/(x.isDim()?2:1);B=u.color.ensureContrastRatio(T||C,P||p,H),O.setColor((T||C).rgba,(P||p).rgba,B??null)}return!!B&&(this._addStyle(S,`color:${B.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 p=this._selectionStart,x=this._selectionEnd;return!(!p||!x)&&(this._columnSelectMode?p[0]<=x[0]?S>=p[0]&&C>=p[1]&&S<x[0]&&C<=x[1]:S<p[0]&&C>=p[1]&&S>=x[0]&&C<=x[1]:C>p[1]&&C<x[1]||p[1]===x[1]&&C===p[1]&&S>=p[0]&&S<x[0]||p[1]<x[1]&&C===x[1]&&S<x[0]||p[1]<x[1]&&C===p[1]&&S>=p[0])}};function m(S,C,p){for(;S.length<p;)S=C+S;return S}n.DomRendererRowFactory=d=c([f(1,r.ICharacterJoinerService),f(2,g.IOptionsService),f(3,r.ICoreBrowserService),f(4,g.ICoreService),f(5,g.IDecorationService),f(6,r.IThemeService)],d)},2550:(k,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 h=a.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontStyle="italic";const v=a.createElement("span");v.classList.add("xterm-char-measure-element"),v.style.fontWeight="bold",v.style.fontStyle="italic",this._measureElements=[f,l,h,v],this._container.appendChild(f),this._container.appendChild(l),this._container.appendChild(h),this._container.appendChild(v),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 h=a;c&&(h+="B"),f&&(h+="I");let v=this._holey.get(h);if(v===void 0){let g=0;c&&(g|=1),f&&(g|=2),v=this._measure(a,g),v>0&&this._holey.set(h,v)}return v}_measure(a,c){const f=this._measureElements[c];return f.textContent=a.repeat(32),f.offsetWidth/32}}},2223:(k,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:(k,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,h,v){return l===1&&h>Math.ceil(1.5*v)&&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,h=0){return(f-(2*Math.round(l)-h))%(2*Math.round(l))}},6052:(k,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,h,v=!1){if(this.selectionStart=l,this.selectionEnd=h,!l||!h||l[0]===h[0]&&l[1]===h[1])return void this.clear();const g=f.buffers.active.ydisp,u=l[1]-g,r=h[1]-g,i=Math.max(u,0),e=Math.min(r,f.rows-1);i>=f.rows||e<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=v,this.viewportStartRow=u,this.viewportEndRow=r,this.viewportCappedStartRow=i,this.viewportCappedEndRow=e,this.startCol=l[0],this.endCol=h[0])}isCellSelected(f,l,h){return!!this.hasSelection&&(h-=f.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?l>=this.startCol&&h>=this.viewportCappedStartRow&&l<this.endCol&&h<=this.viewportCappedEndRow:l<this.startCol&&h>=this.viewportCappedStartRow&&l>=this.endCol&&h<=this.viewportCappedEndRow:h>this.viewportStartRow&&h<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&h===this.viewportStartRow&&l>=this.startCol&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&h===this.viewportEndRow&&l<this.endCol||this.viewportStartRow<this.viewportEndRow&&h===this.viewportStartRow&&l>=this.startCol)}}n.createSelectionRenderModel=function(){return new a}},456:(k,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(k,n,a){var c=this&&this.__decorate||function(e,s,d,m){var S,C=arguments.length,p=C<3?s:m===null?m=Object.getOwnPropertyDescriptor(s,d):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,d,m);else for(var x=e.length-1;x>=0;x--)(S=e[x])&&(p=(C<3?S(p):C>3?S(s,d,p):S(s,d))||p);return C>3&&p&&Object.defineProperty(s,d,p),p},f=this&&this.__param||function(e,s){return function(d,m){s(d,m,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CharSizeService=void 0;const l=a(2585),h=a(8460),v=a(844);let g=n.CharSizeService=class extends v.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,s,d){super(),this._optionsService=d,this.width=0,this.height=0,this._onCharSizeChange=this.register(new h.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new i(this._optionsService))}catch{this._measureStrategy=this.register(new r(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 u extends v.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(s,d){s!==void 0&&s>0&&d!==void 0&&d>0&&(this._result.width=s,this._result.height=d)}}class r extends u{constructor(s,d,m){super(),this._document=s,this._parentElement=d,this._optionsService=m,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class i extends u{constructor(s){super(),this._optionsService=s,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const d=this._ctx.measureText("W");if(!("width"in d&&"fontBoundingBoxAscent"in d&&"fontBoundingBoxDescent"in d))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const s=this._ctx.measureText("W");return this._validateAndSet(s.width,s.fontBoundingBoxAscent+s.fontBoundingBoxDescent),this._result}}},4269:function(k,n,a){var c=this&&this.__decorate||function(i,e,s,d){var m,S=arguments.length,C=S<3?e:d===null?d=Object.getOwnPropertyDescriptor(e,s):d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(i,e,s,d);else for(var p=i.length-1;p>=0;p--)(m=i[p])&&(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,d){e(s,d,i)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CharacterJoinerService=n.JoinedCellData=void 0;const l=a(3734),h=a(643),v=a(511),g=a(2585);class u extends l.AttributeData{constructor(e,s,d){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=s,this._width=d}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=u;let r=n.CharacterJoinerService=class Do{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new v.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 d=[],m=s.translateToString(!0);let S=0,C=0,p=0,x=s.getFg(0),T=s.getBg(0);for(let P=0;P<s.getTrimmedLength();P++)if(s.loadCell(P,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==x||this._workCell.bg!==T){if(P-S>1){const O=this._getJoinedRanges(m,p,C,s,S);for(let B=0;B<O.length;B++)d.push(O[B])}S=P,p=C,x=this._workCell.fg,T=this._workCell.bg}C+=this._workCell.getChars().length||h.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-S>1){const P=this._getJoinedRanges(m,p,C,s,S);for(let O=0;O<P.length;O++)d.push(P[O])}return d}_getJoinedRanges(e,s,d,m,S){const C=e.substring(s,d);let p=[];try{p=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 P=0;P<T.length;P++)Do._mergeRanges(p,T[P])}catch(T){console.error(T)}return this._stringRangesToCellRanges(p,m,S),p}_stringRangesToCellRanges(e,s,d){let m=0,S=!1,C=0,p=e[m];if(p){for(let x=d;x<this._bufferService.cols;x++){const T=s.getWidth(x),P=s.getString(x).length||h.WHITESPACE_CELL_CHAR.length;if(T!==0){if(!S&&p[0]<=C&&(p[0]=x,S=!0),p[1]<=C){if(p[1]=x,p=e[++m],!p)break;p[0]<=C?(p[0]=x,S=!0):S=!1}C+=P}}p&&(p[1]=this._bufferService.cols)}}static _mergeRanges(e,s){let d=!1;for(let m=0;m<e.length;m++){const S=e[m];if(d){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]),d=!0)}}return d?e[e.length-1][1]=s[1]:e.push(s),e}};n.CharacterJoinerService=r=c([f(0,g.IBufferService)],r)},5114:(k,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoreBrowserService=void 0;const c=a(844),f=a(8460),l=a(3656);class h extends c.Disposable{constructor(u,r,i){super(),this._textarea=u,this._window=r,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new v(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(u){this._window!==u&&(this._window=u,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}n.CoreBrowserService=h;class v extends c.Disposable{constructor(u){super(),this._parentWindow=u,this._windowResizeListener=this.register(new c.MutableDisposable),this._onDprChange=this.register(new f.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,c.toDisposable)((()=>this.clearListener())))}setWindow(u){this._parentWindow=u,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,l.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var u;this._outerListener&&((u=this._resolutionMediaMatchList)==null||u.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(k,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(h){return this.linkProviders.push(h),{dispose:()=>{const v=this.linkProviders.indexOf(h);v!==-1&&this.linkProviders.splice(v,1)}}}}n.LinkProviderService=f},8934:function(k,n,a){var c=this&&this.__decorate||function(g,u,r,i){var e,s=arguments.length,d=s<3?u:i===null?i=Object.getOwnPropertyDescriptor(u,r):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")d=Reflect.decorate(g,u,r,i);else for(var m=g.length-1;m>=0;m--)(e=g[m])&&(d=(s<3?e(d):s>3?e(u,r,d):e(u,r))||d);return s>3&&d&&Object.defineProperty(u,r,d),d},f=this&&this.__param||function(g,u){return function(r,i){u(r,i,g)}};Object.defineProperty(n,"__esModule",{value:!0}),n.MouseService=void 0;const l=a(4725),h=a(9806);let v=n.MouseService=class{constructor(g,u){this._renderService=g,this._charSizeService=u}getCoords(g,u,r,i,e){return(0,h.getCoords)(window,g,u,r,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,e)}getMouseReportCoords(g,u){const r=(0,h.getCoordsRelativeToElement)(window,g,u);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};n.MouseService=v=c([f(0,l.IRenderService),f(1,l.ICharSizeService)],v)},3230:function(k,n,a){var c=this&&this.__decorate||function(e,s,d,m){var S,C=arguments.length,p=C<3?s:m===null?m=Object.getOwnPropertyDescriptor(s,d):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,d,m);else for(var x=e.length-1;x>=0;x--)(S=e[x])&&(p=(C<3?S(p):C>3?S(s,d,p):S(s,d))||p);return C>3&&p&&Object.defineProperty(s,d,p),p},f=this&&this.__param||function(e,s){return function(d,m){s(d,m,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.RenderService=void 0;const l=a(6193),h=a(4725),v=a(8460),g=a(844),u=a(7226),r=a(2585);let i=n.RenderService=class extends g.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,s,d,m,S,C,p,x){super(),this._rowCount=e,this._charSizeService=m,this._renderer=this.register(new g.MutableDisposable),this._pausedResizeTask=new u.DebouncedIdleTask,this._observerDisposable=this.register(new g.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new v.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new v.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new v.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new v.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new l.RenderDebouncer(((T,P)=>this._renderRows(T,P)),p),this.register(this._renderDebouncer),this.register(p.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(d.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(S.onDecorationRegistered((()=>this._fullRefresh()))),this.register(S.onDecorationRemoved((()=>this._fullRefresh()))),this.register(d.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(C.cols,C.rows),this._fullRefresh()}))),this.register(d.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(C.buffer.y,C.buffer.y,!0)))),this.register(x.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(p.window,s),this.register(p.onWindowChange((T=>this._registerIntersectionObserver(T,s))))}_registerIntersectionObserver(e,s){if("IntersectionObserver"in e){const d=new e.IntersectionObserver((m=>this._handleIntersectionChange(m[m.length-1])),{threshold:0});d.observe(s),this._observerDisposable.value=(0,g.toDisposable)((()=>d.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,d=!1){this._isPaused?this._needsFullRefresh=!0:(d||(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 d;return(d=this._renderer.value)==null?void 0:d.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,d){var m;this._selectionState.start=e,this._selectionState.end=s,this._selectionState.columnSelectMode=d,(m=this._renderer.value)==null||m.handleSelectionChanged(e,s,d)}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,r.IOptionsService),f(3,h.ICharSizeService),f(4,r.IDecorationService),f(5,r.IBufferService),f(6,h.ICoreBrowserService),f(7,h.IThemeService)],i)},9312:function(k,n,a){var c=this&&this.__decorate||function(p,x,T,P){var O,B=arguments.length,H=B<3?x:P===null?P=Object.getOwnPropertyDescriptor(x,T):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")H=Reflect.decorate(p,x,T,P);else for(var U=p.length-1;U>=0;U--)(O=p[U])&&(H=(B<3?O(H):B>3?O(x,T,H):O(x,T))||H);return B>3&&H&&Object.defineProperty(x,T,H),H},f=this&&this.__param||function(p,x){return function(T,P){x(T,P,p)}};Object.defineProperty(n,"__esModule",{value:!0}),n.SelectionService=void 0;const l=a(9806),h=a(9504),v=a(456),g=a(4725),u=a(8460),r=a(844),i=a(6114),e=a(4841),s=a(511),d=a(2585),m=" ",S=new RegExp(m,"g");let C=n.SelectionService=class extends r.Disposable{constructor(p,x,T,P,O,B,H,U,J){super(),this._element=p,this._screenElement=x,this._linkifier=T,this._bufferService=P,this._coreService=O,this._mouseService=B,this._optionsService=H,this._renderService=U,this._coreBrowserService=J,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new s.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new u.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new u.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new u.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new u.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=Q=>this._handleMouseMove(Q),this._mouseUpListener=Q=>this._handleMouseUp(Q),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Q=>this._handleTrim(Q))),this.register(this._bufferService.buffers.onBufferActivate((Q=>this._handleBufferActivate(Q)))),this.enable(),this._model=new v.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,r.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 p=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;return!(!p||!x||p[0]===x[0]&&p[1]===x[1])}get selectionText(){const p=this._model.finalSelectionStart,x=this._model.finalSelectionEnd;if(!p||!x)return"";const T=this._bufferService.buffer,P=[];if(this._activeSelectionMode===3){if(p[0]===x[0])return"";const O=p[0]<x[0]?p[0]:x[0],B=p[0]<x[0]?x[0]:p[0];for(let H=p[1];H<=x[1];H++){const U=T.translateBufferLineToString(H,!0,O,B);P.push(U)}}else{const O=p[1]===x[1]?x[0]:void 0;P.push(T.translateBufferLineToString(p[1],!0,p[0],O));for(let B=p[1]+1;B<=x[1]-1;B++){const H=T.lines.get(B),U=T.translateBufferLineToString(B,!0);H!=null&&H.isWrapped?P[P.length-1]+=U:P.push(U)}if(p[1]!==x[1]){const B=T.lines.get(x[1]),H=T.translateBufferLineToString(x[1],!0,0,x[0]);B&&B.isWrapped?P[P.length-1]+=H:P.push(H)}}return P.map((O=>O.replace(S," "))).join(i.isWindows?`\r
|
|
7
|
+
`:`
|
|
8
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(p){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),i.isLinux&&p&&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(p){const x=this._getMouseBufferCoords(p),T=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!!(T&&P&&x)&&this._areCoordsInSelection(x,T,P)}isCellInSelection(p,x){const T=this._model.finalSelectionStart,P=this._model.finalSelectionEnd;return!(!T||!P)&&this._areCoordsInSelection([p,x],T,P)}_areCoordsInSelection(p,x,T){return p[1]>x[1]&&p[1]<T[1]||x[1]===T[1]&&p[1]===x[1]&&p[0]>=x[0]&&p[0]<T[0]||x[1]<T[1]&&p[1]===T[1]&&p[0]<T[0]||x[1]<T[1]&&p[1]===x[1]&&p[0]>=x[0]}_selectWordAtCursor(p,x){var O,B;const T=(B=(O=this._linkifier.currentLink)==null?void 0:O.link)==null?void 0:B.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 P=this._getMouseBufferCoords(p);return!!P&&(this._selectWordAt(P,x),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(p,x){this._model.clearSelection(),p=Math.max(p,0),x=Math.min(x,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,p],this._model.selectionEnd=[this._bufferService.cols,x],this.refresh(),this._onSelectionChange.fire()}_handleTrim(p){this._model.handleTrim(p)&&this.refresh()}_getMouseBufferCoords(p){const x=this._mouseService.getCoords(p,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(x)return x[0]--,x[1]--,x[1]+=this._bufferService.buffer.ydisp,x}_getMouseEventScrollAmount(p){let x=(0,l.getCoordsRelativeToElement)(this._coreBrowserService.window,p,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(p){return i.isMac?p.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:p.shiftKey}handleMouseDown(p){if(this._mouseDownTimeStamp=p.timeStamp,(p.button!==2||!this.hasSelection)&&p.button===0){if(!this._enabled){if(!this.shouldForceSelection(p))return;p.stopPropagation()}p.preventDefault(),this._dragScrollAmount=0,this._enabled&&p.shiftKey?this._handleIncrementalClick(p):p.detail===1?this._handleSingleClick(p):p.detail===2?this._handleDoubleClick(p):p.detail===3&&this._handleTripleClick(p),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(p){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(p))}_handleSingleClick(p){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(p)?3:0,this._model.selectionStart=this._getMouseBufferCoords(p),!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(p){this._selectWordAtCursor(p,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(p){const x=this._getMouseBufferCoords(p);x&&(this._activeSelectionMode=2,this._selectLineAt(x[1]))}shouldColumnSelect(p){return p.altKey&&!(i.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(p){if(p.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(p),!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(p),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 P=T.lines.get(this._model.selectionEnd[1]);P&&P.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 p=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(p.ydisp+this._bufferService.rows,p.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=p.ydisp),this.refresh()}}_handleMouseUp(p){const x=p.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&x<500&&p.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const T=this._mouseService.getCoords(p,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(T&&T[0]!==void 0&&T[1]!==void 0){const P=(0,h.moveToCellSequence)(T[0]-1,T[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(P,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const p=this._model.finalSelectionStart,x=this._model.finalSelectionEnd,T=!(!p||!x||p[0]===x[0]&&p[1]===x[1]);T?p&&x&&(this._oldSelectionStart&&this._oldSelectionEnd&&p[0]===this._oldSelectionStart[0]&&p[1]===this._oldSelectionStart[1]&&x[0]===this._oldSelectionEnd[0]&&x[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(p,x,T)):this._oldHasSelection&&this._fireOnSelectionChange(p,x,T)}_fireOnSelectionChange(p,x,T){this._oldSelectionStart=p,this._oldSelectionEnd=x,this._oldHasSelection=T,this._onSelectionChange.fire()}_handleBufferActivate(p){this.clearSelection(),this._trimListener.dispose(),this._trimListener=p.activeBuffer.lines.onTrim((x=>this._handleTrim(x)))}_convertViewportColToCharacterIndex(p,x){let T=x;for(let P=0;x>=P;P++){const O=p.loadCell(P,this._workCell).getChars().length;this._workCell.getWidth()===0?T--:O>1&&x!==P&&(T+=O-1)}return T}setSelection(p,x,T){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[p,x],this._model.selectionStartLength=T,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(p){this._isClickInSelection(p)||(this._selectWordAtCursor(p,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(p,x,T=!0,P=!0){if(p[0]>=this._bufferService.cols)return;const O=this._bufferService.buffer,B=O.lines.get(p[1]);if(!B)return;const H=O.translateBufferLineToString(p[1],!1);let U=this._convertViewportColToCharacterIndex(B,p[0]),J=U;const Q=p[0]-U;let X=0,E=0,A=0,R=0;if(H.charAt(U)===" "){for(;U>0&&H.charAt(U-1)===" ";)U--;for(;J<H.length&&H.charAt(J+1)===" ";)J++}else{let q=p[0],te=p[0];B.getWidth(q)===0&&(X++,q--),B.getWidth(te)===2&&(E++,te++);const re=B.getString(te).length;for(re>1&&(R+=re-1,J+=re-1);q>0&&U>0&&!this._isCharWordSeparator(B.loadCell(q-1,this._workCell));){B.loadCell(q-1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===0?(X++,q--):I>1&&(A+=I-1,U-=I-1),U--,q--}for(;te<B.length&&J+1<H.length&&!this._isCharWordSeparator(B.loadCell(te+1,this._workCell));){B.loadCell(te+1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===2?(E++,te++):I>1&&(R+=I-1,J+=I-1),J++,te++}}J++;let M=U+Q-X+A,z=Math.min(this._bufferService.cols,J-U+X+E-A-R);if(x||H.slice(U,J).trim()!==""){if(T&&M===0&&B.getCodePoint(0)!==32){const q=O.lines.get(p[1]-1);if(q&&B.isWrapped&&q.getCodePoint(this._bufferService.cols-1)!==32){const te=this._getWordAt([this._bufferService.cols-1,p[1]-1],!1,!0,!1);if(te){const re=this._bufferService.cols-te.start;M-=re,z+=re}}}if(P&&M+z===this._bufferService.cols&&B.getCodePoint(this._bufferService.cols-1)!==32){const q=O.lines.get(p[1]+1);if(q!=null&&q.isWrapped&&q.getCodePoint(0)!==32){const te=this._getWordAt([0,p[1]+1],!1,!1,!0);te&&(z+=te.length)}}return{start:M,length:z}}}_selectWordAt(p,x){const T=this._getWordAt(p,x);if(T){for(;T.start<0;)T.start+=this._bufferService.cols,p[1]--;this._model.selectionStart=[T.start,p[1]],this._model.selectionStartLength=T.length}}_selectToWordAt(p){const x=this._getWordAt(p,!0);if(x){let T=p[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(p){return p.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(p.getChars())>=0}_selectLineAt(p){const x=this._bufferService.buffer.getWrappedRangeForLine(p),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,d.IBufferService),f(4,d.ICoreService),f(5,g.IMouseService),f(6,d.IOptionsService),f(7,g.IRenderService),f(8,g.ICoreBrowserService)],C)},4725:(k,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(k,n,a){var c=this&&this.__decorate||function(C,p,x,T){var P,O=arguments.length,B=O<3?p:T===null?T=Object.getOwnPropertyDescriptor(p,x):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(C,p,x,T);else for(var H=C.length-1;H>=0;H--)(P=C[H])&&(B=(O<3?P(B):O>3?P(p,x,B):P(p,x))||B);return O>3&&B&&Object.defineProperty(p,x,B),B},f=this&&this.__param||function(C,p){return function(x,T){p(x,T,C)}};Object.defineProperty(n,"__esModule",{value:!0}),n.ThemeService=n.DEFAULT_ANSI_COLORS=void 0;const l=a(7239),h=a(8055),v=a(8460),g=a(844),u=a(2585),r=h.css.toColor("#ffffff"),i=h.css.toColor("#000000"),e=h.css.toColor("#ffffff"),s=h.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};n.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const C=[h.css.toColor("#2e3436"),h.css.toColor("#cc0000"),h.css.toColor("#4e9a06"),h.css.toColor("#c4a000"),h.css.toColor("#3465a4"),h.css.toColor("#75507b"),h.css.toColor("#06989a"),h.css.toColor("#d3d7cf"),h.css.toColor("#555753"),h.css.toColor("#ef2929"),h.css.toColor("#8ae234"),h.css.toColor("#fce94f"),h.css.toColor("#729fcf"),h.css.toColor("#ad7fa8"),h.css.toColor("#34e2e2"),h.css.toColor("#eeeeec")],p=[0,95,135,175,215,255];for(let x=0;x<216;x++){const T=p[x/36%6|0],P=p[x/6%6|0],O=p[x%6];C.push({css:h.channels.toCss(T,P,O),rgba:h.channels.toRgba(T,P,O)})}for(let x=0;x<24;x++){const T=8+10*x;C.push({css:h.channels.toCss(T,T,T),rgba:h.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 v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:r,background:i,cursor:e,cursorAccent:s,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:h.color.blend(i,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:h.color.blend(i,d),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 p=this._colors;if(p.foreground=S(C.foreground,r),p.background=S(C.background,i),p.cursor=S(C.cursor,e),p.cursorAccent=S(C.cursorAccent,s),p.selectionBackgroundTransparent=S(C.selectionBackground,d),p.selectionBackgroundOpaque=h.color.blend(p.background,p.selectionBackgroundTransparent),p.selectionInactiveBackgroundTransparent=S(C.selectionInactiveBackground,p.selectionBackgroundTransparent),p.selectionInactiveBackgroundOpaque=h.color.blend(p.background,p.selectionInactiveBackgroundTransparent),p.selectionForeground=C.selectionForeground?S(C.selectionForeground,h.NULL_COLOR):void 0,p.selectionForeground===h.NULL_COLOR&&(p.selectionForeground=void 0),h.color.isOpaque(p.selectionBackgroundTransparent)&&(p.selectionBackgroundTransparent=h.color.opacity(p.selectionBackgroundTransparent,.3)),h.color.isOpaque(p.selectionInactiveBackgroundTransparent)&&(p.selectionInactiveBackgroundTransparent=h.color.opacity(p.selectionInactiveBackgroundTransparent,.3)),p.ansi=n.DEFAULT_ANSI_COLORS.slice(),p.ansi[0]=S(C.black,n.DEFAULT_ANSI_COLORS[0]),p.ansi[1]=S(C.red,n.DEFAULT_ANSI_COLORS[1]),p.ansi[2]=S(C.green,n.DEFAULT_ANSI_COLORS[2]),p.ansi[3]=S(C.yellow,n.DEFAULT_ANSI_COLORS[3]),p.ansi[4]=S(C.blue,n.DEFAULT_ANSI_COLORS[4]),p.ansi[5]=S(C.magenta,n.DEFAULT_ANSI_COLORS[5]),p.ansi[6]=S(C.cyan,n.DEFAULT_ANSI_COLORS[6]),p.ansi[7]=S(C.white,n.DEFAULT_ANSI_COLORS[7]),p.ansi[8]=S(C.brightBlack,n.DEFAULT_ANSI_COLORS[8]),p.ansi[9]=S(C.brightRed,n.DEFAULT_ANSI_COLORS[9]),p.ansi[10]=S(C.brightGreen,n.DEFAULT_ANSI_COLORS[10]),p.ansi[11]=S(C.brightYellow,n.DEFAULT_ANSI_COLORS[11]),p.ansi[12]=S(C.brightBlue,n.DEFAULT_ANSI_COLORS[12]),p.ansi[13]=S(C.brightMagenta,n.DEFAULT_ANSI_COLORS[13]),p.ansi[14]=S(C.brightCyan,n.DEFAULT_ANSI_COLORS[14]),p.ansi[15]=S(C.brightWhite,n.DEFAULT_ANSI_COLORS[15]),C.extendedAnsi){const x=Math.min(p.ansi.length-16,C.extendedAnsi.length);for(let T=0;T<x;T++)p.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 p=0;p<this._restoreColors.ansi.length;++p)this._colors.ansi[p]=this._restoreColors.ansi[p]}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,p){if(C!==void 0)try{return h.css.toColor(C)}catch{}return p}n.ThemeService=m=c([f(0,u.IOptionsService)],m)},6349:(k,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(v){super(),this._maxLength=v,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(v){if(this._maxLength===v)return;const g=new Array(v);for(let u=0;u<Math.min(v,this.length);u++)g[u]=this._array[this._getCyclicIndex(u)];this._array=g,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let g=this._length;g<v;g++)this._array[g]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,g){this._array[this._getCyclicIndex(v)]=g}push(v){this._array[this._getCyclicIndex(this._length)]=v,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(v,g,...u){if(g){for(let r=v;r<this._length-g;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+g)];this._length-=g,this.onDeleteEmitter.fire({index:v,amount:g})}for(let r=this._length-1;r>=v;r--)this._array[this._getCyclicIndex(r+u.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<u.length;r++)this._array[this._getCyclicIndex(v+r)]=u[r];if(u.length&&this.onInsertEmitter.fire({index:v,amount:u.length}),this._length+u.length>this._maxLength){const r=this._length+u.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=u.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,g,u){if(!(g<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+u<0)throw new Error("Cannot shift elements in list beyond index 0");if(u>0){for(let i=g-1;i>=0;i--)this.set(v+i+u,this.get(v+i));const r=v+g+u-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<g;r++)this.set(v+r+u,this.get(v+r))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}n.CircularList=l},1439:(k,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 h in c)l[h]=f<=1?c[h]:c[h]&&a(c[h],f-1);return l}},8055:(k,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 h,v,g,u,r;function i(s){const d=s.toString(16);return d.length<2?"0"+d:d}function e(s,d){return s<d?(d+.05)/(s+.05):(s+.05)/(d+.05)}n.NULL_COLOR={css:"#00000000",rgba:0},(function(s){s.toCss=function(d,m,S,C){return C!==void 0?`#${i(d)}${i(m)}${i(S)}${i(C)}`:`#${i(d)}${i(m)}${i(S)}`},s.toRgba=function(d,m,S,C=255){return(d<<24|m<<16|S<<8|C)>>>0},s.toColor=function(d,m,S,C){return{css:s.toCss(d,m,S,C),rgba:s.toRgba(d,m,S,C)}}})(h||(n.channels=h={})),(function(s){function d(m,S){return l=Math.round(255*S),[a,c,f]=r.toChannels(m.rgba),{css:h.toCss(a,c,f,l),rgba:h.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,p=S.rgba>>16&255,x=S.rgba>>8&255,T=m.rgba>>24&255,P=m.rgba>>16&255,O=m.rgba>>8&255;return a=T+Math.round((C-T)*l),c=P+Math.round((p-P)*l),f=O+Math.round((x-O)*l),{css:h.toCss(a,c,f),rgba:h.toRgba(a,c,f)}},s.isOpaque=function(m){return(255&m.rgba)==255},s.ensureContrastRatio=function(m,S,C){const p=r.ensureContrastRatio(m.rgba,S.rgba,C);if(p)return h.toColor(p>>24&255,p>>16&255,p>>8&255)},s.opaque=function(m){const S=(255|m.rgba)>>>0;return[a,c,f]=r.toChannels(S),{css:h.toCss(a,c,f),rgba:S}},s.opacity=d,s.multiplyOpacity=function(m,S){return l=255&m.rgba,d(m,l*S/255)},s.toColorRGB=function(m){return[m.rgba>>24&255,m.rgba>>16&255,m.rgba>>8&255]}})(v||(n.color=v={})),(function(s){let d,m;try{const S=document.createElement("canvas");S.width=1,S.height=1;const C=S.getContext("2d",{willReadFrequently:!0});C&&(d=C,d.globalCompositeOperation="copy",m=d.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),h.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),h.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]))),h.toColor(a,c,f,l);if(!d||!m)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=m,d.fillStyle=S,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[a,c,f,l]=d.getImageData(0,0,1,1).data,l!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:h.toRgba(a,c,f,l),css:S}}})(g||(n.css=g={})),(function(s){function d(m,S,C){const p=m/255,x=S/255,T=C/255;return .2126*(p<=.03928?p/12.92:Math.pow((p+.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 d(m>>16&255,m>>8&255,255&m)},s.relativeLuminance2=d})(u||(n.rgb=u={})),(function(s){function d(S,C,p){const x=S>>24&255,T=S>>16&255,P=S>>8&255;let O=C>>24&255,B=C>>16&255,H=C>>8&255,U=e(u.relativeLuminance2(O,B,H),u.relativeLuminance2(x,T,P));for(;U<p&&(O>0||B>0||H>0);)O-=Math.max(0,Math.ceil(.1*O)),B-=Math.max(0,Math.ceil(.1*B)),H-=Math.max(0,Math.ceil(.1*H)),U=e(u.relativeLuminance2(O,B,H),u.relativeLuminance2(x,T,P));return(O<<24|B<<16|H<<8|255)>>>0}function m(S,C,p){const x=S>>24&255,T=S>>16&255,P=S>>8&255;let O=C>>24&255,B=C>>16&255,H=C>>8&255,U=e(u.relativeLuminance2(O,B,H),u.relativeLuminance2(x,T,P));for(;U<p&&(O<255||B<255||H<255);)O=Math.min(255,O+Math.ceil(.1*(255-O))),B=Math.min(255,B+Math.ceil(.1*(255-B))),H=Math.min(255,H+Math.ceil(.1*(255-H))),U=e(u.relativeLuminance2(O,B,H),u.relativeLuminance2(x,T,P));return(O<<24|B<<16|H<<8|255)>>>0}s.blend=function(S,C){if(l=(255&C)/255,l===1)return C;const p=C>>24&255,x=C>>16&255,T=C>>8&255,P=S>>24&255,O=S>>16&255,B=S>>8&255;return a=P+Math.round((p-P)*l),c=O+Math.round((x-O)*l),f=B+Math.round((T-B)*l),h.toRgba(a,c,f)},s.ensureContrastRatio=function(S,C,p){const x=u.relativeLuminance(S>>8),T=u.relativeLuminance(C>>8);if(e(x,T)<p){if(T<x){const B=d(S,C,p),H=e(x,u.relativeLuminance(B>>8));if(H<p){const U=m(S,C,p);return H>e(x,u.relativeLuminance(U>>8))?B:U}return B}const P=m(S,C,p),O=e(x,u.relativeLuminance(P>>8));if(O<p){const B=d(S,C,p);return O>e(x,u.relativeLuminance(B>>8))?P:B}return P}},s.reduceLuminance=d,s.increaseLuminance=m,s.toChannels=function(S){return[S>>24&255,S>>16&255,S>>8&255,255&S]}})(r||(n.rgba=r={})),n.toPaddedHex=i,n.contrastRatio=e},8969:(k,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoreTerminal=void 0;const c=a(844),f=a(2585),l=a(4348),h=a(7866),v=a(744),g=a(7302),u=a(6975),r=a(8460),i=a(1753),e=a(1480),s=a(7994),d=a(9282),m=a(5435),S=a(5981),C=a(2660);let p=!1;class x extends c.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new r.EventEmitter),this._onScroll.event((P=>{var O;(O=this._onScrollApi)==null||O.fire(P.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(P){for(const O in P)this.optionsService.options[O]=P[O]}constructor(P){super(),this._windowsWrappingHeuristics=this.register(new c.MutableDisposable),this._onBinary=this.register(new r.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new r.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new r.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new r.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new r.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new r.EventEmitter),this._instantiationService=new l.InstantiationService,this.optionsService=this.register(new g.OptionsService(P)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(h.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(u.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(i.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(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,r.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,r.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,r.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,r.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,B)=>this._inputHandler.parse(O,B)))),this.register((0,r.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(P,O){this._writeBuffer.write(P,O)}writeSync(P,O){this._logService.logLevel<=f.LogLevelEnum.WARN&&!p&&(this._logService.warn("writeSync is unreliable and will be removed soon."),p=!0),this._writeBuffer.writeSync(P,O)}input(P,O=!0){this.coreService.triggerDataEvent(P,O)}resize(P,O){isNaN(P)||isNaN(O)||(P=Math.max(P,v.MINIMUM_COLS),O=Math.max(O,v.MINIMUM_ROWS),this._bufferService.resize(P,O))}scroll(P,O=!1){this._bufferService.scroll(P,O)}scrollLines(P,O,B){this._bufferService.scrollLines(P,O,B)}scrollPages(P){this.scrollLines(P*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(P){const O=P-this._bufferService.buffer.ydisp;O!==0&&this.scrollLines(O)}registerEscHandler(P,O){return this._inputHandler.registerEscHandler(P,O)}registerDcsHandler(P,O){return this._inputHandler.registerDcsHandler(P,O)}registerCsiHandler(P,O){return this._inputHandler.registerCsiHandler(P,O)}registerOscHandler(P,O){return this._inputHandler.registerOscHandler(P,O)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let P=!1;const O=this.optionsService.rawOptions.windowsPty;O&&O.buildNumber!==void 0&&O.buildNumber!==void 0?P=O.backend==="conpty"&&O.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(P=!0),P?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const P=[];P.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),P.push(this.registerCsiHandler({final:"H"},(()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,c.toDisposable)((()=>{for(const O of P)O.dispose()}))}}}n.CoreTerminal=x},8460:(k,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(k,n,a){var c=this&&this.__decorate||function(X,E,A,R){var M,z=arguments.length,q=z<3?E:R===null?R=Object.getOwnPropertyDescriptor(E,A):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(X,E,A,R);else for(var te=X.length-1;te>=0;te--)(M=X[te])&&(q=(z<3?M(q):z>3?M(E,A,q):M(E,A))||q);return z>3&&q&&Object.defineProperty(E,A,q),q},f=this&&this.__param||function(X,E){return function(A,R){E(A,R,X)}};Object.defineProperty(n,"__esModule",{value:!0}),n.InputHandler=n.WindowsOptionsReportType=void 0;const l=a(2584),h=a(7116),v=a(2015),g=a(844),u=a(482),r=a(8437),i=a(8460),e=a(643),s=a(511),d=a(3734),m=a(2585),S=a(1480),C=a(6242),p=a(6351),x=a(5941),T={"(":0,")":1,"*":2,"+":3,"-":1,".":2},P=131072;function O(X,E){if(X>24)return E.setWinLines||!1;switch(X){case 1:return!!E.restoreWin;case 2:return!!E.minimizeWin;case 3:return!!E.setWinPosition;case 4:return!!E.setWinSizePixels;case 5:return!!E.raiseWin;case 6:return!!E.lowerWin;case 7:return!!E.refreshWin;case 8:return!!E.setWinSizeChars;case 9:return!!E.maximizeWin;case 10:return!!E.fullscreenWin;case 11:return!!E.getWinState;case 13:return!!E.getWinPosition;case 14:return!!E.getWinSizePixels;case 15:return!!E.getScreenSizePixels;case 16:return!!E.getCellSizePixels;case 18:return!!E.getWinSizeChars;case 19:return!!E.getScreenSizeChars;case 20:return!!E.getIconTitle;case 21:return!!E.getWinTitle;case 22:return!!E.pushTitle;case 23:return!!E.popTitle;case 24:return!!E.setWinLines}return!1}var B;(function(X){X[X.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",X[X.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(B||(n.WindowsOptionsReportType=B={}));let H=0;class U extends g.Disposable{getAttrData(){return this._curAttrData}constructor(E,A,R,M,z,q,te,re,I=new v.EscapeSequenceParser){super(),this._bufferService=E,this._charsetService=A,this._coreService=R,this._logService=M,this._optionsService=z,this._oscLinkService=q,this._coreMouseService=te,this._unicodeService=re,this._parser=I,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new u.StringToUtf32,this._utf8Decoder=new u.Utf8ToUtf32,this._workCell=new s.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=r.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=r.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 J(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((D=>this._activeBuffer=D.activeBuffer))),this._parser.setCsiHandlerFallback(((D,G)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(D),params:G.toArray()})})),this._parser.setEscHandlerFallback((D=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(D)})})),this._parser.setExecuteHandlerFallback((D=>{this._logService.debug("Unknown EXECUTE code: ",{code:D})})),this._parser.setOscHandlerFallback(((D,G,F)=>{this._logService.debug("Unknown OSC code: ",{identifier:D,action:G,data:F})})),this._parser.setDcsHandlerFallback(((D,G,F)=>{G==="HOOK"&&(F=F.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(D),action:G,payload:F})})),this._parser.setPrintHandler(((D,G,F)=>this.print(D,G,F))),this._parser.registerCsiHandler({final:"@"},(D=>this.insertChars(D))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(D=>this.scrollLeft(D))),this._parser.registerCsiHandler({final:"A"},(D=>this.cursorUp(D))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(D=>this.scrollRight(D))),this._parser.registerCsiHandler({final:"B"},(D=>this.cursorDown(D))),this._parser.registerCsiHandler({final:"C"},(D=>this.cursorForward(D))),this._parser.registerCsiHandler({final:"D"},(D=>this.cursorBackward(D))),this._parser.registerCsiHandler({final:"E"},(D=>this.cursorNextLine(D))),this._parser.registerCsiHandler({final:"F"},(D=>this.cursorPrecedingLine(D))),this._parser.registerCsiHandler({final:"G"},(D=>this.cursorCharAbsolute(D))),this._parser.registerCsiHandler({final:"H"},(D=>this.cursorPosition(D))),this._parser.registerCsiHandler({final:"I"},(D=>this.cursorForwardTab(D))),this._parser.registerCsiHandler({final:"J"},(D=>this.eraseInDisplay(D,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(D=>this.eraseInDisplay(D,!0))),this._parser.registerCsiHandler({final:"K"},(D=>this.eraseInLine(D,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(D=>this.eraseInLine(D,!0))),this._parser.registerCsiHandler({final:"L"},(D=>this.insertLines(D))),this._parser.registerCsiHandler({final:"M"},(D=>this.deleteLines(D))),this._parser.registerCsiHandler({final:"P"},(D=>this.deleteChars(D))),this._parser.registerCsiHandler({final:"S"},(D=>this.scrollUp(D))),this._parser.registerCsiHandler({final:"T"},(D=>this.scrollDown(D))),this._parser.registerCsiHandler({final:"X"},(D=>this.eraseChars(D))),this._parser.registerCsiHandler({final:"Z"},(D=>this.cursorBackwardTab(D))),this._parser.registerCsiHandler({final:"`"},(D=>this.charPosAbsolute(D))),this._parser.registerCsiHandler({final:"a"},(D=>this.hPositionRelative(D))),this._parser.registerCsiHandler({final:"b"},(D=>this.repeatPrecedingCharacter(D))),this._parser.registerCsiHandler({final:"c"},(D=>this.sendDeviceAttributesPrimary(D))),this._parser.registerCsiHandler({prefix:">",final:"c"},(D=>this.sendDeviceAttributesSecondary(D))),this._parser.registerCsiHandler({final:"d"},(D=>this.linePosAbsolute(D))),this._parser.registerCsiHandler({final:"e"},(D=>this.vPositionRelative(D))),this._parser.registerCsiHandler({final:"f"},(D=>this.hVPosition(D))),this._parser.registerCsiHandler({final:"g"},(D=>this.tabClear(D))),this._parser.registerCsiHandler({final:"h"},(D=>this.setMode(D))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(D=>this.setModePrivate(D))),this._parser.registerCsiHandler({final:"l"},(D=>this.resetMode(D))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(D=>this.resetModePrivate(D))),this._parser.registerCsiHandler({final:"m"},(D=>this.charAttributes(D))),this._parser.registerCsiHandler({final:"n"},(D=>this.deviceStatus(D))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(D=>this.deviceStatusPrivate(D))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(D=>this.softReset(D))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(D=>this.setCursorStyle(D))),this._parser.registerCsiHandler({final:"r"},(D=>this.setScrollRegion(D))),this._parser.registerCsiHandler({final:"s"},(D=>this.saveCursor(D))),this._parser.registerCsiHandler({final:"t"},(D=>this.windowOptions(D))),this._parser.registerCsiHandler({final:"u"},(D=>this.restoreCursor(D))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(D=>this.insertColumns(D))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(D=>this.deleteColumns(D))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(D=>this.selectProtected(D))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(D=>this.requestMode(D,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(D=>this.requestMode(D,!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((D=>(this.setTitle(D),this.setIconName(D),!0)))),this._parser.registerOscHandler(1,new C.OscHandler((D=>this.setIconName(D)))),this._parser.registerOscHandler(2,new C.OscHandler((D=>this.setTitle(D)))),this._parser.registerOscHandler(4,new C.OscHandler((D=>this.setOrReportIndexedColor(D)))),this._parser.registerOscHandler(8,new C.OscHandler((D=>this.setHyperlink(D)))),this._parser.registerOscHandler(10,new C.OscHandler((D=>this.setOrReportFgColor(D)))),this._parser.registerOscHandler(11,new C.OscHandler((D=>this.setOrReportBgColor(D)))),this._parser.registerOscHandler(12,new C.OscHandler((D=>this.setOrReportCursorColor(D)))),this._parser.registerOscHandler(104,new C.OscHandler((D=>this.restoreIndexedColor(D)))),this._parser.registerOscHandler(110,new C.OscHandler((D=>this.restoreFgColor(D)))),this._parser.registerOscHandler(111,new C.OscHandler((D=>this.restoreBgColor(D)))),this._parser.registerOscHandler(112,new C.OscHandler((D=>this.restoreCursorColor(D)))),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 D in h.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:D},(()=>this.selectCharset("("+D))),this._parser.registerEscHandler({intermediates:")",final:D},(()=>this.selectCharset(")"+D))),this._parser.registerEscHandler({intermediates:"*",final:D},(()=>this.selectCharset("*"+D))),this._parser.registerEscHandler({intermediates:"+",final:D},(()=>this.selectCharset("+"+D))),this._parser.registerEscHandler({intermediates:"-",final:D},(()=>this.selectCharset("-"+D))),this._parser.registerEscHandler({intermediates:".",final:D},(()=>this.selectCharset("."+D))),this._parser.registerEscHandler({intermediates:"/",final:D},(()=>this.selectCharset("/"+D)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((D=>(this._logService.error("Parsing error: ",D),D))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new p.DcsHandler(((D,G)=>this.requestStatusString(D,G))))}_preserveStack(E,A,R,M){this._parseStack.paused=!0,this._parseStack.cursorStartX=E,this._parseStack.cursorStartY=A,this._parseStack.decodedLength=R,this._parseStack.position=M}_logSlowResolvingAsync(E){this._logService.logLevel<=m.LogLevelEnum.WARN&&Promise.race([E,new Promise(((A,R)=>setTimeout((()=>R("#SLOW_TIMEOUT")),5e3)))]).catch((A=>{if(A!=="#SLOW_TIMEOUT")throw A;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(E,A){let R,M=this._activeBuffer.x,z=this._activeBuffer.y,q=0;const te=this._parseStack.paused;if(te){if(R=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,A))return this._logSlowResolvingAsync(R),R;M=this._parseStack.cursorStartX,z=this._parseStack.cursorStartY,this._parseStack.paused=!1,E.length>P&&(q=this._parseStack.position+P)}if(this._logService.logLevel<=m.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof E=="string"?` "${E}"`:` "${Array.prototype.map.call(E,(D=>String.fromCharCode(D))).join("")}"`),typeof E=="string"?E.split("").map((D=>D.charCodeAt(0))):E),this._parseBuffer.length<E.length&&this._parseBuffer.length<P&&(this._parseBuffer=new Uint32Array(Math.min(E.length,P))),te||this._dirtyRowTracker.clearRange(),E.length>P)for(let D=q;D<E.length;D+=P){const G=D+P<E.length?D+P:E.length,F=typeof E=="string"?this._stringDecoder.decode(E.substring(D,G),this._parseBuffer):this._utf8Decoder.decode(E.subarray(D,G),this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,F))return this._preserveStack(M,z,F,D),this._logSlowResolvingAsync(R),R}else if(!te){const D=typeof E=="string"?this._stringDecoder.decode(E,this._parseBuffer):this._utf8Decoder.decode(E,this._parseBuffer);if(R=this._parser.parse(this._parseBuffer,D))return this._preserveStack(M,z,D,0),this._logSlowResolvingAsync(R),R}this._activeBuffer.x===M&&this._activeBuffer.y===z||this._onCursorMove.fire();const re=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),I=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);I<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(I,this._bufferService.rows-1),Math.min(re,this._bufferService.rows-1))}print(E,A,R){let M,z;const q=this._charsetService.charset,te=this._optionsService.rawOptions.screenReaderMode,re=this._bufferService.cols,I=this._coreService.decPrivateModes.wraparound,D=this._coreService.modes.insertMode,G=this._curAttrData;let F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&R-A>0&&F.getWidth(this._activeBuffer.x-1)===2&&F.setCellFromCodepoint(this._activeBuffer.x-1,0,1,G);let ie=this._parser.precedingJoinState;for(let Z=A;Z<R;++Z){if(M=E[Z],M<127&&q){const Ie=q[String.fromCharCode(M)];Ie&&(M=Ie.charCodeAt(0))}const ce=this._unicodeService.charProperties(M,ie);z=S.UnicodeService.extractWidth(ce);const me=S.UnicodeService.extractShouldJoin(ce),Ce=me?S.UnicodeService.extractWidth(ie):0;if(ie=ce,te&&this._onA11yChar.fire((0,u.stringFromCodePoint)(M)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+z-Ce>re){if(I){const Ie=F;let le=this._activeBuffer.x-Ce;for(this._activeBuffer.x=Ce,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),F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Ce>0&&F instanceof r.BufferLine&&F.copyCellsFrom(Ie,le,0,Ce,!1);le<re;)Ie.setCellFromCodepoint(le++,0,1,G)}else if(this._activeBuffer.x=re-1,z===2)continue}if(me&&this._activeBuffer.x){const Ie=F.getWidth(this._activeBuffer.x-1)?1:2;F.addCodepointToCell(this._activeBuffer.x-Ie,M,z);for(let le=z-Ce;--le>=0;)F.setCellFromCodepoint(this._activeBuffer.x++,0,0,G)}else if(D&&(F.insertCells(this._activeBuffer.x,z-Ce,this._activeBuffer.getNullCell(G)),F.getWidth(re-1)===2&&F.setCellFromCodepoint(re-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,G)),F.setCellFromCodepoint(this._activeBuffer.x++,M,z,G),z>0)for(;--z;)F.setCellFromCodepoint(this._activeBuffer.x++,0,0,G)}this._parser.precedingJoinState=ie,this._activeBuffer.x<re&&R-A>0&&F.getWidth(this._activeBuffer.x)===0&&!F.hasContent(this._activeBuffer.x)&&F.setCellFromCodepoint(this._activeBuffer.x,0,1,G),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(E,A){return E.final!=="t"||E.prefix||E.intermediates?this._parser.registerCsiHandler(E,A):this._parser.registerCsiHandler(E,(R=>!O(R.params[0],this._optionsService.rawOptions.windowOptions)||A(R)))}registerDcsHandler(E,A){return this._parser.registerDcsHandler(E,new p.DcsHandler(A))}registerEscHandler(E,A){return this._parser.registerEscHandler(E,A)}registerOscHandler(E,A){return this._parser.registerOscHandler(E,new C.OscHandler(A))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var E;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&E.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);A.hasWidth(this._activeBuffer.x)&&!A.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const E=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-E),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(E=this._bufferService.cols-1){this._activeBuffer.x=Math.min(E,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(E,A){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=E,this._activeBuffer.y=this._activeBuffer.scrollTop+A):(this._activeBuffer.x=E,this._activeBuffer.y=A),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(E,A){this._restrictCursor(),this._setCursor(this._activeBuffer.x+E,this._activeBuffer.y+A)}cursorUp(E){const A=this._activeBuffer.y-this._activeBuffer.scrollTop;return A>=0?this._moveCursor(0,-Math.min(A,E.params[0]||1)):this._moveCursor(0,-(E.params[0]||1)),!0}cursorDown(E){const A=this._activeBuffer.scrollBottom-this._activeBuffer.y;return A>=0?this._moveCursor(0,Math.min(A,E.params[0]||1)):this._moveCursor(0,E.params[0]||1),!0}cursorForward(E){return this._moveCursor(E.params[0]||1,0),!0}cursorBackward(E){return this._moveCursor(-(E.params[0]||1),0),!0}cursorNextLine(E){return this.cursorDown(E),this._activeBuffer.x=0,!0}cursorPrecedingLine(E){return this.cursorUp(E),this._activeBuffer.x=0,!0}cursorCharAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(E){return this._setCursor(E.length>=2?(E.params[1]||1)-1:0,(E.params[0]||1)-1),!0}charPosAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(E){return this._moveCursor(E.params[0]||1,0),!0}linePosAbsolute(E){return this._setCursor(this._activeBuffer.x,(E.params[0]||1)-1),!0}vPositionRelative(E){return this._moveCursor(0,E.params[0]||1),!0}hVPosition(E){return this.cursorPosition(E),!0}tabClear(E){const A=E.params[0];return A===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:A===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let A=E.params[0]||1;for(;A--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let A=E.params[0]||1;for(;A--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(E){const A=E.params[0];return A===1&&(this._curAttrData.bg|=536870912),A!==2&&A!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(E,A,R,M=!1,z=!1){const q=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);q.replaceCells(A,R,this._activeBuffer.getNullCell(this._eraseAttrData()),z),M&&(q.isWrapped=!1)}_resetBufferLine(E,A=!1){const R=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);R&&(R.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),A),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+E),R.isWrapped=!1)}eraseInDisplay(E,A=!1){let R;switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,A);R<this._bufferService.rows;R++)this._resetBufferLine(R,A);this._dirtyRowTracker.markDirty(R);break;case 1:for(R=this._activeBuffer.y,this._dirtyRowTracker.markDirty(R),this._eraseInBufferLine(R,0,this._activeBuffer.x+1,!0,A),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(R+1).isWrapped=!1);R--;)this._resetBufferLine(R,A);this._dirtyRowTracker.markDirty(0);break;case 2:for(R=this._bufferService.rows,this._dirtyRowTracker.markDirty(R-1);R--;)this._resetBufferLine(R,A);this._dirtyRowTracker.markDirty(0);break;case 3:const M=this._activeBuffer.lines.length-this._bufferService.rows;M>0&&(this._activeBuffer.lines.trimStart(M),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-M,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-M,0),this._onScroll.fire(0))}return!0}eraseInLine(E,A=!1){switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,A);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,A);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,A)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(E){this._restrictCursor();let A=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y,M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,z=this._bufferService.rows-1+this._activeBuffer.ybase-M+1;for(;A--;)this._activeBuffer.lines.splice(z-1,1),this._activeBuffer.lines.splice(R,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(E){this._restrictCursor();let A=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const R=this._activeBuffer.ybase+this._activeBuffer.y;let M;for(M=this._bufferService.rows-1-this._activeBuffer.scrollBottom,M=this._bufferService.rows-1+this._activeBuffer.ybase-M;A--;)this._activeBuffer.lines.splice(R,1),this._activeBuffer.lines.splice(M,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(E){this._restrictCursor();const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.insertCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(E){this._restrictCursor();const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.deleteCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(E){let A=E.params[0]||1;for(;A--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(E){let A=E.params[0]||1;for(;A--;)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(r.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=E.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);M.deleteCells(0,A,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=E.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);M.insertCells(0,A,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=E.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);M.insertCells(this._activeBuffer.x,A,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=E.params[0]||1;for(let R=this._activeBuffer.scrollTop;R<=this._activeBuffer.scrollBottom;++R){const M=this._activeBuffer.lines.get(this._activeBuffer.ybase+R);M.deleteCells(this._activeBuffer.x,A,this._activeBuffer.getNullCell(this._eraseAttrData())),M.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(E){this._restrictCursor();const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return A&&(A.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(E.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(E){const A=this._parser.precedingJoinState;if(!A)return!0;const R=E.params[0]||1,M=S.UnicodeService.extractWidth(A),z=this._activeBuffer.x-M,q=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(z),te=new Uint32Array(q.length*R);let re=0;for(let D=0;D<q.length;){const G=q.codePointAt(D)||0;te[re++]=G,D+=G>65535?2:1}let I=re;for(let D=1;D<R;++D)te.copyWithin(I,0,re),I+=re;return this.print(te,0,I),!0}sendDeviceAttributesPrimary(E){return E.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(E){return E.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(E.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(l.C0.ESC+"[>83;40003;0c")),!0}_is(E){return(this._optionsService.rawOptions.termName+"").indexOf(E)===0}setMode(E){for(let A=0;A<E.length;A++)switch(E.params[A]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(E){for(let A=0;A<E.length;A++)switch(E.params[A]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,h.DEFAULT_CHARSET),this._charsetService.setgCharset(1,h.DEFAULT_CHARSET),this._charsetService.setgCharset(2,h.DEFAULT_CHARSET),this._charsetService.setgCharset(3,h.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(E){for(let A=0;A<E.length;A++)switch(E.params[A]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(E){for(let A=0;A<E.length;A++)switch(E.params[A]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),E.params[A]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(E,A){const R=this._coreService.decPrivateModes,{activeProtocol:M,activeEncoding:z}=this._coreMouseService,q=this._coreService,{buffers:te,cols:re}=this._bufferService,{active:I,alt:D}=te,G=this._optionsService.rawOptions,F=me=>me?1:2,ie=E.params[0];return Z=ie,ce=A?ie===2?4:ie===4?F(q.modes.insertMode):ie===12?3:ie===20?F(G.convertEol):0:ie===1?F(R.applicationCursorKeys):ie===3?G.windowOptions.setWinLines?re===80?2:re===132?1:0:0:ie===6?F(R.origin):ie===7?F(R.wraparound):ie===8?3:ie===9?F(M==="X10"):ie===12?F(G.cursorBlink):ie===25?F(!q.isCursorHidden):ie===45?F(R.reverseWraparound):ie===66?F(R.applicationKeypad):ie===67?4:ie===1e3?F(M==="VT200"):ie===1002?F(M==="DRAG"):ie===1003?F(M==="ANY"):ie===1004?F(R.sendFocus):ie===1005?4:ie===1006?F(z==="SGR"):ie===1015?4:ie===1016?F(z==="SGR_PIXELS"):ie===1048?1:ie===47||ie===1047||ie===1049?F(I===D):ie===2004?F(R.bracketedPasteMode):0,q.triggerDataEvent(`${l.C0.ESC}[${A?"":"?"}${Z};${ce}$y`),!0;var Z,ce}_updateAttrColor(E,A,R,M,z){return A===2?(E|=50331648,E&=-16777216,E|=d.AttributeData.fromColorRGB([R,M,z])):A===5&&(E&=-50331904,E|=33554432|255&R),E}_extractColor(E,A,R){const M=[0,0,-1,0,0,0];let z=0,q=0;do{if(M[q+z]=E.params[A+q],E.hasSubParams(A+q)){const te=E.getSubParams(A+q);let re=0;do M[1]===5&&(z=1),M[q+re+1+z]=te[re];while(++re<te.length&&re+q+1+z<M.length);break}if(M[1]===5&&q+z>=2||M[1]===2&&q+z>=5)break;M[1]&&(z=1)}while(++q+A<E.length&&q+z<M.length);for(let te=2;te<M.length;++te)M[te]===-1&&(M[te]=0);switch(M[0]){case 38:R.fg=this._updateAttrColor(R.fg,M[1],M[3],M[4],M[5]);break;case 48:R.bg=this._updateAttrColor(R.bg,M[1],M[3],M[4],M[5]);break;case 58:R.extended=R.extended.clone(),R.extended.underlineColor=this._updateAttrColor(R.extended.underlineColor,M[1],M[3],M[4],M[5])}return q}_processUnderline(E,A){A.extended=A.extended.clone(),(!~E||E>5)&&(E=1),A.extended.underlineStyle=E,A.fg|=268435456,E===0&&(A.fg&=-268435457),A.updateExtended()}_processSGR0(E){E.fg=r.DEFAULT_ATTR_DATA.fg,E.bg=r.DEFAULT_ATTR_DATA.bg,E.extended=E.extended.clone(),E.extended.underlineStyle=0,E.extended.underlineColor&=-67108864,E.updateExtended()}charAttributes(E){if(E.length===1&&E.params[0]===0)return this._processSGR0(this._curAttrData),!0;const A=E.length;let R;const M=this._curAttrData;for(let z=0;z<A;z++)R=E.params[z],R>=30&&R<=37?(M.fg&=-50331904,M.fg|=16777216|R-30):R>=40&&R<=47?(M.bg&=-50331904,M.bg|=16777216|R-40):R>=90&&R<=97?(M.fg&=-50331904,M.fg|=16777224|R-90):R>=100&&R<=107?(M.bg&=-50331904,M.bg|=16777224|R-100):R===0?this._processSGR0(M):R===1?M.fg|=134217728:R===3?M.bg|=67108864:R===4?(M.fg|=268435456,this._processUnderline(E.hasSubParams(z)?E.getSubParams(z)[0]:1,M)):R===5?M.fg|=536870912:R===7?M.fg|=67108864:R===8?M.fg|=1073741824:R===9?M.fg|=2147483648:R===2?M.bg|=134217728:R===21?this._processUnderline(2,M):R===22?(M.fg&=-134217729,M.bg&=-134217729):R===23?M.bg&=-67108865:R===24?(M.fg&=-268435457,this._processUnderline(0,M)):R===25?M.fg&=-536870913:R===27?M.fg&=-67108865:R===28?M.fg&=-1073741825:R===29?M.fg&=2147483647:R===39?(M.fg&=-67108864,M.fg|=16777215&r.DEFAULT_ATTR_DATA.fg):R===49?(M.bg&=-67108864,M.bg|=16777215&r.DEFAULT_ATTR_DATA.bg):R===38||R===48||R===58?z+=this._extractColor(E,z,M):R===53?M.bg|=1073741824:R===55?M.bg&=-1073741825:R===59?(M.extended=M.extended.clone(),M.extended.underlineColor=-1,M.updateExtended()):R===100?(M.fg&=-67108864,M.fg|=16777215&r.DEFAULT_ATTR_DATA.fg,M.bg&=-67108864,M.bg|=16777215&r.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",R);return!0}deviceStatus(E){switch(E.params[0]){case 5:this._coreService.triggerDataEvent(`${l.C0.ESC}[0n`);break;case 6:const A=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[${A};${R}R`)}return!0}deviceStatusPrivate(E){if(E.params[0]===6){const A=this._activeBuffer.y+1,R=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${l.C0.ESC}[?${A};${R}R`)}return!0}softReset(E){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=r.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(E){const A=E.params[0]||1;switch(A){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 R=A%2==1;return this._optionsService.options.cursorBlink=R,!0}setScrollRegion(E){const A=E.params[0]||1;let R;return(E.length<2||(R=E.params[1])>this._bufferService.rows||R===0)&&(R=this._bufferService.rows),R>A&&(this._activeBuffer.scrollTop=A-1,this._activeBuffer.scrollBottom=R-1,this._setCursor(0,0)),!0}windowOptions(E){if(!O(E.params[0],this._optionsService.rawOptions.windowOptions))return!0;const A=E.length>1?E.params[1]:0;switch(E.params[0]){case 14:A!==2&&this._onRequestWindowsOptionsReport.fire(B.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(B.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:A!==0&&A!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),A!==0&&A!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:A!==0&&A!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),A!==0&&A!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(E){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(E){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(E){return this._windowTitle=E,this._onTitleChange.fire(E),!0}setIconName(E){return this._iconName=E,!0}setOrReportIndexedColor(E){const A=[],R=E.split(";");for(;R.length>1;){const M=R.shift(),z=R.shift();if(/^\d+$/.exec(M)){const q=parseInt(M);if(Q(q))if(z==="?")A.push({type:0,index:q});else{const te=(0,x.parseColor)(z);te&&A.push({type:1,index:q,color:te})}}}return A.length&&this._onColor.fire(A),!0}setHyperlink(E){const A=E.split(";");return!(A.length<2)&&(A[1]?this._createHyperlink(A[0],A[1]):!A[0]&&this._finishHyperlink())}_createHyperlink(E,A){this._getCurrentLinkId()&&this._finishHyperlink();const R=E.split(":");let M;const z=R.findIndex((q=>q.startsWith("id=")));return z!==-1&&(M=R[z].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:M,uri:A}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(E,A){const R=E.split(";");for(let M=0;M<R.length&&!(A>=this._specialColors.length);++M,++A)if(R[M]==="?")this._onColor.fire([{type:0,index:this._specialColors[A]}]);else{const z=(0,x.parseColor)(R[M]);z&&this._onColor.fire([{type:1,index:this._specialColors[A],color:z}])}return!0}setOrReportFgColor(E){return this._setOrReportSpecialColor(E,0)}setOrReportBgColor(E){return this._setOrReportSpecialColor(E,1)}setOrReportCursorColor(E){return this._setOrReportSpecialColor(E,2)}restoreIndexedColor(E){if(!E)return this._onColor.fire([{type:2}]),!0;const A=[],R=E.split(";");for(let M=0;M<R.length;++M)if(/^\d+$/.exec(R[M])){const z=parseInt(R[M]);Q(z)&&A.push({type:2,index:z})}return A.length&&this._onColor.fire(A),!0}restoreFgColor(E){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(E){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(E){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,h.DEFAULT_CHARSET),!0}selectCharset(E){return E.length!==2?(this.selectDefaultCharset(),!0):(E[0]==="/"||this._charsetService.setgCharset(T[E[0]],h.CHARSETS[E[1]]||h.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const E=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,E,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=r.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=r.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(E){return this._charsetService.setgLevel(E),!0}screenAlignmentPattern(){const E=new s.CellData;E.content=4194373,E.fg=this._curAttrData.fg,E.bg=this._curAttrData.bg,this._setCursor(0,0);for(let A=0;A<this._bufferService.rows;++A){const R=this._activeBuffer.ybase+this._activeBuffer.y+A,M=this._activeBuffer.lines.get(R);M&&(M.fill(E),M.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(E,A){const R=this._bufferService.buffer,M=this._optionsService.rawOptions;return(z=>(this._coreService.triggerDataEvent(`${l.C0.ESC}${z}${l.C0.ESC}\\`),!0))(E==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:E==='"p'?'P1$r61;1"p':E==="r"?`P1$r${R.scrollTop+1};${R.scrollBottom+1}r`:E==="m"?"P1$r0m":E===" q"?`P1$r${{block:2,underline:4,bar:6}[M.cursorStyle]-(M.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(E,A){this._dirtyRowTracker.markRangeDirty(E,A)}}n.InputHandler=U;let J=class{constructor(X){this._bufferService=X,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(X){X<this.start?this.start=X:X>this.end&&(this.end=X)}markRangeDirty(X,E){X>E&&(H=X,X=E,E=H),X<this.start&&(this.start=X),E>this.end&&(this.end=E)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Q(X){return 0<=X&&X<256}J=c([f(0,m.IBufferService)],J)},844:(k,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:(k,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.FourKeyMap=n.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(f,l,h){this._data[f]||(this._data[f]={}),this._data[f][l]=h}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,h,v){this._data.get(c,f)||this._data.set(c,f,new a),this._data.get(c,f).set(l,h,v)}get(c,f,l,h){var v;return(v=this._data.get(c,f))==null?void 0:v.get(l,h)}clear(){this._data.clear()}}},6114:(k,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:(k,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 h=f+l>>1;const v=this._getKey(this._array[h]);if(v>c)l=h-1;else{if(!(v<c)){for(;h>0&&this._getKey(this._array[h-1])===c;)h--;return h}f=h+1}}return f}}},7226:(k,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(v){this._tasks.push(v),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(v){this._idleCallback=void 0;let g=0,u=0,r=v.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(g=Date.now(),this._tasks[this._i]()||this._i++,g=Math.max(1,Date.now()-g),u=Math.max(g,u),i=v.timeRemaining(),1.5*u>i)return r-g<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-g))}ms`),void this._start();r=i}this.clear()}}class l extends f{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const g=Date.now()+v;return{timeRemaining:()=>Math.max(0,g-Date.now())}}}n.PriorityTaskQueue=l,n.IdleTaskQueue=!c.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(h){return requestIdleCallback(h)}_cancelCallback(h){cancelIdleCallback(h)}}:l,n.DebouncedIdleTask=class{constructor(){this._queue=new n.IdleTaskQueue}set(h){this._queue.clear(),this._queue.enqueue(h)}flush(){this._queue.flush()}}},9282:(k,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),h=l==null?void 0:l.get(f.cols-1),v=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);v&&h&&(v.isWrapped=h[c.CHAR_DATA_CODE_INDEX]!==c.NULL_CELL_CODE&&h[c.CHAR_DATA_CODE_INDEX]!==c.WHITESPACE_CELL_CODE)}},3734:(k,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,h=0){this._ext=0,this._urlId=0,this._ext=l,this._urlId=h}clone(){return new c(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}n.ExtendedAttrs=c},9092:(k,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),h=a(8437),v=a(4634),g=a(511),u=a(643),r=a(4863),i=a(7116);n.MAX_BUFFER_SIZE=4294967295,n.Buffer=class{constructor(e,s,d){this._hasScrollback=e,this._optionsService=s,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=h.DEFAULT_ATTR_DATA.clone(),this.savedCharset=i.DEFAULT_CHARSET,this.markers=[],this._nullCell=g.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]),this._whitespaceCell=g.CellData.fromCharData([0,u.WHITESPACE_CELL_CHAR,u.WHITESPACE_CELL_WIDTH,u.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new c.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(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 h.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=h.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 d=this.getNullCell(h.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 p=0;p<this.lines.length;p++)m+=+this.lines.get(p).resize(e,d);let C=0;if(this._rows<s)for(let p=this._rows;p<s;p++)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 h.BufferLine(e,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+C+1?(this.ybase--,C++,this.ydisp>0&&this.ydisp--):this.lines.push(new h.BufferLine(e,d)));else for(let p=this._rows;p>s;p--)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 p=this.lines.length-S;p>0&&(this.lines.trimStart(p),this.ybase=Math.max(this.ybase-p,0),this.ydisp=Math.max(this.ydisp-p,0),this.savedY=Math.max(this.savedY-p,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,d);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 d=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(h.DEFAULT_ATTR_DATA));if(d.length>0){const m=(0,v.reflowLargerCreateNewLayout)(this.lines,d);(0,v.reflowLargerApplyNewLayout)(this.lines,m.layout),this._reflowLargerAdjustViewport(e,s,m.countRemoved)}}_reflowLargerAdjustViewport(e,s,d){const m=this.getNullCell(h.DEFAULT_ATTR_DATA);let S=d;for(;S-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<s&&this.lines.push(new h.BufferLine(e,m))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(e,s){const d=this.getNullCell(h.DEFAULT_ATTR_DATA),m=[];let S=0;for(let C=this.lines.length-1;C>=0;C--){let p=this.lines.get(C);if(!p||!p.isWrapped&&p.getTrimmedLength()<=e)continue;const x=[p];for(;p.isWrapped&&C>0;)p=this.lines.get(--C),x.unshift(p);const T=this.ybase+this.y;if(T>=C&&T<C+x.length)continue;const P=x[x.length-1].getTrimmedLength(),O=(0,v.reflowSmallerGetNewLineLengths)(x,this._cols,e),B=O.length-x.length;let H;H=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+B):Math.max(0,this.lines.length-this.lines.maxLength+B);const U=[];for(let R=0;R<B;R++){const M=this.getBlankLine(h.DEFAULT_ATTR_DATA,!0);U.push(M)}U.length>0&&(m.push({start:C+x.length+S,newLines:U}),S+=U.length),x.push(...U);let J=O.length-1,Q=O[J];Q===0&&(J--,Q=O[J]);let X=x.length-B-1,E=P;for(;X>=0;){const R=Math.min(E,Q);if(x[J]===void 0)break;if(x[J].copyCellsFrom(x[X],E-R,Q-R,R,!0),Q-=R,Q===0&&(J--,Q=O[J]),E-=R,E===0){X--;const M=Math.max(X,0);E=(0,v.getWrappedLineTrimmedLength)(x,M,this._cols)}}for(let R=0;R<x.length;R++)O[R]<e&&x[R].setCell(O[R],d);let A=B-H;for(;A-- >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+B,this.ybase+s-1)}if(m.length>0){const C=[],p=[];for(let J=0;J<this.lines.length;J++)p.push(this.lines.get(J));const x=this.lines.length;let T=x-1,P=0,O=m[P];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+S);let B=0;for(let J=Math.min(this.lines.maxLength-1,x+S-1);J>=0;J--)if(O&&O.start>T+B){for(let Q=O.newLines.length-1;Q>=0;Q--)this.lines.set(J--,O.newLines[Q]);J++,C.push({index:T+1,amount:O.newLines.length}),B+=O.newLines.length,O=m[++P]}else this.lines.set(J,p[T--]);let H=0;for(let J=C.length-1;J>=0;J--)C[J].index+=H,this.lines.onInsertEmitter.fire(C[J]),H+=C[J].amount;const U=Math.max(0,x+S-this.lines.maxLength);U>0&&this.lines.onTrimEmitter.fire(U)}}translateBufferLineToString(e,s,d=0,m){const S=this.lines.get(e);return S?S.translateToString(s,d,m):""}getWrappedRangeForLine(e){let s=e,d=e;for(;s>0&&this.lines.get(s).isWrapped;)s--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:s,last:d}}setupTabStops(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 r.Marker(e);return this.markers.push(s),s.register(this.lines.onTrim((d=>{s.line-=d,s.line<0&&s.dispose()}))),s.register(this.lines.onInsert((d=>{s.line>=d.index&&(s.line+=d.amount)}))),s.register(this.lines.onDelete((d=>{s.line>=d.index&&s.line<d.index+d.amount&&s.dispose(),s.line>d.index&&(s.line-=d.amount)}))),s.register(s.onDispose((()=>this._removeMarker(s)))),s}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(k,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),h=a(482);n.DEFAULT_ATTR_DATA=Object.freeze(new c.AttributeData);let v=0;class g{constructor(r,i,e=!1){this.isWrapped=e,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*r);const s=i||f.CellData.fromCharData([0,l.NULL_CELL_CHAR,l.NULL_CELL_WIDTH,l.NULL_CELL_CODE]);for(let d=0;d<r;++d)this.setCell(d,s);this.length=r}get(r){const i=this._data[3*r+0],e=2097151&i;return[this._data[3*r+1],2097152&i?this._combined[r]:e?(0,h.stringFromCodePoint)(e):"",i>>22,2097152&i?this._combined[r].charCodeAt(this._combined[r].length-1):e]}set(r,i){this._data[3*r+1]=i[l.CHAR_DATA_ATTR_INDEX],i[l.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[r]=i[1],this._data[3*r+0]=2097152|r|i[l.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*r+0]=i[l.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|i[l.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(r){return this._data[3*r+0]>>22}hasWidth(r){return 12582912&this._data[3*r+0]}getFg(r){return this._data[3*r+1]}getBg(r){return this._data[3*r+2]}hasContent(r){return 4194303&this._data[3*r+0]}getCodePoint(r){const i=this._data[3*r+0];return 2097152&i?this._combined[r].charCodeAt(this._combined[r].length-1):2097151&i}isCombined(r){return 2097152&this._data[3*r+0]}getString(r){const i=this._data[3*r+0];return 2097152&i?this._combined[r]:2097151&i?(0,h.stringFromCodePoint)(2097151&i):""}isProtected(r){return 536870912&this._data[3*r+2]}loadCell(r,i){return v=3*r,i.content=this._data[v+0],i.fg=this._data[v+1],i.bg=this._data[v+2],2097152&i.content&&(i.combinedData=this._combined[r]),268435456&i.bg&&(i.extended=this._extendedAttrs[r]),i}setCell(r,i){2097152&i.content&&(this._combined[r]=i.combinedData),268435456&i.bg&&(this._extendedAttrs[r]=i.extended),this._data[3*r+0]=i.content,this._data[3*r+1]=i.fg,this._data[3*r+2]=i.bg}setCellFromCodepoint(r,i,e,s){268435456&s.bg&&(this._extendedAttrs[r]=s.extended),this._data[3*r+0]=i|e<<22,this._data[3*r+1]=s.fg,this._data[3*r+2]=s.bg}addCodepointToCell(r,i,e){let s=this._data[3*r+0];2097152&s?this._combined[r]+=(0,h.stringFromCodePoint)(i):2097151&s?(this._combined[r]=(0,h.stringFromCodePoint)(2097151&s)+(0,h.stringFromCodePoint)(i),s&=-2097152,s|=2097152):s=i|4194304,e&&(s&=-12582913,s|=e<<22),this._data[3*r+0]=s}insertCells(r,i,e){if((r%=this.length)&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r-1,0,1,e),i<this.length-r){const s=new f.CellData;for(let d=this.length-r-i-1;d>=0;--d)this.setCell(r+i+d,this.loadCell(r+d,s));for(let d=0;d<i;++d)this.setCell(r+d,e)}else for(let s=r;s<this.length;++s)this.setCell(s,e);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,e)}deleteCells(r,i,e){if(r%=this.length,i<this.length-r){const s=new f.CellData;for(let d=0;d<this.length-r-i;++d)this.setCell(r+d,this.loadCell(r+i+d,s));for(let d=this.length-i;d<this.length;++d)this.setCell(d,e)}else for(let s=r;s<this.length;++s)this.setCell(s,e);r&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r-1,0,1,e),this.getWidth(r)!==0||this.hasContent(r)||this.setCellFromCodepoint(r,0,1,e)}replaceCells(r,i,e,s=!1){if(s)for(r&&this.getWidth(r-1)===2&&!this.isProtected(r-1)&&this.setCellFromCodepoint(r-1,0,1,e),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,e);r<i&&r<this.length;)this.isProtected(r)||this.setCell(r,e),r++;else for(r&&this.getWidth(r-1)===2&&this.setCellFromCodepoint(r-1,0,1,e),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,e);r<i&&r<this.length;)this.setCell(r++,e)}resize(r,i){if(r===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const e=3*r;if(r>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<r;++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>=r&&delete this._combined[S]}const d=Object.keys(this._extendedAttrs);for(let m=0;m<d.length;m++){const S=parseInt(d[m],10);S>=r&&delete this._extendedAttrs[S]}}return this.length=r,4*e*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const r=new Uint32Array(this._data.length);return r.set(this._data),this._data=r,1}return 0}fill(r,i=!1){if(i)for(let e=0;e<this.length;++e)this.isProtected(e)||this.setCell(e,r);else{this._combined={},this._extendedAttrs={};for(let e=0;e<this.length;++e)this.setCell(e,r)}}copyFrom(r){this.length!==r.length?this._data=new Uint32Array(r._data):this._data.set(r._data),this.length=r.length,this._combined={};for(const i in r._combined)this._combined[i]=r._combined[i];this._extendedAttrs={};for(const i in r._extendedAttrs)this._extendedAttrs[i]=r._extendedAttrs[i];this.isWrapped=r.isWrapped}clone(){const r=new g(0);r._data=new Uint32Array(this._data),r.length=this.length;for(const i in this._combined)r._combined[i]=this._combined[i];for(const i in this._extendedAttrs)r._extendedAttrs[i]=this._extendedAttrs[i];return r.isWrapped=this.isWrapped,r}getTrimmedLength(){for(let r=this.length-1;r>=0;--r)if(4194303&this._data[3*r+0])return r+(this._data[3*r+0]>>22);return 0}getNoBgTrimmedLength(){for(let r=this.length-1;r>=0;--r)if(4194303&this._data[3*r+0]||50331648&this._data[3*r+2])return r+(this._data[3*r+0]>>22);return 0}copyCellsFrom(r,i,e,s,d){const m=r._data;if(d)for(let C=s-1;C>=0;C--){for(let p=0;p<3;p++)this._data[3*(e+C)+p]=m[3*(i+C)+p];268435456&m[3*(i+C)+2]&&(this._extendedAttrs[e+C]=r._extendedAttrs[i+C])}else for(let C=0;C<s;C++){for(let p=0;p<3;p++)this._data[3*(e+C)+p]=m[3*(i+C)+p];268435456&m[3*(i+C)+2]&&(this._extendedAttrs[e+C]=r._extendedAttrs[i+C])}const S=Object.keys(r._combined);for(let C=0;C<S.length;C++){const p=parseInt(S[C],10);p>=i&&(this._combined[p-i+e]=r._combined[p])}}translateToString(r,i,e,s){i=i??0,e=e??this.length,r&&(e=Math.min(e,this.getTrimmedLength())),s&&(s.length=0);let d="";for(;i<e;){const m=this._data[3*i+0],S=2097151&m,C=2097152&m?this._combined[i]:S?(0,h.stringFromCodePoint)(S):l.WHITESPACE_CELL_CHAR;if(d+=C,s)for(let p=0;p<C.length;++p)s.push(i);i+=m>>22||1}return s&&s.push(i),d}}n.BufferLine=g},4841:(k,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:(k,n)=>{function a(c,f,l){if(f===c.length-1)return c[f].getTrimmedLength();const h=!c[f].hasContent(l-1)&&c[f].getWidth(l-1)===1,v=c[f+1].getWidth(0)===2;return h&&v?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,h,v){const g=[];for(let u=0;u<c.length-1;u++){let r=u,i=c.get(++r);if(!i.isWrapped)continue;const e=[c.get(u)];for(;r<c.length&&i.isWrapped;)e.push(i),i=c.get(++r);if(h>=u&&h<r){u+=e.length-1;continue}let s=0,d=a(e,s,f),m=1,S=0;for(;m<e.length;){const p=a(e,m,f),x=p-S,T=l-d,P=Math.min(x,T);e[s].copyCellsFrom(e[m],S,d,P,!1),d+=P,d===l&&(s++,d=0),S+=P,S===p&&(m++,S=0),d===0&&s!==0&&e[s-1].getWidth(l-1)===2&&(e[s].copyCellsFrom(e[s-1],l-1,d++,1,!1),e[s-1].setCell(l-1,v))}e[s].replaceCells(d,l,v);let C=0;for(let p=e.length-1;p>0&&(p>s||e[p].getTrimmedLength()===0);p--)C++;C>0&&(g.push(u+e.length-C),g.push(C)),u+=e.length-1}return g},n.reflowLargerCreateNewLayout=function(c,f){const l=[];let h=0,v=f[h],g=0;for(let u=0;u<c.length;u++)if(v===u){const r=f[++h];c.onDeleteEmitter.fire({index:u-g,amount:r}),u+=r-1,g+=r,v=f[++h]}else l.push(u);return{layout:l,countRemoved:g}},n.reflowLargerApplyNewLayout=function(c,f){const l=[];for(let h=0;h<f.length;h++)l.push(c.get(f[h]));for(let h=0;h<l.length;h++)c.set(h,l[h]);c.length=f.length},n.reflowSmallerGetNewLineLengths=function(c,f,l){const h=[],v=c.map(((i,e)=>a(c,e,f))).reduce(((i,e)=>i+e));let g=0,u=0,r=0;for(;r<v;){if(v-r<l){h.push(v-r);break}g+=l;const i=a(c,u,f);g>i&&(g-=i,u++);const e=c[u].getWidth(g-1)===2;e&&g--;const s=e?l-1:l;h.push(s),r+=s}return h},n.getWrappedLineTrimmedLength=a},5295:(k,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferSet=void 0;const c=a(8460),f=a(844),l=a(9092);class h extends f.Disposable{constructor(g,u){super(),this._optionsService=g,this._bufferService=u,this._onBufferActivate=this.register(new c.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new 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,u){this._normal.resize(g,u),this._alt.resize(g,u),this.setupTabStops(g)}setupTabStops(g){this._normal.setupTabStops(g),this._alt.setupTabStops(g)}}n.BufferSet=h},511:(k,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CellData=void 0;const c=a(482),f=a(643),l=a(3734);class h 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 u=new h;return u.setFromCharData(g),u}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,c.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(g){this.fg=g[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let u=!1;if(g[f.CHAR_DATA_CHAR_INDEX].length>2)u=!0;else if(g[f.CHAR_DATA_CHAR_INDEX].length===2){const r=g[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=r&&r<=56319){const i=g[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(r-55296)+i-56320+65536|g[f.CHAR_DATA_WIDTH_INDEX]<<22:u=!0}else u=!0}else this.content=g[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|g[f.CHAR_DATA_WIDTH_INDEX]<<22;u&&(this.combinedData=g[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|g[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}n.CellData=h},643:(k,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:(k,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(v){this.line=v,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(v){return this._disposables.push(v),v}}n.Marker=l,l._nextId=1},7116:(k,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:(k,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:(k,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,h,v,g){const u={type:0,cancel:!1,key:void 0},r=(l.shiftKey?1:0)|(l.altKey?2:0)|(l.ctrlKey?4:0)|(l.metaKey?8:0);switch(l.keyCode){case 0:l.key==="UIKeyInputUpArrow"?u.key=h?c.C0.ESC+"OA":c.C0.ESC+"[A":l.key==="UIKeyInputLeftArrow"?u.key=h?c.C0.ESC+"OD":c.C0.ESC+"[D":l.key==="UIKeyInputRightArrow"?u.key=h?c.C0.ESC+"OC":c.C0.ESC+"[C":l.key==="UIKeyInputDownArrow"&&(u.key=h?c.C0.ESC+"OB":c.C0.ESC+"[B");break;case 8:u.key=l.ctrlKey?"\b":c.C0.DEL,l.altKey&&(u.key=c.C0.ESC+u.key);break;case 9:if(l.shiftKey){u.key=c.C0.ESC+"[Z";break}u.key=c.C0.HT,u.cancel=!0;break;case 13:u.key=l.altKey?c.C0.ESC+c.C0.CR:c.C0.CR,u.cancel=!0;break;case 27:u.key=c.C0.ESC,l.altKey&&(u.key=c.C0.ESC+c.C0.ESC),u.cancel=!0;break;case 37:if(l.metaKey)break;r?(u.key=c.C0.ESC+"[1;"+(r+1)+"D",u.key===c.C0.ESC+"[1;3D"&&(u.key=c.C0.ESC+(v?"b":"[1;5D"))):u.key=h?c.C0.ESC+"OD":c.C0.ESC+"[D";break;case 39:if(l.metaKey)break;r?(u.key=c.C0.ESC+"[1;"+(r+1)+"C",u.key===c.C0.ESC+"[1;3C"&&(u.key=c.C0.ESC+(v?"f":"[1;5C"))):u.key=h?c.C0.ESC+"OC":c.C0.ESC+"[C";break;case 38:if(l.metaKey)break;r?(u.key=c.C0.ESC+"[1;"+(r+1)+"A",v||u.key!==c.C0.ESC+"[1;3A"||(u.key=c.C0.ESC+"[1;5A")):u.key=h?c.C0.ESC+"OA":c.C0.ESC+"[A";break;case 40:if(l.metaKey)break;r?(u.key=c.C0.ESC+"[1;"+(r+1)+"B",v||u.key!==c.C0.ESC+"[1;3B"||(u.key=c.C0.ESC+"[1;5B")):u.key=h?c.C0.ESC+"OB":c.C0.ESC+"[B";break;case 45:l.shiftKey||l.ctrlKey||(u.key=c.C0.ESC+"[2~");break;case 46:u.key=r?c.C0.ESC+"[3;"+(r+1)+"~":c.C0.ESC+"[3~";break;case 36:u.key=r?c.C0.ESC+"[1;"+(r+1)+"H":h?c.C0.ESC+"OH":c.C0.ESC+"[H";break;case 35:u.key=r?c.C0.ESC+"[1;"+(r+1)+"F":h?c.C0.ESC+"OF":c.C0.ESC+"[F";break;case 33:l.shiftKey?u.type=2:l.ctrlKey?u.key=c.C0.ESC+"[5;"+(r+1)+"~":u.key=c.C0.ESC+"[5~";break;case 34:l.shiftKey?u.type=3:l.ctrlKey?u.key=c.C0.ESC+"[6;"+(r+1)+"~":u.key=c.C0.ESC+"[6~";break;case 112:u.key=r?c.C0.ESC+"[1;"+(r+1)+"P":c.C0.ESC+"OP";break;case 113:u.key=r?c.C0.ESC+"[1;"+(r+1)+"Q":c.C0.ESC+"OQ";break;case 114:u.key=r?c.C0.ESC+"[1;"+(r+1)+"R":c.C0.ESC+"OR";break;case 115:u.key=r?c.C0.ESC+"[1;"+(r+1)+"S":c.C0.ESC+"OS";break;case 116:u.key=r?c.C0.ESC+"[15;"+(r+1)+"~":c.C0.ESC+"[15~";break;case 117:u.key=r?c.C0.ESC+"[17;"+(r+1)+"~":c.C0.ESC+"[17~";break;case 118:u.key=r?c.C0.ESC+"[18;"+(r+1)+"~":c.C0.ESC+"[18~";break;case 119:u.key=r?c.C0.ESC+"[19;"+(r+1)+"~":c.C0.ESC+"[19~";break;case 120:u.key=r?c.C0.ESC+"[20;"+(r+1)+"~":c.C0.ESC+"[20~";break;case 121:u.key=r?c.C0.ESC+"[21;"+(r+1)+"~":c.C0.ESC+"[21~";break;case 122:u.key=r?c.C0.ESC+"[23;"+(r+1)+"~":c.C0.ESC+"[23~";break;case 123:u.key=r?c.C0.ESC+"[24;"+(r+1)+"~":c.C0.ESC+"[24~";break;default:if(!l.ctrlKey||l.shiftKey||l.altKey||l.metaKey)if(v&&!g||!l.altKey||l.metaKey)!v||l.altKey||l.ctrlKey||l.shiftKey||!l.metaKey?l.key&&!l.ctrlKey&&!l.altKey&&!l.metaKey&&l.keyCode>=48&&l.key.length===1?u.key=l.key:l.key&&l.ctrlKey&&(l.key==="_"&&(u.key=c.C0.US),l.key==="@"&&(u.key=c.C0.NUL)):l.keyCode===65&&(u.type=1);else{const i=f[l.keyCode],e=i==null?void 0:i[l.shiftKey?1:0];if(e)u.key=c.C0.ESC+e;else if(l.keyCode>=65&&l.keyCode<=90){const s=l.ctrlKey?l.keyCode-64:l.keyCode+32;let d=String.fromCharCode(s);l.shiftKey&&(d=d.toUpperCase()),u.key=c.C0.ESC+d}else if(l.keyCode===32)u.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()),u.key=c.C0.ESC+s,u.cancel=!0}}else l.keyCode>=65&&l.keyCode<=90?u.key=String.fromCharCode(l.keyCode-64):l.keyCode===32?u.key=c.C0.NUL:l.keyCode>=51&&l.keyCode<=55?u.key=String.fromCharCode(l.keyCode-51+27):l.keyCode===56?u.key=c.C0.DEL:l.keyCode===219?u.key=c.C0.ESC:l.keyCode===220?u.key=c.C0.FS:l.keyCode===221&&(u.key=c.C0.GS)}return u}},482:(k,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 h=c;h<f;++h){let v=a[h];v>65535?(v-=65536,l+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):l+=String.fromCharCode(v)}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,h=0;if(this._interim){const v=a.charCodeAt(h++);56320<=v&&v<=57343?c[l++]=1024*(this._interim-55296)+v-56320+65536:(c[l++]=this._interim,c[l++]=v),this._interim=0}for(let v=h;v<f;++v){const g=a.charCodeAt(v);if(55296<=g&&g<=56319){if(++v>=f)return this._interim=g,l;const u=a.charCodeAt(v);56320<=u&&u<=57343?c[l++]=1024*(g-55296)+u-56320+65536:(c[l++]=g,c[l++]=u)}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,h,v,g,u=0,r=0,i=0;if(this.interim[0]){let d=!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 p=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,x=p-C;for(;i<x;){if(i>=f)return 0;if(S=a[i++],(192&S)!=128){i--,d=!0;break}this.interim[C++]=S,m<<=6,m|=63&S}d||(p===2?m<128?i--:c[u++]=m:p===3?m<2048||m>=55296&&m<=57343||m===65279||(c[u++]=m):m<65536||m>1114111||(c[u++]=m)),this.interim.fill(0)}const e=f-4;let s=i;for(;s<f;){for(;!(!(s<e)||128&(l=a[s])||128&(h=a[s+1])||128&(v=a[s+2])||128&(g=a[s+3]));)c[u++]=l,c[u++]=h,c[u++]=v,c[u++]=g,s+=4;if(l=a[s++],l<128)c[u++]=l;else if((224&l)==192){if(s>=f)return this.interim[0]=l,u;if(h=a[s++],(192&h)!=128){s--;continue}if(r=(31&l)<<6|63&h,r<128){s--;continue}c[u++]=r}else if((240&l)==224){if(s>=f)return this.interim[0]=l,u;if(h=a[s++],(192&h)!=128){s--;continue}if(s>=f)return this.interim[0]=l,this.interim[1]=h,u;if(v=a[s++],(192&v)!=128){s--;continue}if(r=(15&l)<<12|(63&h)<<6|63&v,r<2048||r>=55296&&r<=57343||r===65279)continue;c[u++]=r}else if((248&l)==240){if(s>=f)return this.interim[0]=l,u;if(h=a[s++],(192&h)!=128){s--;continue}if(s>=f)return this.interim[0]=l,this.interim[1]=h,u;if(v=a[s++],(192&v)!=128){s--;continue}if(s>=f)return this.interim[0]=l,this.interim[1]=h,this.interim[2]=v,u;if(g=a[s++],(192&g)!=128){s--;continue}if(r=(7&l)<<18|(63&h)<<12|(63&v)<<6|63&g,r<65536||r>1114111)continue;c[u++]=r}}return u}}},225:(k,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 h;n.UnicodeV6=class{constructor(){if(this.version="6",!h){h=new Uint8Array(65536),h.fill(1),h[0]=0,h.fill(0,1,32),h.fill(0,127,160),h.fill(2,4352,4448),h[9001]=2,h[9002]=2,h.fill(2,11904,42192),h[12351]=1,h.fill(2,44032,55204),h.fill(2,63744,64256),h.fill(2,65040,65050),h.fill(2,65072,65136),h.fill(2,65280,65377),h.fill(2,65504,65511);for(let v=0;v<f.length;++v)h.fill(0,f[v][0],f[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?h[v]:(function(g,u){let r,i=0,e=u.length-1;if(g<u[0][0]||g>u[e][1])return!1;for(;e>=i;)if(r=i+e>>1,g>u[r][1])i=r+1;else{if(!(g<u[r][0]))return!0;e=r-1}return!1})(v,l)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,g){let u=this.wcwidth(v),r=u===0&&g!==0;if(r){const i=c.UnicodeService.extractWidth(g);i===0?r=!1:i>u&&(u=i)}return c.UnicodeService.createPropertyValue(0,u,r)}}},5981:(k,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(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new c.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,g){if(g!==void 0&&this._syncCalls>g)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let u;for(this._isSyncWriting=!0;u=this._writeBuffer.shift();){this._action(u);const r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,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+=v.length,this._writeBuffer.push(v),this._callbacks.push(g),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(g)}_innerWrite(v=0,g=!0){const u=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const r=this._writeBuffer[this._bufferOffset],i=this._action(r,g);if(i){const s=d=>Date.now()-u>=12?setTimeout((()=>this._innerWrite(0,d))):this._innerWrite(u,d);return void i.catch((d=>(queueMicrotask((()=>{throw d})),Promise.resolve(!1)))).then(s)}const e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=r.length,Date.now()-u>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}n.WriteBuffer=l},5941:(k,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,h){const v=l.toString(16),g=v.length<2?"0"+v:v;switch(h){case 4:return v[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 h=l.toLowerCase();if(h.indexOf("rgb:")===0){h=h.slice(4);const v=a.exec(h);if(v){const g=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/g*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/g*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/g*255)]}}else if(h.indexOf("#")===0&&(h=h.slice(1),c.exec(h)&&[3,6,9,12].includes(h.length))){const v=h.length/3,g=[0,0,0];for(let u=0;u<3;++u){const r=parseInt(h.slice(v*u,v*u+v),16);g[u]=v===1?r<<4:v===2?r:v===3?r>>4:r>>8}return g}},n.toRgbString=function(l,h=16){const[v,g,u]=l;return`rgb:${f(v,h)}/${f(g,h)}/${f(u,h)}`}},5770:(k,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.PAYLOAD_LIMIT=void 0,n.PAYLOAD_LIMIT=1e7},6351:(k,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DcsHandler=n.DcsParser=void 0;const c=a(482),f=a(8742),l=a(5770),h=[];n.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=h,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}registerHandler(g,u){this._handlers[g]===void 0&&(this._handlers[g]=[]);const r=this._handlers[g];return r.push(u),{dispose:()=>{const i=r.indexOf(u);i!==-1&&r.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=h,this._ident=0}hook(g,u){if(this.reset(),this._ident=g,this._active=this._handlers[g]||h,this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(u);else this._handlerFb(this._ident,"HOOK",u)}put(g,u,r){if(this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].put(g,u,r);else this._handlerFb(this._ident,"PUT",(0,c.utf32ToString)(g,u,r))}unhook(g,u=!0){if(this._active.length){let r=!1,i=this._active.length-1,e=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,r=u,e=this._stack.fallThrough,this._stack.paused=!1),!e&&r===!1){for(;i>=0&&(r=this._active[i].unhook(g),r!==!0);i--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,r;i--}for(;i>=0;i--)if(r=this._active[i].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,r}else this._handlerFb(this._ident,"UNHOOK",g);this._active=h,this._ident=0}};const v=new f.Params;v.addParam(0),n.DcsHandler=class{constructor(g){this._handler=g,this._data="",this._params=v,this._hitLimit=!1}hook(g){this._params=g.length>1||g.params[0]?g.clone():v,this._data="",this._hitLimit=!1}put(g,u,r){this._hitLimit||(this._data+=(0,c.utf32ToString)(g,u,r),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(g){let u=!1;if(this._hitLimit)u=!1;else if(g&&(u=this._handler(this._data,this._params),u instanceof Promise))return u.then((r=>(this._params=v,this._data="",this._hitLimit=!1,r)));return this._params=v,this._data="",this._hitLimit=!1,u}}},2015:(k,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),h=a(6351);class v{constructor(i){this.table=new Uint8Array(i)}setDefault(i,e){this.table.fill(i<<4|e)}add(i,e,s,d){this.table[e<<8|i]=s<<4|d}addMany(i,e,s,d){for(let m=0;m<i.length;m++)this.table[e<<8|i[m]]=s<<4|d}}n.TransitionTable=v;const g=160;n.VT500_TRANSITION_TABLE=(function(){const r=new v(4095),i=Array.apply(null,Array(256)).map(((C,p)=>p)),e=(C,p)=>i.slice(C,p),s=e(32,127),d=e(0,24);d.push(25),d.push.apply(d,e(28,32));const m=e(0,14);let S;for(S in r.setDefault(1,0),r.addMany(s,0,2,0),m)r.addMany([24,26,153,154],S,3,0),r.addMany(e(128,144),S,3,0),r.addMany(e(144,152),S,3,0),r.add(156,S,0,0),r.add(27,S,11,1),r.add(157,S,4,8),r.addMany([152,158,159],S,0,7),r.add(155,S,11,3),r.add(144,S,11,9);return r.addMany(d,0,3,0),r.addMany(d,1,3,1),r.add(127,1,0,1),r.addMany(d,8,0,8),r.addMany(d,3,3,3),r.add(127,3,0,3),r.addMany(d,4,3,4),r.add(127,4,0,4),r.addMany(d,6,3,6),r.addMany(d,5,3,5),r.add(127,5,0,5),r.addMany(d,2,3,2),r.add(127,2,0,2),r.add(93,1,4,8),r.addMany(s,8,5,8),r.add(127,8,5,8),r.addMany([156,27,24,26,7],8,6,0),r.addMany(e(28,32),8,0,8),r.addMany([88,94,95],1,0,7),r.addMany(s,7,0,7),r.addMany(d,7,0,7),r.add(156,7,0,0),r.add(127,7,0,7),r.add(91,1,11,3),r.addMany(e(64,127),3,7,0),r.addMany(e(48,60),3,8,4),r.addMany([60,61,62,63],3,9,4),r.addMany(e(48,60),4,8,4),r.addMany(e(64,127),4,7,0),r.addMany([60,61,62,63],4,0,6),r.addMany(e(32,64),6,0,6),r.add(127,6,0,6),r.addMany(e(64,127),6,0,0),r.addMany(e(32,48),3,9,5),r.addMany(e(32,48),5,9,5),r.addMany(e(48,64),5,0,6),r.addMany(e(64,127),5,7,0),r.addMany(e(32,48),4,9,5),r.addMany(e(32,48),1,9,2),r.addMany(e(32,48),2,9,2),r.addMany(e(48,127),2,10,0),r.addMany(e(48,80),1,10,0),r.addMany(e(81,88),1,10,0),r.addMany([89,90,92],1,10,0),r.addMany(e(96,127),1,10,0),r.add(80,1,11,9),r.addMany(d,9,0,9),r.add(127,9,0,9),r.addMany(e(28,32),9,0,9),r.addMany(e(32,48),9,9,12),r.addMany(e(48,60),9,8,10),r.addMany([60,61,62,63],9,9,10),r.addMany(d,11,0,11),r.addMany(e(32,128),11,0,11),r.addMany(e(28,32),11,0,11),r.addMany(d,10,0,10),r.add(127,10,0,10),r.addMany(e(28,32),10,0,10),r.addMany(e(48,60),10,8,10),r.addMany([60,61,62,63],10,0,11),r.addMany(e(32,48),10,9,12),r.addMany(d,12,0,12),r.add(127,12,0,12),r.addMany(e(28,32),12,0,12),r.addMany(e(32,48),12,9,12),r.addMany(e(48,64),12,0,11),r.addMany(e(64,127),12,12,13),r.addMany(e(64,127),10,12,13),r.addMany(e(64,127),9,12,13),r.addMany(d,13,13,13),r.addMany(s,13,13,13),r.add(127,13,0,13),r.addMany([27,156,24,26],13,14,0),r.add(g,0,2,0),r.add(g,8,5,8),r.add(g,6,0,6),r.add(g,11,0,11),r.add(g,13,13,13),r})();class u extends c.Disposable{constructor(i=n.VT500_TRANSITION_TABLE){super(),this._transitions=i,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,s,d)=>{},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 h.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 d=i.final.charCodeAt(0);if(e[0]>d||d>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return s<<=8,s|=d,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 d=this._escHandlers[s];return d.push(e),{dispose:()=>{const m=d.indexOf(e);m!==-1&&d.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 d=this._csiHandlers[s];return d.push(e),{dispose:()=>{const m=d.indexOf(e);m!==-1&&d.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,d,m){this._parseStack.state=i,this._parseStack.handlers=e,this._parseStack.handlerPos=s,this._parseStack.transition=d,this._parseStack.chunkPos=m}parse(i,e,s){let d,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 p=this._parseStack.handlers;let x=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&x>-1){for(;x>=0&&(d=p[x](this._params),d!==!0);x--)if(d instanceof Promise)return this._parseStack.handlerPos=x,d}this._parseStack.handlers=[];break;case 4:if(s===!1&&x>-1){for(;x>=0&&(d=p[x](),d!==!0);x--)if(d instanceof Promise)return this._parseStack.handlerPos=x,d}this._parseStack.handlers=[];break;case 6:if(m=i[this._parseStack.chunkPos],d=this._dcsParser.unhook(m!==24&&m!==26,s),d)return d;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],d=this._oscParser.end(m!==24&&m!==26,s),d)return d;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 p=C;p<e;++p){switch(m=i[p],S=this._transitions.table[this.currentState<<8|(m<160?m:g)],S>>4){case 2:for(let B=p+1;;++B){if(B>=e||(m=i[B])<32||m>126&&m<g){this._printHandler(i,p,B),p=B-1;break}if(++B>=e||(m=i[B])<32||m>126&&m<g){this._printHandler(i,p,B),p=B-1;break}if(++B>=e||(m=i[B])<32||m>126&&m<g){this._printHandler(i,p,B),p=B-1;break}if(++B>=e||(m=i[B])<32||m>126&&m<g){this._printHandler(i,p,B),p=B-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:p,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&&(d=x[T](this._params),d!==!0);T--)if(d instanceof Promise)return this._preserveStack(3,x,T,S,p),d;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(++p<e&&(m=i[p])>47&&m<60);p--;break;case 9:this._collect<<=8,this._collect|=m;break;case 10:const P=this._escHandlers[this._collect<<8|m];let O=P?P.length-1:-1;for(;O>=0&&(d=P[O](),d!==!0);O--)if(d instanceof Promise)return this._preserveStack(4,P,O,S,p),d;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 B=p+1;;++B)if(B>=e||(m=i[B])===24||m===26||m===27||m>127&&m<g){this._dcsParser.put(i,p,B),p=B-1;break}break;case 14:if(d=this._dcsParser.unhook(m!==24&&m!==26),d)return this._preserveStack(6,[],0,S,p),d;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 B=p+1;;B++)if(B>=e||(m=i[B])<32||m>127&&m<g){this._oscParser.put(i,p,B),p=B-1;break}break;case 6:if(d=this._oscParser.end(m!==24&&m!==26),d)return this._preserveStack(5,[],0,S,p),d;m===27&&(S|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&S}}}n.EscapeSequenceParser=u},6242:(k,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(h,v){this._handlers[h]===void 0&&(this._handlers[h]=[]);const g=this._handlers[h];return g.push(v),{dispose:()=>{const u=g.indexOf(v);u!==-1&&g.splice(u,1)}}}clearHandler(h){this._handlers[h]&&delete this._handlers[h]}setHandlerFallback(h){this._handlerFb=h}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=l}reset(){if(this._state===2)for(let h=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;h>=0;--h)this._active[h].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 h=this._active.length-1;h>=0;h--)this._active[h].start();else this._handlerFb(this._id,"START")}_put(h,v,g){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(h,v,g);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(h,v,g))}start(){this.reset(),this._state=1}put(h,v,g){if(this._state!==3){if(this._state===1)for(;v<g;){const u=h[v++];if(u===59){this._state=2,this._start();break}if(u<48||57<u)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+u-48}this._state===2&&g-v>0&&this._put(h,v,g)}}end(h,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let g=!1,u=this._active.length-1,r=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,g=v,r=this._stack.fallThrough,this._stack.paused=!1),!r&&g===!1){for(;u>=0&&(g=this._active[u].end(h),g!==!0);u--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,g;u--}for(;u>=0;u--)if(g=this._active[u].end(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,g}else this._handlerFb(this._id,"END",h);this._active=l,this._id=-1,this._state=0}}},n.OscHandler=class{constructor(h){this._handler=h,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(h,v,g){this._hitLimit||(this._data+=(0,f.utf32ToString)(h,v,g),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(h){let v=!1;if(this._hitLimit)v=!1;else if(h&&(v=this._handler(this._data),v instanceof Promise))return v.then((g=>(this._data="",this._hitLimit=!1,g)));return this._data="",this._hitLimit=!1,v}}},8742:(k,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Params=void 0;const a=2147483647;class c{static fromArray(l){const h=new c;if(!l.length)return h;for(let v=Array.isArray(l[0])?1:0;v<l.length;++v){const g=l[v];if(Array.isArray(g))for(let u=0;u<g.length;++u)h.addSubParam(g[u]);else h.addParam(g)}return h}constructor(l=32,h=32){if(this.maxLength=l,this.maxSubParamsLength=h,h>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(l),this.length=0,this._subParams=new Int32Array(h),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 h=0;h<this.length;++h){l.push(this.params[h]);const v=this._subParamsIdx[h]>>8,g=255&this._subParamsIdx[h];g-v>0&&l.push(Array.prototype.slice.call(this._subParams,v,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 h=this._subParamsIdx[l]>>8,v=255&this._subParamsIdx[l];return v-h>0?this._subParams.subarray(h,v):null}getSubParamsAll(){const l={};for(let h=0;h<this.length;++h){const v=this._subParamsIdx[h]>>8,g=255&this._subParamsIdx[h];g-v>0&&(l[h]=this._subParams.slice(v,g))}return l}addDigit(l){let h;if(this._rejectDigits||!(h=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,g=v[h-1];v[h-1]=~g?Math.min(10*g+l,a):l}}n.Params=c},5741:(k,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:(k,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferApiView=void 0;const c=a(3785),f=a(511);n.BufferApiView=class{constructor(l,h){this._buffer=l,this.type=h}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 h=this._buffer.lines.get(l);if(h)return new c.BufferLineApiView(h)}getNullCell(){return new f.CellData}}},3785:(k,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,h){return this._line.translateToString(f,l,h)}}},8285:(k,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferNamespaceApi=void 0;const c=a(8771),f=a(8460),l=a(844);class h 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=h},7975:(k,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:(k,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(k,n,a){var c=this&&this.__decorate||function(r,i,e,s){var d,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(r,i,e,s);else for(var C=r.length-1;C>=0;C--)(d=r[C])&&(S=(m<3?d(S):m>3?d(i,e,S):d(i,e))||S);return m>3&&S&&Object.defineProperty(i,e,S),S},f=this&&this.__param||function(r,i){return function(e,s){i(e,s,r)}};Object.defineProperty(n,"__esModule",{value:!0}),n.BufferService=n.MINIMUM_ROWS=n.MINIMUM_COLS=void 0;const l=a(8460),h=a(844),v=a(5295),g=a(2585);n.MINIMUM_COLS=2,n.MINIMUM_ROWS=1;let u=n.BufferService=class extends h.Disposable{get buffer(){return this.buffers.active}constructor(r){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(r.rawOptions.cols||0,n.MINIMUM_COLS),this.rows=Math.max(r.rawOptions.rows||0,n.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(r,this))}resize(r,i){this.cols=r,this.rows=i,this.buffers.resize(r,i),this._onResize.fire({cols:r,rows:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(r,i=!1){const e=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===r.fg&&s.getBg(0)===r.bg||(s=e.getBlankLine(r,i),this._cachedBlankLine=s),s.isWrapped=i;const d=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-d+1;e.lines.shiftElements(d+1,S-1,-1),e.lines.set(m,s.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(r,i,e){const s=this.buffer;if(r<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else r+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const d=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+r,s.ybase),0),d!==s.ydisp&&(i||this._onScroll.fire(s.ydisp))}};n.BufferService=u=c([f(0,g.IOptionsService)],u)},7994:(k,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(k,n,a){var c=this&&this.__decorate||function(s,d,m,S){var C,p=arguments.length,x=p<3?d:S===null?S=Object.getOwnPropertyDescriptor(d,m):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(s,d,m,S);else for(var T=s.length-1;T>=0;T--)(C=s[T])&&(x=(p<3?C(x):p>3?C(d,m,x):C(d,m))||x);return p>3&&x&&Object.defineProperty(d,m,x),x},f=this&&this.__param||function(s,d){return function(m,S){d(m,S,s)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreMouseService=void 0;const l=a(2585),h=a(8460),v=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 u(s,d){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||d||(m|=3)),m}const r=String.fromCharCode,i={DEFAULT:s=>{const d=[u(s,!1)+32,s.col+32,s.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${r(d[0])}${r(d[1])}${r(d[2])}`},SGR:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${u(s,!0)};${s.col};${s.row}${d}`},SGR_PIXELS:s=>{const d=s.action===0&&s.button!==4?"m":"M";return`\x1B[<${u(s,!0)};${s.x};${s.y}${d}`}};let e=n.CoreMouseService=class extends v.Disposable{constructor(s,d){super(),this._bufferService=s,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new h.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,d){this._protocols[s]=d}addEncoding(s,d){this._encodings[s]=d}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(s){if(!this._protocols[s])throw new Error(`unknown protocol "${s}"`);this._activeProtocol=s,this._onProtocolChange.fire(this._protocols[s].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(s){if(!this._encodings[s])throw new Error(`unknown encoding "${s}"`);this._activeEncoding=s}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(s){if(s.col<0||s.col>=this._bufferService.cols||s.row<0||s.row>=this._bufferService.rows||s.button===4&&s.action===32||s.button===3&&s.action!==32||s.button!==4&&(s.action===2||s.action===3)||(s.col++,s.row++,s.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,s,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(s))return!1;const d=this._encodings[this._activeEncoding](s);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!0)),this._lastEvent=s,!0}explainEvents(s){return{down:!!(1&s),up:!!(2&s),drag:!!(4&s),move:!!(8&s),wheel:!!(16&s)}}_equalEvents(s,d,m){if(m){if(s.x!==d.x||s.y!==d.y)return!1}else if(s.col!==d.col||s.row!==d.row)return!1;return s.button===d.button&&s.action===d.action&&s.ctrl===d.ctrl&&s.alt===d.alt&&s.shift===d.shift}};n.CoreMouseService=e=c([f(0,l.IBufferService),f(1,l.ICoreService)],e)},6975:function(k,n,a){var c=this&&this.__decorate||function(e,s,d,m){var S,C=arguments.length,p=C<3?s:m===null?m=Object.getOwnPropertyDescriptor(s,d):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(e,s,d,m);else for(var x=e.length-1;x>=0;x--)(S=e[x])&&(p=(C<3?S(p):C>3?S(s,d,p):S(s,d))||p);return C>3&&p&&Object.defineProperty(s,d,p),p},f=this&&this.__param||function(e,s){return function(d,m){s(d,m,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreService=void 0;const l=a(1439),h=a(8460),v=a(844),g=a(2585),u=Object.freeze({insertMode:!1}),r=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let i=n.CoreService=class extends v.Disposable{constructor(e,s,d){super(),this._bufferService=e,this._logService=s,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new h.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new h.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new h.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new h.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,l.clone)(u),this.decPrivateModes=(0,l.clone)(r)}reset(){this.modes=(0,l.clone)(u),this.decPrivateModes=(0,l.clone)(r)}triggerDataEvent(e,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const d=this._bufferService.buffer;s&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${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:(k,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DecorationService=void 0;const c=a(8055),f=a(8460),l=a(844),h=a(6106);let v=0,g=0;class u extends l.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new h.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 r(e);if(s){const d=s.marker.onDispose((()=>s.dispose()));s.onDispose((()=>{s&&(this._decorations.delete(s)&&this._onDecorationRemoved.fire(s),d.dispose())})),this._decorations.insert(s),this._onDecorationRegistered.fire(s)}return s}reset(){for(const e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,s,d){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&&(!d||(C.options.layer??"bottom")===d)&&(yield C)}forEachDecorationAtCell(e,s,d,m){this._decorations.forEachByKey(s,(S=>{v=S.options.x??0,g=v+(S.options.width??1),e>=v&&e<g&&(!d||(S.options.layer??"bottom")===d)&&m(S)}))}}n.DecorationService=u;class r 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:(k,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.InstantiationService=n.ServiceCollection=void 0;const c=a(2585),f=a(8343);class l{constructor(...v){this._entries=new Map;for(const[g,u]of v)this.set(g,u)}set(v,g){const u=this._entries.get(v);return this._entries.set(v,g),u}forEach(v){for(const[g,u]of this._entries.entries())v(g,u)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}n.ServiceCollection=l,n.InstantiationService=class{constructor(){this._services=new l,this._services.set(c.IInstantiationService,this)}setService(h,v){this._services.set(h,v)}getService(h){return this._services.get(h)}createInstance(h,...v){const g=(0,f.getServiceDependencies)(h).sort(((i,e)=>i.index-e.index)),u=[];for(const i of g){const e=this._services.get(i.id);if(!e)throw new Error(`[createInstance] ${h.name} depends on UNKNOWN service ${i.id}.`);u.push(e)}const r=g.length>0?g[0].index:v.length;if(v.length!==r)throw new Error(`[createInstance] First service dependency of ${h.name} at position ${r+1} conflicts with ${v.length} static arguments`);return new h(...v,...u)}}},7866:function(k,n,a){var c=this&&this.__decorate||function(r,i,e,s){var d,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(r,i,e,s);else for(var C=r.length-1;C>=0;C--)(d=r[C])&&(S=(m<3?d(S):m>3?d(i,e,S):d(i,e))||S);return m>3&&S&&Object.defineProperty(i,e,S),S},f=this&&this.__param||function(r,i){return function(e,s){i(e,s,r)}};Object.defineProperty(n,"__esModule",{value:!0}),n.traceCall=n.setTraceLogger=n.LogService=void 0;const l=a(844),h=a(2585),v={trace:h.LogLevelEnum.TRACE,debug:h.LogLevelEnum.DEBUG,info:h.LogLevelEnum.INFO,warn:h.LogLevelEnum.WARN,error:h.LogLevelEnum.ERROR,off:h.LogLevelEnum.OFF};let g,u=n.LogService=class extends l.Disposable{get logLevel(){return this._logLevel}constructor(r){super(),this._optionsService=r,this._logLevel=h.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),g=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(r){for(let i=0;i<r.length;i++)typeof r[i]=="function"&&(r[i]=r[i]())}_log(r,i,e){this._evalLazyOptionalParams(e),r.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...e)}trace(r,...i){var e;this._logLevel<=h.LogLevelEnum.TRACE&&this._log(((e=this._optionsService.options.logger)==null?void 0:e.trace.bind(this._optionsService.options.logger))??console.log,r,i)}debug(r,...i){var e;this._logLevel<=h.LogLevelEnum.DEBUG&&this._log(((e=this._optionsService.options.logger)==null?void 0:e.debug.bind(this._optionsService.options.logger))??console.log,r,i)}info(r,...i){var e;this._logLevel<=h.LogLevelEnum.INFO&&this._log(((e=this._optionsService.options.logger)==null?void 0:e.info.bind(this._optionsService.options.logger))??console.info,r,i)}warn(r,...i){var e;this._logLevel<=h.LogLevelEnum.WARN&&this._log(((e=this._optionsService.options.logger)==null?void 0:e.warn.bind(this._optionsService.options.logger))??console.warn,r,i)}error(r,...i){var e;this._logLevel<=h.LogLevelEnum.ERROR&&this._log(((e=this._optionsService.options.logger)==null?void 0:e.error.bind(this._optionsService.options.logger))??console.error,r,i)}};n.LogService=u=c([f(0,h.IOptionsService)],u),n.setTraceLogger=function(r){g=r},n.traceCall=function(r,i,e){if(typeof e.value!="function")throw new Error("not supported");const s=e.value;e.value=function(...d){if(g.logLevel!==h.LogLevelEnum.TRACE)return s.apply(this,d);g.trace(`GlyphRenderer#${s.name}(${d.map((S=>JSON.stringify(S))).join(", ")})`);const m=s.apply(this,d);return g.trace(`GlyphRenderer#${s.name} return`,m),m}}},7302:(k,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 h=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends f.Disposable{constructor(u){super(),this._onOptionChange=this.register(new c.EventEmitter),this.onOptionChange=this._onOptionChange.event;const r={...n.DEFAULT_OPTIONS};for(const i in u)if(i in r)try{const e=u[i];r[i]=this._sanitizeAndValidateOption(i,e)}catch(e){console.error(e)}this.rawOptions=r,this.options={...r},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(u,r){return this.onOptionChange((i=>{i===u&&r(this.rawOptions[u])}))}onMultipleOptionChange(u,r){return this.onOptionChange((i=>{u.indexOf(i)!==-1&&r()}))}_setupOptions(){const u=i=>{if(!(i in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},r=(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:u.bind(this,i),set:r.bind(this,i)};Object.defineProperty(this.options,i,e)}}_sanitizeAndValidateOption(u,r){switch(u){case"cursorStyle":if(r||(r=n.DEFAULT_OPTIONS[u]),!(function(i){return i==="block"||i==="underline"||i==="bar"})(r))throw new Error(`"${r}" is not a valid value for ${u}`);break;case"wordSeparator":r||(r=n.DEFAULT_OPTIONS[u]);break;case"fontWeight":case"fontWeightBold":if(typeof r=="number"&&1<=r&&r<=1e3)break;r=h.includes(r)?r:n.DEFAULT_OPTIONS[u];break;case"cursorWidth":r=Math.floor(r);case"lineHeight":case"tabStopWidth":if(r<1)throw new Error(`${u} cannot be less than 1, value: ${r}`);break;case"minimumContrastRatio":r=Math.max(1,Math.min(21,Math.round(10*r)/10));break;case"scrollback":if((r=Math.min(r,4294967295))<0)throw new Error(`${u} cannot be less than 0, value: ${r}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(r<=0)throw new Error(`${u} cannot be less than or equal to 0, value: ${r}`);break;case"rows":case"cols":if(!r&&r!==0)throw new Error(`${u} must be numeric, value: ${r}`);break;case"windowsPty":r=r??{}}return r}}n.OptionsService=v},2660:function(k,n,a){var c=this&&this.__decorate||function(v,g,u,r){var i,e=arguments.length,s=e<3?g:r===null?r=Object.getOwnPropertyDescriptor(g,u):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(v,g,u,r);else for(var d=v.length-1;d>=0;d--)(i=v[d])&&(s=(e<3?i(s):e>3?i(g,u,s):i(g,u))||s);return e>3&&s&&Object.defineProperty(g,u,s),s},f=this&&this.__param||function(v,g){return function(u,r){g(u,r,v)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkService=void 0;const l=a(2585);let h=n.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const g=this._bufferService.buffer;if(v.id===void 0){const d=g.addMarker(g.ybase+g.y),m={data:v,id:this._nextId++,lines:[d]};return d.onDispose((()=>this._removeMarkerFromLink(m,d))),this._dataByLinkId.set(m.id,m),m.id}const u=v,r=this._getEntryIdKey(u),i=this._entriesWithId.get(r);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(u),data:u,lines:[e]};return e.onDispose((()=>this._removeMarkerFromLink(s,e))),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(v,g){const u=this._dataByLinkId.get(v);if(u&&u.lines.every((r=>r.line!==g))){const r=this._bufferService.buffer.addMarker(g);u.lines.push(r),r.onDispose((()=>this._removeMarkerFromLink(u,r)))}}getLinkData(v){var g;return(g=this._dataByLinkId.get(v))==null?void 0:g.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,g){const u=v.lines.indexOf(g);u!==-1&&(v.lines.splice(u,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};n.OscLinkService=h=c([f(0,l.IBufferService)],h)},8343:(k,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(h,v,g){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(u,r,i){r[a]===r?r[c].push({id:u,index:i}):(r[c]=[{id:u,index:i}],r[a]=r)})(l,h,g)};return l.toString=()=>f,n.serviceRegistry.set(f,l),l}},2585:(k,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:(k,n,a)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeService=void 0;const c=a(8460),f=a(225);class l{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,g,u=!1){return(16777215&v)<<3|(3&g)<<1|(u?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new c.EventEmitter,this.onChange=this._onChange.event;const v=new f.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let g=0,u=0;const r=v.length;for(let i=0;i<r;++i){let e=v.charCodeAt(i);if(55296<=e&&e<=56319){if(++i>=r)return g+this.wcwidth(e);const m=v.charCodeAt(i);56320<=m&&m<=57343?e=1024*(e-55296)+m-56320+65536:g+=this.wcwidth(m)}const s=this.charProperties(e,u);let d=l.extractWidth(s);l.extractShouldJoin(s)&&(d-=l.extractWidth(u)),g+=d,u=s}return g}charProperties(v,g){return this._activeProvider.charProperties(v,g)}}n.UnicodeService=l}},b={};function w(k){var n=b[k];if(n!==void 0)return n.exports;var a=b[k]={exports:{}};return _[k].call(a.exports,a,a.exports,w),a.exports}var L={};return(()=>{var k=L;Object.defineProperty(k,"__esModule",{value:!0}),k.Terminal=void 0;const n=w(9042),a=w(3236),c=w(844),f=w(5741),l=w(8285),h=w(7975),v=w(7090),g=["cols","rows"];class u 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=d=>this._core.options[d],s=(d,m)=>{this._checkReadonlyOptions(d),this._core.options[d]=m};for(const d in this._core.options){const m={get:e.bind(this,d),set:s.bind(this,d)};Object.defineProperty(this._publicOptions,d,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 h.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new 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")}}k.Terminal=u})(),L})()))})(ds)),ds.exports}var Oc=Pc(),fs={exports:{}},bn;function Ic(){return bn||(bn=1,(function(t,o){(function(_,b){t.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 L=this._terminal._core;this._terminal.rows===w.rows&&this._terminal.cols===w.cols||(L._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,L=w._renderService.dimensions;if(L.css.cell.width===0||L.css.cell.height===0)return;const k=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"))),h=c-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-k;return{cols:Math.max(2,Math.floor(h/L.css.cell.width)),rows:Math.max(1,Math.floor(l/L.css.cell.height))}}}})(),_})()))})(fs)),fs.exports}var Hc=Ic(),_s={exports:{}},wn;function Fc(){return wn||(wn=1,(function(t,o){(function(_,b){t.exports=b()})(self,(()=>(()=>{var _={6:(k,n)=>{function a(f){try{const l=new URL(f),h=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(h.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(n,"__esModule",{value:!0}),n.LinkComputer=n.WebLinkProvider=void 0,n.WebLinkProvider=class{constructor(f,l,h,v={}){this._terminal=f,this._regex=l,this._handler=h,this._options=v}provideLinks(f,l){const h=c.computeLink(f,this._regex,this._terminal,this._handler);l(this._addCallbacks(h))}_addCallbacks(f){return f.map((l=>(l.leave=this._options.leave,l.hover=(h,v)=>{if(this._options.hover){const{range:g}=l;this._options.hover(h,v,g)}},l)))}};class c{static computeLink(l,h,v,g){const u=new RegExp(h.source,(h.flags||"")+"g"),[r,i]=c._getWindowedLineStrings(l-1,v),e=r.join("");let s;const d=[];for(;s=u.exec(e);){const m=s[0];if(!a(m))continue;const[S,C]=c._mapStrIdx(v,i,0,s.index),[p,x]=c._mapStrIdx(v,S,C,m.length);if(S===-1||C===-1||p===-1||x===-1)continue;const T={start:{x:C+1,y:S+1},end:{x,y:p+1}};d.push({range:T,text:m,activate:g})}return d}static _getWindowedLineStrings(l,h){let v,g=l,u=l,r=0,i="";const e=[];if(v=h.buffer.active.getLine(l)){const s=v.translateToString(!0);if(v.isWrapped&&s[0]!==" "){for(r=0;(v=h.buffer.active.getLine(--g))&&r<2048&&(i=v.translateToString(!0),r+=i.length,e.push(i),v.isWrapped&&i.indexOf(" ")===-1););e.reverse()}for(e.push(s),r=0;(v=h.buffer.active.getLine(++u))&&v.isWrapped&&r<2048&&(i=v.translateToString(!0),r+=i.length,e.push(i),i.indexOf(" ")===-1););}return[e,g]}static _mapStrIdx(l,h,v,g){const u=l.buffer.active,r=u.getNullCell();let i=v;for(;g;){const e=u.getLine(h);if(!e)return[-1,-1];for(let s=i;s<e.length;++s){e.getCell(s,r);const d=r.getChars();if(r.getWidth()&&(g-=d.length||1,s===e.length-1&&d==="")){const m=u.getLine(h+1);m&&m.isWrapped&&(m.getCell(0,r),r.getWidth()===2&&(g+=1))}if(g<0)return[h,s]}h++,i=0}return[h,i]}}n.LinkComputer=c}},b={};function w(k){var n=b[k];if(n!==void 0)return n.exports;var a=b[k]={exports:{}};return _[k](a,a.exports,w),a.exports}var L={};return(()=>{var k=L;Object.defineProperty(k,"__esModule",{value:!0}),k.WebLinksAddon=void 0;const n=w(6),a=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function c(f,l){const h=window.open();if(h){try{h.opener=null}catch{}h.location.href=l}else console.warn("Opening link blocked as opener could not be cleared")}k.WebLinksAddon=class{constructor(f=c,l={}){this._handler=f,this._options=l}activate(f){this._terminal=f;const l=this._options,h=l.urlRegex||a;this._linkProvider=this._terminal.registerLinkProvider(new n.WebLinkProvider(this._terminal,h,this._handler,l))}dispose(){var f;(f=this._linkProvider)==null||f.dispose()}}})(),L})()))})(_s)),_s.exports}var Nc=Fc(),Wc=Y('<div class="flex-1 min-h-0 w-full p-1 overflow-hidden"></div>');function Uc(t,o){Ne(o,!0);let _=we(o,"isMobile",3,!1),b,w,L,k,n,a;function c(g){var r;if((r=navigator.clipboard)!=null&&r.writeText){navigator.clipboard.writeText(g).catch(()=>{});return}const u=document.createElement("textarea");u.value=g,u.style.position="fixed",u.style.opacity="0",document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u)}function f(g){(k==null?void 0:k.readyState)===WebSocket.OPEN&&k.send(JSON.stringify({type:"selectPane",pane:g}))}function l(g){(k==null?void 0:k.readyState)===WebSocket.OPEN&&k.send(JSON.stringify({type:"input",data:g}))}Js(()=>{w=new Oc.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}),L=new Hc.FitAddon,w.loadAddon(L),w.loadAddon(new Nc.WebLinksAddon),w.open(b),b.addEventListener("contextmenu",u=>u.preventDefault()),w.parser.registerOscHandler(52,u=>{const r=u.indexOf(";");if(r!==-1){const i=u.slice(r+1);try{c(atob(i))}catch{}}return!0}),w.onSelectionChange(()=>{const u=w.getSelection();u&&c(u)}),w.attachCustomKeyEventHandler(u=>{if(u.key==="Enter"&&u.shiftKey&&!u.ctrlKey&&!u.metaKey&&!u.altKey)return u.type==="keydown"&&k.readyState===WebSocket.OPEN&&k.send(JSON.stringify({type:"sendKeys",hexBytes:["1b","5b","31","33","3b","32","75"]})),!1;if(u.type!=="keydown")return!0;const r=u.metaKey||u.ctrlKey;return r&&(u.key==="c"||u.key==="C")?w.hasSelection()?(c(w.getSelection()),w.clearSelection(),!1):!0:!(r&&(u.key==="ArrowUp"||u.key==="ArrowDown")||r&&(u.key==="k"||u.key==="K")||r&&(u.key==="m"||u.key==="M")||r&&(u.key==="d"||u.key==="D"))}),requestAnimationFrame(()=>{L.fit(),w.focus()});const g=location.protocol==="https:"?"wss:":"ws:";k=new WebSocket(`${g}//${location.host}/ws/${encodeURIComponent(o.worktree)}`),k.onmessage=u=>{const r=u.data,i=r[0];if(i==="o"||i==="s"){w.write(r.slice(1));return}try{const e=JSON.parse(r);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{}},k.onopen=()=>{L.fit();const u={type:"resize",cols:w.cols,rows:w.rows};_()&&o.initialPane!==void 0&&(u.initialPane=o.initialPane),k.send(JSON.stringify(u))},k.onclose=()=>{w.writeln(`\r
|
|
13
|
+
\x1B[90m[Disconnected]\x1B[0m`)},w.onData(u=>{k.readyState===WebSocket.OPEN&&k.send(JSON.stringify({type:"input",data:u}))}),n=new ResizeObserver(()=>{clearTimeout(a),a=setTimeout(()=>{L.fit(),k.readyState===WebSocket.OPEN&&k.send(JSON.stringify({type:"resize",cols:w.cols,rows:w.rows}))},150)}),n.observe(b)}),Cl(()=>{clearTimeout(a),n==null||n.disconnect(),k==null||k.close(),w==null||w.dispose()});var h={sendSelectPane:f,sendInput:l},v=Wc();return Zr(v,g=>b=g,()=>b),K(t,v),We(h)}var jc=Y("<dialog><!></dialog>");function ti(t,o){Ne(o,!0);let _=we(o,"wide",3,!1),b;jt(()=>{b==null||b.showModal()});var w=jc(),L=$(w);Gs(L,()=>o.children),Zr(w,k=>b=k,()=>b),oe(()=>Fe(w,1,`bg-sidebar text-primary border border-edge rounded-xl p-6 w-[90%] ${_()?"max-w-[560px]":"max-w-[380px]"}`)),Ci("close",w,function(...k){var n;(n=o.onclose)==null||n.apply(this,k)}),K(t,w),We()}var zc=Y('<p class="text-[12px] text-danger mb-4 -mt-2 whitespace-pre-wrap"> </p>'),$c=Y('<span class="spinner"></span>'),Kc=Y("<!> ",1),qc=Y('<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 Cn(t,o){Ne(o,!0);let _=we(o,"loading",3,!1),b=we(o,"error",3,""),w=we(o,"confirmLabel",3,"Remove"),L=we(o,"variant",3,"danger");ti(t,{get onclose(){return o.oncancel},children:(k,n)=>{var a=qc(),c=V($(a),2),f=$(c),l=V(c,2);{var h=r=>{var i=zc(),e=$(i);oe(()=>se(e,b())),K(r,i)};ne(l,r=>{b()&&r(h)})}var v=V(l,2),g=$(v);Ze(g,{type:"button",get onclick(){return o.oncancel},get disabled(){return _()},children:(r,i)=>{var e=ze("Cancel");K(r,e)},$$slots:{default:!0}});var u=V(g,2);{let r=he(()=>L()==="accent"?"cta":"danger");Ze(u,{type:"submit",get variant(){return y(r)},class:"flex items-center gap-1.5",get disabled(){return _()},autofocus:!0,children:(i,e)=>{var s=Kc(),d=Re(s);{var m=C=>{var p=$c();K(C,p)};ne(d,C=>{_()&&C(m)})}var S=V(d);oe(()=>se(S,` ${w()??""}`)),K(i,s)},$$slots:{default:!0}})}oe(()=>se(f,o.message)),Ci("submit",a,r=>{r.preventDefault(),o.onconfirm()}),K(k,a)},$$slots:{default:!0}}),We()}var Vc=Y('<div class="mb-3"><label class="flex items-center gap-2 text-xs text-muted cursor-pointer"> <input type="checkbox" class="accent-[var(--accent)]"/></label></div>'),Gc=Y('<div class="mb-3"><label class="block text-xs text-muted mb-1.5"> </label> <input 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"/></div>'),Jc=Y('<div class="mb-4"><p class="text-xs text-muted mb-2">Startup Environment <span class="opacity-60">(optional)</span></p> <div class="pl-3 border-l border-edge"></div></div>');function Xc(t,o){Ne(o,!0);let _=we(o,"startupEnvs",19,()=>({})),b=we(o,"envValues",31,()=>Me({})),w=he(()=>Object.keys(_()));var L=It(),k=Re(L);{var n=a=>{var c=Jc(),f=V($(c),2);Xe(f,20,()=>y(w),l=>l,(l,h)=>{var v=It(),g=Re(v);{var u=i=>{var e=Vc(),s=$(e),d=$(s),m=V(d);oe(()=>{De(s,"for",`wt-env-${h??""}`),se(d,`${h??""} `),De(m,"id",`wt-env-${h??""}`),Fi(m,b()[h]===!0)}),Se("change",m,S=>{b(b()[h]=S.currentTarget.checked,!0)}),K(i,e)},r=i=>{var e=Gc(),s=$(e),d=$(s),m=V(s,2);oe(()=>{De(s,"for",`wt-env-${h??""}`),se(d,h),De(m,"id",`wt-env-${h??""}`)}),Or(m,()=>b()[h],S=>b(b()[h]=S,!0)),K(i,e)};ne(g,i=>{typeof _()[h]=="boolean"?i(u):i(r,-1)})}K(l,v)}),K(a,c)};ne(k,a=>{y(w).length>0&&a(n)})}K(t,L),We()}ft(["change"]);var Yc=Y('<label class="block text-xs text-muted mb-1.5" for="wt-name">Branch 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"/> <button type="button" class="mt-2 text-[11px] text-accent hover:underline">Use existing branch</button>',1),Zc=Y('<p class="px-3 py-2 text-xs text-muted">Loading branches...</p>'),Qc=Y('<p class="px-3 py-2 text-xs text-muted"> </p>'),eh=Y('<p class="px-3 py-2 text-xs text-muted">No matching branches</p>'),th=Y('<span class="text-[10px] text-accent">Selected</span>'),rh=Y('<li><button type="button"><span class="font-mono text-primary"> </span> <!></button></li>'),ih=Y('<div class="border-b border-edge px-3 py-2 text-[11px] text-muted"> </div> <ul class="max-h-48 overflow-y-auto py-1"></ul>',1),sh=Y('<div class="mt-2 rounded-lg border border-edge bg-surface/60"><div class="border-b border-edge p-2"><input type="text" class="w-full rounded-md border border-edge bg-surface px-2.5 py-1.5 text-[12px] text-primary placeholder:text-muted/50 outline-none focus:border-accent" placeholder="Search branches..."/></div> <!></div>'),nh=Y('<div><span class="block text-xs text-muted mb-1.5">Existing branch</span> <button type="button" class="flex w-full items-center justify-between gap-3 rounded-md border border-edge bg-surface px-2.5 py-1.5 text-left text-[13px] text-primary outline-none transition-colors hover:bg-hover focus:border-accent"><span> </span> <span class="text-[11px] text-muted"> </span></button> <!></div> <button type="button" class="mt-2 text-[11px] text-accent hover:underline">Create new branch instead</button> <p class="mt-2 text-[11px] text-muted">Removing this worktree will also delete the branch.</p>',1),oh=Y('<label><input type="radio" name="agent" class="accent-[var(--accent)]"/> </label>'),ah=Y('<label><input type="radio" name="profile" class="accent-[var(--accent)]"/> </label>'),lh=Y('<div class="flex flex-col gap-2 mb-6"></div>'),ch=Y('<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"><!></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 hh(t,o){Ne(o,!0);let _=we(o,"profiles",19,()=>[]),b=we(o,"defaultProfileName",3,""),w=we(o,"autoNameEnabled",3,!1),L=we(o,"initialBranch",3,""),k=we(o,"initialPrompt",3,""),n=we(o,"availableBranches",19,()=>[]),a=we(o,"availableBranchesLoading",3,!1),c=we(o,"availableBranchesError",3,null),f=we(o,"startupEnvs",19,()=>({}));const l=[{value:"claude",label:"Claude"},{value:"codex",label:"Codex"}],h="wt-default-profile",v="wt-default-agent",g="wt-default-envs",u=localStorage.getItem(h),r=localStorage.getItem(v),i=localStorage.getItem(g);let e=he(()=>{var re;return b()||((re=_()[0])==null?void 0:re.name)||"default"}),s=ae("new"),d=ae(Me(L())),m=ae(Me(k())),S=ae(""),C=ae(""),p=ae(!1),x=ae(Me(r??"claude")),T=ae(Me(u??""));const P=u!=null||r!=null||i!=null;let O=ae(Me(P)),B=ae(void 0),H=ae(void 0);function U(){if(!i)return{...f()};try{const re=JSON.parse(i),I=Object.fromEntries(Object.entries(re).filter(([D])=>D in f()));return{...f(),...I}}catch{return{...f()}}}let J=ae(Me(U()));function Q(re){re.focus()}let X=he(()=>y(C).trim()?n().filter(re=>Bs(y(C),re.name)):n()),E=he(()=>y(s)==="new"||y(S).length>0);jt(()=>{_().some(re=>re.name===y(T))||N(T,y(e),!0)});function A(re){N(S,re,!0),N(C,""),N(p,!1)}function R(){queueMicrotask(()=>{var re;return(re=y(H))==null?void 0:re.focus()})}function M(){N(s,"existing"),N(p,!0),!y(S)&&L().trim().length>0&&N(S,L().trim(),!0),N(C,""),R()}function z(){N(s,"new"),N(p,!1),N(C,"")}function q(re){var D;const I=re.relatedTarget;I instanceof Node&&((D=y(B))!=null&&D.contains(I))||(N(p,!1),N(C,""))}function te(){if(N(p,!y(p)),!y(p)){N(C,"");return}R()}ti(t,{get onclose(){return o.oncancel},children:(re,I)=>{var D=ch(),G=V($(D),2),F=V($(G),2);Dl(F,de=>Q==null?void 0:Q(de)),Si(()=>Or(F,()=>y(m),de=>N(m,de)));var ie=V(G,2),Z=$(ie);{var ce=de=>{var ge=Yc(),ye=V(Re(ge),2),xe=V(ye,2);oe(()=>De(ye,"placeholder",w()?"generated from prompt if empty":"auto-generated if empty")),Or(ye,()=>y(d),ke=>N(d,ke)),Se("click",xe,M),K(de,ge)},me=de=>{var ge=nh(),ye=Re(ge),xe=V($(ye),2),ke=$(xe),lt=$(ke),et=V(ke,2),Ht=$(et),Le=V(xe,2);{var Lr=tr=>{var xi=sh(),Ei=$(xi),Dr=$(Ei);Zr(Dr,Te=>N(H,Te),()=>y(H));var ki=V(Ei,2);{var Yi=Te=>{var vt=Zc();K(Te,vt)},Zi=Te=>{var vt=Qc(),Rr=$(vt);oe(()=>se(Rr,`Failed to load branches: ${c()??""}`)),K(Te,vt)},Qi=Te=>{var vt=eh();K(Te,vt)},es=Te=>{var vt=ih(),Rr=Re(vt),Li=$(Rr),ts=V(Rr,2);Xe(ts,21,()=>y(X),Ar=>Ar.name,(Ar,Br)=>{var ri=rh(),ii=$(ri),si=$(ii),rs=$(si),Di=V(si,2);{var is=Tr=>{var ss=th();K(Tr,ss)};ne(Di,Tr=>{y(S)===y(Br).name&&Tr(is)})}oe(()=>{Fe(ii,1,`flex w-full items-center justify-between gap-3 px-3 py-2 text-left text-[12px] transition-colors hover:bg-hover
|
|
14
|
+
${y(S)===y(Br).name?"bg-accent/10":""}`),se(rs,y(Br).name)}),Se("click",ii,()=>A(y(Br).name)),K(Ar,ri)}),oe(()=>se(Li,`${(y(X).length!==n().length?`${y(X).length}/${n().length}`:n().length)??""}
|
|
15
|
+
available`)),K(Te,vt)};ne(ki,Te=>{a()?Te(Yi):c()?Te(Zi,1):y(X).length===0?Te(Qi,2):Te(es,-1)})}Se("keydown",Dr,Te=>{Te.key==="Enter"&&!Te.shiftKey&&(Te.preventDefault(),y(X)[0]&&A(y(X)[0].name)),Te.key==="Escape"&&(Te.preventDefault(),N(p,!1),N(C,""))}),Or(Dr,()=>y(C),Te=>N(C,Te)),K(tr,xi)};ne(Le,tr=>{y(p)&&tr(Lr)})}Zr(ye,tr=>N(B,tr),()=>y(B));var yi=V(ye,2);oe(()=>{De(xe,"aria-expanded",y(p)),Fe(ke,1,Xs(y(S)?"font-mono":"text-muted/50")),se(lt,y(S)||"Select a branch"),se(Ht,y(p)?"▴":"▾")}),Se("focusout",ye,q),Se("click",xe,te),Se("click",yi,z),K(de,ge)};ne(Z,de=>{y(s)==="new"?de(ce):de(me,-1)})}var Ce=V(ie,2);Xc(Ce,{get startupEnvs(){return f()},get envValues(){return y(J)},set envValues(de){N(J,de,!0)}});var Ie=V(Ce,2);Xe(Ie,21,()=>l,fi,(de,ge)=>{var ye=oh(),xe=$(ye),ke=V(xe);oe(()=>{Fe(ye,1,`flex-1 flex items-center justify-center gap-2 p-2.5 rounded-lg border cursor-pointer text-[13px] transition-colors
|
|
16
|
+
${y(x)===y(ge).value?"border-accent bg-accent/10":"border-edge hover:bg-hover"}`),vn(xe,y(ge).value),Fi(xe,y(x)===y(ge).value),se(ke,` ${y(ge).label??""}`)}),Se("change",xe,()=>N(x,y(ge).value,!0)),K(de,ye)});var le=V(Ie,2);{var _t=de=>{var ge=lh();Xe(ge,21,_,fi,(ye,xe)=>{var ke=ah(),lt=$(ke),et=V(lt);oe(()=>{Fe(ke,1,`flex items-center gap-2.5 p-2.5 rounded-lg border cursor-pointer text-[13px] transition-colors
|
|
17
|
+
${y(T)===y(xe).name?"border-accent bg-accent/10":"border-edge hover:bg-hover"}`),vn(lt,y(xe).name),Fi(lt,y(T)===y(xe).name),se(et,` ${y(xe).name??""}`)}),Se("change",lt,()=>N(T,y(xe).name,!0)),K(ye,ke)}),K(de,ge)};ne(le,de=>{_().length>1&&de(_t)})}var ot=V(le,2),xt=$(ot),Et=V(ot,2),at=$(Et);Ze(at,{type:"button",get onclick(){return o.oncancel},children:(de,ge)=>{var ye=ze("Cancel");K(de,ye)},$$slots:{default:!0}});var Ae=V(at,2);{let de=he(()=>!y(E));Ze(Ae,{type:"submit",variant:"cta",get disabled(){return y(de)},children:(ge,ye)=>{var xe=ze("Create");K(ge,xe)},$$slots:{default:!0}})}Ci("submit",D,de=>{de.preventDefault(),y(O)?(localStorage.setItem(h,y(T)),localStorage.setItem(v,y(x)),localStorage.setItem(g,JSON.stringify(y(J)))):(localStorage.removeItem(h),localStorage.removeItem(v),localStorage.removeItem(g));const ge={};for(const[xe,ke]of Object.entries(y(J)))typeof ke=="boolean"?ke&&(ge[xe]="true"):ke&&(ge[xe]=ke);const ye=y(s)==="existing"?y(S):y(d).trim();o.oncreate(y(s),ye,y(T),y(x),y(m).trim(),ge)}),Se("keydown",F,de=>{var ge;de.key==="Enter"&&!de.shiftKey&&(de.preventDefault(),(ge=de.currentTarget.form)==null||ge.requestSubmit())}),Nl(xt,()=>y(O),de=>N(O,de)),K(re,D)},$$slots:{default:!0}}),We()}ft(["keydown","click","focusout","change"]);var uh=Y('<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 dh(t,o){Ne(o,!0);let _=ae(Me(localStorage.getItem(Ii)??"")),b;jt(()=>{b==null||b.focus()});function w(){const L=y(_).trim();L?localStorage.setItem(Ii,L):localStorage.removeItem(Ii),o.onsave(L)}ti(t,{get onclose(){return o.onclose},children:(L,k)=>{var n=uh(),a=V($(n),2),c=V($(a),2);Zr(c,v=>b=v,()=>b);var f=V(a,2),l=$(f);Ze(l,{type:"button",get onclick(){return o.onclose},children:(v,g)=>{var u=ze("Cancel");K(v,u)},$$slots:{default:!0}});var h=V(l,2);Ze(h,{type:"submit",variant:"cta",children:(v,g)=>{var u=ze("Save");K(v,u)},$$slots:{default:!0}}),Ci("submit",n,v=>{v.preventDefault(),w()}),Or(c,()=>y(_),v=>N(_,v)),K(L,n)},$$slots:{default:!0}}),We()}async function yt(t,o){const _=await fetch(`/api/${t}`,{headers:{"Content-Type":"application/json"},...o}),b=await _.json();if(!_.ok)throw new Error(b.error||`HTTP ${_.status}`);return b}function fh(){return yt("config")}function _h(t){switch(t){case"creating":case"running":case"starting":return"working";case"idle":return"waiting";case"stopped":return"done";case"error":return"error";default:return"idle"}}function vh(t){return{...t,ciChecks:t.ciChecks.map(o=>({...o})),comments:t.comments.map(o=>({...o}))}}function ph(t){var o;return{branch:t.branch,agent:_h(t.status),mux:t.mux?"✓":"",path:t.path,dir:t.dir,dirty:t.dirty,status:t.status,elapsed:t.elapsed,profile:t.profile,agentName:t.agentName,services:t.services.map(_=>({..._})),paneCount:t.paneCount,prs:t.prs.map(_=>vh(_)),linearIssue:t.linearIssue,creating:t.creation!==null,creationPhase:((o=t.creation)==null?void 0:o.phase)??null}}async function gh(){return(await yt("project")).worktrees.map(o=>ph(o))}async function mh(){return(await yt("branches")).branches}function Sh(t,o,_,b,w,L){return yt("worktrees",{method:"POST",body:JSON.stringify({mode:t,...o?{branch:o}:{},profile:_,agent:b,...w?{prompt:w}:{},...L&&Object.keys(L).length>0?{envOverrides:L}:{}})})}function bh(t){return yt(`worktrees/${encodeURIComponent(t)}`,{method:"DELETE"})}function wh(t){return yt(`worktrees/${encodeURIComponent(t)}/open`,{method:"POST"})}function Ch(t){return yt(`worktrees/${encodeURIComponent(t)}/close`,{method:"POST"})}function yh(t){return yt(`worktrees/${encodeURIComponent(t)}/merge`,{method:"POST"})}function xh(){return yt("linear/issues")}async function Eh(t){return(await yt(`ci-logs/${t}`)).logs}async function Ro(t,o,_){await yt(`worktrees/${encodeURIComponent(t)}/send`,{method:"POST",body:JSON.stringify({text:o,..._?{preamble:_}:{}})})}function kh(t,o,_){const b=new EventSource("/api/notifications/stream");return b.addEventListener("initial",w=>{try{const L=JSON.parse(w.data);_==null||_(L)}catch{}}),b.addEventListener("notification",w=>{try{const L=JSON.parse(w.data);t(L)}catch{}}),b.addEventListener("dismiss",w=>{try{const{id:L}=JSON.parse(w.data);o(L)}catch{}}),()=>b.close()}async function Lh(t){await yt(`notifications/${t}/dismiss`,{method:"POST"})}function Dh(t){return t.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g,"").replace(/\x1B[@-_]/g,"")}function Ao(t,o=3e4){const b=Dh(t).replace(/\r\n/g,`
|
|
18
|
+
`).replace(/\r/g,`
|
|
19
|
+
`).replace(/[^\x09\x0A\x20-\x7E]/g,"");return b.length>o?`[... truncated]
|
|
20
|
+
`+b.slice(-o):b}var Rh=Y("<button><!></button>");function Ts(t,o){let _=yo(o,["$$slots","$$events","$$legacy","children"]);var b=Rh();wo(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=$(b);Gs(w,()=>o.children),K(t,b)}var Ah=Y('<a target="_blank" rel="noopener" class="text-[11px] text-muted hover:text-primary no-underline hover:underline">GitHub ↗</a>'),Bh=Y('<div class="text-[12px] text-muted py-2">Loading logs...</div>'),Th=Y('<div class="text-[12px] text-danger py-2"> </div>'),Mh=Y('<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),Ph=Y('<div class="text-[12px] text-danger py-1.5"> </div>'),Oh=Y('<div class="mt-2"><!> <!></div>'),Ih=Y('<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>'),Hh=Y('<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 Fh(t,o){Ne(o,!0);let _=ae(null),b=ae(""),w=ae(!1),L=ae(""),k=ae(!1),n=ae(null),a=ae(""),c=he(()=>Ys(o.pr));async function f(u){if(y(_)===u){N(_,null);return}N(_,u,!0),N(b,""),N(L,""),N(w,!0),N(k,!1),N(a,"");try{N(b,await Eh(u),!0)}catch(r){N(L,Gt(r),!0)}finally{N(w,!1)}}async function l(u){if(!o.branch)return;N(a,""),N(n,y(_)??-1,!0);const r=["Fix the failing CI check.",`PR: ${y(c)}`,`Check: ${u}`,"","Logs:"].join(`
|
|
21
|
+
`)+`
|
|
22
|
+
`,i=Ao(y(b));try{await Ro(o.branch,i,r),o.onfixsuccess()}catch(e){N(a,Gt(e),!0)}finally{N(n,null)}}async function h(){await navigator.clipboard.writeText(y(b)),N(k,!0),setTimeout(()=>{N(k,!1)},2e3)}function v(u){return u==="success"?"✓":u==="failed"?"✗":u==="skipped"?"—":"○"}function g(u){return u==="success"?"text-success":u==="failed"?"text-danger":u==="pending"?"text-warning":"text-muted"}ti(t,{get onclose(){return o.onclose},wide:!0,children:(u,r)=>{var i=Hh(),e=Re(i),s=$(e),d=V(e,2);Xe(d,21,()=>o.pr.ciChecks,C=>C.name+C.runId,(C,p)=>{var x=Ih(),T=$(x),P=$(T),O=$(P),B=V(P,2),H=$(B),U=V(B,2),J=$(U),Q=V(T,2),X=$(Q);{var E=q=>{Ts(q,{onclick:()=>f(y(p).runId??-1),children:(te,re)=>{var I=ze();oe(()=>se(I,y(_)===y(p).runId?"Hide logs":"View logs")),K(te,I)},$$slots:{default:!0}})};ne(X,q=>{y(p).status==="failed"&&y(p).runId!==null&&q(E)})}var A=V(X,2);{var R=q=>{var te=Ah();oe(()=>De(te,"href",y(p).url)),K(q,te)};ne(A,q=>{y(p).url&&q(R)})}var M=V(Q,2);{var z=q=>{var te=Oh(),re=$(te);{var I=Z=>{var ce=Bh();K(Z,ce)},D=Z=>{var ce=Th(),me=$(ce);oe(()=>se(me,y(L))),K(Z,ce)},G=Z=>{var ce=Mh(),me=Re(ce),Ce=$(me),Ie=V(me,2),le=$(Ie);Ts(le,{onclick:h,children:(ot,xt)=>{var Et=ze();oe(()=>se(Et,y(k)?"Copied!":"Copy logs")),K(ot,Et)},$$slots:{default:!0}});var _t=V(le,2);{let ot=he(()=>!o.branch||!y(b)||y(w)||y(n)!==null);Ze(_t,{variant:"cta",small:!0,get disabled(){return y(ot)},onclick:()=>l(y(p).name),children:(xt,Et)=>{var at=ze();oe(()=>se(at,y(n)!==null?"Asking agent...":"Ask agent to fix")),K(xt,at)},$$slots:{default:!0}})}oe(()=>se(Ce,y(b))),K(Z,ce)};ne(re,Z=>{y(w)?Z(I):y(L)?Z(D,1):y(b)&&Z(G,2)})}var F=V(re,2);{var ie=Z=>{var ce=Ph(),me=$(ce);oe(()=>se(me,y(a))),K(Z,ce)};ne(F,Z=>{y(a)&&Z(ie)})}K(q,te)};ne(M,q=>{y(_)===y(p).runId&&q(z)})}oe((q,te,re)=>{Fe(P,1,`text-sm font-bold ${q??""}`),se(O,te),se(H,y(p).name),Fe(U,1,`text-[11px] ${re??""}`),se(J,y(p).status)},[()=>g(y(p).status),()=>v(y(p).status),()=>g(y(p).status)]),K(C,x)});var m=V(d,2),S=$(m);Ze(S,{type:"button",get onclick(){return o.onclose},children:(C,p)=>{var x=ze("Close");K(C,x)},$$slots:{default:!0}}),oe(()=>se(s,`CI Checks — ${y(c)??""}`)),K(u,i)},$$slots:{default:!0}}),We()}var Nh=["forEach","isDisjointFrom","isSubsetOf","isSupersetOf"],Wh=["difference","intersection","symmetricDifference","union"],yn=!1,Kr,Tt,or,ji,Qr,Bo,To;const zi=class zi extends Set{constructor(_){super();ue(this,Qr);ue(this,Kr,new Map);ue(this,Tt,ae(0));ue(this,or,ae(0));ue(this,ji,Qt||-1);if(_){for(var b of _)super.add(b);W(this,or).v=super.size}yn||Oe(this,Qr,To).call(this)}has(_){var b=super.has(_),w=W(this,Kr),L=w.get(_);if(L===void 0){if(!b)return y(W(this,Tt)),!1;L=Oe(this,Qr,Bo).call(this,!0),w.set(_,L)}return y(L),b}add(_){return super.has(_)||(super.add(_),N(W(this,or),super.size),hr(W(this,Tt))),this}delete(_){var b=super.delete(_),w=W(this,Kr),L=w.get(_);return L!==void 0&&(w.delete(_),N(L,!1)),b&&(N(W(this,or),super.size),hr(W(this,Tt))),b}clear(){if(super.size!==0){super.clear();var _=W(this,Kr);for(var b of _.values())N(b,!1);_.clear(),N(W(this,or),0),hr(W(this,Tt))}}keys(){return this.values()}values(){return y(W(this,Tt)),super.values()}entries(){return y(W(this,Tt)),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return y(W(this,or))}};Kr=new WeakMap,Tt=new WeakMap,or=new WeakMap,ji=new WeakMap,Qr=new WeakSet,Bo=function(_){return Qt===W(this,ji)?ae(_):ur(_)},To=function(){yn=!0;var _=zi.prototype,b=Set.prototype;for(const w of Nh)_[w]=function(...L){return y(W(this,Tt)),b[w].apply(this,L)};for(const w of Wh)_[w]=function(...L){y(W(this,Tt));var k=b[w].apply(this,L);return new zi(k)}};let Ms=zi;var Uh=Y('<span class="text-muted ml-1">(reply)</span>'),jh=Y('<div class="text-[10px] font-mono text-accent mb-1 truncate"> <!></div>'),zh=Y('<span class="text-accent/60 ml-1">review</span>'),$h=Y('<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>'),Kh=Y('<div class="text-[12px] text-danger mb-3"> </div>'),qh=Y('<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 Vh(t,o){Ne(o,!0);let _=ae(!1),b=ae("");const w=new Ms;jt(()=>{const h=o.pr.comments.length;er(()=>{w.clear();for(let v=0;v<h;v++)w.add(v)})});let L=he(()=>Ys(o.pr)),k=he(()=>w.size===o.pr.comments.length),n=he(()=>w.size===0);function a(){if(y(k))w.clear();else for(let h=0;h<o.pr.comments.length;h++)w.add(h)}function c(h){w.has(h)?w.delete(h):w.add(h)}function f(h,v){if(h.type==="inline"){const g=h.line?`${h.path}:${h.line}`:h.path,u=h.diffHunk?`
|
|
23
|
+
\`\`\`diff
|
|
24
|
+
${h.diffHunk}
|
|
25
|
+
\`\`\`
|
|
26
|
+
`:`
|
|
27
|
+
`;return`[${v}] @${h.author} (${h.createdAt.slice(0,10)}) on ${g}:${u}${h.body}`}return`[${v}] @${h.author} (${h.createdAt.slice(0,10)}):
|
|
28
|
+
${h.body}`}async function l(){if(!o.branch||y(n))return;N(_,!0),N(b,"");const h=["Review the PR comments (including inline review comments) and elaborate a plan to address them.",`PR: ${y(L)}`,"","Comments:"].join(`
|
|
29
|
+
`)+`
|
|
30
|
+
`,v=o.pr.comments.filter((g,u)=>w.has(u)).map((g,u)=>f(g,u+1)).join(`
|
|
31
|
+
|
|
32
|
+
`);try{await Ro(o.branch,Ao(v,2e4),h),o.onsendsuccess()}catch(g){N(b,Gt(g),!0)}finally{N(_,!1)}}ti(t,{get onclose(){return o.onclose},wide:!0,children:(h,v)=>{var g=qh(),u=Re(g),r=$(u),i=V(u,2),e=$(i);Ts(e,{onclick:a,children:(P,O)=>{var B=ze();oe(()=>se(B,y(k)?"Deselect all":"Select all")),K(P,B)},$$slots:{default:!0}});var s=V(e,2),d=$(s),m=V(i,2);Xe(m,21,()=>o.pr.comments,fi,(P,O,B)=>{var H=$h(),U=$(H),J=$(U),Q=V(J,2),X=$(Q);{var E=D=>{var G=jh(),F=$(G),ie=V(F);{var Z=ce=>{var me=Uh();K(ce,me)};ne(ie,ce=>{y(O).isReply&&ce(Z)})}oe(()=>{De(G,"title",y(O).path),se(F,`${y(O).path??""}${y(O).line?`:${y(O).line}`:""} `)}),K(D,G)};ne(X,D=>{y(O).type==="inline"&&D(E)})}var A=V(X,2),R=$(A),M=$(R),z=V(R),q=V(z);{var te=D=>{var G=zh();K(D,G)};ne(q,D=>{y(O).type==="inline"&&D(te)})}var re=V(A,2),I=$(re);oe((D,G)=>{Fi(J,D),se(M,`@${y(O).author??""}`),se(z,` · ${G??""} `),se(I,y(O).body)},[()=>w.has(B),()=>y(O).createdAt.slice(0,10)]),Se("change",J,()=>c(B)),K(P,H)});var S=V(m,2);{var C=P=>{var O=Kh(),B=$(O);oe(()=>se(B,y(b))),K(P,O)};ne(S,P=>{y(b)&&P(C)})}var p=V(S,2),x=$(p);Ze(x,{type:"button",get onclick(){return o.onclose},children:(P,O)=>{var B=ze("Cancel");K(P,B)},$$slots:{default:!0}});var T=V(x,2);{let P=he(()=>y(n)||y(_));Ze(T,{variant:"cta",small:!0,get disabled(){return y(P)},onclick:l,children:(O,B)=>{var H=ze();oe(()=>se(H,y(_)?"Sending...":`Send ${w.size} to agent`)),K(O,H)},$$slots:{default:!0}})}oe(()=>{se(r,`PR Comments — ${y(L)??""}`),se(d,`${w.size??""} of ${o.pr.comments.length??""} selected`)}),K(h,g)},$$slots:{default:!0}}),We()}ft(["change"]);var Gh=Y('<button type="button"> </button>'),Jh=Y('<nav class="flex items-stretch bg-topbar border-t border-edge pane-bar svelte-19vlwaa"></nav>');function Xh(t,o){Ne(o,!0);var _=Jh();Xe(_,21,()=>o.panes,b=>b.index,(b,w)=>{var L=Gh(),k=$(L);oe(()=>{Fe(L,1,`flex-1 py-3 text-sm font-medium cursor-pointer border-none bg-transparent ${o.activePane===y(w).index?"text-accent pane-active":"text-muted"}`,"svelte-19vlwaa"),se(k,y(w).label)}),Se("click",L,()=>o.onselect(y(w).index)),K(b,L)}),K(t,_),We()}ft(["click"]);var Yh=Y('<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">×</button></div>'),Zh=Y('<div class="fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm"></div>');function Qh(t,o){Ne(o,!0);var _=It(),b=Re(_);{var w=L=>{var k=Zh();Xe(k,21,()=>o.notifications,n=>n.id,(n,a)=>{var c=Yh(),f=$(c),l=$(f);Lo(l,{get notification(){return y(a)},large:!0});var h=V(f,2);Se("click",f,()=>{o.ondismiss(y(a).id),o.onselect(y(a).branch)}),Se("click",h,()=>o.ondismiss(y(a).id)),K(n,c)}),K(L,k)};ne(b,L=>{o.notifications.length>0&&L(w)})}K(t,_),We()}ft(["click"]);var eu=Y('<p class="text-[10px] text-muted truncate m-0 mb-1"> </p>'),tu=Y('<li class="mb-1 p-2 rounded-md border border-transparent hover:bg-hover text-[12px] cursor-pointer" role="button" tabindex="0"><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> <p class="truncate text-primary mb-1 m-0"> </p> <!> <div class="flex items-center justify-between gap-2"><span class="text-[10px] text-muted truncate"> <!></span> <span role="none"><!></span></div></li>'),ru=Y('<div class="px-2 pb-1"><input type="text" placeholder="Search issues…" class="w-full px-2 py-1 text-xs rounded border border-edge bg-surface text-primary placeholder:text-muted outline-none focus:border-accent"/></div> <ul class="list-none overflow-y-auto max-h-64 px-2 pb-2"></ul>',1),iu=Y('<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 su(t,o){Ne(o,!0);let _=ae(!0),b=ae(""),w=he(()=>y(b)?o.issues.filter(v=>Bs(y(b),v.title)||(v.description?Bs(y(b),v.description):!1)):o.issues);var L=iu(),k=$(L),n=$(k),a=$(n),c=V(n,2),f=$(c),l=V(k,2);{var h=v=>{var g=ru(),u=Re(g),r=$(u),i=V(u,2);Xe(i,21,()=>y(w),e=>e.id,(e,s)=>{var d=tu(),m=$(d),S=$(m),C=V(S,2),p=$(C),x=V(C,2),T=$(x),P=V(m,2),O=$(P),B=V(P,2);{var H=M=>{var z=eu(),q=$(z);oe(()=>se(q,y(s).description)),K(M,z)};ne(B,M=>{y(s).description&&M(H)})}var U=V(B,2),J=$(U),Q=$(J),X=V(Q);{var E=M=>{var z=ze();oe(()=>se(z,`· ${y(s).project??""}`)),K(M,z)};ne(X,M=>{y(s).project&&M(E)})}var A=V(J,2),R=$(A);Ze(R,{small:!0,variant:"accent-outline",onclick:()=>o.onassign(y(s)),children:(M,z)=>{var q=ze("Implement");K(M,q)},$$slots:{default:!0}}),oe(()=>{_i(S,`background: ${y(s).state.color??""};`),De(S,"title",y(s).state.name),De(C,"href",y(s).url),se(p,y(s).identifier),se(T,y(s).priorityLabel),se(O,y(s).title),se(Q,y(s).team.key)}),Se("click",d,()=>o.onselect(y(s))),Se("keydown",d,M=>{(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),o.onselect(y(s)))}),Se("click",C,M=>M.stopPropagation()),Se("keydown",C,M=>M.stopPropagation()),Se("click",A,M=>M.stopPropagation()),Se("keydown",A,M=>{(M.key==="Enter"||M.key===" ")&&M.stopPropagation()}),K(e,d)}),Or(r,()=>y(b),e=>N(b,e)),K(v,g)};ne(l,v=>{y(_)||v(h)})}oe(()=>{se(a,`Linear (${y(w).length!==o.issues.length?`${y(w).length}/`:""}${o.issues.length??""})`),se(f,y(_)?"▸":"▾")}),Se("click",k,()=>N(_,!y(_))),K(t,L),We()}ft(["click","keydown"]);var nu=Y('<div class="text-[13px] text-secondary whitespace-pre-wrap max-h-64 overflow-y-auto mb-4 leading-relaxed"> </div>'),ou=Y('<p class="text-[13px] text-muted italic mb-4">No description</p>'),au=Y("<span> </span>"),lu=Y('<span class="px-1.5 py-0.5 rounded-full text-[10px]"> </span>'),cu=Y("<span> </span>"),hu=Y('<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 uu(t,o){Ne(o,!0),ti(t,{get onclose(){return o.onclose},wide:!0,children:(_,b)=>{var w=hu(),L=Re(w),k=$(L),n=V(k,2),a=$(n),c=V(n,2),f=$(c),l=V(c,2),h=$(l),v=V(L,2),g=$(v),u=V(v,2);{var r=H=>{var U=nu(),J=$(U);oe(()=>se(J,o.issue.description)),K(H,U)},i=H=>{var U=ou();K(H,U)};ne(u,H=>{o.issue.description?H(r):H(i,-1)})}var e=V(u,2),s=$(e),d=$(s),m=V(s,2);{var S=H=>{var U=au(),J=$(U);oe(()=>se(J,`· ${o.issue.project??""}`)),K(H,U)};ne(m,H=>{o.issue.project&&H(S)})}var C=V(m,2);{var p=H=>{var U=It(),J=Re(U);Xe(J,17,()=>o.issue.labels,Q=>Q.name,(Q,X)=>{var E=lu(),A=$(E);oe(()=>{_i(E,`color: ${y(X).color??""}; background: ${y(X).color??""}20;`),se(A,y(X).name)}),K(Q,E)}),K(H,U)};ne(C,H=>{o.issue.labels.length>0&&H(p)})}var x=V(C,2);{var T=H=>{var U=cu(),J=$(U);oe(()=>se(J,`Due ${o.issue.dueDate??""}`)),K(H,U)};ne(x,H=>{o.issue.dueDate&&H(T)})}var P=V(e,2),O=$(P);Ze(O,{get onclick(){return o.onclose},children:(H,U)=>{var J=ze("Close");K(H,J)},$$slots:{default:!0}});var B=V(O,2);Ze(B,{variant:"accent-outline",onclick:()=>o.onassign(o.issue),children:(H,U)=>{var J=ze("Implement");K(H,J)},$$slots:{default:!0}}),oe(()=>{_i(k,`background: ${o.issue.state.color??""};`),De(k,"title",o.issue.state.name),De(n,"href",o.issue.url),se(a,o.issue.identifier),se(f,o.issue.state.name),se(h,`· ${o.issue.priorityLabel??""}`),se(g,o.issue.title),se(d,o.issue.team.key)}),K(_,w)},$$slots:{default:!0}}),We()}var du=Y('<div class="fixed inset-0 bg-black/50 z-40"></div>'),fu=Y('<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">×</button>'),_u=Y('<div class="mt-2 flex items-center gap-1 text-[10px] text-muted"><span class="spinner"></span> </div>'),vu=Y('<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>'),pu=Y('<!> <aside><div class="p-4 border-b border-edge"><div class="flex items-center justify-between"><h1 class="text-base font-semibold"> </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> <!></div> <!> <!> <!></aside>',1),gu=Y('<div class="flex-1 flex items-center justify-center px-6"><div class="flex flex-col items-center gap-3 text-center"><span class="spinner" style="width: 24px; height: 24px; border-width: 2px;"></span> <p class="text-sm text-primary font-medium"> </p> <p class="text-xs text-muted"> </p></div></div>'),mu=Y('<div class="flex-1 flex items-center justify-center text-muted text-sm"><p>Select a worktree from the sidebar to connect</p></div>'),Su=Y('<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 bu(t,o){Ne(o,!0);let _=ae(Me({services:[],profiles:[],defaultProfileName:"",autoName:!1,linkedRepos:[]})),b=ae(Me([])),w=ae(null),L=ae(null),k=ae(null),n=ae(Me(new Set)),a=ae(!1),c=ae(!1),f=ae(null),l=ae(null),h=ae(0),v=-1,g=0,u=0,r=ae(Me(localStorage.getItem(Ii)??"")),i=null,e=ae(null),s=ae(Me([])),d=ae(!1),m=ae(null),S=ae(Me([])),C=ae(null),p=ae(null),x=0;const T=3e5,P=5e3,O=1e3;let B=ae(Me([])),H=ae(Me([])),U=ae(0);const J=4e3,Q=10;let X=ae(Me(new Set));function E(j){N(B,[...y(B),j],!0),N(X,new Set([...y(X),j.branch]),!0),N(H,[j,...y(H)].slice(0,Q),!0),Ga(U),setTimeout(()=>{N(B,y(B).filter(ee=>ee.id!==j.id),!0)},J),document.hidden&&Notification.permission==="granted"&&new Notification(j.message,{body:j.url??j.branch,tag:`wm-${j.id}`})}function A(j){y(H).some(ee=>ee.id===j.id)||N(H,[j,...y(H)].slice(0,Q),!0)}function R(j){N(B,y(B).filter(ee=>ee.id!==j),!0),Lh(j).catch(()=>{})}function M(j){N(B,y(B).filter(ee=>ee.id!==j),!0)}function z(){N(U,0)}let q=ae(!1),te=ae(!1),re=ae(0),I=ae(void 0);const D=200;let G=ae(Me(new Set)),F=he(()=>y(b)),ie=he(()=>y(F).filter(j=>j.creating)),Z=he(()=>y(F).filter(j=>j.creating).length),ce=he(()=>Math.max(y(h),y(Z))),me=he(()=>y(ce)>0),Ce=he(()=>y(F).filter(j=>!y(n).has(j.branch))),Ie=he(()=>y(ce)===1?"Creating...":`Creating ${y(ce)}...`),le=he(()=>y(w)&&!y(n).has(y(w))?y(F).find(j=>j.branch===y(w)):void 0),_t=he(()=>{var j,ee;return!!y(w)&&((j=y(le))==null?void 0:j.mux)==="✓"&&!((ee=y(le))!=null&&ee.creating)}),ot=he(()=>y(me)?O:P);jt(()=>{if(y(w)&&y(le))return;if(y(Ce).length===0){N(w,null);return}const j=y(Ce).find(ee=>ee.mux==="✓");N(w,(j??y(Ce)[0]).branch,!0)}),jt(()=>{if(y(h)===0)return;const j=y(e)?y(F).find(ee=>ee.branch===y(e)):y(ie).length===1?y(ie)[0]:void 0;j&&(N(w,j.branch,!0),y(q)&&N(te,!1))}),jt(()=>{i==null||i(y(ot))}),jt(()=>{if(!y(a))return;const j=++u;N(s,[],!0),N(d,!0),N(m,null),mh().then(ee=>{j===u&&N(s,ee,!0)}).catch(ee=>{j===u&&N(m,Gt(ee),!0)}).finally(()=>{j===u&&N(d,!1)})}),jt(()=>{document.title=y(_).name?`${y(_).name} - Dashboard`:"Dev Dashboard"});let xt=he(()=>{var ee;const j=((ee=y(le))==null?void 0:ee.paneCount)??0;return j<2?[]:Array.from({length:j},(ve,Be)=>({index:Be,label:String(Be+1)}))}),Et=he(()=>y(q)&&y(_t)&&y(xt).length>0);function at(){const j=Date.now();j-x<T||(x=j,xh().then(ee=>{N(S,ee,!0)}).catch(ee=>console.warn("[linear]",ee)))}async function Ae(){try{N(b,await gh(),!0)}catch(j){console.error("Failed to refresh:",j)}at()}function de(j){N(C,j,!0),N(a,!0)}async function ge(j,ee,ve,Be,Pe,Ue){const tt=g++;v=tt,N(h,y(h)+1),N(e,ee||null,!0),N(a,!1),N(C,null);try{const kt=Sh(j,ee||void 0,ve,Be,Pe||void 0,Object.keys(Ue).length>0?Ue:void 0);Ae();const rr=await kt;N(e,rr.branch,!0),await Ae(),tt===v&&(N(w,rr.branch,!0),y(q)&&N(te,!1))}catch(kt){alert(`Failed to create: ${Gt(kt)}`)}finally{N(h,Math.max(0,y(h)-1),!0),tt===v&&N(e,null)}}function ye(j){if(y(w)!==j)return;const ee=y(F).findIndex(Ue=>Ue.branch===j),ve=y(F)[ee-1],Be=y(F)[ee+1],Pe=[ve,Be].find(Ue=>Ue&&!y(n).has(Ue.branch));N(w,Pe?Pe.branch:null,!0)}async function xe(){const j=y(L);if(j){N(L,null),ye(j),N(n,new Set([...y(n),j]),!0);try{await bh(j),await Ae()}catch(ee){alert(`Failed to remove: ${Gt(ee)}`)}finally{N(n,new Set([...y(n)].filter(ee=>ee!==j)),!0)}}}async function ke(){const j=y(k);if(j){N(k,null),ye(j),N(n,new Set([...y(n),j]),!0);try{await yh(j),await Ae()}catch(ee){alert(`Failed to merge: ${Gt(ee)}`)}finally{N(n,new Set([...y(n)].filter(ee=>ee!==j)),!0)}}}async function lt(){const j=y(w);if(j){ye(j);try{await Ch(j),await Ae()}catch(ee){alert(`Failed to close worktree: ${Gt(ee)}`)}}}function et(j){const ee=y(F).filter(Pe=>!y(n).has(Pe.branch));if(ee.length===0)return;if(!y(w)){N(w,ee[j===1?0:ee.length-1].branch,!0);return}const Be=ee.findIndex(Pe=>Pe.branch===y(w))+j;Be>=0&&Be<ee.length&&N(w,ee[Be].branch,!0)}function Ht(j){y(a)||y(L)||y(k)||!(j.metaKey||j.ctrlKey)||(j.key==="ArrowUp"?(j.preventDefault(),et(-1)):j.key==="ArrowDown"?(j.preventDefault(),et(1)):j.key==="k"||j.key==="K"?(j.preventDefault(),N(a,!0)):j.key==="m"||j.key==="M"?(j.preventDefault(),y(w)&&N(k,y(w),!0)):(j.key==="d"||j.key==="D")&&(j.preventDefault(),y(w)&&N(L,y(w),!0)))}function Le(j){var ee;N(re,j,!0),(ee=y(I))==null||ee.sendSelectPane(j)}Js(()=>{fh().then(qt=>{N(_,qt,!0)}).catch(()=>{}),Ae(),at();let j=y(ot),ee;window.addEventListener("keydown",Ht);let ve=kh(E,M,A);Notification.permission==="default"&&Notification.requestPermission().catch(()=>{});let Be,Pe=!1;function Ue(){ee&&clearInterval(ee),!(document.hidden||Pe)&&(ee=setInterval(Ae,j))}i=qt=>{j!==qt&&(j=qt,Ue())},Ue();function tt(){Pe&&(Pe=!1,Ae(),Ue()),clearTimeout(Be),Be=setTimeout(()=>{Pe=!0,ee&&clearInterval(ee)},6e4)}document.addEventListener("click",tt),document.addEventListener("keydown",tt),tt();function kt(){document.hidden?ee&&clearInterval(ee):(tt(),Ae(),Ue())}document.addEventListener("visibilitychange",kt);const rr=window.matchMedia("(max-width: 768px)");N(q,rr.matches,!0),y(q)&&N(te,!0);function Ri(qt){N(q,qt.matches,!0)}return rr.addEventListener("change",Ri),()=>{ee&&clearInterval(ee),i=null,clearTimeout(Be),document.removeEventListener("click",tt),document.removeEventListener("keydown",tt),window.removeEventListener("keydown",Ht),document.removeEventListener("visibilitychange",kt),rr.removeEventListener("change",Ri),ve()}});var Lr=Su(),yi=Re(Lr),tr=$(yi);{var xi=j=>{var ee=pu(),ve=Re(ee);{var Be=Ee=>{var je=du();Se("click",je,()=>N(te,!1)),Se("keydown",je,Lt=>{Lt.key==="Escape"&&N(te,!1)}),K(Ee,je)};ne(ve,Ee=>{y(q)&&Ee(Be)})}var Pe=V(ve,2),Ue=$(Pe),tt=$(Ue),kt=$(tt),rr=$(kt),Ri=V(kt,2),qt=$(Ri),Po=V(qt,2);{var Oo=Ee=>{var je=fu();Se("click",je,()=>N(te,!1)),K(Ee,je)};ne(Po,Ee=>{y(q)&&Ee(Oo)})}var Io=V(tt,2);{var Ho=Ee=>{var je=_u(),Lt=V($(je));oe(()=>se(Lt,` ${y(Ie)??""}`)),K(Ee,je)};ne(Io,Ee=>{y(ce)>0&&Ee(Ho)})}var Zs=V(Ue,2);ac(Zs,{get worktrees(){return y(F)},get selected(){return y(w)},get removing(){return y(n)},get initializing(){return y(G)},get notifiedBranches(){return y(X)},onselect:async Ee=>{const je=y(b).find(Lt=>Lt.branch===Ee);if(N(w,Ee,!0),N(X,new Set([...y(X)].filter(Lt=>Lt!==Ee)),!0),y(q)&&N(te,!1),!(je!=null&&je.creating)&&je&&je.mux!=="✓"){N(G,new Set([...y(G),Ee]),!0);try{await wh(Ee),await Ae()}catch(Lt){alert(`Failed to open worktree: ${Gt(Lt)}`)}finally{N(G,new Set([...y(G)].filter(Lt=>Lt!==Ee)),!0)}}},onremove:Ee=>N(L,Ee,!0)});var Qs=V(Zs,2);{var Fo=Ee=>{su(Ee,{get issues(){return y(S)},onassign:de,onselect:je=>N(p,je,!0)})};ne(Qs,Ee=>{y(S).length>0&&Ee(Fo)})}var No=V(Qs,2);{var Wo=Ee=>{var je=vu();K(Ee,je)};ne(No,Ee=>{y(q)||Ee(Wo)})}oe(()=>{Fe(Pe,1,`${y(q)?"fixed inset-0 z-50 w-full":"w-[220px] min-w-[220px]"} bg-sidebar border-r border-edge flex flex-col overflow-hidden`),se(rr,y(_).name??"Dashboard")}),Se("click",qt,()=>N(a,!0)),K(j,ee)};ne(tr,j=>{(!y(q)||y(te))&&j(xi)})}var Ei=V(tr,2),Dr=$(Ei);{let j=he(()=>{var ve;return((ve=y(le))==null?void 0:ve.branch)??null}),ee=he(()=>y(_).linkedRepos??[]);Mc(Dr,{get name(){return y(j)},get worktree(){return y(le)},get sshHost(){return y(r)},get linkedRepos(){return y(ee)},get isMobile(){return y(q)},get notificationHistory(){return y(H)},get unreadCount(){return y(U)},ontogglesidebar:()=>N(te,!y(te)),onclose:lt,onmerge:()=>{y(w)&&N(k,y(w),!0)},onremove:()=>{y(w)&&N(L,y(w),!0)},onsettings:()=>N(c,!0),onciclick:ve=>N(f,ve,!0),onreviewsclick:ve=>N(l,ve,!0),onbellopen:z,onnotificationselect:ve=>{N(w,ve,!0),N(X,new Set([...y(X)].filter(Be=>Be!==ve)),!0),y(q)&&N(te,!1)}})}var ki=V(Dr,2);{var Yi=j=>{var ee=It(),ve=Re(ee);xl(ve,()=>y(w),Be=>{{let Pe=he(()=>y(q)?y(re):void 0);Zr(Uc(Be,{get worktree(){return y(w)},get isMobile(){return y(q)},get initialPane(){return y(Pe)}}),Ue=>N(I,Ue,!0),()=>y(I))}}),K(j,ee)},Zi=j=>{var ee=gu(),ve=$(ee),Be=V($(ve),2),Pe=$(Be),Ue=V(Be,2),tt=$(Ue);oe(kt=>{se(Pe,y(le).branch),se(tt,kt)},[()=>xo(y(le).creationPhase)]),K(j,ee)},Qi=j=>{var ee=mu();K(j,ee)};ne(ki,j=>{var ee;y(_t)?j(Yi):(ee=y(le))!=null&&ee.creating?j(Zi,1):j(Qi,-1)})}var es=V(ki,2);{var Te=j=>{Xh(j,{get activePane(){return y(re)},get panes(){return y(xt)},onselect:Le})};ne(es,j=>{y(Et)&&j(Te)})}var vt=V(yi,2);{var Rr=j=>{{let ee=he(()=>{var Pe;return((Pe=y(C))==null?void 0:Pe.branchName)??""}),ve=he(()=>y(C)?`${y(C).title}${y(C).description?`
|
|
33
|
+
|
|
34
|
+
`+y(C).description:""}`:""),Be=he(()=>y(_).startupEnvs??{});hh(j,{get profiles(){return y(_).profiles},get defaultProfileName(){return y(_).defaultProfileName},get autoNameEnabled(){return y(_).autoName},get initialBranch(){return y(ee)},get initialPrompt(){return y(ve)},get availableBranches(){return y(s)},get availableBranchesLoading(){return y(d)},get availableBranchesError(){return y(m)},get startupEnvs(){return y(Be)},oncreate:ge,oncancel:()=>{N(a,!1),N(C,null)}})}};ne(vt,j=>{y(a)&&j(Rr)})}var Li=V(vt,2);{var ts=j=>{{let ee=he(()=>`Remove worktree "${y(L)}"? This action cannot be undone.`);Cn(j,{get message(){return y(ee)},onconfirm:xe,oncancel:()=>N(L,null)})}};ne(Li,j=>{y(L)&&j(ts)})}var Ar=V(Li,2);{var Br=j=>{{let ee=he(()=>`Merge worktree "${y(k)}" into main? The worktree will be removed after merging.`);Cn(j,{get message(){return y(ee)},confirmLabel:"Merge",variant:"accent",onconfirm:ke,oncancel:()=>N(k,null)})}};ne(Ar,j=>{y(k)&&j(Br)})}var ri=V(Ar,2);{var ii=j=>{dh(j,{onsave:ee=>{N(r,ee,!0),N(c,!1)},onclose:()=>N(c,!1)})};ne(ri,j=>{y(c)&&j(ii)})}var si=V(ri,2);{var rs=j=>{{let ee=he(()=>{var ve;return((ve=y(le))==null?void 0:ve.branch)??""});Fh(j,{get pr(){return y(f)},get branch(){return y(ee)},onclose:()=>N(f,null),onfixsuccess:()=>{N(f,null),setTimeout(()=>{var ve;return(ve=y(I))==null?void 0:ve.sendInput("\r")},D)}})}};ne(si,j=>{y(f)&&j(rs)})}var Di=V(si,2);{var is=j=>{{let ee=he(()=>{var ve;return((ve=y(le))==null?void 0:ve.branch)??""});Vh(j,{get pr(){return y(l)},get branch(){return y(ee)},onclose:()=>N(l,null),onsendsuccess:()=>{N(l,null),setTimeout(()=>{var ve;return(ve=y(I))==null?void 0:ve.sendInput("\r")},D)}})}};ne(Di,j=>{y(l)&&j(is)})}var Tr=V(Di,2);{var ss=j=>{uu(j,{get issue(){return y(p)},onassign:ee=>{N(p,null),de(ee)},onclose:()=>N(p,null)})};ne(Tr,j=>{y(p)&&j(ss)})}var Mo=V(Tr,2);Qh(Mo,{get notifications(){return y(B)},ondismiss:R,onselect:j=>{N(w,j,!0),N(X,new Set([...y(X)].filter(ee=>ee!==j)),!0),y(q)&&N(te,!1)}}),K(t,Lr),We()}ft(["click","keydown"]);Sl(bu,{target:document.getElementById("app")});
|