kaizen-agent 1.84.0 → 1.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/accounts.ts +1 -1
- package/cli/add-project.ts +1 -1
- package/cli/phone-setup.ts +1 -1
- package/cli/state.ts +22 -0
- package/cli/ui-audit.ts +1 -1
- package/cli/web.ts +31 -10
- package/package.json +1 -1
- package/web/board/home-ws.ts +265 -0
- package/web/board/main.ts +2 -0
- package/web/board/onboarding.ts +1 -1
- package/web/board/phone-setup.ts +1 -1
- package/web/board/phone.ts +8 -5
- package/web/board/run-view.ts +12 -10
- package/web/board/search.ts +1 -1
- package/web/board/settings-accounts.ts +1 -1
- package/web/board/settings-automations.ts +1 -1
- package/web/board/settings-cleanup.ts +1 -1
- package/web/board/settings-pages.ts +33 -24
- package/web/board/settings.ts +31 -40
- package/web/board/views.ts +1 -1
- package/web/board/whatsapp-setup.ts +1 -1
- package/web/board/workspace.ts +89 -8
- package/web/board/ws-tabs.ts +15 -0
- package/web/board.html +65 -27
- package/web/board.js +203 -199
- package/web/notebook.js +136 -132
- package/web/notes.html +3 -1
- package/web/term.js +56 -56
- package/web/term.ts +63 -13
- package/web/video.html +3 -1
- package/web/video.js +236 -232
package/web/term.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/* kaizen terminal
|
|
2
|
-
(()=>{var ko=0,Lo=()=>{};function pc(e,t,i,s){return s&&Math.abs(i-1)<0.05&&t-e>100?Math.round(e):null}function Eo(){if(ko++===0){let e=window.visualViewport,t=()=>{let s=document.activeElement,r=s instanceof HTMLElement&&!!s.closest(".term, .termkeys"),n=e&&matchMedia("(max-width:640px)").matches?pc(e.height,window.innerHeight,e.scale,r):null;if(document.body.classList.toggle("term-keyboard",n!==null),n!==null)document.documentElement.style.setProperty("--term-viewport-height",`${n}px`);else document.documentElement.style.removeProperty("--term-viewport-height")},i=()=>requestAnimationFrame(t);e?.addEventListener("resize",t),e?.addEventListener("scroll",t),window.addEventListener("resize",t),document.addEventListener("focusin",i),document.addEventListener("focusout",i),t(),Lo=()=>{e?.removeEventListener("resize",t),e?.removeEventListener("scroll",t),window.removeEventListener("resize",t),document.removeEventListener("focusin",i),document.removeEventListener("focusout",i),document.body.classList.remove("term-keyboard"),document.documentElement.style.removeProperty("--term-viewport-height")}}return()=>{if(--ko===0)Lo()}}var{defineProperty:Aa,getOwnPropertyDescriptor:vc}=Object,mc=(e,t)=>{for(var i in t)Aa(e,i,{get:t[i],enumerable:!0})},_e=(e,t,i,s)=>{for(var r=s>1?void 0:s?vc(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&Aa(t,i,r),r},I=(e,t)=>(i,s)=>t(i,s,e),Mo="Terminal input",Nr={get:()=>Mo,set:(e)=>Mo=e},Do="Too much output to announce, navigate to rows manually to read",Fr={get:()=>Do,set:(e)=>Do=e};function wc(e){return e.replace(/\r?\n/g,"\r")}function Sc(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function bc(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function yc(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");Ta(r,t,i,s)}}function Ta(e,t,i,s){e=wc(e),e=Sc(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function Ba(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function Ro(e,t,i,s,r){Ba(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function jt(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Hs(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var Cc=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let a=e.charCodeAt(n);56320<=a&&a<=57343?t[s++]=(o-55296)*1024+a-56320+65536:(t[s++]=o,t[s++]=a);continue}o!==65279&&(t[s++]=o)}return s}},xc=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,o,a,l=0,h=0;if(this.interim[0]){let f=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let w=0,y;for(;(y=this.interim[++w]&63)&&w<4;)p<<=6,p|=y;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,B=E-w;for(;h<B;){if(h>=i)return 0;if(y=e[h++],(y&192)!==128){h--,f=!0;break}else this.interim[w++]=y,p<<=6,p|=y&63}f||(E===2?p<128?h--:t[s++]=p:E===3?p<2048||p>=55296&&p<=57343||p===65279||(t[s++]=p):p<65536||p>1114111||(t[s++]=p)),this.interim.fill(0)}let d=i-4,c=h;for(;c<i;){for(;c<d&&!((r=e[c])&128)&&!((n=e[c+1])&128)&&!((o=e[c+2])&128)&&!((a=e[c+3])&128);)t[s++]=r,t[s++]=n,t[s++]=o,t[s++]=a,c+=4;if(r=e[c++],r<128)t[s++]=r;else if((r&224)===192){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(l=(r&31)<<6|n&63,l<128){c--;continue}t[s++]=l}else if((r&240)===224){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(l=(r&15)<<12|(n&63)<<6|o&63,l<2048||l>=55296&&l<=57343||l===65279)continue;t[s++]=l}else if((r&248)===240){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(a=e[c++],(a&192)!==128){c--;continue}if(l=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,l<65536||l>1114111)continue;t[s++]=l}}return s}},Pa="",Gt=" ",ss=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Ts}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Ts=class e{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},lt=class e extends ss{constructor(){super(...arguments);this.content=0,this.fg=0,this.bg=0,this.extended=new Ts,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?jt(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ao="di$target",Wr="di$dependencies",br=new Map;function kc(e){return e[Wr]||[]}function Ae(e){if(br.has(e))return br.get(e);let t=function(i,s,r){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");Lc(t,i,r)};return t._id=e,br.set(e,t),t}function Lc(e,t,i){t[Ao]===t?t[Wr].push({id:e,index:i}):(t[Wr]=[{id:e,index:i}],t[Ao]=t)}var $e=Ae("BufferService"),Oa=Ae("CoreMouseService"),ui=Ae("CoreService"),Ec=Ae("CharsetService"),fn=Ae("InstantiationService"),Ia=Ae("LogService"),Ue=Ae("OptionsService"),Na=Ae("OscLinkService"),Mc=Ae("UnicodeService"),rs=Ae("DecorationService"),zr=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new lt,o=i.getTrimmedLength(),a=-1,l=-1,h=!1;for(let d=0;d<o;d++)if(!(l===-1&&!i.hasContent(d))){if(i.loadCell(d,n),n.hasExtendedAttrs()&&n.extended.urlId)if(l===-1){l=d,a=n.extended.urlId;continue}else h=n.extended.urlId!==a;else l!==-1&&(h=!0);if(h||l!==-1&&d===o-1){let c=this._oscLinkService.getLinkData(a)?.uri;if(c){let f={start:{x:l+1,y:e},end:{x:d+(!h&&d===o-1?1:0),y:e}},p=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(c);["http:","https:"].includes(w.protocol)||(p=!0)}catch{p=!0}p||s.push({text:c,range:f,activate:(w,y)=>r?r.activate(w,y,f):Dc(w,y),hover:(w,y)=>r?.hover?.(w,y,f),leave:(w,y)=>r?.leave?.(w,y,f)})}h=!1,n.hasExtendedAttrs()&&n.extended.urlId?(l=d,a=n.extended.urlId):(l=-1,a=-1)}}t(s)}};zr=_e([I(0,$e),I(1,Ue),I(2,Na)],zr);function Dc(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
1
|
+
/* kaizen terminal 1b06857f87822e5f -- generated by bun run build:web from web/term.ts; do not edit */
|
|
2
|
+
(()=>{var Ro=0,Ao=()=>{};function Sc(e,t,i,s){return s&&Math.abs(i-1)<0.05&&t-e>100?Math.round(e):null}function To(){if(Ro++===0){let e=window.visualViewport,t=()=>{let s=document.activeElement,r=s instanceof HTMLElement&&!!s.closest(".term, .termkeys"),n=e&&matchMedia("(max-width:640px)").matches?Sc(e.height,window.innerHeight,e.scale,r):null;if(document.body.classList.toggle("term-keyboard",n!==null),n!==null)document.documentElement.style.setProperty("--term-viewport-height",`${n}px`);else document.documentElement.style.removeProperty("--term-viewport-height")},i=()=>requestAnimationFrame(t);e?.addEventListener("resize",t),e?.addEventListener("scroll",t),window.addEventListener("resize",t),document.addEventListener("focusin",i),document.addEventListener("focusout",i),t(),Ao=()=>{e?.removeEventListener("resize",t),e?.removeEventListener("scroll",t),window.removeEventListener("resize",t),document.removeEventListener("focusin",i),document.removeEventListener("focusout",i),document.body.classList.remove("term-keyboard"),document.documentElement.style.removeProperty("--term-viewport-height")}}return()=>{if(--Ro===0)Ao()}}var{defineProperty:Ia,getOwnPropertyDescriptor:bc}=Object,yc=(e,t)=>{for(var i in t)Ia(e,i,{get:t[i],enumerable:!0})},ge=(e,t,i,s)=>{for(var r=s>1?void 0:s?bc(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&Ia(t,i,r),r},O=(e,t)=>(i,s)=>t(i,s,e),Bo="Terminal input",$r={get:()=>Bo,set:(e)=>Bo=e},Po="Too much output to announce, navigate to rows manually to read",Ur={get:()=>Po,set:(e)=>Po=e};function Cc(e){return e.replace(/\r?\n/g,"\r")}function xc(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function kc(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Lc(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");Na(r,t,i,s)}}function Na(e,t,i,s){e=Cc(e),e=xc(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function Fa(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function Oo(e,t,i,s,r){Fa(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Jt(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function qs(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var Ec=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let a=e.charCodeAt(n);56320<=a&&a<=57343?t[s++]=(o-55296)*1024+a-56320+65536:(t[s++]=o,t[s++]=a);continue}o!==65279&&(t[s++]=o)}return s}},Mc=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,o,a,h=0,l=0;if(this.interim[0]){let f=!1,g=this.interim[0];g&=(g&224)===192?31:(g&240)===224?15:7;let v=0,y;for(;(y=this.interim[++v]&63)&&v<4;)g<<=6,g|=y;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,R=E-v;for(;l<R;){if(l>=i)return 0;if(y=e[l++],(y&192)!==128){l--,f=!0;break}else this.interim[v++]=y,g<<=6,g|=y&63}f||(E===2?g<128?l--:t[s++]=g:E===3?g<2048||g>=55296&&g<=57343||g===65279||(t[s++]=g):g<65536||g>1114111||(t[s++]=g)),this.interim.fill(0)}let d=i-4,c=l;for(;c<i;){for(;c<d&&!((r=e[c])&128)&&!((n=e[c+1])&128)&&!((o=e[c+2])&128)&&!((a=e[c+3])&128);)t[s++]=r,t[s++]=n,t[s++]=o,t[s++]=a,c+=4;if(r=e[c++],r<128)t[s++]=r;else if((r&224)===192){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(h=(r&31)<<6|n&63,h<128){c--;continue}t[s++]=h}else if((r&240)===224){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(h=(r&15)<<12|(n&63)<<6|o&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[s++]=h}else if((r&248)===240){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(a=e[c++],(a&192)!==128){c--;continue}if(h=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,h<65536||h>1114111)continue;t[s++]=h}}return s}},Wa="",Qt=" ",as=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Is}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Is=class e{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},_t=class e extends as{constructor(){super(...arguments);this.content=0,this.fg=0,this.bg=0,this.extended=new Is,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Jt(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Io="di$target",Kr="di$dependencies",Lr=new Map;function Dc(e){return e[Kr]||[]}function Ae(e){if(Lr.has(e))return Lr.get(e);let t=function(i,s,r){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");Rc(t,i,r)};return t._id=e,Lr.set(e,t),t}function Rc(e,t,i){t[Io]===t?t[Kr].push({id:e,index:i}):(t[Kr]=[{id:e,index:i}],t[Io]=t)}var Ke=Ae("BufferService"),za=Ae("CoreMouseService"),mi=Ae("CoreService"),Ac=Ae("CharsetService"),wn=Ae("InstantiationService"),Ha=Ae("LogService"),qe=Ae("OptionsService"),$a=Ae("OscLinkService"),Tc=Ae("UnicodeService"),hs=Ae("DecorationService"),qr=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new _t,o=i.getTrimmedLength(),a=-1,h=-1,l=!1;for(let d=0;d<o;d++)if(!(h===-1&&!i.hasContent(d))){if(i.loadCell(d,n),n.hasExtendedAttrs()&&n.extended.urlId)if(h===-1){h=d,a=n.extended.urlId;continue}else l=n.extended.urlId!==a;else h!==-1&&(l=!0);if(l||h!==-1&&d===o-1){let c=this._oscLinkService.getLinkData(a)?.uri;if(c){let f={start:{x:h+1,y:e},end:{x:d+(!l&&d===o-1?1:0),y:e}},g=!1;if(!r?.allowNonHttpProtocols)try{let v=new URL(c);["http:","https:"].includes(v.protocol)||(g=!0)}catch{g=!0}g||s.push({text:c,range:f,activate:(v,y)=>r?r.activate(v,y,f):Bc(v,y),hover:(v,y)=>r?.hover?.(v,y,f),leave:(v,y)=>r?.leave?.(v,y,f)})}l=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=d,a=n.extended.urlId):(h=-1,a=-1)}}t(s)}};qr=ge([O(0,Ke),O(1,qe),O(2,$a)],qr);function Bc(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
3
3
|
|
|
4
|
-
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var
|
|
4
|
+
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Vs=Ae("CharSizeService"),Ot=Ae("CoreBrowserService"),Sn=Ae("MouseService"),It=Ae("RenderService"),Pc=Ae("SelectionService"),Ua=Ae("CharacterJoinerService"),ki=Ae("ThemeService"),Ka=Ae("LinkProviderService"),Oc=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?No.isErrorNoTelemetry(e)?new No(e.message+`
|
|
5
5
|
|
|
6
6
|
`+e.stack):Error(e.message+`
|
|
7
7
|
|
|
8
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach((t)=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},
|
|
9
|
-
`).map((c)=>c.trim().replace("at ","")).filter((c)=>c!=="");return
|
|
10
|
-
`),
|
|
11
|
-
`)).size}/${s.length} leaks) at ${f}`;let
|
|
12
|
-
`)),
|
|
8
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach((t)=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Ic=new Oc;function Ms(e){Nc(e)||Ic.onUnexpectedError(e)}var Vr="Canceled";function Nc(e){return e instanceof Fc?!0:e instanceof Error&&e.name===Vr&&e.message===Vr}var Fc=class extends Error{constructor(){super(Vr),this.name=this.message}};function Wc(e){return e?Error(`Illegal argument: ${e}`):Error("Illegal argument")}var No=class e extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e)return t;let i=new e;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Gr=class e extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,e.prototype)}};function zc(e,t,i=0,s=e.length){let r=i,n=s;for(;r<n;){let o=Math.floor((r+n)/2);t(e[o])?r=o+1:n=o}return r-1}var Hc=class e{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let s of this._array)if(this._prevFindLastPredicate(s)&&!t(s))throw Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=zc(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};Hc.assertInvariants=!1;function rt(e,t=0){return e[e.length-(1+t)]}var qa;((e)=>{function t(n){return n<0}e.isLessThan=t;function i(n){return n<=0}e.isLessThanOrEqual=i;function s(n){return n>0}e.isGreaterThan=s;function r(n){return n===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(qa||={});function $c(e,t){return(i,s)=>t(e(i),e(s))}var Uc=(e,t)=>e-t,Fo=class e{constructor(t){this.iterate=t}forEach(t){this.iterate((i)=>(t(i),!0))}toArray(){let t=[];return this.iterate((i)=>(t.push(i),!0)),t}filter(t){return new e((i)=>this.iterate((s)=>t(s)?i(s):!0))}map(t){return new e((i)=>this.iterate((s)=>i(t(s))))}some(t){let i=!1;return this.iterate((s)=>(i=t(s),!i)),i}findFirst(t){let i;return this.iterate((s)=>t(s)?(i=s,!1):!0),i}findLast(t){let i;return this.iterate((s)=>(t(s)&&(i=s),!0)),i}findLastMaxBy(t){let i,s=!0;return this.iterate((r)=>((s||qa.isGreaterThan(t(r,i)))&&(s=!1,i=r),!0)),i}};Fo.empty=new Fo((e)=>{});function Kc(e,t){let i=Object.create(null);for(let s of e){let r=t(s),n=i[r];n||(n=i[r]=[]),n.push(s)}return i}var Wo,zo,im=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Wo]="SetWithKey";for(let i of e)this.add(i)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach((i)=>e.call(t,i,i,this))}[(zo=Symbol.iterator,Wo=Symbol.toStringTag,zo)](){return this.values()}},qc=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}};function Vc(e,t){let i=this,s=!1,r;return function(){if(s)return r;if(s=!0,t)try{r=e.apply(i,arguments)}finally{t()}else r=e.apply(i,arguments);return r}}var Va;((e)=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function s(){return i}e.empty=s;function*r(b){yield b}e.single=r;function n(b){return t(b)?b:r(b)}e.wrap=n;function o(b){return b||i}e.from=o;function*a(b){for(let x=b.length-1;x>=0;x--)yield b[x]}e.reverse=a;function h(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=h;function l(b){return b[Symbol.iterator]().next().value}e.first=l;function d(b,x){let L=0;for(let N of b)if(x(N,L++))return!0;return!1}e.some=d;function c(b,x){for(let L of b)if(x(L))return L}e.find=c;function*f(b,x){for(let L of b)x(L)&&(yield L)}e.filter=f;function*g(b,x){let L=0;for(let N of b)yield x(N,L++)}e.map=g;function*v(b,x){let L=0;for(let N of b)yield*x(N,L++)}e.flatMap=v;function*y(...b){for(let x of b)yield*x}e.concat=y;function E(b,x,L){let N=L;for(let q of b)N=x(N,q);return N}e.reduce=E;function*R(b,x,L=b.length){for(x<0&&(x+=b.length),L<0?L+=b.length:L>b.length&&(L=b.length);x<L;x++)yield b[x]}e.slice=R;function P(b,x=Number.POSITIVE_INFINITY){let L=[];if(x===0)return[L,b];let N=b[Symbol.iterator]();for(let q=0;q<x;q++){let Y=N.next();if(Y.done)return[L,e.empty()];L.push(Y.value)}return[L,{[Symbol.iterator](){return N}}]}e.consume=P;async function A(b){let x=[];for await(let L of b)x.push(L);return Promise.resolve(x)}e.asyncToArray=A})(Va||={});var Gc=!1,gi=null,jc=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let i=this.livingDisposables.get(t);return i||(i={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,i)),i}trackDisposable(t){let i=this.getDisposableData(t);i.source||(i.source=Error().stack)}setParent(t,i){let s=this.getDisposableData(t);s.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let s=i.get(t);if(s)return s;let r=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,r),r}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,i])=>i.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,i){let s;if(i)s=i;else{let h=new Map,l=[...this.livingDisposables.values()].filter((c)=>c.source!==null&&!this.getRootParent(c,h).isSingleton);if(l.length===0)return;let d=new Set(l.map((c)=>c.value));if(s=l.filter((c)=>!(c.parent&&d.has(c.parent))),s.length===0)throw Error("There are cyclic diposable chains!")}if(!s)return;function r(h){function l(c,f){for(;c.length>0&&f.some((g)=>typeof g=="string"?g===c[0]:c[0].match(g));)c.shift()}let d=h.source.split(`
|
|
9
|
+
`).map((c)=>c.trim().replace("at ","")).filter((c)=>c!=="");return l(d,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),d.reverse()}let n=new qc;for(let h of s){let l=r(h);for(let d=0;d<=l.length;d++)n.add(l.slice(0,d).join(`
|
|
10
|
+
`),h)}s.sort($c((h)=>h.idx,Uc));let o="",a=0;for(let h of s.slice(0,t)){a++;let l=r(h),d=[];for(let c=0;c<l.length;c++){let f=l[c];f=`(shared with ${n.get(l.slice(0,c+1).join(`
|
|
11
|
+
`)).size}/${s.length} leaks) at ${f}`;let g=n.get(l.slice(0,c).join(`
|
|
12
|
+
`)),v=Kc([...g].map((y)=>r(y)[c]),(y)=>y);delete v[l[c]];for(let[y,E]of Object.entries(v))d.unshift(` - stacktraces of ${E.length} other leaks continue with ${y}`);d.unshift(f)}o+=`
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
==================== Leaking disposable ${a}/${s.length}: ${
|
|
15
|
+
==================== Leaking disposable ${a}/${s.length}: ${h.value.constructor.name} ====================
|
|
16
16
|
${d.join(`
|
|
17
17
|
`)}
|
|
18
18
|
============================================================
|
|
@@ -22,30 +22,30 @@ ${d.join(`
|
|
|
22
22
|
|
|
23
23
|
... and ${s.length-t} more leaking disposables
|
|
24
24
|
|
|
25
|
-
`),{leaks:s,details:o}}};Kc.idx=0;function qc(e){li=e}if(Uc){let e="__is_disposable_tracked__";qc(new class{trackDisposable(t){let i=Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3000)}setParent(t,i){if(t&&t!==Y.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Y.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Us(e){return li?.trackDisposable(e),e}function Ks(e){li?.markAsDisposed(e)}function Qi(e,t){li?.setParent(e,t)}function Vc(e,t){if(li)for(let i of e)li.setParent(i,t)}function Io(e){return li?.markAsSingleton(e),e}function ci(e){if(Ha.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function jc(...e){let t=oe(()=>ci(e));return Vc(e,t),t}function oe(e){let t=Us({dispose:$c(()=>{Ks(t),e()})});return t}var $a=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,Us(this)}dispose(){this._isDisposed||(Ks(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ci(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error("Cannot register a disposable on itself!");return Qi(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),Qi(t,null))}};$a.DISABLE_DISPOSED_WARNING=!1;var Yt=$a,Y=class{constructor(){this._store=new Yt,Us(this),Qi(this._store,this)}dispose(){Ks(this),this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}};Y.None=Object.freeze({dispose(){}});var wi=class{constructor(){this._isDisposed=!1,Us(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Qi(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Ks(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Qi(e,null),e}},it=typeof window=="object"?window:globalThis,Ur=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Ur.Undefined=new Ur(void 0);var le=Ur,No=class{constructor(){this._first=le.Undefined,this._last=le.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===le.Undefined}clear(){let e=this._first;for(;e!==le.Undefined;){let t=e.next;e.prev=le.Undefined,e.next=le.Undefined,e=t}this._first=le.Undefined,this._last=le.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new le(e);if(this._first===le.Undefined)this._first=i,this._last=i;else if(t){let r=this._last;this._last=i,i.prev=r,r.next=i}else{let r=this._first;this._first=i,i.next=r,r.prev=i}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(i))}}shift(){if(this._first!==le.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==le.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==le.Undefined&&e.next!==le.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===le.Undefined&&e.next===le.Undefined?(this._first=le.Undefined,this._last=le.Undefined):e.next===le.Undefined?(this._last=this._last.prev,this._last.next=le.Undefined):e.prev===le.Undefined&&(this._first=this._first.next,this._first.prev=le.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==le.Undefined;)yield e.element,e=e.next}},Gc=globalThis.performance&&typeof globalThis.performance.now=="function",Yc=class e{static create(t){return new e(t)}constructor(t){this._now=Gc&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Xc=!1,Fo=!1,Zc=!1,Ne;((e)=>{e.None=()=>Y.None;function t(u){if(Zc){let{onDidAddListener:_}=u,S=qr.create(),g=0;u.onDidAddListener=()=>{++g===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),S.print()),_?.()}}}function i(u,_){return f(u,()=>{},0,void 0,!0,void 0,_)}e.defer=i;function s(u){return(_,S=null,g)=>{let m=!1,v;return v=u((C)=>{if(!m)return v?v.dispose():m=!0,_.call(S,C)},null,g),m&&v.dispose(),v}}e.once=s;function r(u,_,S){return d((g,m=null,v)=>u((C)=>g.call(m,_(C)),null,v),S)}e.map=r;function n(u,_,S){return d((g,m=null,v)=>u((C)=>{_(C),g.call(m,C)},null,v),S)}e.forEach=n;function o(u,_,S){return d((g,m=null,v)=>u((C)=>_(C)&&g.call(m,C),null,v),S)}e.filter=o;function a(u){return u}e.signal=a;function l(...u){return(_,S=null,g)=>{let m=jc(...u.map((v)=>v((C)=>_.call(S,C))));return c(m,g)}}e.any=l;function h(u,_,S,g){let m=S;return r(u,(v)=>(m=_(m,v),m),g)}e.reduce=h;function d(u,_){let S,g={onWillAddFirstListener(){S=u(m.fire,m)},onDidRemoveLastListener(){S?.dispose()}};_||t(g);let m=new T(g);return _?.add(m),m.event}function c(u,_){return _ instanceof Array?_.push(u):_&&_.add(u),u}function f(u,_,S=100,g=!1,m=!1,v,C){let k,D,U,H=0,q,ee={leakWarningThreshold:v,onWillAddFirstListener(){k=u((te)=>{H++,D=_(D,te),g&&!U&&(G.fire(D),D=void 0),q=()=>{let Z=D;D=void 0,U=void 0,(!g||H>1)&&G.fire(Z),H=0},typeof S=="number"?(clearTimeout(U),U=setTimeout(q,S)):U===void 0&&(U=0,queueMicrotask(q))})},onWillRemoveListener(){m&&H>0&&q?.()},onDidRemoveLastListener(){q=void 0,k.dispose()}};C||t(ee);let G=new T(ee);return C?.add(G),G.event}e.debounce=f;function p(u,_=0,S){return e.debounce(u,(g,m)=>g?(g.push(m),g):[m],_,void 0,!0,void 0,S)}e.accumulate=p;function w(u,_=(g,m)=>g===m,S){let g=!0,m;return o(u,(v)=>{let C=g||!_(v,m);return g=!1,m=v,C},S)}e.latch=w;function y(u,_,S){return[e.filter(u,_,S),e.filter(u,(g)=>!_(g),S)]}e.split=y;function E(u,_=!1,S=[],g){let m=S.slice(),v=u((D)=>{m?m.push(D):k.fire(D)});g&&g.add(v);let C=()=>{m?.forEach((D)=>k.fire(D)),m=null},k=new T({onWillAddFirstListener(){v||(v=u((D)=>k.fire(D)),g&&g.add(v))},onDidAddFirstListener(){m&&(_?setTimeout(C):C())},onDidRemoveLastListener(){v&&v.dispose(),v=null}});return g&&g.add(k),k.event}e.buffer=E;function B(u,_){return(S,g,m)=>{let v=_(new R);return u(function(C){let k=v.evaluate(C);k!==P&&S.call(g,k)},void 0,m)}}e.chain=B;let P=Symbol("HaltChainable");class R{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push((_)=>(u(_),_)),this}filter(u){return this.steps.push((_)=>u(_)?_:P),this}reduce(u,_){let S=_;return this.steps.push((g)=>(S=u(S,g),S)),this}latch(u=(_,S)=>_===S){let _=!0,S;return this.steps.push((g)=>{let m=_||!u(g,S);return _=!1,S=g,m?g:P}),this}evaluate(u){for(let _ of this.steps)if(u=_(u),u===P)break;return u}}function b(u,_,S=(g)=>g){let g=(...k)=>C.fire(S(...k)),m=()=>u.on(_,g),v=()=>u.removeListener(_,g),C=new T({onWillAddFirstListener:m,onDidRemoveLastListener:v});return C.event}e.fromNodeEventEmitter=b;function x(u,_,S=(g)=>g){let g=(...k)=>C.fire(S(...k)),m=()=>u.addEventListener(_,g),v=()=>u.removeEventListener(_,g),C=new T({onWillAddFirstListener:m,onDidRemoveLastListener:v});return C.event}e.fromDOMEventEmitter=x;function L(u){return new Promise((_)=>s(u)(_))}e.toPromise=L;function O(u){let _=new T;return u.then((S)=>{_.fire(S)},()=>{_.fire(void 0)}).finally(()=>{_.dispose()}),_.event}e.fromPromise=O;function V(u,_){return u((S)=>_.fire(S))}e.forward=V;function j(u,_,S){return _(S),u((g)=>_(g))}e.runAndSubscribe=j;class he{constructor(u,_){this._observable=u,this._counter=0,this._hasChanged=!1;let S={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};_||t(S),this.emitter=new T(S),_&&_.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,_){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function F(u,_){return new he(u,_).emitter.event}e.fromObservable=F;function be(u){return(_,S,g)=>{let m=0,v=!1,C={beginUpdate(){m++},endUpdate(){m--,m===0&&(u.reportChanges(),v&&(v=!1,_.call(S)))},handlePossibleChange(){},handleChange(){v=!0}};u.addObserver(C),u.reportChanges();let k={dispose(){u.removeObserver(C)}};return g instanceof Yt?g.add(k):Array.isArray(g)&&g.push(k),k}}e.fromObservableLight=be})(Ne||={});var Kr=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(t){this._stopWatch=new Yc,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Kr.all=new Set,Kr._idPool=0;var Jc=Kr,Wo=-1,Ua=class e{constructor(t,i,s=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*0.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let l=new ed(a,n);this._errorHandler(l)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,r]of this._stacks)(!t||i<r)&&(t=[s,r],i=r);return t}};Ua._idPool=1;var Qc=Ua,qr=class e{constructor(t){this.value=t}static create(){let t=Error();return new e(t.stack??"")}print(){console.warn(this.value.split(`
|
|
25
|
+
`),{leaks:s,details:o}}};jc.idx=0;function Yc(e){gi=e}if(Gc){let e="__is_disposable_tracked__";Yc(new class{trackDisposable(t){let i=Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3000)}setParent(t,i){if(t&&t!==G.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==G.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Gs(e){return gi?.trackDisposable(e),e}function js(e){gi?.markAsDisposed(e)}function ss(e,t){gi?.setParent(e,t)}function Xc(e,t){if(gi)for(let i of e)gi.setParent(i,t)}function Ho(e){return gi?.markAsSingleton(e),e}function pi(e){if(Va.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Zc(...e){let t=le(()=>pi(e));return Xc(e,t),t}function le(e){let t=Gs({dispose:Vc(()=>{js(t),e()})});return t}var Ga=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,Gs(this)}dispose(){this._isDisposed||(js(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{pi(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error("Cannot register a disposable on itself!");return ss(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),ss(t,null))}};Ga.DISABLE_DISPOSED_WARNING=!1;var ei=Ga,G=class{constructor(){this._store=new ei,Gs(this),ss(this._store,this)}dispose(){js(this),this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}};G.None=Object.freeze({dispose(){}});var xi=class{constructor(){this._isDisposed=!1,Gs(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&ss(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,js(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&ss(e,null),e}},at=typeof window=="object"?window:globalThis,jr=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};jr.Undefined=new jr(void 0);var ue=jr,$o=class{constructor(){this._first=ue.Undefined,this._last=ue.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ue.Undefined}clear(){let e=this._first;for(;e!==ue.Undefined;){let t=e.next;e.prev=ue.Undefined,e.next=ue.Undefined,e=t}this._first=ue.Undefined,this._last=ue.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new ue(e);if(this._first===ue.Undefined)this._first=i,this._last=i;else if(t){let r=this._last;this._last=i,i.prev=r,r.next=i}else{let r=this._first;this._first=i,i.next=r,r.prev=i}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(i))}}shift(){if(this._first!==ue.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ue.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ue.Undefined&&e.next!==ue.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ue.Undefined&&e.next===ue.Undefined?(this._first=ue.Undefined,this._last=ue.Undefined):e.next===ue.Undefined?(this._last=this._last.prev,this._last.next=ue.Undefined):e.prev===ue.Undefined&&(this._first=this._first.next,this._first.prev=ue.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ue.Undefined;)yield e.element,e=e.next}},Jc=globalThis.performance&&typeof globalThis.performance.now=="function",Qc=class e{static create(t){return new e(t)}constructor(t){this._now=Jc&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},ed=!1,Uo=!1,td=!1,Ie;((e)=>{e.None=()=>G.None;function t(u){if(td){let{onDidAddListener:_}=u,w=Xr.create(),p=0;u.onDidAddListener=()=>{++p===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),w.print()),_?.()}}}function i(u,_){return f(u,()=>{},0,void 0,!0,void 0,_)}e.defer=i;function s(u){return(_,w=null,p)=>{let S=!1,m;return m=u((C)=>{if(!S)return m?m.dispose():S=!0,_.call(w,C)},null,p),S&&m.dispose(),m}}e.once=s;function r(u,_,w){return d((p,S=null,m)=>u((C)=>p.call(S,_(C)),null,m),w)}e.map=r;function n(u,_,w){return d((p,S=null,m)=>u((C)=>{_(C),p.call(S,C)},null,m),w)}e.forEach=n;function o(u,_,w){return d((p,S=null,m)=>u((C)=>_(C)&&p.call(S,C),null,m),w)}e.filter=o;function a(u){return u}e.signal=a;function h(...u){return(_,w=null,p)=>{let S=Zc(...u.map((m)=>m((C)=>_.call(w,C))));return c(S,p)}}e.any=h;function l(u,_,w,p){let S=w;return r(u,(m)=>(S=_(S,m),S),p)}e.reduce=l;function d(u,_){let w,p={onWillAddFirstListener(){w=u(S.fire,S)},onDidRemoveLastListener(){w?.dispose()}};_||t(p);let S=new T(p);return _?.add(S),S.event}function c(u,_){return _ instanceof Array?_.push(u):_&&_.add(u),u}function f(u,_,w=100,p=!1,S=!1,m,C){let k,B,H,z=0,K,se={leakWarningThreshold:m,onWillAddFirstListener(){k=u((Q)=>{z++,B=_(B,Q),p&&!H&&(V.fire(B),B=void 0),K=()=>{let Z=B;B=void 0,H=void 0,(!p||z>1)&&V.fire(Z),z=0},typeof w=="number"?(clearTimeout(H),H=setTimeout(K,w)):H===void 0&&(H=0,queueMicrotask(K))})},onWillRemoveListener(){S&&z>0&&K?.()},onDidRemoveLastListener(){K=void 0,k.dispose()}};C||t(se);let V=new T(se);return C?.add(V),V.event}e.debounce=f;function g(u,_=0,w){return e.debounce(u,(p,S)=>p?(p.push(S),p):[S],_,void 0,!0,void 0,w)}e.accumulate=g;function v(u,_=(p,S)=>p===S,w){let p=!0,S;return o(u,(m)=>{let C=p||!_(m,S);return p=!1,S=m,C},w)}e.latch=v;function y(u,_,w){return[e.filter(u,_,w),e.filter(u,(p)=>!_(p),w)]}e.split=y;function E(u,_=!1,w=[],p){let S=w.slice(),m=u((B)=>{S?S.push(B):k.fire(B)});p&&p.add(m);let C=()=>{S?.forEach((B)=>k.fire(B)),S=null},k=new T({onWillAddFirstListener(){m||(m=u((B)=>k.fire(B)),p&&p.add(m))},onDidAddFirstListener(){S&&(_?setTimeout(C):C())},onDidRemoveLastListener(){m&&m.dispose(),m=null}});return p&&p.add(k),k.event}e.buffer=E;function R(u,_){return(w,p,S)=>{let m=_(new A);return u(function(C){let k=m.evaluate(C);k!==P&&w.call(p,k)},void 0,S)}}e.chain=R;let P=Symbol("HaltChainable");class A{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push((_)=>(u(_),_)),this}filter(u){return this.steps.push((_)=>u(_)?_:P),this}reduce(u,_){let w=_;return this.steps.push((p)=>(w=u(w,p),w)),this}latch(u=(_,w)=>_===w){let _=!0,w;return this.steps.push((p)=>{let S=_||!u(p,w);return _=!1,w=p,S?p:P}),this}evaluate(u){for(let _ of this.steps)if(u=_(u),u===P)break;return u}}function b(u,_,w=(p)=>p){let p=(...k)=>C.fire(w(...k)),S=()=>u.on(_,p),m=()=>u.removeListener(_,p),C=new T({onWillAddFirstListener:S,onDidRemoveLastListener:m});return C.event}e.fromNodeEventEmitter=b;function x(u,_,w=(p)=>p){let p=(...k)=>C.fire(w(...k)),S=()=>u.addEventListener(_,p),m=()=>u.removeEventListener(_,p),C=new T({onWillAddFirstListener:S,onDidRemoveLastListener:m});return C.event}e.fromDOMEventEmitter=x;function L(u){return new Promise((_)=>s(u)(_))}e.toPromise=L;function N(u){let _=new T;return u.then((w)=>{_.fire(w)},()=>{_.fire(void 0)}).finally(()=>{_.dispose()}),_.event}e.fromPromise=N;function q(u,_){return u((w)=>_.fire(w))}e.forward=q;function Y(u,_,w){return _(w),u((p)=>_(p))}e.runAndSubscribe=Y;class oe{constructor(u,_){this._observable=u,this._counter=0,this._hasChanged=!1;let w={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};_||t(w),this.emitter=new T(w),_&&_.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,_){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function F(u,_){return new oe(u,_).emitter.event}e.fromObservable=F;function Le(u){return(_,w,p)=>{let S=0,m=!1,C={beginUpdate(){S++},endUpdate(){S--,S===0&&(u.reportChanges(),m&&(m=!1,_.call(w)))},handlePossibleChange(){},handleChange(){m=!0}};u.addObserver(C),u.reportChanges();let k={dispose(){u.removeObserver(C)}};return p instanceof ei?p.add(k):Array.isArray(p)&&p.push(k),k}}e.fromObservableLight=Le})(Ie||={});var Yr=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(t){this._stopWatch=new Qc,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Yr.all=new Set,Yr._idPool=0;var id=Yr,Ko=-1,ja=class e{constructor(t,i,s=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*0.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let h=new rd(a,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,r]of this._stacks)(!t||i<r)&&(t=[s,r],i=r);return t}};ja._idPool=1;var sd=ja,Xr=class e{constructor(t){this.value=t}static create(){let t=Error();return new e(t.stack??"")}print(){console.warn(this.value.split(`
|
|
26
26
|
`).slice(2).join(`
|
|
27
|
-
`))}},
|
|
28
|
-
`)),e.length=0)},3000),
|
|
27
|
+
`))}},rd=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},nd=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},od=0,Ds=class{constructor(e){this.value=e,this.id=od++}},ad=2,hd=(e,t)=>{if(e instanceof Ds)t(e);else for(let i=0;i<e.length;i++){let s=e[i];s&&t(s)}},Rs;if(ed){let e=[];setInterval(()=>{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(`
|
|
28
|
+
`)),e.length=0)},3000),Rs=new FinalizationRegistry((t)=>{typeof t=="string"&&e.push(t)})}var T=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Ko>0||this._options?.leakWarningThreshold?new sd(e?.onListenerError??Ms,this._options?.leakWarningThreshold??Ko):void 0,this._perfMon=this._options?._profName?new id(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Uo){let e=this._listeners;queueMicrotask(()=>{hd(e,(t)=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new nd(`${a}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||Ms)(l),G.None}if(this._disposed)return G.None;t&&(e=e.bind(t));let s=new Ds(e),r,n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*0.2)&&(s.stack=Xr.create(),r=this._leakageMon.check(s.stack,this._size+1)),Uo&&(s.stack=n??Xr.create()),this._listeners?this._listeners instanceof Ds?(this._deliveryQueue??=new ld,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=le(()=>{Rs?.unregister(o),r?.(),this._removeListener(s)});if(i instanceof ei?i.add(o):Array.isArray(i)&&i.push(o),Rs){let a=Error().stack.split(`
|
|
29
29
|
`).slice(2,3).join(`
|
|
30
|
-
`).trim(),l=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);Ls.register(o,l?.[2]??a,o)}return o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*sd<=t.length){let r=0;for(let n=0;n<t.length;n++)t[n]?t[r++]=t[n]:s&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=r}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||xs;if(!i){e.value(t);return}try{e.value(t)}catch(s){i(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof ks)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},nd=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Vr=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new T,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new T,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Vr.INSTANCE=new Vr;var pn=Vr;function od(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var Zv=pn.INSTANCE.onDidChangeZoomLevel;function ad(e){return pn.INSTANCE.getZoomFactor(e)}var Jv=pn.INSTANCE.onDidChangeFullscreen,bi=typeof navigator=="object"?navigator.userAgent:"",jr=bi.indexOf("Firefox")>=0,Es=bi.indexOf("AppleWebKit")>=0,vn=bi.indexOf("Chrome")>=0,Ka=!vn&&bi.indexOf("Safari")>=0,Qv=bi.indexOf("Electron/")>=0,em=bi.indexOf("Android")>=0,Ms=!1;if(typeof it.matchMedia=="function"){let e=it.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=it.matchMedia("(display-mode: fullscreen)");Ms=e.matches,od(it,e,({matches:i})=>{Ms&&t.matches||(Ms=i)})}function hd(){return Ms}var mi="en",Bs=!1,Ps=!1,Zi=!1,ld=!1,qa=!1,Va=!1,cd=!1,dd=!1,ud=!1,_d=!1,ws,Ds=mi,zo=mi,fd,Et,Dt=globalThis,tt;typeof Dt.vscode<"u"&&typeof Dt.vscode.process<"u"?tt=Dt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(tt=process);var ja=typeof tt?.versions?.electron=="string",gd=ja&&tt?.type==="renderer";if(typeof tt=="object"){Bs=tt.platform==="win32",Ps=tt.platform==="darwin",Zi=tt.platform==="linux",ld=Zi&&!!tt.env.SNAP&&!!tt.env.SNAP_REVISION,cd=ja,ud=!!tt.env.CI||!!tt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ws=mi,Ds=mi;let e=tt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ws=t.userLocale,zo=t.osLocale,Ds=t.resolvedLanguage||mi,fd=t.languagePack?.translationsConfigFile}catch{}qa=!0}else typeof navigator=="object"&&!gd?(Et=navigator.userAgent,Bs=Et.indexOf("Windows")>=0,Ps=Et.indexOf("Macintosh")>=0,dd=(Et.indexOf("Macintosh")>=0||Et.indexOf("iPad")>=0||Et.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Zi=Et.indexOf("Linux")>=0,_d=Et?.indexOf("Mobi")>=0,Va=!0,Ds=globalThis._VSCODE_NLS_LANGUAGE||mi,ws=navigator.language.toLowerCase(),zo=ws):console.error("Unable to resolve platform.");var yr=0;Ps?yr=1:Bs?yr=3:Zi&&(yr=2);var Ga=Bs,mt=Ps,pd=Zi,Cr=qa,vd=Va&&typeof Dt.importScripts=="function",tm=vd?Dt.origin:void 0,wt=Et,Ut=Ds,md;((e)=>{function t(){return Ut}e.value=t;function i(){return Ut.length===2?Ut==="en":Ut.length>=3?Ut[0]==="e"&&Ut[1]==="n"&&Ut[2]==="-":!1}e.isDefaultVariant=i;function s(){return Ut==="en"}e.isDefault=s})(md||={});var wd=typeof Dt.postMessage=="function"&&!Dt.importScripts,Sd=(()=>{if(wd){let e=[];Dt.addEventListener("message",(i)=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let n=e[s];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),n.callback();return}}});let t=0;return(i)=>{let s=++t;e.push({id:s,callback:i}),Dt.postMessage({vscodeScheduleAsyncWork:s},"*")}}return(e)=>setTimeout(e)})(),bd=!!(wt&&wt.indexOf("Chrome")>=0),im=!!(wt&&wt.indexOf("Firefox")>=0),sm=!!(!bd&&wt&&wt.indexOf("Safari")>=0),rm=!!(wt&&wt.indexOf("Edg/")>=0),nm=!!(wt&&wt.indexOf("Android")>=0),Kt=typeof navigator=="object"?navigator:{},om={clipboard:{writeText:Cr||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(Kt&&Kt.clipboard&&Kt.clipboard.writeText),readText:Cr||!!(Kt&&Kt.clipboard&&Kt.clipboard.readText)},keyboard:Cr||hd()?0:Kt.keyboard||Ka?1:2,touch:"ontouchstart"in it||Kt.maxTouchPoints>0,pointerEvents:it.PointerEvent&&(("ontouchstart"in it)||navigator.maxTouchPoints>0)},mn=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},xr=new mn,Ho=new mn,$o=new mn,yd=Array(230),Ya;((e)=>{function t(a){return xr.keyCodeToStr(a)}e.toString=t;function i(a){return xr.strToKeyCode(a)}e.fromString=i;function s(a){return Ho.keyCodeToStr(a)}e.toUserSettingsUS=s;function r(a){return $o.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function n(a){return Ho.strToKeyCode(a)||$o.strToKeyCode(a)}e.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return xr.keyCodeToStr(a)}e.toElectronAccelerator=o})(Ya||={});var Cd=class e{constructor(t,i,s,r,n){this.ctrlKey=t,this.shiftKey=i,this.altKey=s,this.metaKey=r,this.keyCode=n}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${i}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new xd([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},xd=class{constructor(e){if(e.length===0)throw Oc("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function kd(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return Ya.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(jr)switch(t){case 59:return 85;case 60:if(pd)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(mt)return 57;break}else if(Es){if(mt&&t===93)return 57;if(!mt&&t===92)return 57}return yd[t]||0}var Ld=mt?256:2048,Ed=512,Md=1024,Dd=mt?2048:256,Gr=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=kd(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Ld),this.altKey&&(t|=Ed),this.shiftKey&&(t|=Md),this.metaKey&&(t|=Dd),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Cd(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Uo=new WeakMap;function Rd(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var Ad=class{static getSameOriginWindowChain(e){let t=Uo.get(e);if(!t){t=[],Uo.set(e,t);let i=e,s;do s=Rd(i),s?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=s;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,s=0,r=this.getSameOriginWindowChain(e);for(let n of r){let o=n.window.deref();if(i+=o?.scrollY??0,s+=o?.scrollX??0,o===t||!n.iframeElement)break;let a=n.iframeElement.getBoundingClientRect();i+=a.top,s+=a.left}return{top:i,left:s}}},qi=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=Ad.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Ko=class{constructor(e,t=0,i=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let s=!1;if(vn){let r=navigator.userAgent.match(/Chrome\/(\d+)/);s=(r?parseInt(r[1]):123)<=122}if(e){let r=e,n=e,o=e.view?.devicePixelRatio||1;if(typeof r.wheelDeltaY<"u")s?this.deltaY=r.wheelDeltaY/(120*o):this.deltaY=r.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<"u"&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?jr&&!mt?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof r.wheelDeltaX<"u")Ka&&Ga?this.deltaX=-(r.wheelDeltaX/120):s?this.deltaX=r.wheelDeltaX/(120*o):this.deltaX=r.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<"u"&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?jr&&!mt?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*o):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},Xa=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Td;((e)=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Bd?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ne.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Xa})})(Td||={});var Bd=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Xa:(this._emitter||(this._emitter=new T),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},am=Symbol("MicrotaskDelay"),wn=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new $r("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new $r("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Pd=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new $r("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=i.setInterval(()=>{e()},t);this.disposable=oe(()=>{i.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Od,kr;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?kr=(e,t)=>{Sd(()=>{if(i)return;let s=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,s-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:kr=(e,t,i)=>{let s=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(s))}}},Od=(e)=>kr(globalThis,e)})();var Id;((e)=>{async function t(s){let r,n=await Promise.all(s.map((o)=>o.then((a)=>a,(a)=>{r||(r=a)})));if(typeof r<"u")throw r;return n}e.settled=t;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}e.withAsyncBody=i})(Id||={});var qo=class e{static fromArray(t){return new e((i)=>{i.emitMany(t)})}static fromPromise(t){return new e(async(i)=>{i.emitMany(await t)})}static fromPromises(t){return new e(async(i)=>{await Promise.all(t.map(async(s)=>i.emitOne(await s)))})}static merge(t){return new e(async(i)=>{await Promise.all(t.map(async(s)=>{for await(let r of s)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new T,queueMicrotask(async()=>{let s={emitOne:(r)=>this.emitOne(r),emitMany:(r)=>this.emitMany(r),reject:(r)=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ne.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new e(async(s)=>{for await(let r of t)s.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async(s)=>{for await(let r of t)i(r)&&s.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,(i)=>!!i)}coalesce(){return e.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return e.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};qo.EMPTY=qo.fromArray([]);function Nd(e){return 55296<=e&&e<=56319}function Vo(e){return 56320<=e&&e<=57343}function Fd(e,t){return(e-55296<<10)+(t-56320)+65536}function Wd(e){return Sn(e,0)}function Sn(e,t){switch(typeof e){case"object":return e===null?Mt(349,t):Array.isArray(e)?Hd(e,t):$d(e,t);case"string":return Za(e,t);case"boolean":return zd(e,t);case"number":return Mt(e,t);case"undefined":return Mt(937,t);default:return Mt(617,t)}}function Mt(e,t){return(t<<5)-t+e|0}function zd(e,t){return Mt(e?433:863,t)}function Za(e,t){t=Mt(149417,t);for(let i=0,s=e.length;i<s;i++)t=Mt(e.charCodeAt(i),t);return t}function Hd(e,t){return t=Mt(104579,t),e.reduce((i,s)=>Sn(s,i),t)}function $d(e,t){return t=Mt(181387,t),Object.keys(e).sort().reduce((i,s)=>(i=Za(s,i),Sn(e[s],i)),t)}function Lr(e,t,i=32){let s=i-t,r=~((1<<s)-1);return(e<<t|(r&e)>>>s)>>>0}function jo(e,t=0,i=e.byteLength,s=0){for(let r=0;r<i;r++)e[t+r]=s}function Ud(e,t,i="0"){for(;e.length<t;)e=i+e;return e}function Fi(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map((i)=>i.toString(16).padStart(2,"0")).join(""):Ud((e>>>0).toString(16),t/4)}var Kd=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let i=t.length;if(i===0)return;let s=this._buff,r=this._buffLen,n=this._leftoverHighSurrogate,o,a;for(n!==0?(o=n,a=-1,n=0):(o=t.charCodeAt(0),a=0);;){let l=o;if(Nd(o))if(a+1<i){let h=t.charCodeAt(a+1);Vo(h)?(a++,l=Fd(o,h)):l=65533}else{n=o;break}else Vo(o)&&(l=65533);if(r=this._push(s,r,l),a++,a<i)o=t.charCodeAt(a);else break}this._buffLen=r,this._leftoverHighSurrogate=n}_push(t,i,s){return s<128?t[i++]=s:s<2048?(t[i++]=192|(s&1984)>>>6,t[i++]=128|(s&63)>>>0):s<65536?(t[i++]=224|(s&61440)>>>12,t[i++]=128|(s&4032)>>>6,t[i++]=128|(s&63)>>>0):(t[i++]=240|(s&1835008)>>>18,t[i++]=128|(s&258048)>>>12,t[i++]=128|(s&4032)>>>6,t[i++]=128|(s&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),i}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Fi(this._h0)+Fi(this._h1)+Fi(this._h2)+Fi(this._h3)+Fi(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,jo(this._buff,this._buffLen),this._buffLen>56&&(this._step(),jo(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,i=this._buffDV;for(let c=0;c<64;c+=4)t.setUint32(c,i.getUint32(c,!1),!1);for(let c=64;c<320;c+=4)t.setUint32(c,Lr(t.getUint32(c-12,!1)^t.getUint32(c-32,!1)^t.getUint32(c-56,!1)^t.getUint32(c-64,!1),1),!1);let s=this._h0,r=this._h1,n=this._h2,o=this._h3,a=this._h4,l,h,d;for(let c=0;c<80;c++)c<20?(l=r&n|~r&o,h=1518500249):c<40?(l=r^n^o,h=1859775393):c<60?(l=r&n|r&o|n&o,h=2400959708):(l=r^n^o,h=3395469782),d=Lr(s,5)+l+a+h+t.getUint32(c*4,!1)&4294967295,a=o,o=n,n=Lr(r,30),r=s,s=d;this._h0=this._h0+s&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+n&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+a&4294967295}};Kd._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:hm,getWindow:ut,getDocument:lm,getWindows:cm,getWindowsCount:dm,getWindowId:Go,getWindowById:um,hasWindow:_m,onDidRegisterWindow:qd,onWillUnregisterWindow:fm,onDidUnregisterWindow:gm}=function(){let e=new Map,t={window:it,disposables:new Yt};e.set(it.vscodeWindowId,t);let i=new T,s=new T,r=new T;function n(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(e.has(o.vscodeWindowId))return Y.None;let a=new Yt,l={window:o,disposables:a.add(new Yt)};return e.set(o.vscodeWindowId,l),a.add(oe(()=>{e.delete(o.vscodeWindowId),s.fire(o)})),a.add(K(o,Ee.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(l),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:n,getWindow(o){let a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let l=o;return l?.view?l.view.window:it},getDocument(o){return ut(o).document}}}(),Vd=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function K(e,t,i,s){return new Vd(e,t,i,s)}function jd(e,t){return function(i){return t(new qi(e,i))}}function Gd(e){return function(t){return e(new Gr(t))}}var Yo=function(e,t,i,s){let r=i;return t==="click"||t==="mousedown"||t==="contextmenu"?r=jd(ut(e),i):(t==="keydown"||t==="keypress"||t==="keyup")&&(r=Gd(i)),K(e,t,r,s)},Yd,Os,Xd=class extends Pd{constructor(e){super(),this.defaultTarget=e&&ut(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},Er=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){xs(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,s=new Map,r=(n)=>{i.set(n,!1);let o=e.get(n)??[];for(t.set(n,o),e.set(n,[]),s.set(n,!0);o.length>0;)o.sort(Er.sort),o.shift().execute();s.set(n,!1)};Os=(n,o,a=0)=>{let l=Go(n),h=new Er(o,a),d=e.get(l);return d||(d=[],e.set(l,d)),d.push(h),i.get(l)||(i.set(l,!0),n.requestAnimationFrame(()=>r(l))),h},Yd=(n,o,a)=>{let l=Go(n);if(s.get(l)){let h=new Er(o,a),d=t.get(l);return d||(d=[],t.set(l,d)),d.push(h),h}else return Os(n,o,a)}})();var Xo=class e{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new e(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};Xo.None=new Xo(0,0);function Zd(e){let t=e.getBoundingClientRect(),i=ut(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var pm=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let s=this.mutationObservers.get(e);s||(s=new Map,this.mutationObservers.set(e,s));let r=Wd(i),n=s.get(r);if(n)n.users+=1;else{let o=new T,a=new MutationObserver((h)=>o.fire(h));a.observe(e,i);let l=n={users:1,observer:a,onDidMutate:o.event};t.add(oe(()=>{l.users-=1,l.users===0&&(o.dispose(),a.disconnect(),s?.delete(r),s?.size===0&&this.mutationObservers.delete(e))})),s.set(r,n)}return n.onDidMutate}},Ee={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Es?"webkitAnimationStart":"animationstart",ANIMATION_END:Es?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Es?"webkitAnimationIteration":"animationiteration"},Jd=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Ja(e,t,i,...s){let r=Jd.exec(t);if(!r)throw Error("Bad use of emmet");let n=r[1]||"div",o;return e!=="http://www.w3.org/1999/xhtml"?o=document.createElementNS(e,n):o=document.createElement(n),r[3]&&(o.id=r[3]),r[4]&&(o.className=r[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([a,l])=>{typeof l>"u"||(/^on\w+$/.test(a)?o[a]=l:a==="selected"?l&&o.setAttribute(a,"true"):o.setAttribute(a,l))}),o.append(...s),o}function Qd(e,t,...i){return Ja("http://www.w3.org/1999/xhtml",e,t,...i)}Qd.SVG=function(e,t,...i){return Ja("http://www.w3.org/2000/svg",e,t,...i)};var eu=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Ye(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ye(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ye(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ye(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ye(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ye(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ye(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ye(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ye(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ye(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ye(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Ye(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Ye(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ye(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Ye(e){return typeof e=="number"?`${e}px`:e}function Ji(e){return new eu(e)}var Qa=class{constructor(){this._hooks=new Yt,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,s,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=r;let n=e;try{e.setPointerCapture(t),this._hooks.add(oe(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=ut(e)}this._hooks.add(K(n,Ee.POINTER_MOVE,(o)=>{if(o.buttons!==i){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(K(n,Ee.POINTER_UP,(o)=>this.stopMonitoring(!0)))}};function tu(e,t,i){let s=null,r=null;if(typeof i.value=="function"?(s="value",r=i.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(s="get",r=i.get),!r)throw Error("not supported");let n=`$memoize$${t}`;i[s]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[n]}}var vt;((e)=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(vt||={});var Vi=class e extends Y{constructor(){super();this.dispatched=!1,this.targets=new No,this.ignoreTargets=new No,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ne.runAndSubscribe(qd,({window:t,disposables:i})=>{i.add(K(t.document,"touchstart",(s)=>this.onTouchStart(s),{passive:!1})),i.add(K(t.document,"touchend",(s)=>this.onTouchEnd(t,s))),i.add(K(t.document,"touchmove",(s)=>this.onTouchMove(s),{passive:!1}))},{window:it,disposables:this._store}))}static addTarget(t){if(!e.isTouchDevice())return Y.None;e.INSTANCE||(e.INSTANCE=Io(new e));let i=e.INSTANCE.targets.push(t);return oe(i)}static ignoreTarget(t){if(!e.isTouchDevice())return Y.None;e.INSTANCE||(e.INSTANCE=Io(new e));let i=e.INSTANCE.ignoreTargets.push(t);return oe(i)}static isTouchDevice(){return"ontouchstart"in it||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=t.targetTouches.length;s<r;s++){let n=t.targetTouches.item(s);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(vt.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let s=Date.now(),r=Object.keys(this.activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let a=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],h=Date.now()-l.initialTimeStamp;if(h<e.HOLD_DELAY&&Math.abs(l.initialPageX-Qe(l.rollingPageX))<30&&Math.abs(l.initialPageY-Qe(l.rollingPageY))<30){let d=this.newGestureEvent(vt.Tap,l.initialTarget);d.pageX=Qe(l.rollingPageX),d.pageY=Qe(l.rollingPageY),this.dispatchEvent(d)}else if(h>=e.HOLD_DELAY&&Math.abs(l.initialPageX-Qe(l.rollingPageX))<30&&Math.abs(l.initialPageY-Qe(l.rollingPageY))<30){let d=this.newGestureEvent(vt.Contextmenu,l.initialTarget);d.pageX=Qe(l.rollingPageX),d.pageY=Qe(l.rollingPageY),this.dispatchEvent(d)}else if(r===1){let d=Qe(l.rollingPageX),c=Qe(l.rollingPageY),f=Qe(l.rollingTimestamps)-l.rollingTimestamps[0],p=d-l.rollingPageX[0],w=c-l.rollingPageY[0],y=[...this.targets].filter((E)=>l.initialTarget instanceof Node&&E.contains(l.initialTarget));this.inertia(t,y,s,Math.abs(p)/f,p>0?1:-1,d,Math.abs(w)/f,w>0?1:-1,c)}this.dispatchEvent(this.newGestureEvent(vt.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=i,s.tapCount=0,s}dispatchEvent(t){if(t.type===vt.Tap){let i=new Date().getTime(),s=0;i-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=i,t.tapCount=s}else(t.type===vt.Change||t.type===vt.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let i=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let r=0,n=t.initialTarget;for(;n&&n!==s;)r++,n=n.parentElement;i.push([r,s])}i.sort((s,r)=>s[0]-r[0]);for(let[s,r]of i)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,s,r,n,o,a,l,h){this.handle=Os(t,()=>{let d=Date.now(),c=d-s,f=0,p=0,w=!0;r+=e.SCROLL_FRICTION*c,a+=e.SCROLL_FRICTION*c,r>0&&(w=!1,f=n*r*c),a>0&&(w=!1,p=l*a*c);let y=this.newGestureEvent(vt.Change);y.translationX=f,y.translationY=p,i.forEach((E)=>E.dispatchEvent(y)),w||this.inertia(t,i,d,r,n,o+f,a,l,h+p)})}onTouchMove(t){let i=Date.now();for(let s=0,r=t.changedTouches.length;s<r;s++){let n=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],a=this.newGestureEvent(vt.Change,o.initialTarget);a.translationX=n.pageX-Qe(o.rollingPageX),a.translationY=n.pageY-Qe(o.rollingPageY),a.pageX=n.pageX,a.pageY=n.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Vi.SCROLL_FRICTION=-0.005,Vi.HOLD_DELAY=700,Vi.CLEAR_TAP_COUNT_TIME=400,_e([tu],Vi,"isTouchDevice",1);var iu=Vi,bn=class extends Y{onclick(e,t){this._register(K(e,Ee.CLICK,(i)=>t(new qi(ut(e),i))))}onmousedown(e,t){this._register(K(e,Ee.MOUSE_DOWN,(i)=>t(new qi(ut(e),i))))}onmouseover(e,t){this._register(K(e,Ee.MOUSE_OVER,(i)=>t(new qi(ut(e),i))))}onmouseleave(e,t){this._register(K(e,Ee.MOUSE_LEAVE,(i)=>t(new qi(ut(e),i))))}onkeydown(e,t){this._register(K(e,Ee.KEY_DOWN,(i)=>t(new Gr(i))))}onkeyup(e,t){this._register(K(e,Ee.KEY_UP,(i)=>t(new Gr(i))))}oninput(e,t){this._register(K(e,Ee.INPUT,t))}onblur(e,t){this._register(K(e,Ee.BLUR,t))}onfocus(e,t){this._register(K(e,Ee.FOCUS,t))}onchange(e,t){this._register(K(e,Ee.CHANGE,t))}ignoreGesture(e){return iu.ignoreTarget(e)}},Zo=11,su=class extends bn{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=Zo+"px",this.domNode.style.height=Zo+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new Qa),this._register(Yo(this.bgDomNode,Ee.POINTER_DOWN,(t)=>this._arrowPointerDown(t))),this._register(Yo(this.domNode,Ee.POINTER_DOWN,(t)=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Xd),this._pointerdownScheduleRepeatTimer=this._register(new wn)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),41.666666666666664,ut(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,(i)=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},ru=class e{constructor(t,i,s,r,n,o,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,s=s|0,r=r|0,n=n|0,o=o|0,a=a|0),this.rawScrollLeft=r,this.rawScrollTop=a,i<0&&(i=0),r+i>s&&(r=s-i),r<0&&(r=0),n<0&&(n=0),a+n>o&&(a=o-n),a<0&&(a=0),this.width=i,this.scrollWidth=s,this.scrollLeft=r,this.height=n,this.scrollHeight=o,this.scrollTop=a}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,i){return new e(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,i){let s=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,l=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}},nu=class extends Y{constructor(e){super();this._scrollableBrand=void 0,this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new ru(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let s;t?s=new Qo(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=Qo.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},Jo=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function Mr(e,t){let i=t-e;return function(s){return e+i*hu(s)}}function ou(e,t,i){return function(s){return s<i?e(s/i):t((s-i)/(1-i))}}var Qo=class e{constructor(t,i,s,r){this.from=t,this.to=i,this.duration=r,this.startTime=s,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,i,s){if(Math.abs(t-i)>2.5*s){let r,n;return t<i?(r=t+0.75*s,n=i-0.75*s):(r=t-0.75*s,n=i+0.75*s),ou(Mr(t,r),Mr(n,i),0.33)}return Mr(t,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let i=(t-this.startTime)/this.duration;if(i<1){let s=this.scrollLeft(i),r=this.scrollTop(i);return new Jo(s,r,!1)}return new Jo(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,s){return e.start(t,i,s)}static start(t,i,s){s=s+10;let r=Date.now()-10;return new e(t,i,r,s)}};function au(e){return Math.pow(e,3)}function hu(e){return 1-au(1-e)}var lu=class extends Y{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new wn)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},cu=140,eh=class extends bn{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new lu(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Qa),this._shouldRender=!0,this.domNode=Ji(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(K(this.domNode.domNode,Ee.POINTER_DOWN,(t)=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new su(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,s){this.slider=Ji(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(K(this.slider.domNode,Ee.POINTER_DOWN,(r)=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,(r)=>{r.leftButton&&r.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);i<=r&&r<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let r=Zd(this.domNode.domNode);t=e.pageX-r.left,i=e.pageY-r.top}let s=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,(r)=>{let n=this._sliderOrthogonalPointerPosition(r),o=Math.abs(n-i);if(Ga&&o>cu){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let a=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(a))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},th=class e{constructor(t,i,s,r,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,s,r,n){let o=Math.max(0,s-t),a=Math.max(0,o-2*i),l=r>0&&r>s;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(s*a/r))),d=(a-h)/(r-s),c=n*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(h),computedSliderRatio:d,computedSliderPosition:Math.round(c)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,s=this._scrollPosition;return i<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},du=class extends eh{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new th(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},uu=class extends eh{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new th(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},_u=500,ea=50,ta=!0,fu=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},Yr=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,i=0,s=1,r=this._rear;do{let n=r===this._front?t:Math.pow(2,-s);if(t-=n,i+=this._memory[r].score*n,r===this._front)break;r=(this._capacity+r-1)%this._capacity,s++}while(!0);return i<=0.5}acceptStandardWheelEvent(t){if(vn){let i=ut(t.browserEvent),s=ad(i);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,s){let r=null,n=new fu(t,i,s);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,r)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=0.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=0.25),i){let r=Math.abs(t.deltaX),n=Math.abs(t.deltaY),o=Math.abs(i.deltaX),a=Math.abs(i.deltaY),l=Math.max(Math.min(r,o),1),h=Math.max(Math.min(n,a),1),d=Math.max(r,o),c=Math.max(n,a);d%l===0&&c%h===0&&(s-=0.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<0.01}};Yr.INSTANCE=new Yr;var gu=Yr,pu=class extends bn{constructor(e,t,i){super();this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new T),this.onWillScroll=this._onWillScroll.event,this._options=mu(t),this._scrollable=i,this._register(this._scrollable.onScroll((r)=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:(r)=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new uu(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new du(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Ji(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Ji(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Ji(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,(r)=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,(r)=>this._onMouseLeave(r)),this._hideTimeout=this._register(new wn),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ci(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,mt&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Ko(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ci(this._mouseWheelToDispose),e)){let t=(i)=>{this._onMouseWheel(new Ko(i))};this._mouseWheelToDispose.push(K(this._listenOnDomNode,Ee.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=gu.INSTANCE;ta&&t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,n=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&n+r===0?n=r=0:Math.abs(r)>=Math.abs(n)?n=0:r=0),this._options.flipAxes&&([r,n]=[n,r]);let o=!mt&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||o)&&!n&&(n=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(n=n*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),l={};if(r){let h=ea*r,d=a.scrollTop-(h<0?Math.floor(h):Math.ceil(h));this._verticalScrollbar.writeScrollPosition(l,d)}if(n){let h=ea*n,d=a.scrollLeft-(h<0?Math.floor(h):Math.ceil(h));this._horizontalScrollbar.writeScrollPosition(l,d)}l=this._scrollable.validateScrollPosition(l),(a.scrollLeft!==l.scrollLeft||a.scrollTop!==l.scrollTop)&&(ta&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(l):this._scrollable.setScrollPositionNow(l),i=!0)}let s=i;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,s=i?" left":"",r=t?" top":"",n=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),_u)}},vu=class extends pu{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function mu(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,mt&&(t.className+=" mac"),t}var Xr=class extends Y{constructor(e,t,i,s,r,n,o,a){super();this._bufferService=i,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new T),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new nu({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:(h)=>Os(s.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new vu(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},l)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange((h)=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ne.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(oe(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(oe(()=>this._styleElement.remove())),this._register(Ne.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
31
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll((h)=>this._handleScroll(h)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};Xr=_e([I(2,$e),I(3,Rt),I(4,Oa),I(5,Si),I(6,Ue),I(7,At)],Xr);var Zr=class extends Y{constructor(e,t,i,s,r){super();this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=s,this._renderService=r,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((n)=>this._removeDecoration(n))),this._register(oe(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Zr=_e([I(1,$e),I(2,Rt),I(3,rs),I(4,At)],Zr);var wu=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(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},gt={full:0,left:0,center:0,right:0},qt={full:0,left:0,center:0,right:0},Wi={full:0,left:0,center:0,right:0},Is=class extends Y{constructor(e,t,i,s,r,n,o,a){super();this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=n,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new wu,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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(oe(()=>this._canvas?.remove()));let l=this._canvas.getContext("2d");if(l)this._ctx=l;else throw Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);qt.full=this._canvas.width,qt.left=e,qt.center=t,qt.right=e,this._refreshDrawHeightConstants(),Wi.full=1,Wi.left=1,Wi.center=1+qt.left,Wi.right=1+qt.left+qt.center}_refreshDrawHeightConstants(){gt.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);gt.left=t,gt.center=t,gt.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*gt.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*gt.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*gt.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*gt.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(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Wi[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-gt[e.position||"full"]/2),qt[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+gt[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Is=_e([I(2,$e),I(3,rs),I(4,At),I(5,Ue),I(6,Si),I(7,Rt)],Is);var M;((e)=>(e.NUL="\x00",e.SOH="\x01",e.STX="\x02",e.ETX="\x03",e.EOT="\x04",e.ENQ="\x05",e.ACK="\x06",e.BEL="\x07",e.BS="\b",e.HT="\t",e.LF=`
|
|
32
|
-
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="\x0E",e.SI="\x0F",e.DLE="\x10",e.DC1="\x11",e.DC2="\x12",e.DC3="\x13",e.DC4="\x14",e.NAK="\x15",e.SYN="\x16",e.ETB="\x17",e.CAN="\x18",e.EM="\x19",e.SUB="\x1A",e.ESC="\x1B",e.FS="\x1C",e.GS="\x1D",e.RS="\x1E",e.US="\x1F",e.SP=" ",e.DEL=""))(M||={});var Rs;((e)=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(Rs||={});var ih;((e)=>e.ST=`${M.ESC}\\`)(ih||={});var Jr=class{constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${M.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=s+"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";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Jr=_e([I(2,$e),I(3,Ue),I(4,ui),I(5,At)],Jr);var Me=0,De=0,Re=0,ue=0,ia={css:"#00000000",rgba:0},we;((e)=>{function t(r,n,o,a){return a!==void 0?`#${ni(r)}${ni(n)}${ni(o)}${ni(a)}`:`#${ni(r)}${ni(n)}${ni(o)}`}e.toCss=t;function i(r,n,o,a=255){return(r<<24|n<<16|o<<8|a)>>>0}e.toRgba=i;function s(r,n,o,a){return{css:e.toCss(r,n,o,a),rgba:e.toRgba(r,n,o,a)}}e.toColor=s})(we||={});var ne;((e)=>{function t(l,h){if(ue=(h.rgba&255)/255,ue===1)return{css:h.css,rgba:h.rgba};let d=h.rgba>>24&255,c=h.rgba>>16&255,f=h.rgba>>8&255,p=l.rgba>>24&255,w=l.rgba>>16&255,y=l.rgba>>8&255;Me=p+Math.round((d-p)*ue),De=w+Math.round((c-w)*ue),Re=y+Math.round((f-y)*ue);let E=we.toCss(Me,De,Re),B=we.toRgba(Me,De,Re);return{css:E,rgba:B}}e.blend=t;function i(l){return(l.rgba&255)===255}e.isOpaque=i;function s(l,h,d){let c=As.ensureContrastRatio(l.rgba,h.rgba,d);if(c)return we.toColor(c>>24&255,c>>16&255,c>>8&255)}e.ensureContrastRatio=s;function r(l){let h=(l.rgba|255)>>>0;return[Me,De,Re]=As.toChannels(h),{css:we.toCss(Me,De,Re),rgba:h}}e.opaque=r;function n(l,h){return ue=Math.round(h*255),[Me,De,Re]=As.toChannels(l.rgba),{css:we.toCss(Me,De,Re,ue),rgba:we.toRgba(Me,De,Re,ue)}}e.opacity=n;function o(l,h){return ue=l.rgba&255,n(l,ue*h/255)}e.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}e.toColorRGB=a})(ne||={});var ce;((e)=>{let t,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Me=parseInt(r.slice(1,2).repeat(2),16),De=parseInt(r.slice(2,3).repeat(2),16),Re=parseInt(r.slice(3,4).repeat(2),16),we.toColor(Me,De,Re);case 5:return Me=parseInt(r.slice(1,2).repeat(2),16),De=parseInt(r.slice(2,3).repeat(2),16),Re=parseInt(r.slice(3,4).repeat(2),16),ue=parseInt(r.slice(4,5).repeat(2),16),we.toColor(Me,De,Re,ue);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Me=parseInt(n[1]),De=parseInt(n[2]),Re=parseInt(n[3]),ue=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),we.toColor(Me,De,Re,ue);if(!t||!i)throw Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=r,typeof t.fillStyle!="string")throw Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Me,De,Re,ue]=t.getImageData(0,0,1,1).data,ue!==255)throw Error("css.toColor: Unsupported css format");return{rgba:we.toRgba(Me,De,Re,ue),css:r}}e.toColor=s})(ce||={});var He;((e)=>{function t(s){return i(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function i(s,r,n){let o=s/255,a=r/255,l=n/255,h=o<=0.03928?o/12.92:Math.pow((o+0.055)/1.055,2.4),d=a<=0.03928?a/12.92:Math.pow((a+0.055)/1.055,2.4),c=l<=0.03928?l/12.92:Math.pow((l+0.055)/1.055,2.4);return h*0.2126+d*0.7152+c*0.0722}e.relativeLuminance2=i})(He||={});var As;((e)=>{function t(o,a){if(ue=(a&255)/255,ue===1)return a;let l=a>>24&255,h=a>>16&255,d=a>>8&255,c=o>>24&255,f=o>>16&255,p=o>>8&255;return Me=c+Math.round((l-c)*ue),De=f+Math.round((h-f)*ue),Re=p+Math.round((d-p)*ue),we.toRgba(Me,De,Re)}e.blend=t;function i(o,a,l){let h=He.relativeLuminance(o>>8),d=He.relativeLuminance(a>>8);if(Lt(h,d)<l){if(d<h){let p=s(o,a,l),w=Lt(h,He.relativeLuminance(p>>8));if(w<l){let y=r(o,a,l),E=Lt(h,He.relativeLuminance(y>>8));return w>E?p:y}return p}let c=r(o,a,l),f=Lt(h,He.relativeLuminance(c>>8));if(f<l){let p=s(o,a,l),w=Lt(h,He.relativeLuminance(p>>8));return f>w?c:p}return c}}e.ensureContrastRatio=i;function s(o,a,l){let h=o>>24&255,d=o>>16&255,c=o>>8&255,f=a>>24&255,p=a>>16&255,w=a>>8&255,y=Lt(He.relativeLuminance2(f,p,w),He.relativeLuminance2(h,d,c));for(;y<l&&(f>0||p>0||w>0);)f-=Math.max(0,Math.ceil(f*0.1)),p-=Math.max(0,Math.ceil(p*0.1)),w-=Math.max(0,Math.ceil(w*0.1)),y=Lt(He.relativeLuminance2(f,p,w),He.relativeLuminance2(h,d,c));return(f<<24|p<<16|w<<8|255)>>>0}e.reduceLuminance=s;function r(o,a,l){let h=o>>24&255,d=o>>16&255,c=o>>8&255,f=a>>24&255,p=a>>16&255,w=a>>8&255,y=Lt(He.relativeLuminance2(f,p,w),He.relativeLuminance2(h,d,c));for(;y<l&&(f<255||p<255||w<255);)f=Math.min(255,f+Math.ceil((255-f)*0.1)),p=Math.min(255,p+Math.ceil((255-p)*0.1)),w=Math.min(255,w+Math.ceil((255-w)*0.1)),y=Lt(He.relativeLuminance2(f,p,w),He.relativeLuminance2(h,d,c));return(f<<24|p<<16|w<<8|255)>>>0}e.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=n})(As||={});function ni(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Lt(e,t){return e<t?(t+0.05)/(e+0.05):(e+0.05)/(t+0.05)}var Su=class extends ss{constructor(e,t,i){super();this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ns=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new lt}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let i=[],s=t.translateToString(!0),r=0,n=0,o=0,a=t.getFg(0),l=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==l){if(h-r>1){let d=this._getJoinedRanges(s,o,n,t,r);for(let c=0;c<d.length;c++)i.push(d[c])}r=h,o=n,a=this._workCell.fg,l=this._workCell.bg}n+=this._workCell.getChars().length||Gt.length}if(this._bufferService.cols-r>1){let h=this._getJoinedRanges(s,o,n,t,r);for(let d=0;d<h.length;d++)i.push(h[d])}return i}_getJoinedRanges(e,t,i,s,r){let n=e.substring(t,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let l=this._characterJoiners[a].handler(n);for(let h=0;h<l.length;h++)Ns._mergeRanges(o,l[h])}catch(l){console.error(l)}return this._stringRangesToCellRanges(o,s,r),o}_stringRangesToCellRanges(e,t,i){let s=0,r=!1,n=0,o=e[s];if(o){for(let a=i;a<this._bufferService.cols;a++){let l=t.getWidth(a),h=t.getString(a).length||Gt.length;if(l!==0){if(!r&&o[0]<=n&&(o[0]=a,r=!0),o[1]<=n){if(o[1]=a,o=e[++s],!o)break;o[0]<=n?(o[0]=a,r=!0):r=!1}n+=h}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let s=0;s<e.length;s++){let r=e[s];if(i){if(t[1]<=r[0])return e[s-1][1]=t[1],e;if(t[1]<=r[1])return e[s-1][1]=Math.max(t[1],r[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=r[0])return e.splice(s,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};Ns=_e([I(0,$e)],Ns);function bu(e){return 57508<=e&&e<=57558}function yu(e){return 9472<=e&&e<=9631}function Cu(e){return bu(e)||yu(e)}function xu(){return{css:{canvas:Ss(),cell:Ss()},device:{canvas:Ss(),cell:Ss(),char:{width:0,height:0,left:0,top:0}}}}function Ss(){return{width:0,height:0}}var Qr=class{constructor(e,t,i,s,r,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=o,this._workCell=new lt,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,n,o,a,l,h,d){let c=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,w=e.getNoBgTrimmedLength();i&&w<n+1&&(w=n+1);let y,E=0,B="",P=0,R=0,b=0,x=0,L=!1,O=0,V=!1,j=0,he=0,F=[],be=h!==-1&&d!==-1;for(let u=0;u<w;u++){e.loadCell(u,this._workCell);let _=this._workCell.getWidth();if(_===0)continue;let S=!1,g=u>=he,m=u,v=this._workCell;if(f.length>0&&u===f[0][0]&&g){let W=f.shift(),Le=this._isCellInSelection(W[0],t);for(P=W[0]+1;P<W[1];P++)g&&=Le===this._isCellInSelection(P,t);g&&=!i||n<W[0]||n>=W[1],g?(S=!0,v=new Su(this._workCell,e.translateToString(!0,W[0],W[1]),W[1]-W[0]),m=W[1]-1,_=v.getWidth()):he=W[1]}let C=this._isCellInSelection(u,t),k=i&&u===n,D=be&&u>=h&&u<=d,U=!1;this._decorationService.forEachDecorationAtCell(u,t,void 0,(W)=>{U=!0});let H=v.getChars()||Gt;if(H===" "&&(v.isUnderline()||v.isOverline())&&(H=" "),j=_*a-l.get(H,v.isBold(),v.isItalic()),!y)y=this._document.createElement("span");else if(E&&(C&&V||!C&&!V&&v.bg===R)&&(C&&V&&p.selectionForeground||v.fg===b)&&v.extended.ext===x&&D===L&&j===O&&!k&&!S&&!U&&g){v.isInvisible()?B+=Gt:B+=H,E++;continue}else E&&(y.textContent=B),y=this._document.createElement("span"),E=0,B="";if(R=v.bg,b=v.fg,x=v.extended.ext,L=D,O=j,V=C,S&&n>=u&&n<=m&&(n=u),!this._coreService.isCursorHidden&&k&&this._coreService.isCursorInitialized){if(F.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&F.push("xterm-cursor-blink"),F.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":F.push("xterm-cursor-outline");break;case"block":F.push("xterm-cursor-block");break;case"bar":F.push("xterm-cursor-bar");break;case"underline":F.push("xterm-cursor-underline");break;default:break}}if(v.isBold()&&F.push("xterm-bold"),v.isItalic()&&F.push("xterm-italic"),v.isDim()&&F.push("xterm-dim"),v.isInvisible()?B=Gt:B=v.getChars()||Gt,v.isUnderline()&&(F.push(`xterm-underline-${v.extended.underlineStyle}`),B===" "&&(B=" "),!v.isUnderlineColorDefault()))if(v.isUnderlineColorRGB())y.style.textDecorationColor=`rgb(${ss.toColorRGB(v.getUnderlineColor()).join(",")})`;else{let W=v.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&v.isBold()&&W<8&&(W+=8),y.style.textDecorationColor=p.ansi[W].css}v.isOverline()&&(F.push("xterm-overline"),B===" "&&(B=" ")),v.isStrikethrough()&&F.push("xterm-strikethrough"),D&&(y.style.textDecoration="underline");let q=v.getFgColor(),ee=v.getFgColorMode(),G=v.getBgColor(),te=v.getBgColorMode(),Z=!!v.isInverse();if(Z){let W=q;q=G,G=W;let Le=ee;ee=te,te=Le}let re,A,Q=!1;this._decorationService.forEachDecorationAtCell(u,t,void 0,(W)=>{W.options.layer!=="top"&&Q||(W.backgroundColorRGB&&(te=50331648,G=W.backgroundColorRGB.rgba>>8&16777215,re=W.backgroundColorRGB),W.foregroundColorRGB&&(ee=50331648,q=W.foregroundColorRGB.rgba>>8&16777215,A=W.foregroundColorRGB),Q=W.options.layer==="top")}),!Q&&C&&(re=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,G=re.rgba>>8&16777215,te=50331648,Q=!0,p.selectionForeground&&(ee=50331648,q=p.selectionForeground.rgba>>8&16777215,A=p.selectionForeground)),Q&&F.push("xterm-decoration-top");let de;switch(te){case 16777216:case 33554432:de=p.ansi[G],F.push(`xterm-bg-${G}`);break;case 50331648:de=we.toColor(G>>16,G>>8&255,G&255),this._addStyle(y,`background-color:#${sa((G>>>0).toString(16),"0",6)}`);break;case 0:default:Z?(de=p.foreground,F.push("xterm-bg-257")):de=p.background}switch(re||v.isDim()&&(re=ne.multiplyOpacity(de,0.5)),ee){case 16777216:case 33554432:v.isBold()&&q<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(q+=8),this._applyMinimumContrast(y,de,p.ansi[q],v,re,void 0)||F.push(`xterm-fg-${q}`);break;case 50331648:let W=we.toColor(q>>16&255,q>>8&255,q&255);this._applyMinimumContrast(y,de,W,v,re,A)||this._addStyle(y,`color:#${sa(q.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(y,de,p.foreground,v,re,A)||Z&&F.push("xterm-fg-257")}F.length&&(y.className=F.join(" "),F.length=0),!k&&!S&&!U&&g?E++:y.textContent=B,j!==this.defaultSpacing&&(y.style.letterSpacing=`${j}px`),c.push(y),u=m}return y&&E&&(y.textContent=B),c}_applyMinimumContrast(e,t,i,s,r,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||Cu(s.getCode()))return!1;let o=this._getContrastCache(s),a;if(!r&&!n&&(a=o.getColor(t.rgba,i.rgba)),a===void 0){let l=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=ne.ensureContrastRatio(r||t,n||i,l),o.setColor((r||t).rgba,(n||i).rgba,a??null)}return a?(this._addStyle(e,`color:${a.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let i=this._selectionStart,s=this._selectionEnd;return!i||!s?!1:this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e<s[0]&&t<=s[1]:e<i[0]&&t>=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t<s[1]||i[1]===s[1]&&t===i[1]&&e>=i[0]&&e<s[0]||i[1]<s[1]&&t===s[1]&&e<s[0]||i[1]<s[1]&&t===i[1]&&e>=i[0]}};Qr=_e([I(1,Fa),I(2,Ue),I(3,Rt),I(4,ui),I(5,rs),I(6,Si)],Qr);function sa(e,t,i){for(;e.length<i;)e=t+e;return e}var ku=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.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";let i=e.createElement("span");i.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,s,r,n],this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(n),t.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(e,t,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,i){let s=0;if(!t&&!i&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let o=this._measure(e,0);return o>0&&(this._flat[s]=o),o}let r=e;t&&(r+="B"),i&&(r+="I");let n=this._holey.get(r);if(n===void 0){let o=0;t&&(o|=1),i&&(o|=2),n=this._measure(e,o),n>0&&this._holey.set(r,n)}return n}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},Lu=class{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(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let r=e.buffers.active.ydisp,n=t[1]-r,o=i[1]-r,a=Math.max(n,0),l=Math.min(o,e.rows-1);if(a>=e.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function Eu(){return new Lu}var Dr="xterm-dom-renderer-owner-",at="xterm-rows",bs="xterm-fg-",ra="xterm-bg-",zi="xterm-focus",ys="xterm-selection",Mu=1,en=class extends Y{constructor(e,t,i,s,r,n,o,a,l,h,d,c,f,p){super();this._terminal=e,this._document=t,this._element=i,this._screenElement=s,this._viewportElement=r,this._helperContainer=n,this._linkifier2=o,this._charSizeService=l,this._optionsService=h,this._bufferService=d,this._coreService=c,this._coreBrowserService=f,this._themeService=p,this._terminalClass=Mu++,this._rowElements=[],this._selectionRenderModel=Eu(),this.onRequestRedraw=this._register(new T).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(at),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(ys),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=xu(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors((w)=>this._injectCss(w))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(Qr,document),this._element.classList.add(Dr+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline((w)=>this._handleLinkHover(w))),this._register(this._linkifier2.onHideLinkUnderline((w)=>this._handleLinkLeave(w))),this._register(oe(()=>{this._element.classList.remove(Dr+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new ku(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(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),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(let i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${at} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${at} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${at} .xterm-dim { color: ${ne.multiplyOpacity(e.foreground,0.5).css};}`,t+=`${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;}`;let i=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${at}.${zi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${at}.${zi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${at}.${zi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${at} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${at} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${at} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${at} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${at} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ys} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ys} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ys} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .${bs}${n} { color: ${o.css}; }${this._terminalSelector} .${bs}${n}.xterm-dim { color: ${ne.multiplyOpacity(o,0.5).css}; }${this._terminalSelector} .${ra}${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${bs}257 { color: ${ne.opaque(e.background).css}; }${this._terminalSelector} .${bs}257.xterm-dim { color: ${ne.multiplyOpacity(ne.opaque(e.background),0.5).css}; }${this._terminalSelector} .${ra}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let i=this._rowElements.length;i<=t;i++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(zi),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(zi),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(i){let l=e[0]>t[0];a.appendChild(this._createSelectionElement(n,l?t[0]:e[0],l?e[0]:t[0],o-n+1))}else{let l=s===n?e[0]:0,h=n===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,l,h));let d=o-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,d)),n!==o){let c=r===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,c))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,i,s=1){let r=this._document.createElement("div"),n=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),r.style.height=`${s*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${n}px`,r.style.width=`${o}px`,r}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(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){let h=l+i.ydisp,d=this._rowElements[l],c=i.lines.get(h);if(!d||!c)break;d.replaceChildren(...this._rowFactory.createRow(c,h,h===s,o,a,r,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Dr}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,s,r,n){i<0&&(e=0),s<0&&(t=0);let o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),s=Math.max(Math.min(s,o),0),r=Math.min(r,this._bufferService.cols);let a=this._bufferService.buffer,l=a.ybase+a.y,h=Math.min(a.x,r-1),d=this._optionsService.rawOptions.cursorBlink,c=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=i;p<=s;++p){let w=p+a.ydisp,y=this._rowElements[p],E=a.lines.get(w);if(!y||!E)break;y.replaceChildren(...this._rowFactory.createRow(E,w,w===l,c,f,h,d,this.dimensions.css.cell.width,this._widthCache,n?p===i?e:0:-1,n?(p===s?t:r)-1:-1))}}};en=_e([I(7,fn),I(8,$s),I(9,Ue),I(10,$e),I(11,ui),I(12,Rt),I(13,Si)],en);var tn=class extends Y{constructor(e,t,i){super();this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new T),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Ru(this._optionsService))}catch{this._measureStrategy=this._register(new Du(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};tn=_e([I(2,Ue)],tn);var sh=class extends Y{constructor(){super(...arguments);this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},Du=class extends sh{constructor(e,t,i){super();this._document=e,this._parentElement=t,this._optionsService=i,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}},Ru=class extends sh{constructor(e){super();this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!(("width"in t)&&("fontBoundingBoxAscent"in t)&&("fontBoundingBoxDescent"in t)))throw Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Au=class extends Y{constructor(e,t,i){super();this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Tu(this._window)),this._onDprChange=this._register(new T),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new T),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange((s)=>this._screenDprMonitor.setWindow(s))),this._register(Ne.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(K(this._textarea,"focus",()=>this._isFocused=!0)),this._register(K(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,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}},Tu=class extends Y{constructor(e){super();this._parentWindow=e,this._windowResizeListener=this._register(new wi),this._onDprChange=this._register(new T),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(oe(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=K(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}},Bu=class extends Y{constructor(){super();this.linkProviders=[],this._register(oe(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function yn(e,t,i){let s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-s.left-n,t.clientY-s.top-o]}function Pu(e,t,i,s,r,n,o,a,l){if(!n)return;let h=yn(e,t,i);if(h)return h[0]=Math.ceil((h[0]+(l?o/2:0))/o),h[1]=Math.ceil(h[1]/a),h[0]=Math.min(Math.max(h[0],1),s+(l?1:0)),h[1]=Math.min(Math.max(h[1],1),r),h}var sn=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,s,r){return Pu(window,e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let i=yn(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};sn=_e([I(0,At),I(1,$s)],sn);var Ou=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!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){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},rh={};mc(rh,{getSafariVersion:()=>Nu,isChromeOS:()=>hh,isFirefox:()=>nh,isIpad:()=>Fu,isIphone:()=>Wu,isLegacyEdge:()=>Iu,isLinux:()=>Cn,isMac:()=>Fs,isNode:()=>qs,isSafari:()=>oh,isWindows:()=>ah});var qs=typeof process<"u"&&"title"in process,ns=qs?"node":navigator.userAgent,os=qs?"node":navigator.platform,nh=ns.includes("Firefox"),Iu=ns.includes("Edge"),oh=/^((?!chrome|android).)*safari/i.test(ns);function Nu(){if(!oh)return 0;let e=ns.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Fs=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(os),Fu=os==="iPad",Wu=os==="iPhone",ah=["Windows","Win16","Win32","WinCE"].includes(os),Cn=os.indexOf("Linux")>=0,hh=/\bCrOS\b/.test(ns),lh=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),r=e.timeRemaining(),i*1.5>r){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=r}this.clear()}},zu=class extends lh{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Hu=class extends lh{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Ws=!qs&&"requestIdleCallback"in window?Hu:zu,$u=class{constructor(){this._queue=new Ws}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},rn=class extends Y{constructor(e,t,i,s,r,n,o,a,l){super();this._rowCount=e,this._optionsService=i,this._charSizeService=s,this._coreService=r,this._coreBrowserService=a,this._renderer=this._register(new wi),this._pausedResizeTask=new $u,this._observerDisposable=this._register(new wi),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 T),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new T),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new T),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new T),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Ou((h,d)=>this._renderRows(h,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Uu(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(oe(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(n.onDecorationRegistered(()=>this._fullRefresh())),this._register(n.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange((h)=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver((s)=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=oe(()=>i.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,t,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),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:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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((t)=>this.refreshRows(t.start,t.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(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.value?.handleSelectionChanged(e,t,i)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};rn=_e([I(2,Ue),I(3,$s),I(4,ui),I(5,rs),I(6,$e),I(7,Rt),I(8,Si)],rn);var Uu=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1000))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Ku(e,t,i,s){let r=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return ju(r,n,e,t,i,s)+Vs(n,t,i,s)+Gu(r,n,e,t,i,s);let o;if(n===t)return o=r>e?"D":"C",ts(Math.abs(r-e),es(o,s));o=n>t?"D":"C";let a=Math.abs(n-t),l=Vu(n>t?e:r,i)+(a-1)*i.cols+1+qu(n>t?r:e,i);return ts(l,es(o,s))}function qu(e,t){return e-1}function Vu(e,t){return t.cols-e}function ju(e,t,i,s,r,n){return Vs(t,s,r,n).length===0?"":ts(dh(e,t,e,t-di(t,r),!1,r).length,es("D",n))}function Vs(e,t,i,s){let r=e-di(e,i),n=t-di(t,i),o=Math.abs(r-n)-Yu(e,t,i);return ts(o,es(ch(e,t),s))}function Gu(e,t,i,s,r,n){let o;Vs(t,s,r,n).length>0?o=s-di(s,r):o=t;let a=s,l=Xu(e,t,i,s,r,n);return ts(dh(e,o,i,a,l==="C",r).length,es(l,n))}function Yu(e,t,i){let s=0,r=e-di(e,i),n=t-di(t,i);for(let o=0;o<Math.abs(r-n);o++){let a=ch(e,t)==="A"?-1:1;i.buffer.lines.get(r+a*o)?.isWrapped&&s++}return s}function di(e,t){let i=0,s=t.buffer.lines.get(e),r=s?.isWrapped;for(;r&&e>=0&&e<t.rows;)i++,s=t.buffer.lines.get(--e),r=s?.isWrapped;return i}function Xu(e,t,i,s,r,n){let o;return Vs(i,s,r,n).length>0?o=s-di(s,r):o=t,e<i&&o<=s||e>=i&&o<s?"C":"D"}function ch(e,t){return e>t?"A":"B"}function dh(e,t,i,s,r,n){let o=e,a=t,l="";for(;(o!==i||a!==s)&&a>=0&&a<n.buffer.lines.length;)o+=r?1:-1,r&&o>n.cols-1?(l+=n.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!r&&o<0&&(l+=n.buffer.translateBufferLineToString(a,!1,0,e+1),o=n.cols-1,e=o,a--);return l+n.buffer.translateBufferLineToString(a,!1,e,o)}function es(e,t){let i=t?"O":"[";return M.ESC+i+e}function ts(e,t){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=t;return i}var Zu=class{constructor(e){this._bufferService=e,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.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()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function na(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Rr=50,Ju=15,Qu=50,e_=500,t_=" ",i_=new RegExp(t_,"g"),nn=class extends Y{constructor(e,t,i,s,r,n,o,a,l){super();this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseService=n,this._optionsService=o,this._renderService=a,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new lt,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new T),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new T),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new T),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new T),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=(h)=>this._handleMouseMove(h),this._mouseUpListener=(h)=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim((h)=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate((h)=>this._handleBufferActivate(h))),this.enable(),this._model=new Zu(this._bufferService),this._activeSelectionMode=0,this._register(oe(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize((h)=>{h.rowsChanged&&this.clearSelection()}))}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(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let a=i.translateBufferLineToString(o,!0,r,n);s.push(a)}}else{let r=e[1]===t[1]?t[0]:void 0;s.push(i.translateBufferLineToString(e[1],!0,e[0],r));for(let n=e[1]+1;n<=t[1]-1;n++){let o=i.lines.get(n),a=i.translateBufferLineToString(n,!0);o?.isWrapped?s[s.length-1]+=a:s.push(a)}if(e[1]!==t[1]){let n=i.lines.get(t[1]),o=i.translateBufferLineToString(t[1],!0,0,t[0]);n&&n.isWrapped?s[s.length-1]+=o:s.push(o)}}return s.map((r)=>r.replace(i_," ")).join(ah?`\r
|
|
30
|
+
`).trim(),h=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);Rs.register(o,h?.[2]??a,o)}return o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*ad<=t.length){let r=0;for(let n=0;n<t.length;n++)t[n]?t[r++]=t[n]:s&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=r}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||Ms;if(!i){e.value(t);return}try{e.value(t)}catch(s){i(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Ds)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},ld=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Zr=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new T,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new T,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Zr.INSTANCE=new Zr;var bn=Zr;function cd(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var sm=bn.INSTANCE.onDidChangeZoomLevel;function dd(e){return bn.INSTANCE.getZoomFactor(e)}var rm=bn.INSTANCE.onDidChangeFullscreen,Li=typeof navigator=="object"?navigator.userAgent:"",Jr=Li.indexOf("Firefox")>=0,As=Li.indexOf("AppleWebKit")>=0,yn=Li.indexOf("Chrome")>=0,Ya=!yn&&Li.indexOf("Safari")>=0,nm=Li.indexOf("Electron/")>=0,om=Li.indexOf("Android")>=0,Ts=!1;if(typeof at.matchMedia=="function"){let e=at.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=at.matchMedia("(display-mode: fullscreen)");Ts=e.matches,cd(at,e,({matches:i})=>{Ts&&t.matches||(Ts=i)})}function ud(){return Ts}var Ci="en",Ns=!1,Fs=!1,ts=!1,_d=!1,Xa=!1,Za=!1,fd=!1,gd=!1,pd=!1,vd=!1,Cs,Bs=Ci,qo=Ci,md,Tt,Pt=globalThis,ot;typeof Pt.vscode<"u"&&typeof Pt.vscode.process<"u"?ot=Pt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ot=process);var Ja=typeof ot?.versions?.electron=="string",wd=Ja&&ot?.type==="renderer";if(typeof ot=="object"){Ns=ot.platform==="win32",Fs=ot.platform==="darwin",ts=ot.platform==="linux",_d=ts&&!!ot.env.SNAP&&!!ot.env.SNAP_REVISION,fd=Ja,pd=!!ot.env.CI||!!ot.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Cs=Ci,Bs=Ci;let e=ot.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Cs=t.userLocale,qo=t.osLocale,Bs=t.resolvedLanguage||Ci,md=t.languagePack?.translationsConfigFile}catch{}Xa=!0}else typeof navigator=="object"&&!wd?(Tt=navigator.userAgent,Ns=Tt.indexOf("Windows")>=0,Fs=Tt.indexOf("Macintosh")>=0,gd=(Tt.indexOf("Macintosh")>=0||Tt.indexOf("iPad")>=0||Tt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ts=Tt.indexOf("Linux")>=0,vd=Tt?.indexOf("Mobi")>=0,Za=!0,Bs=globalThis._VSCODE_NLS_LANGUAGE||Ci,Cs=navigator.language.toLowerCase(),qo=Cs):console.error("Unable to resolve platform.");var Er=0;Fs?Er=1:Ns?Er=3:ts&&(Er=2);var Qa=Ns,yt=Fs,Sd=ts,Mr=Xa,bd=Za&&typeof Pt.importScripts=="function",am=bd?Pt.origin:void 0,Ct=Tt,jt=Bs,yd;((e)=>{function t(){return jt}e.value=t;function i(){return jt.length===2?jt==="en":jt.length>=3?jt[0]==="e"&&jt[1]==="n"&&jt[2]==="-":!1}e.isDefaultVariant=i;function s(){return jt==="en"}e.isDefault=s})(yd||={});var Cd=typeof Pt.postMessage=="function"&&!Pt.importScripts,xd=(()=>{if(Cd){let e=[];Pt.addEventListener("message",(i)=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let n=e[s];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),n.callback();return}}});let t=0;return(i)=>{let s=++t;e.push({id:s,callback:i}),Pt.postMessage({vscodeScheduleAsyncWork:s},"*")}}return(e)=>setTimeout(e)})(),kd=!!(Ct&&Ct.indexOf("Chrome")>=0),hm=!!(Ct&&Ct.indexOf("Firefox")>=0),lm=!!(!kd&&Ct&&Ct.indexOf("Safari")>=0),cm=!!(Ct&&Ct.indexOf("Edg/")>=0),dm=!!(Ct&&Ct.indexOf("Android")>=0),Yt=typeof navigator=="object"?navigator:{},um={clipboard:{writeText:Mr||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(Yt&&Yt.clipboard&&Yt.clipboard.writeText),readText:Mr||!!(Yt&&Yt.clipboard&&Yt.clipboard.readText)},keyboard:Mr||ud()?0:Yt.keyboard||Ya?1:2,touch:"ontouchstart"in at||Yt.maxTouchPoints>0,pointerEvents:at.PointerEvent&&(("ontouchstart"in at)||navigator.maxTouchPoints>0)},Cn=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Dr=new Cn,Vo=new Cn,Go=new Cn,Ld=Array(230),eh;((e)=>{function t(a){return Dr.keyCodeToStr(a)}e.toString=t;function i(a){return Dr.strToKeyCode(a)}e.fromString=i;function s(a){return Vo.keyCodeToStr(a)}e.toUserSettingsUS=s;function r(a){return Go.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function n(a){return Vo.strToKeyCode(a)||Go.strToKeyCode(a)}e.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Dr.keyCodeToStr(a)}e.toElectronAccelerator=o})(eh||={});var Ed=class e{constructor(t,i,s,r,n){this.ctrlKey=t,this.shiftKey=i,this.altKey=s,this.metaKey=r,this.keyCode=n}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${t}${i}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Md([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Md=class{constructor(e){if(e.length===0)throw Wc("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function Dd(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return eh.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(Jr)switch(t){case 59:return 85;case 60:if(Sd)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(yt)return 57;break}else if(As){if(yt&&t===93)return 57;if(!yt&&t===92)return 57}return Ld[t]||0}var Rd=yt?256:2048,Ad=512,Td=1024,Bd=yt?2048:256,Qr=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=Dd(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Rd),this.altKey&&(t|=Ad),this.shiftKey&&(t|=Td),this.metaKey&&(t|=Bd),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Ed(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},jo=new WeakMap;function Pd(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var Od=class{static getSameOriginWindowChain(e){let t=jo.get(e);if(!t){t=[],jo.set(e,t);let i=e,s;do s=Pd(i),s?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=s;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,s=0,r=this.getSameOriginWindowChain(e);for(let n of r){let o=n.window.deref();if(i+=o?.scrollY??0,s+=o?.scrollX??0,o===t||!n.iframeElement)break;let a=n.iframeElement.getBoundingClientRect();i+=a.top,s+=a.left}return{top:i,left:s}}},Yi=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=Od.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Yo=class{constructor(e,t=0,i=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let s=!1;if(yn){let r=navigator.userAgent.match(/Chrome\/(\d+)/);s=(r?parseInt(r[1]):123)<=122}if(e){let r=e,n=e,o=e.view?.devicePixelRatio||1;if(typeof r.wheelDeltaY<"u")s?this.deltaY=r.wheelDeltaY/(120*o):this.deltaY=r.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<"u"&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?Jr&&!yt?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof r.wheelDeltaX<"u")Ya&&Qa?this.deltaX=-(r.wheelDeltaX/120):s?this.deltaX=r.wheelDeltaX/(120*o):this.deltaX=r.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<"u"&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let a=e;a.deltaMode===a.DOM_DELTA_LINE?Jr&&!yt?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(s?this.deltaY=e.wheelDelta/(120*o):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},th=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Id;((e)=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Nd?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ie.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:th})})(Id||={});var Nd=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?th:(this._emitter||(this._emitter=new T),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},_m=Symbol("MicrotaskDelay"),xn=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Gr("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Gr("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Fd=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new Gr("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let s=i.setInterval(()=>{e()},t);this.disposable=le(()=>{i.clearInterval(s),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Wd,Rr;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Rr=(e,t)=>{xd(()=>{if(i)return;let s=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,s-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Rr=(e,t,i)=>{let s=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(s))}}},Wd=(e)=>Rr(globalThis,e)})();var zd;((e)=>{async function t(s){let r,n=await Promise.all(s.map((o)=>o.then((a)=>a,(a)=>{r||(r=a)})));if(typeof r<"u")throw r;return n}e.settled=t;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}e.withAsyncBody=i})(zd||={});var Xo=class e{static fromArray(t){return new e((i)=>{i.emitMany(t)})}static fromPromise(t){return new e(async(i)=>{i.emitMany(await t)})}static fromPromises(t){return new e(async(i)=>{await Promise.all(t.map(async(s)=>i.emitOne(await s)))})}static merge(t){return new e(async(i)=>{await Promise.all(t.map(async(s)=>{for await(let r of s)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new T,queueMicrotask(async()=>{let s={emitOne:(r)=>this.emitOne(r),emitMany:(r)=>this.emitMany(r),reject:(r)=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ie.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new e(async(s)=>{for await(let r of t)s.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async(s)=>{for await(let r of t)i(r)&&s.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,(i)=>!!i)}coalesce(){return e.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return e.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Xo.EMPTY=Xo.fromArray([]);function Hd(e){return 55296<=e&&e<=56319}function Zo(e){return 56320<=e&&e<=57343}function $d(e,t){return(e-55296<<10)+(t-56320)+65536}function Ud(e){return kn(e,0)}function kn(e,t){switch(typeof e){case"object":return e===null?Bt(349,t):Array.isArray(e)?qd(e,t):Vd(e,t);case"string":return ih(e,t);case"boolean":return Kd(e,t);case"number":return Bt(e,t);case"undefined":return Bt(937,t);default:return Bt(617,t)}}function Bt(e,t){return(t<<5)-t+e|0}function Kd(e,t){return Bt(e?433:863,t)}function ih(e,t){t=Bt(149417,t);for(let i=0,s=e.length;i<s;i++)t=Bt(e.charCodeAt(i),t);return t}function qd(e,t){return t=Bt(104579,t),e.reduce((i,s)=>kn(s,i),t)}function Vd(e,t){return t=Bt(181387,t),Object.keys(e).sort().reduce((i,s)=>(i=ih(s,i),kn(e[s],i)),t)}function Ar(e,t,i=32){let s=i-t,r=~((1<<s)-1);return(e<<t|(r&e)>>>s)>>>0}function Jo(e,t=0,i=e.byteLength,s=0){for(let r=0;r<i;r++)e[t+r]=s}function Gd(e,t,i="0"){for(;e.length<t;)e=i+e;return e}function $i(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map((i)=>i.toString(16).padStart(2,"0")).join(""):Gd((e>>>0).toString(16),t/4)}var jd=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let i=t.length;if(i===0)return;let s=this._buff,r=this._buffLen,n=this._leftoverHighSurrogate,o,a;for(n!==0?(o=n,a=-1,n=0):(o=t.charCodeAt(0),a=0);;){let h=o;if(Hd(o))if(a+1<i){let l=t.charCodeAt(a+1);Zo(l)?(a++,h=$d(o,l)):h=65533}else{n=o;break}else Zo(o)&&(h=65533);if(r=this._push(s,r,h),a++,a<i)o=t.charCodeAt(a);else break}this._buffLen=r,this._leftoverHighSurrogate=n}_push(t,i,s){return s<128?t[i++]=s:s<2048?(t[i++]=192|(s&1984)>>>6,t[i++]=128|(s&63)>>>0):s<65536?(t[i++]=224|(s&61440)>>>12,t[i++]=128|(s&4032)>>>6,t[i++]=128|(s&63)>>>0):(t[i++]=240|(s&1835008)>>>18,t[i++]=128|(s&258048)>>>12,t[i++]=128|(s&4032)>>>6,t[i++]=128|(s&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),i}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),$i(this._h0)+$i(this._h1)+$i(this._h2)+$i(this._h3)+$i(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Jo(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Jo(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,i=this._buffDV;for(let c=0;c<64;c+=4)t.setUint32(c,i.getUint32(c,!1),!1);for(let c=64;c<320;c+=4)t.setUint32(c,Ar(t.getUint32(c-12,!1)^t.getUint32(c-32,!1)^t.getUint32(c-56,!1)^t.getUint32(c-64,!1),1),!1);let s=this._h0,r=this._h1,n=this._h2,o=this._h3,a=this._h4,h,l,d;for(let c=0;c<80;c++)c<20?(h=r&n|~r&o,l=1518500249):c<40?(h=r^n^o,l=1859775393):c<60?(h=r&n|r&o|n&o,l=2400959708):(h=r^n^o,l=3395469782),d=Ar(s,5)+h+a+l+t.getUint32(c*4,!1)&4294967295,a=o,o=n,n=Ar(r,30),r=s,s=d;this._h0=this._h0+s&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+n&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+a&4294967295}};jd._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:fm,getWindow:vt,getDocument:gm,getWindows:pm,getWindowsCount:vm,getWindowId:Qo,getWindowById:mm,hasWindow:wm,onDidRegisterWindow:Yd,onWillUnregisterWindow:Sm,onDidUnregisterWindow:bm}=function(){let e=new Map,t={window:at,disposables:new ei};e.set(at.vscodeWindowId,t);let i=new T,s=new T,r=new T;function n(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(e.has(o.vscodeWindowId))return G.None;let a=new ei,h={window:o,disposables:a.add(new ei)};return e.set(o.vscodeWindowId,h),a.add(le(()=>{e.delete(o.vscodeWindowId),s.fire(o)})),a.add(U(o,Ee.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(h),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:n,getWindow(o){let a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let h=o;return h?.view?h.view.window:at},getDocument(o){return vt(o).document}}}(),Xd=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function U(e,t,i,s){return new Xd(e,t,i,s)}function Zd(e,t){return function(i){return t(new Yi(e,i))}}function Jd(e){return function(t){return e(new Qr(t))}}var ea=function(e,t,i,s){let r=i;return t==="click"||t==="mousedown"||t==="contextmenu"?r=Zd(vt(e),i):(t==="keydown"||t==="keypress"||t==="keyup")&&(r=Jd(i)),U(e,t,r,s)},Qd,Ws,eu=class extends Fd{constructor(e){super(),this.defaultTarget=e&&vt(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},Tr=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Ms(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,s=new Map,r=(n)=>{i.set(n,!1);let o=e.get(n)??[];for(t.set(n,o),e.set(n,[]),s.set(n,!0);o.length>0;)o.sort(Tr.sort),o.shift().execute();s.set(n,!1)};Ws=(n,o,a=0)=>{let h=Qo(n),l=new Tr(o,a),d=e.get(h);return d||(d=[],e.set(h,d)),d.push(l),i.get(h)||(i.set(h,!0),n.requestAnimationFrame(()=>r(h))),l},Qd=(n,o,a)=>{let h=Qo(n);if(s.get(h)){let l=new Tr(o,a),d=t.get(h);return d||(d=[],t.set(h,d)),d.push(l),l}else return Ws(n,o,a)}})();var ta=class e{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new e(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};ta.None=new ta(0,0);function tu(e){let t=e.getBoundingClientRect(),i=vt(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var ym=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let s=this.mutationObservers.get(e);s||(s=new Map,this.mutationObservers.set(e,s));let r=Ud(i),n=s.get(r);if(n)n.users+=1;else{let o=new T,a=new MutationObserver((l)=>o.fire(l));a.observe(e,i);let h=n={users:1,observer:a,onDidMutate:o.event};t.add(le(()=>{h.users-=1,h.users===0&&(o.dispose(),a.disconnect(),s?.delete(r),s?.size===0&&this.mutationObservers.delete(e))})),s.set(r,n)}return n.onDidMutate}},Ee={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:As?"webkitAnimationStart":"animationstart",ANIMATION_END:As?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:As?"webkitAnimationIteration":"animationiteration"},iu=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function sh(e,t,i,...s){let r=iu.exec(t);if(!r)throw Error("Bad use of emmet");let n=r[1]||"div",o;return e!=="http://www.w3.org/1999/xhtml"?o=document.createElementNS(e,n):o=document.createElement(n),r[3]&&(o.id=r[3]),r[4]&&(o.className=r[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([a,h])=>{typeof h>"u"||(/^on\w+$/.test(a)?o[a]=h:a==="selected"?h&&o.setAttribute(a,"true"):o.setAttribute(a,h))}),o.append(...s),o}function su(e,t,...i){return sh("http://www.w3.org/1999/xhtml",e,t,...i)}su.SVG=function(e,t,...i){return sh("http://www.w3.org/2000/svg",e,t,...i)};var ru=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Ye(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ye(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ye(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ye(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ye(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ye(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ye(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ye(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ye(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ye(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ye(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Ye(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Ye(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ye(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Ye(e){return typeof e=="number"?`${e}px`:e}function is(e){return new ru(e)}var rh=class{constructor(){this._hooks=new ei,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,s,r){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=s,this._onStopCallback=r;let n=e;try{e.setPointerCapture(t),this._hooks.add(le(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{n=vt(e)}this._hooks.add(U(n,Ee.POINTER_MOVE,(o)=>{if(o.buttons!==i){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(U(n,Ee.POINTER_UP,(o)=>this.stopMonitoring(!0)))}};function nu(e,t,i){let s=null,r=null;if(typeof i.value=="function"?(s="value",r=i.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(s="get",r=i.get),!r)throw Error("not supported");let n=`$memoize$${t}`;i[s]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[n]}}var bt;((e)=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(bt||={});var Xi=class e extends G{constructor(){super();this.dispatched=!1,this.targets=new $o,this.ignoreTargets=new $o,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ie.runAndSubscribe(Yd,({window:t,disposables:i})=>{i.add(U(t.document,"touchstart",(s)=>this.onTouchStart(s),{passive:!1})),i.add(U(t.document,"touchend",(s)=>this.onTouchEnd(t,s))),i.add(U(t.document,"touchmove",(s)=>this.onTouchMove(s),{passive:!1}))},{window:at,disposables:this._store}))}static addTarget(t){if(!e.isTouchDevice())return G.None;e.INSTANCE||(e.INSTANCE=Ho(new e));let i=e.INSTANCE.targets.push(t);return le(i)}static ignoreTarget(t){if(!e.isTouchDevice())return G.None;e.INSTANCE||(e.INSTANCE=Ho(new e));let i=e.INSTANCE.ignoreTargets.push(t);return le(i)}static isTouchDevice(){return"ontouchstart"in at||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=t.targetTouches.length;s<r;s++){let n=t.targetTouches.item(s);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:i,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[i],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(bt.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let s=Date.now(),r=Object.keys(this.activeTouches).length;for(let n=0,o=i.changedTouches.length;n<o;n++){let a=i.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let h=this.activeTouches[a.identifier],l=Date.now()-h.initialTimeStamp;if(l<e.HOLD_DELAY&&Math.abs(h.initialPageX-rt(h.rollingPageX))<30&&Math.abs(h.initialPageY-rt(h.rollingPageY))<30){let d=this.newGestureEvent(bt.Tap,h.initialTarget);d.pageX=rt(h.rollingPageX),d.pageY=rt(h.rollingPageY),this.dispatchEvent(d)}else if(l>=e.HOLD_DELAY&&Math.abs(h.initialPageX-rt(h.rollingPageX))<30&&Math.abs(h.initialPageY-rt(h.rollingPageY))<30){let d=this.newGestureEvent(bt.Contextmenu,h.initialTarget);d.pageX=rt(h.rollingPageX),d.pageY=rt(h.rollingPageY),this.dispatchEvent(d)}else if(r===1){let d=rt(h.rollingPageX),c=rt(h.rollingPageY),f=rt(h.rollingTimestamps)-h.rollingTimestamps[0],g=d-h.rollingPageX[0],v=c-h.rollingPageY[0],y=[...this.targets].filter((E)=>h.initialTarget instanceof Node&&E.contains(h.initialTarget));this.inertia(t,y,s,Math.abs(g)/f,g>0?1:-1,d,Math.abs(v)/f,v>0?1:-1,c)}this.dispatchEvent(this.newGestureEvent(bt.End,h.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let s=document.createEvent("CustomEvent");return s.initEvent(t,!1,!0),s.initialTarget=i,s.tapCount=0,s}dispatchEvent(t){if(t.type===bt.Tap){let i=new Date().getTime(),s=0;i-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=i,t.tapCount=s}else(t.type===bt.Change||t.type===bt.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(t.initialTarget))return;let i=[];for(let s of this.targets)if(s.contains(t.initialTarget)){let r=0,n=t.initialTarget;for(;n&&n!==s;)r++,n=n.parentElement;i.push([r,s])}i.sort((s,r)=>s[0]-r[0]);for(let[s,r]of i)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,s,r,n,o,a,h,l){this.handle=Ws(t,()=>{let d=Date.now(),c=d-s,f=0,g=0,v=!0;r+=e.SCROLL_FRICTION*c,a+=e.SCROLL_FRICTION*c,r>0&&(v=!1,f=n*r*c),a>0&&(v=!1,g=h*a*c);let y=this.newGestureEvent(bt.Change);y.translationX=f,y.translationY=g,i.forEach((E)=>E.dispatchEvent(y)),v||this.inertia(t,i,d,r,n,o+f,a,h,l+g)})}onTouchMove(t){let i=Date.now();for(let s=0,r=t.changedTouches.length;s<r;s++){let n=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],a=this.newGestureEvent(bt.Change,o.initialTarget);a.translationX=n.pageX-rt(o.rollingPageX),a.translationY=n.pageY-rt(o.rollingPageY),a.pageX=n.pageX,a.pageY=n.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Xi.SCROLL_FRICTION=-0.005,Xi.HOLD_DELAY=700,Xi.CLEAR_TAP_COUNT_TIME=400,ge([nu],Xi,"isTouchDevice",1);var ou=Xi,Ln=class extends G{onclick(e,t){this._register(U(e,Ee.CLICK,(i)=>t(new Yi(vt(e),i))))}onmousedown(e,t){this._register(U(e,Ee.MOUSE_DOWN,(i)=>t(new Yi(vt(e),i))))}onmouseover(e,t){this._register(U(e,Ee.MOUSE_OVER,(i)=>t(new Yi(vt(e),i))))}onmouseleave(e,t){this._register(U(e,Ee.MOUSE_LEAVE,(i)=>t(new Yi(vt(e),i))))}onkeydown(e,t){this._register(U(e,Ee.KEY_DOWN,(i)=>t(new Qr(i))))}onkeyup(e,t){this._register(U(e,Ee.KEY_UP,(i)=>t(new Qr(i))))}oninput(e,t){this._register(U(e,Ee.INPUT,t))}onblur(e,t){this._register(U(e,Ee.BLUR,t))}onfocus(e,t){this._register(U(e,Ee.FOCUS,t))}onchange(e,t){this._register(U(e,Ee.CHANGE,t))}ignoreGesture(e){return ou.ignoreTarget(e)}},ia=11,au=class extends Ln{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=ia+"px",this.domNode.style.height=ia+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new rh),this._register(ea(this.bgDomNode,Ee.POINTER_DOWN,(t)=>this._arrowPointerDown(t))),this._register(ea(this.domNode,Ee.POINTER_DOWN,(t)=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new eu),this._pointerdownScheduleRepeatTimer=this._register(new xn)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),41.666666666666664,vt(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,(i)=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},hu=class e{constructor(t,i,s,r,n,o,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,s=s|0,r=r|0,n=n|0,o=o|0,a=a|0),this.rawScrollLeft=r,this.rawScrollTop=a,i<0&&(i=0),r+i>s&&(r=s-i),r<0&&(r=0),n<0&&(n=0),a+n>o&&(a=o-n),a<0&&(a=0),this.width=i,this.scrollWidth=s,this.scrollLeft=r,this.height=n,this.scrollHeight=o,this.scrollTop=a}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,i){return new e(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,i){let s=this.width!==t.width,r=this.scrollWidth!==t.scrollWidth,n=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,h=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:h}}},lu=class extends G{constructor(e){super();this._scrollableBrand=void 0,this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new hu(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let s;t?s=new ra(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=ra.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},sa=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function Br(e,t){let i=t-e;return function(s){return e+i*uu(s)}}function cu(e,t,i){return function(s){return s<i?e(s/i):t((s-i)/(1-i))}}var ra=class e{constructor(t,i,s,r){this.from=t,this.to=i,this.duration=r,this.startTime=s,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,i,s){if(Math.abs(t-i)>2.5*s){let r,n;return t<i?(r=t+0.75*s,n=i-0.75*s):(r=t-0.75*s,n=i+0.75*s),cu(Br(t,r),Br(n,i),0.33)}return Br(t,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let i=(t-this.startTime)/this.duration;if(i<1){let s=this.scrollLeft(i),r=this.scrollTop(i);return new sa(s,r,!1)}return new sa(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,s){return e.start(t,i,s)}static start(t,i,s){s=s+10;let r=Date.now()-10;return new e(t,i,r,s)}};function du(e){return Math.pow(e,3)}function uu(e){return 1-du(1-e)}var _u=class extends G{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new xn)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},fu=140,nh=class extends Ln{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new _u(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new rh),this._shouldRender=!0,this.domNode=is(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register(U(this.domNode.domNode,Ee.POINTER_DOWN,(t)=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new au(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,s){this.slider=is(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof s=="number"&&this.slider.setHeight(s),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(U(this.slider.domNode,Ee.POINTER_DOWN,(r)=>{r.button===0&&(r.preventDefault(),this._sliderPointerDown(r))})),this.onclick(this.slider.domNode,(r)=>{r.leftButton&&r.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),s=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),r=this._sliderPointerPosition(e);i<=r&&r<=s?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let r=tu(this.domNode.domNode);t=e.pageX-r.left,i=e.pageY-r.top}let s=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(s):this._scrollbarState.getDesiredScrollPositionFromOffset(s)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),s=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,(r)=>{let n=this._sliderOrthogonalPointerPosition(r),o=Math.abs(n-i);if(Qa&&o>fu){this._setDesiredScrollPositionNow(s.getScrollPosition());return}let a=this._sliderPointerPosition(r)-t;this._setDesiredScrollPositionNow(s.getDesiredScrollPositionFromDelta(a))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},oh=class e{constructor(t,i,s,r,n,o){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(t),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,s,r,n){let o=Math.max(0,s-t),a=Math.max(0,o-2*i),h=r>0&&r>s;if(!h)return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let l=Math.round(Math.max(20,Math.floor(s*a/r))),d=(a-l)/(r-s),c=n*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:h,computedSliderSize:Math.round(l),computedSliderRatio:d,computedSliderPosition:Math.round(c)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,s=this._scrollPosition;return i<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},gu=class extends nh{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new oh(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,s.width,s.scrollWidth,r.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},pu=class extends nh{constructor(e,t,i){let s=e.getScrollDimensions(),r=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new oh(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,s.height,s.scrollHeight,r.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},vu=500,na=50,oa=!0,mu=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},en=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,i=0,s=1,r=this._rear;do{let n=r===this._front?t:Math.pow(2,-s);if(t-=n,i+=this._memory[r].score*n,r===this._front)break;r=(this._capacity+r-1)%this._capacity,s++}while(!0);return i<=0.5}acceptStandardWheelEvent(t){if(yn){let i=vt(t.browserEvent),s=dd(i);this.accept(Date.now(),t.deltaX*s,t.deltaY*s)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,s){let r=null,n=new mu(t,i,s);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,r)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let s=0.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(s+=0.25),i){let r=Math.abs(t.deltaX),n=Math.abs(t.deltaY),o=Math.abs(i.deltaX),a=Math.abs(i.deltaY),h=Math.max(Math.min(r,o),1),l=Math.max(Math.min(n,a),1),d=Math.max(r,o),c=Math.max(n,a);d%h===0&&c%l===0&&(s-=0.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<0.01}};en.INSTANCE=new en;var wu=en,Su=class extends Ln{constructor(e,t,i){super();this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new T),this.onWillScroll=this._onWillScroll.event,this._options=yu(t),this._scrollable=i,this._register(this._scrollable.onScroll((r)=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:(r)=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new pu(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new gu(this._scrollable,this._options,s)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=is(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=is(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=is(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,(r)=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,(r)=>this._onMouseLeave(r)),this._hideTimeout=this._register(new xn),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=pi(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,yt&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Yo(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=pi(this._mouseWheelToDispose),e)){let t=(i)=>{this._onMouseWheel(new Yo(i))};this._mouseWheelToDispose.push(U(this._listenOnDomNode,Ee.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=wu.INSTANCE;oa&&t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,n=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&n+r===0?n=r=0:Math.abs(r)>=Math.abs(n)?n=0:r=0),this._options.flipAxes&&([r,n]=[n,r]);let o=!yt&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||o)&&!n&&(n=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(n=n*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let a=this._scrollable.getFutureScrollPosition(),h={};if(r){let l=na*r,d=a.scrollTop-(l<0?Math.floor(l):Math.ceil(l));this._verticalScrollbar.writeScrollPosition(h,d)}if(n){let l=na*n,d=a.scrollLeft-(l<0?Math.floor(l):Math.ceil(l));this._horizontalScrollbar.writeScrollPosition(h,d)}h=this._scrollable.validateScrollPosition(h),(a.scrollLeft!==h.scrollLeft||a.scrollTop!==h.scrollTop)&&(oa&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(h):this._scrollable.setScrollPositionNow(h),i=!0)}let s=i;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,s=i?" left":"",r=t?" top":"",n=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),vu)}},bu=class extends Su{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function yu(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,yt&&(t.className+=" mac"),t}var tn=class extends G{constructor(e,t,i,s,r,n,o,a){super();this._bufferService=i,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new T),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let h=this._register(new lu({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:(l)=>Ws(s.window,l)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{h.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new bu(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},h)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(r.onProtocolChange((l)=>{this._scrollableElement.updateOptions({handleMouseWheel:!(l&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ie.runAndSubscribe(n.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=n.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(le(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=s.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(le(()=>this._styleElement.remove())),this._register(Ie.runAndSubscribe(n.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${n.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${n.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${n.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
31
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll((l)=>this._handleScroll(l)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};tn=ge([O(2,Ke),O(3,Ot),O(4,za),O(5,ki),O(6,qe),O(7,It)],tn);var sn=class extends G{constructor(e,t,i,s,r){super();this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=s,this._renderService=r,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((n)=>this._removeDecoration(n))),this._register(le(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};sn=ge([O(1,Ke),O(2,Ot),O(3,hs),O(4,It)],sn);var Cu=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(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},wt={full:0,left:0,center:0,right:0},Xt={full:0,left:0,center:0,right:0},Ui={full:0,left:0,center:0,right:0},zs=class extends G{constructor(e,t,i,s,r,n,o,a){super();this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=s,this._renderService=r,this._optionsService=n,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new Cu,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(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(le(()=>this._canvas?.remove()));let h=this._canvas.getContext("2d");if(h)this._ctx=h;else throw Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),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())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Xt.full=this._canvas.width,Xt.left=e,Xt.center=t,Xt.right=e,this._refreshDrawHeightConstants(),Ui.full=1,Ui.left=1,Ui.center=1+Xt.left,Ui.right=1+Xt.left+Xt.center}_refreshDrawHeightConstants(){wt.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);wt.left=t,wt.center=t,wt.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wt.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wt.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wt.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*wt.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(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Ui[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-wt[e.position||"full"]/2),Xt[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+wt[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};zs=ge([O(2,Ke),O(3,hs),O(4,It),O(5,qe),O(6,ki),O(7,Ot)],zs);var M;((e)=>(e.NUL="\x00",e.SOH="\x01",e.STX="\x02",e.ETX="\x03",e.EOT="\x04",e.ENQ="\x05",e.ACK="\x06",e.BEL="\x07",e.BS="\b",e.HT="\t",e.LF=`
|
|
32
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="\x0E",e.SI="\x0F",e.DLE="\x10",e.DC1="\x11",e.DC2="\x12",e.DC3="\x13",e.DC4="\x14",e.NAK="\x15",e.SYN="\x16",e.ETB="\x17",e.CAN="\x18",e.EM="\x19",e.SUB="\x1A",e.ESC="\x1B",e.FS="\x1C",e.GS="\x1D",e.RS="\x1E",e.US="\x1F",e.SP=" ",e.DEL=""))(M||={});var Ps;((e)=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(Ps||={});var ah;((e)=>e.ST=`${M.ESC}\\`)(ah||={});var rn=class{constructor(e,t,i,s,r,n){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=s,this._coreService=r,this._renderService=n,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${M.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,s=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+"px",this._compositionView.style.top=s+"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";let n=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+"px",this._textarea.style.top=s+"px",this._textarea.style.width=Math.max(n.width,1)+"px",this._textarea.style.height=Math.max(n.height,1)+"px",this._textarea.style.lineHeight=n.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};rn=ge([O(2,Ke),O(3,qe),O(4,mi),O(5,It)],rn);var Me=0,De=0,Re=0,fe=0,aa={css:"#00000000",rgba:0},Se;((e)=>{function t(r,n,o,a){return a!==void 0?`#${di(r)}${di(n)}${di(o)}${di(a)}`:`#${di(r)}${di(n)}${di(o)}`}e.toCss=t;function i(r,n,o,a=255){return(r<<24|n<<16|o<<8|a)>>>0}e.toRgba=i;function s(r,n,o,a){return{css:e.toCss(r,n,o,a),rgba:e.toRgba(r,n,o,a)}}e.toColor=s})(Se||={});var he;((e)=>{function t(h,l){if(fe=(l.rgba&255)/255,fe===1)return{css:l.css,rgba:l.rgba};let d=l.rgba>>24&255,c=l.rgba>>16&255,f=l.rgba>>8&255,g=h.rgba>>24&255,v=h.rgba>>16&255,y=h.rgba>>8&255;Me=g+Math.round((d-g)*fe),De=v+Math.round((c-v)*fe),Re=y+Math.round((f-y)*fe);let E=Se.toCss(Me,De,Re),R=Se.toRgba(Me,De,Re);return{css:E,rgba:R}}e.blend=t;function i(h){return(h.rgba&255)===255}e.isOpaque=i;function s(h,l,d){let c=Os.ensureContrastRatio(h.rgba,l.rgba,d);if(c)return Se.toColor(c>>24&255,c>>16&255,c>>8&255)}e.ensureContrastRatio=s;function r(h){let l=(h.rgba|255)>>>0;return[Me,De,Re]=Os.toChannels(l),{css:Se.toCss(Me,De,Re),rgba:l}}e.opaque=r;function n(h,l){return fe=Math.round(l*255),[Me,De,Re]=Os.toChannels(h.rgba),{css:Se.toCss(Me,De,Re,fe),rgba:Se.toRgba(Me,De,Re,fe)}}e.opacity=n;function o(h,l){return fe=h.rgba&255,n(h,fe*l/255)}e.multiplyOpacity=o;function a(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=a})(he||={});var _e;((e)=>{let t,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Me=parseInt(r.slice(1,2).repeat(2),16),De=parseInt(r.slice(2,3).repeat(2),16),Re=parseInt(r.slice(3,4).repeat(2),16),Se.toColor(Me,De,Re);case 5:return Me=parseInt(r.slice(1,2).repeat(2),16),De=parseInt(r.slice(2,3).repeat(2),16),Re=parseInt(r.slice(3,4).repeat(2),16),fe=parseInt(r.slice(4,5).repeat(2),16),Se.toColor(Me,De,Re,fe);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Me=parseInt(n[1]),De=parseInt(n[2]),Re=parseInt(n[3]),fe=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Se.toColor(Me,De,Re,fe);if(!t||!i)throw Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=r,typeof t.fillStyle!="string")throw Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Me,De,Re,fe]=t.getImageData(0,0,1,1).data,fe!==255)throw Error("css.toColor: Unsupported css format");return{rgba:Se.toRgba(Me,De,Re,fe),css:r}}e.toColor=s})(_e||={});var Ue;((e)=>{function t(s){return i(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function i(s,r,n){let o=s/255,a=r/255,h=n/255,l=o<=0.03928?o/12.92:Math.pow((o+0.055)/1.055,2.4),d=a<=0.03928?a/12.92:Math.pow((a+0.055)/1.055,2.4),c=h<=0.03928?h/12.92:Math.pow((h+0.055)/1.055,2.4);return l*0.2126+d*0.7152+c*0.0722}e.relativeLuminance2=i})(Ue||={});var Os;((e)=>{function t(o,a){if(fe=(a&255)/255,fe===1)return a;let h=a>>24&255,l=a>>16&255,d=a>>8&255,c=o>>24&255,f=o>>16&255,g=o>>8&255;return Me=c+Math.round((h-c)*fe),De=f+Math.round((l-f)*fe),Re=g+Math.round((d-g)*fe),Se.toRgba(Me,De,Re)}e.blend=t;function i(o,a,h){let l=Ue.relativeLuminance(o>>8),d=Ue.relativeLuminance(a>>8);if(At(l,d)<h){if(d<l){let g=s(o,a,h),v=At(l,Ue.relativeLuminance(g>>8));if(v<h){let y=r(o,a,h),E=At(l,Ue.relativeLuminance(y>>8));return v>E?g:y}return g}let c=r(o,a,h),f=At(l,Ue.relativeLuminance(c>>8));if(f<h){let g=s(o,a,h),v=At(l,Ue.relativeLuminance(g>>8));return f>v?c:g}return c}}e.ensureContrastRatio=i;function s(o,a,h){let l=o>>24&255,d=o>>16&255,c=o>>8&255,f=a>>24&255,g=a>>16&255,v=a>>8&255,y=At(Ue.relativeLuminance2(f,g,v),Ue.relativeLuminance2(l,d,c));for(;y<h&&(f>0||g>0||v>0);)f-=Math.max(0,Math.ceil(f*0.1)),g-=Math.max(0,Math.ceil(g*0.1)),v-=Math.max(0,Math.ceil(v*0.1)),y=At(Ue.relativeLuminance2(f,g,v),Ue.relativeLuminance2(l,d,c));return(f<<24|g<<16|v<<8|255)>>>0}e.reduceLuminance=s;function r(o,a,h){let l=o>>24&255,d=o>>16&255,c=o>>8&255,f=a>>24&255,g=a>>16&255,v=a>>8&255,y=At(Ue.relativeLuminance2(f,g,v),Ue.relativeLuminance2(l,d,c));for(;y<h&&(f<255||g<255||v<255);)f=Math.min(255,f+Math.ceil((255-f)*0.1)),g=Math.min(255,g+Math.ceil((255-g)*0.1)),v=Math.min(255,v+Math.ceil((255-v)*0.1)),y=At(Ue.relativeLuminance2(f,g,v),Ue.relativeLuminance2(l,d,c));return(f<<24|g<<16|v<<8|255)>>>0}e.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=n})(Os||={});function di(e){let t=e.toString(16);return t.length<2?"0"+t:t}function At(e,t){return e<t?(t+0.05)/(e+0.05):(e+0.05)/(t+0.05)}var xu=class extends as{constructor(e,t,i){super();this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Hs=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new _t}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let i=[],s=t.translateToString(!0),r=0,n=0,o=0,a=t.getFg(0),h=t.getBg(0);for(let l=0;l<t.getTrimmedLength();l++)if(t.loadCell(l,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==h){if(l-r>1){let d=this._getJoinedRanges(s,o,n,t,r);for(let c=0;c<d.length;c++)i.push(d[c])}r=l,o=n,a=this._workCell.fg,h=this._workCell.bg}n+=this._workCell.getChars().length||Qt.length}if(this._bufferService.cols-r>1){let l=this._getJoinedRanges(s,o,n,t,r);for(let d=0;d<l.length;d++)i.push(l[d])}return i}_getJoinedRanges(e,t,i,s,r){let n=e.substring(t,i),o=[];try{o=this._characterJoiners[0].handler(n)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let h=this._characterJoiners[a].handler(n);for(let l=0;l<h.length;l++)Hs._mergeRanges(o,h[l])}catch(h){console.error(h)}return this._stringRangesToCellRanges(o,s,r),o}_stringRangesToCellRanges(e,t,i){let s=0,r=!1,n=0,o=e[s];if(o){for(let a=i;a<this._bufferService.cols;a++){let h=t.getWidth(a),l=t.getString(a).length||Qt.length;if(h!==0){if(!r&&o[0]<=n&&(o[0]=a,r=!0),o[1]<=n){if(o[1]=a,o=e[++s],!o)break;o[0]<=n?(o[0]=a,r=!0):r=!1}n+=l}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let s=0;s<e.length;s++){let r=e[s];if(i){if(t[1]<=r[0])return e[s-1][1]=t[1],e;if(t[1]<=r[1])return e[s-1][1]=Math.max(t[1],r[1]),e.splice(s,1),e;e.splice(s,1),s--}else{if(t[1]<=r[0])return e.splice(s,0,t),e;if(t[1]<=r[1])return r[0]=Math.min(t[0],r[0]),e;t[0]<r[1]&&(r[0]=Math.min(t[0],r[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};Hs=ge([O(0,Ke)],Hs);function ku(e){return 57508<=e&&e<=57558}function Lu(e){return 9472<=e&&e<=9631}function Eu(e){return ku(e)||Lu(e)}function Mu(){return{css:{canvas:xs(),cell:xs()},device:{canvas:xs(),cell:xs(),char:{width:0,height:0,left:0,top:0}}}}function xs(){return{width:0,height:0}}var nn=class{constructor(e,t,i,s,r,n,o){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._themeService=o,this._workCell=new _t,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,s,r,n,o,a,h,l,d){let c=[],f=this._characterJoinerService.getJoinedCharacters(t),g=this._themeService.colors,v=e.getNoBgTrimmedLength();i&&v<n+1&&(v=n+1);let y,E=0,R="",P=0,A=0,b=0,x=0,L=!1,N=0,q=!1,Y=0,oe=0,F=[],Le=l!==-1&&d!==-1;for(let u=0;u<v;u++){e.loadCell(u,this._workCell);let _=this._workCell.getWidth();if(_===0)continue;let w=!1,p=u>=oe,S=u,m=this._workCell;if(f.length>0&&u===f[0][0]&&p){let J=f.shift(),D=this._isCellInSelection(J[0],t);for(P=J[0]+1;P<J[1];P++)p&&=D===this._isCellInSelection(P,t);p&&=!i||n<J[0]||n>=J[1],p?(w=!0,m=new xu(this._workCell,e.translateToString(!0,J[0],J[1]),J[1]-J[0]),S=J[1]-1,_=m.getWidth()):oe=J[1]}let C=this._isCellInSelection(u,t),k=i&&u===n,B=Le&&u>=l&&u<=d,H=!1;this._decorationService.forEachDecorationAtCell(u,t,void 0,(J)=>{H=!0});let z=m.getChars()||Qt;if(z===" "&&(m.isUnderline()||m.isOverline())&&(z=" "),Y=_*a-h.get(z,m.isBold(),m.isItalic()),!y)y=this._document.createElement("span");else if(E&&(C&&q||!C&&!q&&m.bg===A)&&(C&&q&&g.selectionForeground||m.fg===b)&&m.extended.ext===x&&B===L&&Y===N&&!k&&!w&&!H&&p){m.isInvisible()?R+=Qt:R+=z,E++;continue}else E&&(y.textContent=R),y=this._document.createElement("span"),E=0,R="";if(A=m.bg,b=m.fg,x=m.extended.ext,L=B,N=Y,q=C,w&&n>=u&&n<=S&&(n=u),!this._coreService.isCursorHidden&&k&&this._coreService.isCursorInitialized){if(F.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&F.push("xterm-cursor-blink"),F.push(s==="bar"?"xterm-cursor-bar":s==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(r)switch(r){case"outline":F.push("xterm-cursor-outline");break;case"block":F.push("xterm-cursor-block");break;case"bar":F.push("xterm-cursor-bar");break;case"underline":F.push("xterm-cursor-underline");break;default:break}}if(m.isBold()&&F.push("xterm-bold"),m.isItalic()&&F.push("xterm-italic"),m.isDim()&&F.push("xterm-dim"),m.isInvisible()?R=Qt:R=m.getChars()||Qt,m.isUnderline()&&(F.push(`xterm-underline-${m.extended.underlineStyle}`),R===" "&&(R=" "),!m.isUnderlineColorDefault()))if(m.isUnderlineColorRGB())y.style.textDecorationColor=`rgb(${as.toColorRGB(m.getUnderlineColor()).join(",")})`;else{let J=m.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&m.isBold()&&J<8&&(J+=8),y.style.textDecorationColor=g.ansi[J].css}m.isOverline()&&(F.push("xterm-overline"),R===" "&&(R=" ")),m.isStrikethrough()&&F.push("xterm-strikethrough"),B&&(y.style.textDecoration="underline");let K=m.getFgColor(),se=m.getFgColorMode(),V=m.getBgColor(),Q=m.getBgColorMode(),Z=!!m.isInverse();if(Z){let J=K;K=V,V=J;let D=se;se=Q,Q=D}let re,Ze,Je=!1;this._decorationService.forEachDecorationAtCell(u,t,void 0,(J)=>{J.options.layer!=="top"&&Je||(J.backgroundColorRGB&&(Q=50331648,V=J.backgroundColorRGB.rgba>>8&16777215,re=J.backgroundColorRGB),J.foregroundColorRGB&&(se=50331648,K=J.foregroundColorRGB.rgba>>8&16777215,Ze=J.foregroundColorRGB),Je=J.options.layer==="top")}),!Je&&C&&(re=this._coreBrowserService.isFocused?g.selectionBackgroundOpaque:g.selectionInactiveBackgroundOpaque,V=re.rgba>>8&16777215,Q=50331648,Je=!0,g.selectionForeground&&(se=50331648,K=g.selectionForeground.rgba>>8&16777215,Ze=g.selectionForeground)),Je&&F.push("xterm-decoration-top");let ze;switch(Q){case 16777216:case 33554432:ze=g.ansi[V],F.push(`xterm-bg-${V}`);break;case 50331648:ze=Se.toColor(V>>16,V>>8&255,V&255),this._addStyle(y,`background-color:#${ha((V>>>0).toString(16),"0",6)}`);break;case 0:default:Z?(ze=g.foreground,F.push("xterm-bg-257")):ze=g.background}switch(re||m.isDim()&&(re=he.multiplyOpacity(ze,0.5)),se){case 16777216:case 33554432:m.isBold()&&K<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(K+=8),this._applyMinimumContrast(y,ze,g.ansi[K],m,re,void 0)||F.push(`xterm-fg-${K}`);break;case 50331648:let J=Se.toColor(K>>16&255,K>>8&255,K&255);this._applyMinimumContrast(y,ze,J,m,re,Ze)||this._addStyle(y,`color:#${ha(K.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(y,ze,g.foreground,m,re,Ze)||Z&&F.push("xterm-fg-257")}F.length&&(y.className=F.join(" "),F.length=0),!k&&!w&&!H&&p?E++:y.textContent=R,Y!==this.defaultSpacing&&(y.style.letterSpacing=`${Y}px`),c.push(y),u=S}return y&&E&&(y.textContent=R),c}_applyMinimumContrast(e,t,i,s,r,n){if(this._optionsService.rawOptions.minimumContrastRatio===1||Eu(s.getCode()))return!1;let o=this._getContrastCache(s),a;if(!r&&!n&&(a=o.getColor(t.rgba,i.rgba)),a===void 0){let h=this._optionsService.rawOptions.minimumContrastRatio/(s.isDim()?2:1);a=he.ensureContrastRatio(r||t,n||i,h),o.setColor((r||t).rgba,(n||i).rgba,a??null)}return a?(this._addStyle(e,`color:${a.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let i=this._selectionStart,s=this._selectionEnd;return!i||!s?!1:this._columnSelectMode?i[0]<=s[0]?e>=i[0]&&t>=i[1]&&e<s[0]&&t<=s[1]:e<i[0]&&t>=i[1]&&e>=s[0]&&t<=s[1]:t>i[1]&&t<s[1]||i[1]===s[1]&&t===i[1]&&e>=i[0]&&e<s[0]||i[1]<s[1]&&t===s[1]&&e<s[0]||i[1]<s[1]&&t===i[1]&&e>=i[0]}};nn=ge([O(1,Ua),O(2,qe),O(3,Ot),O(4,mi),O(5,hs),O(6,ki)],nn);function ha(e,t,i){for(;e.length<i;)e=t+e;return e}var Du=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.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";let i=e.createElement("span");i.classList.add("xterm-char-measure-element");let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold";let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontStyle="italic";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontWeight="bold",n.style.fontStyle="italic",this._measureElements=[i,s,r,n],this._container.appendChild(i),this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(n),t.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(e,t,i,s){e===this._font&&t===this._fontSize&&i===this._weight&&s===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=s,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${s}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${s}`,this.clear())}get(e,t,i){let s=0;if(!t&&!i&&e.length===1&&(s=e.charCodeAt(0))<256){if(this._flat[s]!==-9999)return this._flat[s];let o=this._measure(e,0);return o>0&&(this._flat[s]=o),o}let r=e;t&&(r+="B"),i&&(r+="I");let n=this._holey.get(r);if(n===void 0){let o=0;t&&(o|=1),i&&(o|=2),n=this._measure(e,o),n>0&&this._holey.set(r,n)}return n}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},Ru=class{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(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let r=e.buffers.active.ydisp,n=t[1]-r,o=i[1]-r,a=Math.max(n,0),h=Math.min(o,e.rows-1);if(a>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function Au(){return new Ru}var Pr="xterm-dom-renderer-owner-",dt="xterm-rows",ks="xterm-fg-",la="xterm-bg-",Ki="xterm-focus",Ls="xterm-selection",Tu=1,on=class extends G{constructor(e,t,i,s,r,n,o,a,h,l,d,c,f,g){super();this._terminal=e,this._document=t,this._element=i,this._screenElement=s,this._viewportElement=r,this._helperContainer=n,this._linkifier2=o,this._charSizeService=h,this._optionsService=l,this._bufferService=d,this._coreService=c,this._coreBrowserService=f,this._themeService=g,this._terminalClass=Tu++,this._rowElements=[],this._selectionRenderModel=Au(),this.onRequestRedraw=this._register(new T).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(dt),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(Ls),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Mu(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors((v)=>this._injectCss(v))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(nn,document),this._element.classList.add(Pr+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline((v)=>this._handleLinkHover(v))),this._register(this._linkifier2.onHideLinkUnderline((v)=>this._handleLinkLeave(v))),this._register(le(()=>{this._element.classList.remove(Pr+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Du(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(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),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/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),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(let i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${dt} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,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(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${dt} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${dt} .xterm-dim { color: ${he.multiplyOpacity(e.foreground,0.5).css};}`,t+=`${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;}`;let i=`blink_underline_${this._terminalClass}`,s=`blink_bar_${this._terminalClass}`,r=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${s} { 50% { box-shadow: none; }}`,t+=`@keyframes ${r} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${dt}.${Ki} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${dt}.${Ki} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${dt}.${Ki} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${dt} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${dt} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${dt} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${dt} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${dt} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Ls} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ls} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ls} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,o]of e.ansi.entries())t+=`${this._terminalSelector} .${ks}${n} { color: ${o.css}; }${this._terminalSelector} .${ks}${n}.xterm-dim { color: ${he.multiplyOpacity(o,0.5).css}; }${this._terminalSelector} .${la}${n} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${ks}257 { color: ${he.opaque(e.background).css}; }${this._terminalSelector} .${ks}257.xterm-dim { color: ${he.multiplyOpacity(he.opaque(e.background),0.5).css}; }${this._terminalSelector} .${la}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let i=this._rowElements.length;i<=t;i++){let s=this._document.createElement("div");this._rowContainer.appendChild(s),this._rowElements.push(s)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),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(Ki),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ki),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let s=this._selectionRenderModel.viewportStartRow,r=this._selectionRenderModel.viewportEndRow,n=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(i){let h=e[0]>t[0];a.appendChild(this._createSelectionElement(n,h?t[0]:e[0],h?e[0]:t[0],o-n+1))}else{let h=s===n?e[0]:0,l=n===r?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(n,h,l));let d=o-n-1;if(a.appendChild(this._createSelectionElement(n+1,0,this._bufferService.cols,d)),n!==o){let c=r===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,c))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,i,s=1){let r=this._document.createElement("div"),n=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(i-t);return n+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-n),r.style.height=`${s*this.dimensions.css.cell.height}px`,r.style.top=`${e*this.dimensions.css.cell.height}px`,r.style.left=`${n}px`,r.style.width=`${o}px`,r}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(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let i=this._bufferService.buffer,s=i.ybase+i.y,r=Math.min(i.x,this._bufferService.cols-1),n=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=e;h<=t;h++){let l=h+i.ydisp,d=this._rowElements[h],c=i.lines.get(l);if(!d||!c)break;d.replaceChildren(...this._rowFactory.createRow(c,l,l===s,o,a,r,n,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Pr}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,s,r,n){i<0&&(e=0),s<0&&(t=0);let o=this._bufferService.rows-1;i=Math.max(Math.min(i,o),0),s=Math.max(Math.min(s,o),0),r=Math.min(r,this._bufferService.cols);let a=this._bufferService.buffer,h=a.ybase+a.y,l=Math.min(a.x,r-1),d=this._optionsService.rawOptions.cursorBlink,c=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let g=i;g<=s;++g){let v=g+a.ydisp,y=this._rowElements[g],E=a.lines.get(v);if(!y||!E)break;y.replaceChildren(...this._rowFactory.createRow(E,v,v===h,c,f,l,d,this.dimensions.css.cell.width,this._widthCache,n?g===i?e:0:-1,n?(g===s?t:r)-1:-1))}}};on=ge([O(7,wn),O(8,Vs),O(9,qe),O(10,Ke),O(11,mi),O(12,Ot),O(13,ki)],on);var an=class extends G{constructor(e,t,i){super();this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new T),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Pu(this._optionsService))}catch{this._measureStrategy=this._register(new Bu(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};an=ge([O(2,qe)],an);var hh=class extends G{constructor(){super(...arguments);this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},Bu=class extends hh{constructor(e,t,i){super();this._document=e,this._parentElement=t,this._optionsService=i,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}},Pu=class extends hh{constructor(e){super();this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!(("width"in t)&&("fontBoundingBoxAscent"in t)&&("fontBoundingBoxDescent"in t)))throw Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Ou=class extends G{constructor(e,t,i){super();this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Iu(this._window)),this._onDprChange=this._register(new T),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new T),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange((s)=>this._screenDprMonitor.setWindow(s))),this._register(Ie.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(U(this._textarea,"focus",()=>this._isFocused=!0)),this._register(U(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,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}},Iu=class extends G{constructor(e){super();this._parentWindow=e,this._windowResizeListener=this._register(new xi),this._onDprChange=this._register(new T),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(le(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=U(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.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)}},Nu=class extends G{constructor(){super();this.linkProviders=[],this._register(le(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function En(e,t,i){let s=i.getBoundingClientRect(),r=e.getComputedStyle(i),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[t.clientX-s.left-n,t.clientY-s.top-o]}function Fu(e,t,i,s,r,n,o,a,h){if(!n)return;let l=En(e,t,i);if(l)return l[0]=Math.ceil((l[0]+(h?o/2:0))/o),l[1]=Math.ceil(l[1]/a),l[0]=Math.min(Math.max(l[0],1),s+(h?1:0)),l[1]=Math.min(Math.max(l[1],1),r),l}var hn=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,s,r){return Fu(window,e,t,i,s,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,r)}getMouseReportCoords(e,t){let i=En(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};hn=ge([O(0,It),O(1,Vs)],hn);var Wu=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!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){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},lh={};yc(lh,{getSafariVersion:()=>Hu,isChromeOS:()=>_h,isFirefox:()=>ch,isIpad:()=>$u,isIphone:()=>Uu,isLegacyEdge:()=>zu,isLinux:()=>Mn,isMac:()=>$s,isNode:()=>Ys,isSafari:()=>dh,isWindows:()=>uh});var Ys=typeof process<"u"&&"title"in process,ls=Ys?"node":navigator.userAgent,cs=Ys?"node":navigator.platform,ch=ls.includes("Firefox"),zu=ls.includes("Edge"),dh=/^((?!chrome|android).)*safari/i.test(ls);function Hu(){if(!dh)return 0;let e=ls.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var $s=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(cs),$u=cs==="iPad",Uu=cs==="iPhone",uh=["Windows","Win16","Win32","WinCE"].includes(cs),Mn=cs.indexOf("Linux")>=0,_h=/\bCrOS\b/.test(ls),fh=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),r=e.timeRemaining(),i*1.5>r){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=r}this.clear()}},Ku=class extends fh{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},qu=class extends fh{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Us=!Ys&&"requestIdleCallback"in window?qu:Ku,Vu=class{constructor(){this._queue=new Us}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},ln=class extends G{constructor(e,t,i,s,r,n,o,a,h){super();this._rowCount=e,this._optionsService=i,this._charSizeService=s,this._coreService=r,this._coreBrowserService=a,this._renderer=this._register(new xi),this._pausedResizeTask=new Vu,this._observerDisposable=this._register(new xi),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 T),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new T),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new T),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new T),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Wu((l,d)=>this._renderRows(l,d),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Gu(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(le(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(n.onDecorationRegistered(()=>this._fullRefresh())),this._register(n.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(h.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange((l)=>this._registerIntersectionObserver(l,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver((s)=>this._handleIntersectionChange(s[s.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=le(()=>i.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,t,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let s=this._syncOutputHandler.flush();s&&(e=Math.min(e,s.start),t=Math.max(t,s.end)),i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),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:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,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((t)=>this.refreshRows(t.start,t.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(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.value?.handleSelectionChanged(e,t,i)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};ln=ge([O(2,qe),O(3,Vs),O(4,mi),O(5,hs),O(6,Ke),O(7,Ot),O(8,ki)],ln);var Gu=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1000))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function ju(e,t,i,s){let r=i.buffer.x,n=i.buffer.y;if(!i.buffer.hasScrollback)return Zu(r,n,e,t,i,s)+Xs(n,t,i,s)+Ju(r,n,e,t,i,s);let o;if(n===t)return o=r>e?"D":"C",ns(Math.abs(r-e),rs(o,s));o=n>t?"D":"C";let a=Math.abs(n-t),h=Xu(n>t?e:r,i)+(a-1)*i.cols+1+Yu(n>t?r:e,i);return ns(h,rs(o,s))}function Yu(e,t){return e-1}function Xu(e,t){return t.cols-e}function Zu(e,t,i,s,r,n){return Xs(t,s,r,n).length===0?"":ns(ph(e,t,e,t-vi(t,r),!1,r).length,rs("D",n))}function Xs(e,t,i,s){let r=e-vi(e,i),n=t-vi(t,i),o=Math.abs(r-n)-Qu(e,t,i);return ns(o,rs(gh(e,t),s))}function Ju(e,t,i,s,r,n){let o;Xs(t,s,r,n).length>0?o=s-vi(s,r):o=t;let a=s,h=e_(e,t,i,s,r,n);return ns(ph(e,o,i,a,h==="C",r).length,rs(h,n))}function Qu(e,t,i){let s=0,r=e-vi(e,i),n=t-vi(t,i);for(let o=0;o<Math.abs(r-n);o++){let a=gh(e,t)==="A"?-1:1;i.buffer.lines.get(r+a*o)?.isWrapped&&s++}return s}function vi(e,t){let i=0,s=t.buffer.lines.get(e),r=s?.isWrapped;for(;r&&e>=0&&e<t.rows;)i++,s=t.buffer.lines.get(--e),r=s?.isWrapped;return i}function e_(e,t,i,s,r,n){let o;return Xs(i,s,r,n).length>0?o=s-vi(s,r):o=t,e<i&&o<=s||e>=i&&o<s?"C":"D"}function gh(e,t){return e>t?"A":"B"}function ph(e,t,i,s,r,n){let o=e,a=t,h="";for(;(o!==i||a!==s)&&a>=0&&a<n.buffer.lines.length;)o+=r?1:-1,r&&o>n.cols-1?(h+=n.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!r&&o<0&&(h+=n.buffer.translateBufferLineToString(a,!1,0,e+1),o=n.cols-1,e=o,a--);return h+n.buffer.translateBufferLineToString(a,!1,e,o)}function rs(e,t){let i=t?"O":"[";return M.ESC+i+e}function ns(e,t){e=Math.floor(e);let i="";for(let s=0;s<e;s++)i+=t;return i}var t_=class{constructor(e){this._bufferService=e,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.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()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function ca(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Or=50,i_=15,s_=50,r_=500,n_=" ",o_=new RegExp(n_,"g"),cn=class extends G{constructor(e,t,i,s,r,n,o,a,h){super();this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=s,this._coreService=r,this._mouseService=n,this._optionsService=o,this._renderService=a,this._coreBrowserService=h,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new _t,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new T),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new T),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new T),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new T),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=(l)=>this._handleMouseMove(l),this._mouseUpListener=(l)=>this._handleMouseUp(l),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim((l)=>this._handleTrim(l)),this._register(this._bufferService.buffers.onBufferActivate((l)=>this._handleBufferActivate(l))),this.enable(),this._model=new t_(this._bufferService),this._activeSelectionMode=0,this._register(le(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize((l)=>{l.rowsChanged&&this.clearSelection()}))}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(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,s=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let r=e[0]<t[0]?e[0]:t[0],n=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let a=i.translateBufferLineToString(o,!0,r,n);s.push(a)}}else{let r=e[1]===t[1]?t[0]:void 0;s.push(i.translateBufferLineToString(e[1],!0,e[0],r));for(let n=e[1]+1;n<=t[1]-1;n++){let o=i.lines.get(n),a=i.translateBufferLineToString(n,!0);o?.isWrapped?s[s.length-1]+=a:s.push(a)}if(e[1]!==t[1]){let n=i.lines.get(t[1]),o=i.translateBufferLineToString(t[1],!0,0,t[0]);n&&n.isWrapped?s[s.length-1]+=o:s.push(o)}}return s.map((r)=>r.replace(o_," ")).join(uh?`\r
|
|
33
33
|
`:`
|
|
34
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Cn&&e&&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(e){let t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s||!t?!1:this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s?!1:this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let i=this._linkifier.currentLink?.link?.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=na(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=yn(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-Rr),Rr),t/=Rr,t/Math.abs(t)+Math.round(t*(Ju-1)))}shouldForceSelection(e){return Fs?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),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(),Qu)}_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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Fs&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}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(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let s=i.lines.get(this._model.selectionEnd[1]);s&&s.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[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});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<e_&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let s=Ku(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((t)=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){let r=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;let o=r.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(n,e[0]),l=a,h=e[0]-a,d=0,c=0,f=0,p=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;l<o.length&&o.charAt(l+1)===" ";)l++}else{let E=e[0],B=e[0];n.getWidth(E)===0&&(d++,E--),n.getWidth(B)===2&&(c++,B++);let P=n.getString(B).length;for(P>1&&(p+=P-1,l+=P-1);E>0&&a>0&&!this._isCharWordSeparator(n.loadCell(E-1,this._workCell));){n.loadCell(E-1,this._workCell);let R=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,E--):R>1&&(f+=R-1,a-=R-1),a--,E--}for(;B<n.length&&l+1<o.length&&!this._isCharWordSeparator(n.loadCell(B+1,this._workCell));){n.loadCell(B+1,this._workCell);let R=this._workCell.getChars().length;this._workCell.getWidth()===2?(c++,B++):R>1&&(p+=R-1,l+=R-1),l++,B++}}l++;let w=a+h-d+f,y=Math.min(this._bufferService.cols,l-a+d+c-f-p);if(!(!t&&o.slice(a,l).trim()==="")){if(i&&w===0&&n.getCodePoint(0)!==32){let E=r.lines.get(e[1]-1);if(E&&n.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let B=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(B){let P=this._bufferService.cols-B.start;w-=P,y+=P}}}if(s&&w+y===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let E=r.lines.get(e[1]+1);if(E?.isWrapped&&E.getCodePoint(0)!==32){let B=this._getWordAt([0,e[1]+1],!1,!1,!0);B&&(y+=B.length)}}return{start:w,length:y}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=na(i,this._bufferService.cols)}};nn=_e([I(3,$e),I(4,ui),I(5,gn),I(6,Ue),I(7,At),I(8,Rt)],nn);var oa=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},aa=class{constructor(){this._color=new oa,this._css=new oa}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ye=Object.freeze((()=>{let e=[ce.toColor("#2e3436"),ce.toColor("#cc0000"),ce.toColor("#4e9a06"),ce.toColor("#c4a000"),ce.toColor("#3465a4"),ce.toColor("#75507b"),ce.toColor("#06989a"),ce.toColor("#d3d7cf"),ce.toColor("#555753"),ce.toColor("#ef2929"),ce.toColor("#8ae234"),ce.toColor("#fce94f"),ce.toColor("#729fcf"),ce.toColor("#ad7fa8"),ce.toColor("#34e2e2"),ce.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let s=t[i/36%6|0],r=t[i/6%6|0],n=t[i%6];e.push({css:we.toCss(s,r,n),rgba:we.toRgba(s,r,n)})}for(let i=0;i<24;i++){let s=8+i*10;e.push({css:we.toCss(s,s,s),rgba:we.toRgba(s,s,s)})}return e})()),oi=ce.toColor("#ffffff"),ji=ce.toColor("#000000"),ha=ce.toColor("#ffffff"),la=ji,Hi={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},s_=oi,on=class extends Y{constructor(e){super();this._optionsService=e,this._contrastCache=new aa,this._halfContrastCache=new aa,this._onChangeColors=this._register(new T),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:oi,background:ji,cursor:ha,cursorAccent:la,selectionForeground:void 0,selectionBackgroundTransparent:Hi,selectionBackgroundOpaque:ne.blend(ji,Hi),selectionInactiveBackgroundTransparent:Hi,selectionInactiveBackgroundOpaque:ne.blend(ji,Hi),scrollbarSliderBackground:ne.opacity(oi,0.2),scrollbarSliderHoverBackground:ne.opacity(oi,0.4),scrollbarSliderActiveBackground:ne.opacity(oi,0.5),overviewRulerBorder:oi,ansi:ye.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)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=ie(e.foreground,oi),t.background=ie(e.background,ji),t.cursor=ne.blend(t.background,ie(e.cursor,ha)),t.cursorAccent=ne.blend(t.background,ie(e.cursorAccent,la)),t.selectionBackgroundTransparent=ie(e.selectionBackground,Hi),t.selectionBackgroundOpaque=ne.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ie(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=ne.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ie(e.selectionForeground,ia):void 0,t.selectionForeground===ia&&(t.selectionForeground=void 0),ne.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=ne.opacity(t.selectionBackgroundTransparent,0.3)),ne.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=ne.opacity(t.selectionInactiveBackgroundTransparent,0.3)),t.scrollbarSliderBackground=ie(e.scrollbarSliderBackground,ne.opacity(t.foreground,0.2)),t.scrollbarSliderHoverBackground=ie(e.scrollbarSliderHoverBackground,ne.opacity(t.foreground,0.4)),t.scrollbarSliderActiveBackground=ie(e.scrollbarSliderActiveBackground,ne.opacity(t.foreground,0.5)),t.overviewRulerBorder=ie(e.overviewRulerBorder,s_),t.ansi=ye.slice(),t.ansi[0]=ie(e.black,ye[0]),t.ansi[1]=ie(e.red,ye[1]),t.ansi[2]=ie(e.green,ye[2]),t.ansi[3]=ie(e.yellow,ye[3]),t.ansi[4]=ie(e.blue,ye[4]),t.ansi[5]=ie(e.magenta,ye[5]),t.ansi[6]=ie(e.cyan,ye[6]),t.ansi[7]=ie(e.white,ye[7]),t.ansi[8]=ie(e.brightBlack,ye[8]),t.ansi[9]=ie(e.brightRed,ye[9]),t.ansi[10]=ie(e.brightGreen,ye[10]),t.ansi[11]=ie(e.brightYellow,ye[11]),t.ansi[12]=ie(e.brightBlue,ye[12]),t.ansi[13]=ie(e.brightMagenta,ye[13]),t.ansi[14]=ie(e.brightCyan,ye[14]),t.ansi[15]=ie(e.brightWhite,ye[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<i;s++)t.ansi[s+16]=ie(e.extendedAnsi[s],ye[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){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[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(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()}}};on=_e([I(0,Ue)],on);function ie(e,t){if(e!==void 0)try{return ce.toColor(e)}catch{}return t}var r_=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},n_=class{constructor(){this._services=new r_,this._services.set(fn,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=kc(e).sort((n,o)=>n.index-o.index),s=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${n.id._id}.`);s.push(o)}let r=i.length>0?i[0].index:t.length;if(t.length!==r)throw Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},o_={trace:0,debug:1,info:2,warn:3,error:4,off:5},a_="xterm.js: ",an=class extends Y{constructor(e){super();this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),h_=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=o_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":a_)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};an=_e([I(0,Ue)],an);var h_,ca=class extends Y{constructor(e){super();this._maxLength=e,this.onDeleteEmitter=this._register(new T),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new T),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new T),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw 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(e,t,...i){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+i.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<i.length;s++)this._array[this._getCyclicIndex(e+s)]=i[s];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let s=this._length+i.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw Error("start argument out of range");if(e+i<0)throw Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));let s=e+t+i-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+i,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}};var X=3,me=Object.freeze(new ss),Cs=0,Ar=2,Gi=class e{constructor(t,i,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*X);let r=i||lt.fromCharData([0,Pa,1,0]);for(let n=0;n<t;++n)this.setCell(n,r);this.length=t}get(t){let i=this._data[t*X+0],s=i&2097151;return[this._data[t*X+1],i&2097152?this._combined[t]:s?jt(s):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,i){this._data[t*X+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*X+0]=t|2097152|i[2]<<22):this._data[t*X+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*X+0]>>22}hasWidth(t){return this._data[t*X+0]&12582912}getFg(t){return this._data[t*X+1]}getBg(t){return this._data[t*X+2]}hasContent(t){return this._data[t*X+0]&4194303}getCodePoint(t){let i=this._data[t*X+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*X+0]&2097152}getString(t){let i=this._data[t*X+0];return i&2097152?this._combined[t]:i&2097151?jt(i&2097151):""}isProtected(t){return this._data[t*X+2]&536870912}loadCell(t,i){return Cs=t*X,i.content=this._data[Cs+0],i.fg=this._data[Cs+1],i.bg=this._data[Cs+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*X+0]=i.content,this._data[t*X+1]=i.fg,this._data[t*X+2]=i.bg}setCellFromCodepoint(t,i,s,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*X+0]=i|s<<22,this._data[t*X+1]=r.fg,this._data[t*X+2]=r.bg}addCodepointToCell(t,i,s){let r=this._data[t*X+0];r&2097152?this._combined[t]+=jt(i):r&2097151?(this._combined[t]=jt(r&2097151)+jt(i),r&=-2097152,r|=2097152):r=i|4194304,s&&(r&=-12582913,r|=s<<22),this._data[t*X+0]=r}insertCells(t,i,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length-t){let r=new lt;for(let n=this.length-t-i-1;n>=0;--n)this.setCell(t+i+n,this.loadCell(t+n,r));for(let n=0;n<i;++n)this.setCell(t+n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,i,s){if(t%=this.length,i<this.length-t){let r=new lt;for(let n=0;n<this.length-t-i;++n)this.setCell(t+n,this.loadCell(t+i+n,r));for(let n=this.length-i;n<this.length;++n)this.setCell(n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,i,s,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.setCell(t++,s)}resize(t,i){if(t===this.length)return this._data.length*4*Ar<this._data.buffer.byteLength;let s=t*X;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let o=0;o<r.length;o++){let a=parseInt(r[o],10);a>=t&&delete this._combined[a]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let a=parseInt(n[o],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,s*4*Ar<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Ar<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*X+0]&4194303)return t+(this._data[t*X+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*X+0]&4194303||this._data[t*X+2]&50331648)return t+(this._data[t*X+0]>>22);return 0}copyCellsFrom(t,i,s,r,n){let o=t._data;if(n)for(let l=r-1;l>=0;l--){for(let h=0;h<X;h++)this._data[(s+l)*X+h]=o[(i+l)*X+h];o[(i+l)*X+2]&268435456&&(this._extendedAttrs[s+l]=t._extendedAttrs[i+l])}else for(let l=0;l<r;l++){for(let h=0;h<X;h++)this._data[(s+l)*X+h]=o[(i+l)*X+h];o[(i+l)*X+2]&268435456&&(this._extendedAttrs[s+l]=t._extendedAttrs[i+l])}let a=Object.keys(t._combined);for(let l=0;l<a.length;l++){let h=parseInt(a[l],10);h>=i&&(this._combined[h-i+s]=t._combined[h])}}translateToString(t,i,s,r){i=i??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;i<s;){let o=this._data[i*X+0],a=o&2097151,l=o&2097152?this._combined[i]:a?jt(a):Gt;if(n+=l,r)for(let h=0;h<l.length;++h)r.push(i);i+=o>>22||1}return r&&r.push(i),n}};function l_(e,t,i,s,r,n){let o=[];for(let a=0;a<e.length-1;a++){let l=a,h=e.get(++l);if(!h.isWrapped)continue;let d=[e.get(a)];for(;l<e.length&&h.isWrapped;)d.push(h),h=e.get(++l);if(!n&&s>=a&&s<l){a+=d.length-1;continue}let c=0,f=is(d,c,t),p=1,w=0;for(;p<d.length;){let E=is(d,p,t),B=E-w,P=i-f,R=Math.min(B,P);d[c].copyCellsFrom(d[p],w,f,R,!1),f+=R,f===i&&(c++,f=0),w+=R,w===E&&(p++,w=0),f===0&&c!==0&&d[c-1].getWidth(i-1)===2&&(d[c].copyCellsFrom(d[c-1],i-1,f++,1,!1),d[c-1].setCell(i-1,r))}d[c].replaceCells(f,i,r);let y=0;for(let E=d.length-1;E>0&&(E>c||d[E].getTrimmedLength()===0);E--)y++;y>0&&(o.push(a+d.length-y),o.push(y)),a+=d.length-1}return o}function c_(e,t){let i=[],s=0,r=t[s],n=0;for(let o=0;o<e.length;o++)if(r===o){let a=t[++s];e.onDeleteEmitter.fire({index:o-n,amount:a}),o+=a-1,n+=a,r=t[++s]}else i.push(o);return{layout:i,countRemoved:n}}function d_(e,t){let i=[];for(let s=0;s<t.length;s++)i.push(e.get(t[s]));for(let s=0;s<i.length;s++)e.set(s,i[s]);e.length=t.length}function u_(e,t,i){let s=[],r=e.map((l,h)=>is(e,h,t)).reduce((l,h)=>l+h),n=0,o=0,a=0;for(;a<r;){if(r-a<i){s.push(r-a);break}n+=i;let l=is(e,o,t);n>l&&(n-=l,o++);let h=e[o].getWidth(n-1)===2;h&&n--;let d=h?i-1:i;s.push(d),a+=d}return s}function is(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,r=e[t+1].getWidth(0)===2;return s&&r?i-1:i}var uh=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new T),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ci(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};uh._nextId=1;var __=uh,xe={},ai=xe.B;xe[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:"≥","{":"π","|":"≠","}":"£","~":"·"};xe.A={"#":"£"};xe.B=void 0;xe[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};xe.C=xe[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};xe.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};xe.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};xe.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};xe.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};xe.E=xe[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};xe.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};xe.H=xe[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};xe["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var da=4294967295,ua=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=me.clone(),this.savedCharset=ai,this.markers=[],this._nullCell=lt.fromCharData([0,Pa,1,0]),this._whitespaceCell=lt.fromCharData([0,Gt,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Ws,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new ca(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 Ts),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 Ts),this._whitespaceCell}getBlankLine(e,t){return new Gi(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>da?da:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=me);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new ca(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(me),s=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)s+=+this.lines.get(o).resize(e,i);let n=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Gi(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Gi(e,i)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let o=this.lines.length-r;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>0.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 t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let 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,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=l_(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(me),i);if(s.length>0){let r=c_(this.lines,s);d_(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let s=this.getNullCell(me),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Gi(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(me),r=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let l=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),l.unshift(a);if(!i){let R=this.ybase+this.y;if(R>=o&&R<o+l.length)continue}let h=l[l.length-1].getTrimmedLength(),d=u_(l,this._cols,e),c=d.length-l.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+c):f=Math.max(0,this.lines.length-this.lines.maxLength+c);let p=[];for(let R=0;R<c;R++){let b=this.getBlankLine(me,!0);p.push(b)}p.length>0&&(r.push({start:o+l.length+n,newLines:p}),n+=p.length),l.push(...p);let w=d.length-1,y=d[w];y===0&&(w--,y=d[w]);let E=l.length-c-1,B=h;for(;E>=0;){let R=Math.min(B,y);if(l[w]===void 0)break;if(l[w].copyCellsFrom(l[E],B-R,y-R,R,!0),y-=R,y===0&&(w--,y=d[w]),B-=R,B===0){E--;let b=Math.max(E,0);B=is(l,b,this._cols)}}for(let R=0;R<l.length;R++)d[R]<e&&l[R].setCell(d[R],s);let P=c-f;for(;P-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+c,this.ybase+t-1)}if(r.length>0){let o=[],a=[];for(let y=0;y<this.lines.length;y++)a.push(this.lines.get(y));let l=this.lines.length,h=l-1,d=0,c=r[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let f=0;for(let y=Math.min(this.lines.maxLength-1,l+n-1);y>=0;y--)if(c&&c.start>h+f){for(let E=c.newLines.length-1;E>=0;E--)this.lines.set(y--,c.newLines[E]);y++,o.push({index:h+1,amount:c.newLines.length}),f+=c.newLines.length,c=r[++d]}else this.lines.set(y,a[h--]);let p=0;for(let y=o.length-1;y>=0;y--)o[y].index+=p,this.lines.onInsertEmitter.fire(o[y]),p+=o[y].amount;let w=Math.max(0,l+n-this.lines.maxLength);w>0&&this.lines.onTrimEmitter.fire(w)}}translateBufferLineToString(e,t,i=0,s){let r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}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 t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new __(e);return this.markers.push(t),t.register(this.lines.onTrim((i)=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert((i)=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete((i)=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},f_=class extends Y{constructor(e,t){super();this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new T),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 ua(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new ua(!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(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),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(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},_h=2,fh=1,hn=class extends Y{constructor(e){super();this.isUserScrolling=!1,this._onResize=this._register(new T),this.onResize=this._onResize.event,this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,_h),this.rows=Math.max(e.rawOptions.rows||0,fh),this.buffers=this._register(new f_(e,this)),this._register(this.buffers.onBufferActivate((t)=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-r+1;i.lines.shiftElements(r+1,o-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),s!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};hn=_e([I(0,Ue)],hn);var vi={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1000,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:Fs,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},g_=["normal","bold","100","200","300","400","500","600","700","800","900"],p_=class extends Y{constructor(e){super();this._onOptionChange=this._register(new T),this.onOptionChange=this._onOptionChange.event;let t={...vi};for(let i in e)if(i in t)try{let s=e[i];t[i]=this._sanitizeAndValidateOption(i,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(oe(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange((i)=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange((i)=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=(i)=>{if(!(i in vi))throw Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,s)=>{if(!(i in vi))throw Error(`No option with key "${i}"`);s=this._sanitizeAndValidateOption(i,s),this.rawOptions[i]!==s&&(this.rawOptions[i]=s,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let s={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=vi[e]),!v_(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=vi[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1000)break;t=g_.includes(t)?t:vi[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function v_(e){return e==="block"||e==="underline"||e==="bar"}function Yi(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let s in e)i[s]=t<=1?e[s]:e[s]&&Yi(e[s],t-1);return i}var _a=Object.freeze({insertMode:!1}),fa=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),ln=class extends Y{constructor(e,t,i){super();this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new T),this.onData=this._onData.event,this._onUserInput=this._register(new T),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new T),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new T),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Yi(_a),this.decPrivateModes=Yi(fa)}reset(){this.modes=Yi(_a),this.decPrivateModes=Yi(fa)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map((s)=>s.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map((t)=>t.charCodeAt(0))),this._onBinary.fire(e))}};ln=_e([I(0,$e),I(1,Ia),I(2,Ue)],ln);var ga={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:(e)=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:(e)=>e.action!==32},DRAG:{events:23,restrict:(e)=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:(e)=>!0}};function Tr(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var Br=String.fromCharCode,pa={DEFAULT:(e)=>{let t=[Tr(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Br(t[0])}${Br(t[1])}${Br(t[2])}`},SGR:(e)=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Tr(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:(e)=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Tr(e,!0)};${e.x};${e.y}${t}`}},cn=class extends Y{constructor(e,t,i){super();this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new T),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(ga))this.addProtocol(s,ga[s]);for(let s of Object.keys(pa))this.addEncoding(s,pa[s]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let s=t/i,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(e.deltaY)<50&&(r*=0.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};cn=_e([I(0,$e),I(1,ui),I(2,Ue)],cn);var Pr=[[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]],m_=[[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]],Ce;function w_(e,t){let i=0,s=t.length-1,r;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=i;)if(r=i+s>>1,e>t[r][1])i=r+1;else if(e<t[r][0])s=r-1;else return!0;return!1}var S_=class{constructor(){if(this.version="6",!Ce){Ce=new Uint8Array(65536),Ce.fill(1),Ce[0]=0,Ce.fill(0,1,32),Ce.fill(0,127,160),Ce.fill(2,4352,4448),Ce[9001]=2,Ce[9002]=2,Ce.fill(2,11904,42192),Ce[12351]=1,Ce.fill(2,44032,55204),Ce.fill(2,63744,64256),Ce.fill(2,65040,65050),Ce.fill(2,65072,65136),Ce.fill(2,65280,65377),Ce.fill(2,65504,65511);for(let e=0;e<Pr.length;++e)Ce.fill(0,Pr[e][0],Pr[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ce[e]:w_(e,m_)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),s=i===0&&t!==0;if(s){let r=hi.extractWidth(t);r===0?s=!1:r>i&&(i=r)}return hi.createPropertyValue(0,i,s)}},hi=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new T,this.onChange=this._onChange.event;let t=new S_;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,s=!1){return(t&16777215)<<3|(i&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,s=0,r=t.length;for(let n=0;n<r;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return i+this.wcwidth(o);let h=t.charCodeAt(n);56320<=h&&h<=57343?o=(o-55296)*1024+h-56320+65536:i+=this.wcwidth(h)}let a=this.charProperties(o,s),l=e.extractWidth(a);e.extractShouldJoin(a)&&(l-=e.extractWidth(s)),i+=l,s=a}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},b_=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function va(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var $i=2147483647,y_=256,gh=class e{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>y_)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new e;if(!t.length)return i;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let r=t[s];if(Array.isArray(r))for(let n=0;n<r.length;++n)i.addSubParam(r[n]);else i.addParam(r)}return i}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let i=0;i<this.length;++i){t.push(this.params[i]);let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>$i?$i:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>$i?$i:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-i>0?this._subParams.subarray(i,s):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&(t[i]=this._subParams.slice(s,r))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[i-1];s[i-1]=~r?Math.min(r*10+t,$i):t}},Ui=[],C_=class{constructor(){this._state=0,this._active=Ui,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ui}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Ui,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Ui,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,i){if(!this._active.length)this._handlerFb(this._id,"PUT",Hs(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&i-t>0&&this._put(e,t,i)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].end(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=Ui,this._id=-1,this._state=0}}},et=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Hs(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then((i)=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},Ki=[],x_=class{constructor(){this._handlers=Object.create(null),this._active=Ki,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ki}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Ki,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Ki,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",Hs(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].unhook(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=Ki,this._ident=0}},Xi=new gh;Xi.addParam(0);var ma=class{constructor(e){this._handler=e,this._data="",this._params=Xi,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Xi,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=Hs(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then((i)=>(this._params=Xi,this._data="",this._hitLimit=!1,i));return this._params=Xi,this._data="",this._hitLimit=!1,t}},k_=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,s){this.table[t<<8|e]=i<<4|s}addMany(e,t,i,s){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=i<<4|s}},ht=160,L_=function(){let e=new k_(4095),t=Array.apply(null,Array(256)).map((a,l)=>l),i=(a,l)=>t.slice(a,l),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let n=i(0,14),o;e.setDefault(1,0),e.addMany(s,0,2,0);for(o in n)e.addMany([24,26,153,154],o,3,0),e.addMany(i(128,144),o,3,0),e.addMany(i(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(ht,0,2,0),e.add(ht,8,5,8),e.add(ht,6,0,6),e.add(ht,11,0,11),e.add(ht,13,13,13),e}(),E_=class extends Y{constructor(e=L_){super();this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new gh,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,s)=>{},this._executeHandlerFb=(t)=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=(t)=>{},this._errorHandlerFb=(t)=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(oe(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new C_),this._dcsParser=this._register(new x_),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw Error("only two bytes as intermediates are supported");for(let r=0;r<e.intermediates.length;++r){let n=e.intermediates.charCodeAt(r);if(32>n||n>47)throw Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(e.final.length!==1)throw Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=s,i}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let s=this._escHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let s=this._csiHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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(e,t,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s=0,r=0,n=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&l>-1){for(;l>=0&&(o=a[l](this._params),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 4:if(i===!1&&l>-1){for(;l>=0&&(o=a[l](),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(s!==24&&s!==26,i),o)return o;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],o=this._oscParser.end(s!==24&&s!==26,i),o)return o;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=n;a<t;++a){switch(s=e[a],r=this._transitions.table[this.currentState<<8|(s<160?s:ht)],r>>4){case 2:for(let f=a+1;;++f){if(f>=t||(s=e[f])<32||s>126&&s<ht){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<ht){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<ht){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<ht){this._printHandler(e,a,f),a=f-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|s],h=l?l.length-1:-1;for(;h>=0&&(o=l[h](this._params),o!==!0);h--)if(o instanceof Promise)return this._preserveStack(3,l,h,r,a),o;h<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++a<t&&(s=e[a])>47&&s<60);a--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let d=this._escHandlers[this._collect<<8|s],c=d?d.length-1:-1;for(;c>=0&&(o=d[c](),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(4,d,c,r,a),o;c<0&&this._escHandlerFb(this._collect<<8|s),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|s,this._params);break;case 13:for(let f=a+1;;++f)if(f>=t||(s=e[f])===24||s===26||s===27||s>127&&s<ht){this._dcsParser.put(e,a,f),a=f-1;break}break;case 14:if(o=this._dcsParser.unhook(s!==24&&s!==26),o)return this._preserveStack(6,[],0,r,a),o;s===27&&(r|=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 f=a+1;;f++)if(f>=t||(s=e[f])<32||s>127&&s<ht){this._oscParser.put(e,a,f),a=f-1;break}break;case 6:if(o=this._oscParser.end(s!==24&&s!==26),o)return this._preserveStack(5,[],0,r,a),o;s===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},M_=/^([\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})$/,D_=/^[\da-f]+$/;function wa(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=M_.exec(t);if(i){let s=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/s*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/s*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),D_.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,s=[0,0,0];for(let r=0;r<3;++r){let n=parseInt(t.slice(i*r,i*r+i),16);s[r]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return s}}function Or(e,t){let i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function R_(e,t=16){let[i,s,r]=e;return`rgb:${Or(i,t)}/${Or(s,t)}/${Or(r,t)}`}var A_={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Vt=131072,Sa=10;function ba(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var ya=5000,Ca=0,T_=class extends Y{constructor(e,t,i,s,r,n,o,a,l=new E_){super();this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Cc,this._utf8Decoder=new xc,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=me.clone(),this._eraseAttrDataInternal=me.clone(),this._onRequestBell=this._register(new T),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new T),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new T),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new T),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new T),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new T),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new T),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new T),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new T),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new T),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new T),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new T),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 dn(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate((h)=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:d.toArray()})}),this._parser.setEscHandlerFallback((h)=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback((h)=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,d,c)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:d,data:c})}),this._parser.setDcsHandlerFallback((h,d,c)=>{d==="HOOK"&&(c=c.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:d,payload:c})}),this._parser.setPrintHandler((h,d,c)=>this.print(h,d,c)),this._parser.registerCsiHandler({final:"@"},(h)=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(h)=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},(h)=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(h)=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},(h)=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},(h)=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},(h)=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},(h)=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},(h)=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},(h)=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},(h)=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},(h)=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},(h)=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},(h)=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},(h)=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},(h)=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},(h)=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},(h)=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},(h)=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},(h)=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},(h)=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},(h)=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},(h)=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},(h)=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},(h)=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},(h)=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},(h)=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},(h)=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},(h)=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},(h)=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},(h)=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},(h)=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},(h)=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},(h)=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},(h)=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},(h)=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},(h)=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},(h)=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},(h)=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(h)=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(h)=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},(h)=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},(h)=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},(h)=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},(h)=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(h)=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(h)=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(h)=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(h)=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(h)=>this.requestMode(h,!1)),this._parser.setExecuteHandler(M.BEL,()=>this.bell()),this._parser.setExecuteHandler(M.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(M.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(M.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(M.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(M.BS,()=>this.backspace()),this._parser.setExecuteHandler(M.HT,()=>this.tab()),this._parser.setExecuteHandler(M.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(M.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Rs.IND,()=>this.index()),this._parser.setExecuteHandler(Rs.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Rs.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new et((h)=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new et((h)=>this.setIconName(h))),this._parser.registerOscHandler(2,new et((h)=>this.setTitle(h))),this._parser.registerOscHandler(4,new et((h)=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new et((h)=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new et((h)=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new et((h)=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new et((h)=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new et((h)=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new et((h)=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new et((h)=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new et((h)=>this.restoreCursorColor(h))),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(let h in xe)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler((h)=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new ma((h,d)=>this.requestStatusString(h,d)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),ya))]).catch((t)=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${ya} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Vt&&(n=this._parseStack.position+Vt)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,(h)=>String.fromCharCode(h)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map((h)=>h.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Vt&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Vt))),o||this._dirtyRowTracker.clearRange(),e.length>Vt)for(let h=n;h<e.length;h+=Vt){let d=h+Vt<e.length?h+Vt:e.length,c=typeof e=="string"?this._stringDecoder.decode(e.substring(h,d),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,d),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,c))return this._preserveStack(s,r,c,h),this._logSlowResolvingAsync(i),i}else if(!o){let h=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,h))return this._preserveStack(s,r,h,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,i){let s,r,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,d=this._curAttrData,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&c.getWidth(this._activeBuffer.x-1)===2&&c.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let f=this._parser.precedingJoinState;for(let p=t;p<i;++p){if(s=e[p],s<127&&n){let B=n[String.fromCharCode(s)];B&&(s=B.charCodeAt(0))}let w=this._unicodeService.charProperties(s,f);r=hi.extractWidth(w);let y=hi.extractShouldJoin(w),E=y?hi.extractWidth(f):0;if(f=w,o&&this._onA11yChar.fire(jt(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-E>a){if(l){let B=c,P=this._activeBuffer.x-E;for(this._activeBuffer.x=E,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),c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&c instanceof Gi&&c.copyCellsFrom(B,P,0,E,!1);P<a;)B.setCellFromCodepoint(P++,0,1,d)}else if(this._activeBuffer.x=a-1,r===2)continue}if(y&&this._activeBuffer.x){let B=c.getWidth(this._activeBuffer.x-1)?1:2;c.addCodepointToCell(this._activeBuffer.x-B,s,r);for(let P=r-E;--P>=0;)c.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(h&&(c.insertCells(this._activeBuffer.x,r-E,this._activeBuffer.getNullCell(d)),c.getWidth(a-1)===2&&c.setCellFromCodepoint(a-1,0,1,d)),c.setCellFromCodepoint(this._activeBuffer.x++,s,r,d),r>0)for(;--r;)c.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=f,this._activeBuffer.x<a&&i-t>0&&c.getWidth(this._activeBuffer.x)===0&&!c.hasContent(this._activeBuffer.x)&&c.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,(i)=>ba(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new ma(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new et(t))}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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let 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,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,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){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+i)?.getTrimmedLength(););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!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,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,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 t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(s,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();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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 t=e.params[0]||1;for(;t--;)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(me));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;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.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){let t=this._parser.precedingJoinState;if(!t)return!0;let i=e.params[0]||1,s=hi.extractWidth(t),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(n.length*i),a=0;for(let h=0;h<n.length;){let d=n.codePointAt(h)||0;o[a++]=d,h+=d>65535?2:1}let l=a;for(let h=1;h<i;++h)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(M.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(M.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(M.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(M.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(M.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,ai),this._charsetService.setgCharset(1,ai),this._charsetService.setgCharset(2,ai),this._charsetService.setgCharset(3,ai);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 1000: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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){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 1000: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:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";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[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let i;((y)=>(y[y.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",y[y.SET=1]="SET",y[y.RESET=2]="RESET",y[y.PERMANENTLY_SET=3]="PERMANENTLY_SET",y[y.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(i||={});let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:a,cols:l}=this._bufferService,{active:h,alt:d}=a,c=this._optionsService.rawOptions,f=(y,E)=>(o.triggerDataEvent(`${M.ESC}[${t?"":"?"}${y};${E}$y`),!0),p=(y)=>y?1:2,w=e.params[0];return t?w===2?f(w,4):w===4?f(w,p(o.modes.insertMode)):w===12?f(w,3):w===20?f(w,p(c.convertEol)):f(w,0):w===1?f(w,p(s.applicationCursorKeys)):w===3?f(w,c.windowOptions.setWinLines?l===80?2:l===132?1:0:0):w===6?f(w,p(s.origin)):w===7?f(w,p(s.wraparound)):w===8?f(w,3):w===9?f(w,p(r==="X10")):w===12?f(w,p(c.cursorBlink)):w===25?f(w,p(!o.isCursorHidden)):w===45?f(w,p(s.reverseWraparound)):w===66?f(w,p(s.applicationKeypad)):w===67?f(w,4):w===1000?f(w,p(r==="VT200")):w===1002?f(w,p(r==="DRAG")):w===1003?f(w,p(r==="ANY")):w===1004?f(w,p(s.sendFocus)):w===1005?f(w,4):w===1006?f(w,p(n==="SGR")):w===1015?f(w,4):w===1016?f(w,p(n==="SGR_PIXELS")):w===1048?f(w,1):w===47||w===1047||w===1049?f(w,p(h===d)):w===2004?f(w,p(s.bracketedPasteMode)):w===2026?f(w,p(s.synchronizedOutput)):f(w,0)}_updateAttrColor(e,t,i,s,r){return t===2?(e|=50331648,e&=-16777216,e|=ss.fromColorRGB([i,s,r])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){let o=e.getSubParams(t+n),a=0;do s[1]===5&&(r=1),s[n+a+1+r]=o[a];while(++a<o.length&&a+n+1+r<s.length);break}if(s[1]===5&&n+r>=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+t<e.length&&n+r<s.length);for(let o=2;o<s.length;++o)s[o]===-1&&(s[o]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=me.fg,e.bg=me.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;let t=e.length,i,s=this._curAttrData;for(let r=0;r<t;r++)i=e.params[r],i>=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777216|i-90|8):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777216|i-100|8):i===0?this._processSGR0(s):i===1?s.fg|=134217728:i===3?s.bg|=67108864:i===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):i===5?s.fg|=536870912:i===7?s.fg|=67108864:i===8?s.fg|=1073741824:i===9?s.fg|=2147483648:i===2?s.bg|=134217728:i===21?this._processUnderline(2,s):i===22?(s.fg&=-134217729,s.bg&=-134217729):i===23?s.bg&=-67108865:i===24?(s.fg&=-268435457,this._processUnderline(0,s)):i===25?s.fg&=-536870913:i===27?s.fg&=-67108865:i===28?s.fg&=-1073741825:i===29?s.fg&=2147483647:i===39?(s.fg&=-67108864,s.fg|=me.fg&16777215):i===49?(s.bg&=-67108864,s.bg|=me.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(e,r,s):i===53?s.bg|=1073741824:i===55?s.bg&=-1073741825:i===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):i===100?(s.fg&=-67108864,s.fg|=me.fg&16777215,s.bg&=-67108864,s.bg|=me.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${M.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${M.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${M.ESC}[?${t};${i}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}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=me.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){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!ba(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${M.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Sa&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Sa&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}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){let t=[],i=e.split(";");for(;i.length>1;){let s=i.shift(),r=i.shift();if(/^\d+$/.exec(s)){let n=parseInt(s);if(xa(n))if(r==="?")t.push({type:0,index:n});else{let o=wa(r);o&&t.push({type:1,index:n,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(i,s):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),s,r=i.findIndex((n)=>n.startsWith("id="));return r!==-1&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let i=e.split(";");for(let s=0;s<i.length&&!(t>=this._specialColors.length);++s,++t)if(i[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=wa(i[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}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;let t=[],i=e.split(";");for(let s=0;s<i.length;++s)if(/^\d+$/.exec(i[s])){let r=parseInt(i[s]);xa(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!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,ai),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(A_[e[0]],xe[e[1]]||ai),!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){let 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=me.clone(),this._eraseAttrDataInternal=me.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new lt;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(i);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=(o)=>(this._coreService.triggerDataEvent(`${M.ESC}${o}${M.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},dn=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Ca=e,e=t,t=Ca),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};dn=_e([I(0,$e)],dn);function xa(e){return 0<=e&&e<256}var B_=50000000,ka=12,P_=50,O_=class extends Y{constructor(e){super();this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new T),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let i;for(;i=this._writeBuffer.shift();){this._action(i);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>B_)throw Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],r=this._action(s,t);if(r){let o=(a)=>performance.now()-i>=ka?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(i,a);r.catch((a)=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(o);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-i>=ka)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>P_&&(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()}},un=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let a=t.addMarker(t.ybase+t.y),l={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(l,a)),this._dataByLinkId.set(l.id,l),l.id}let i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every((s)=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);i.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(i,s))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};un=_e([I(0,$e)],un);var La=!1,I_=class extends Y{constructor(e){super();this._windowsWrappingHeuristics=this._register(new wi),this._onBinary=this._register(new T),this.onBinary=this._onBinary.event,this._onData=this._register(new T),this.onData=this._onData.event,this._onLineFeed=this._register(new T),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new T),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new T),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new T),this._instantiationService=new n_,this.optionsService=this._register(new p_(e)),this._instantiationService.setService(Ue,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(hn)),this._instantiationService.setService($e,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(an)),this._instantiationService.setService(Ia,this._logService),this.coreService=this._register(this._instantiationService.createInstance(ln)),this._instantiationService.setService(ui,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(cn)),this._instantiationService.setService(Oa,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(hi)),this._instantiationService.setService(Mc,this.unicodeService),this._charsetService=this._instantiationService.createInstance(b_),this._instantiationService.setService(Ec,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(un),this._instantiationService.setService(Na,this._oscLinkService),this._inputHandler=this._register(new T_(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ne.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ne.forward(this._bufferService.onResize,this._onResize)),this._register(Ne.forward(this.coreService.onData,this._onData)),this._register(Ne.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new O_((t,i)=>this._inputHandler.parse(t,i))),this._register(Ne.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new T),this._onScroll.event((e)=>{this._onScrollApi?.fire(e.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(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!La&&(this._logService.warn("writeSync is unreliable and will be removed soon."),La=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,_h),t=Math.max(t,fh),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(va.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(va(this._bufferService),!1))),this._windowsWrappingHeuristics.value=oe(()=>{for(let t of e)t.dispose()})}}},N_={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:["'",'"']};function F_(e,t,i,s){let r={type:0,cancel:!1,key:void 0},n=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=M.ESC+"OA":r.key=M.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=M.ESC+"OD":r.key=M.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=M.ESC+"OC":r.key=M.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=M.ESC+"OB":r.key=M.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":M.DEL,e.altKey&&(r.key=M.ESC+r.key);break;case 9:if(e.shiftKey){r.key=M.ESC+"[Z";break}r.key=M.HT,r.cancel=!0;break;case 13:r.key=e.altKey?M.ESC+M.CR:M.CR,r.cancel=!0;break;case 27:r.key=M.ESC,e.altKey&&(r.key=M.ESC+M.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;n?r.key=M.ESC+"[1;"+(n+1)+"D":t?r.key=M.ESC+"OD":r.key=M.ESC+"[D";break;case 39:if(e.metaKey)break;n?r.key=M.ESC+"[1;"+(n+1)+"C":t?r.key=M.ESC+"OC":r.key=M.ESC+"[C";break;case 38:if(e.metaKey)break;n?r.key=M.ESC+"[1;"+(n+1)+"A":t?r.key=M.ESC+"OA":r.key=M.ESC+"[A";break;case 40:if(e.metaKey)break;n?r.key=M.ESC+"[1;"+(n+1)+"B":t?r.key=M.ESC+"OB":r.key=M.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=M.ESC+"[2~");break;case 46:n?r.key=M.ESC+"[3;"+(n+1)+"~":r.key=M.ESC+"[3~";break;case 36:n?r.key=M.ESC+"[1;"+(n+1)+"H":t?r.key=M.ESC+"OH":r.key=M.ESC+"[H";break;case 35:n?r.key=M.ESC+"[1;"+(n+1)+"F":t?r.key=M.ESC+"OF":r.key=M.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=M.ESC+"[5;"+(n+1)+"~":r.key=M.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=M.ESC+"[6;"+(n+1)+"~":r.key=M.ESC+"[6~";break;case 112:n?r.key=M.ESC+"[1;"+(n+1)+"P":r.key=M.ESC+"OP";break;case 113:n?r.key=M.ESC+"[1;"+(n+1)+"Q":r.key=M.ESC+"OQ";break;case 114:n?r.key=M.ESC+"[1;"+(n+1)+"R":r.key=M.ESC+"OR";break;case 115:n?r.key=M.ESC+"[1;"+(n+1)+"S":r.key=M.ESC+"OS";break;case 116:n?r.key=M.ESC+"[15;"+(n+1)+"~":r.key=M.ESC+"[15~";break;case 117:n?r.key=M.ESC+"[17;"+(n+1)+"~":r.key=M.ESC+"[17~";break;case 118:n?r.key=M.ESC+"[18;"+(n+1)+"~":r.key=M.ESC+"[18~";break;case 119:n?r.key=M.ESC+"[19;"+(n+1)+"~":r.key=M.ESC+"[19~";break;case 120:n?r.key=M.ESC+"[20;"+(n+1)+"~":r.key=M.ESC+"[20~";break;case 121:n?r.key=M.ESC+"[21;"+(n+1)+"~":r.key=M.ESC+"[21~";break;case 122:n?r.key=M.ESC+"[23;"+(n+1)+"~":r.key=M.ESC+"[23~";break;case 123:n?r.key=M.ESC+"[24;"+(n+1)+"~":r.key=M.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=M.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=M.DEL:e.keyCode===219?r.key=M.ESC:e.keyCode===220?r.key=M.FS:e.keyCode===221&&(r.key=M.GS);else if((!i||s)&&e.altKey&&!e.metaKey){let o=N_[e.keyCode]?.[e.shiftKey?1:0];if(o)r.key=M.ESC+o;else if(e.keyCode>=65&&e.keyCode<=90){let a=e.ctrlKey?e.keyCode-64:e.keyCode+32,l=String.fromCharCode(a);e.shiftKey&&(l=l.toUpperCase()),r.key=M.ESC+l}else if(e.keyCode===32)r.key=M.ESC+(e.ctrlKey?M.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),r.key=M.ESC+a,r.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=M.US),e.key==="@"&&(r.key=M.NUL));break}return r}var pe=0,W_=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Ws,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Ws,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((r,n)=>this._getKey(r)-this._getKey(n)),t=0,i=0,s=Array(this._array.length+this._insertedValues.length);for(let r=0;r<s.length;r++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(s[r]=e[t],t++):s[r]=this._array[i++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(pe=this._search(t),pe===-1)||this._getKey(this._array[pe])!==t)return!1;do if(this._array[pe]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(pe),!0;while(++pe<this._array.length&&this._getKey(this._array[pe])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,n)=>r-n),t=0,i=Array(this._array.length-e.length),s=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:i[s++]=this._array[r];this._array=i,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(pe=this._search(e),!(pe<0||pe>=this._array.length)&&this._getKey(this._array[pe])===e))do yield this._array[pe];while(++pe<this._array.length&&this._getKey(this._array[pe])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(pe=this._search(e),!(pe<0||pe>=this._array.length)&&this._getKey(this._array[pe])===e))do t(this._array[pe]);while(++pe<this._array.length&&this._getKey(this._array[pe])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let s=t+i>>1,r=this._getKey(this._array[s]);if(r>e)i=s-1;else if(r<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},Ir=0,Ea=0,z_=class extends Y{constructor(){super();this._decorations=new W_((e)=>e?.marker.line),this._onDecorationRegistered=this._register(new T),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new T),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(oe(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new H_(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let s=0,r=0;for(let n of this._decorations.getKeyIterator(t))s=n.options.x??0,r=s+(n.options.width??1),e>=s&&e<r&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,s){this._decorations.forEachByKey(t,(r)=>{Ir=r.options.x??0,Ea=Ir+(r.options.width??1),e>=Ir&&e<Ea&&(!i||(r.options.layer??"bottom")===i)&&s(r)})}},H_=class extends Yt{constructor(e){super();this.options=e,this.onRenderEmitter=this.add(new T),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new T),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")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=ce.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=ce.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},$_=1000,U_=class{constructor(e,t=$_){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=s-this._lastRefreshMs,n=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Ma=20,Da=!1,zs=class extends Y{constructor(e,t,i,s){super();this._terminal=e,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=(n)=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=(n)=>this._handleBoundaryFocus(n,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new U_(this._renderRows.bind(this))),!this._terminal.element)throw Error("Cannot enable accessibility before Terminal.open");Da?(this._accessibilityContainer.classList.add("debug"),this._rowContainer.classList.add("debug"),this._debugRootContainer=r.createElement("div"),this._debugRootContainer.classList.add("xterm"),this._debugRootContainer.appendChild(r.createTextNode("------start a11y------")),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(r.createTextNode("------end a11y------")),this._terminal.element.insertAdjacentElement("afterend",this._debugRootContainer)):this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize((n)=>this._handleResize(n.rows))),this._register(this._terminal.onRender((n)=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar((n)=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
35
|
-
`))),this._register(this._terminal.onA11yTab((n)=>this._handleTab(n))),this._register(this._terminal.onKey((n)=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(
|
|
36
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Ma+1&&(this._liveRegion.textContent+=Fr.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){let n=i.lines.get(i.ydisp+r),o=[],a=n?.translateToString(!0,void 0,void 0,o)||"",l=(i.ydisp+r+1).toString(),h=this._rowElements[r];h&&(a.length===0?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=a,this._rowColumns.set(h,o)),h.setAttribute("aria-posinset",l),h.setAttribute("aria-setsize",s),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),n=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||e.relatedTarget!==s)return;let o,a;if(t===0?(o=i,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:s.textContent?.length??0}),!this._rowContainer.contains(i.node))return;let r=({node:a,offset:l})=>{let h=a instanceof Text?a.parentNode:a,d=parseInt(h?.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let c=this._rowColumns.get(h);if(!c)return console.warn("columns is null. Race condition?"),null;let f=l<c.length?c[l]:c.slice(-1)[0]+1;return f>=this._terminal.cols&&(++d,f=0),{row:d,column:f}},n=r(t),o=r(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let 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){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}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]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,i=this._rowColumns.get(e)?.slice(-1)?.[0];if(!i)return;let s=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};zs=_e([I(1,fn),I(2,Rt),I(3,At)],zs);var _n=class extends Y{constructor(e,t,i,s,r){super();this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new T),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new T),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(oe(()=>{ci(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(K(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(K(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(K(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(K(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let i=e.composedPath();for(let s=0;s<i.length;s++){let r=i[s];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach((s)=>{s?.forEach((r)=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[s,r]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(s)&&(i=this._checkLinkProviderResult(s,e,i)):r.provideLinks(e.y,(n)=>{if(this._isMouseOut)return;let o=n?.map((a)=>({link:a}));this._activeProviderReplies?.set(s,o),i=this._checkLinkProviderResult(s,e,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let s=0;s<t.size;s++){let r=t.get(s);if(r)for(let n=0;n<r.length;n++){let o=r[n],a=o.link.range.start.y<e?0:o.link.range.start.x,l=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let h=a;h<=l;h++){if(i.has(h)){r.splice(n--,1);break}i.add(h)}}}}_checkLinkProviderResult(e,t,i){if(!this._activeProviderReplies)return i;let s=this._activeProviderReplies.get(e),r=!1;for(let n=0;n<e;n++)(!this._activeProviderReplies.has(n)||this._activeProviderReplies.get(n))&&(r=!0);if(!r&&s){let n=s.find((o)=>this._linkAtPosition(o.link,t));n&&(i=!0,this._handleNewLink(n))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let n=0;n<this._activeProviderReplies.size;n++){let o=this._activeProviderReplies.get(n)?.find((a)=>this._linkAtPosition(a.link,t));if(o){i=!0,this._handleNewLink(o);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&K_(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ci(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:(i)=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:(i)=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((i)=>{if(!this._currentLink)return;let s=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t,i){let s=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};_n=_e([I(1,gn),I(2,At),I(3,$e),I(4,Wa)],_n);function K_(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var q_=class extends I_{constructor(e={}){super(e);this._linkifier=this._register(new wi),this.browser=rh,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new wi),this._onCursorMove=this._register(new T),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new T),this.onKey=this._onKey.event,this._onRender=this._register(new T),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new T),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new T),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new T),this.onBell=this._onBell.event,this._onFocus=this._register(new T),this._onBlur=this._register(new T),this._onA11yCharEmitter=this._register(new T),this._onA11yTabEmitter=this._register(new T),this._onWillOpen=this._register(new T),this._setup(),this._decorationService=this._instantiationService.createInstance(z_),this._instantiationService.setService(rs,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Bu),this._instantiationService.setService(Wa,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(zr)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows((t)=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport((t)=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor((t)=>this._handleColorEvent(t))),this._register(Ne.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ne.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ne.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ne.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize((t)=>this._afterResize(t.cols,t.rows))),this._register(oe(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_handleColorEvent(e){if(this._themeService)for(let t of e){let i,s="";switch(t.index){case 256:i="foreground",s="10";break;case 257:i="background",s="11";break;case 258:i="cursor",s="12";break;default:i="ansi",s="4;"+t.index}switch(t.type){case 0:let r=ne.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${M.ESC}]${s};${R_(r)}${ih.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors((n)=>n.ansi[t.index]=we.toColor(...t.color));else{let n=i;this._themeService.modifyColors((o)=>o[n]=we.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(zs,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(M.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(M.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(K(this.element,"copy",(t)=>{this.hasSelection()&&bc(t,this._selectionService)}));let e=(t)=>yc(t,this.textarea,this.coreService,this.optionsService);this._register(K(this.textarea,"paste",e)),this._register(K(this.element,"paste",e)),nh?this._register(K(this.element,"mousedown",(t)=>{t.button===2&&Ro(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(K(this.element,"contextmenu",(t)=>{Ro(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Cn&&this._register(K(this.element,"auxclick",(t)=>{t.button===1&&Ba(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(K(this.textarea,"keyup",(e)=>this._keyUp(e),!0)),this._register(K(this.textarea,"keydown",(e)=>this._keyDown(e),!0)),this._register(K(this.textarea,"keypress",(e)=>this._keyPress(e),!0)),this._register(K(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(K(this.textarea,"compositionupdate",(e)=>this._compositionHelper.compositionupdate(e))),this._register(K(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(K(this.textarea,"input",(e)=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.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"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(K(this.screenElement,"mousemove",(r)=>this.updateCursorStyle(r))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Nr.get()),hh||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._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Au,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Rt,this._coreBrowserService),this._register(K(this.textarea,"focus",(r)=>this._handleTextAreaFocus(r))),this._register(K(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(tn,this._document,this._helperContainer),this._instantiationService.setService($s,this._charSizeService),this._themeService=this._instantiationService.createInstance(on),this._instantiationService.setService(Si,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Ns),this._instantiationService.setService(Fa,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(rn,this.rows,this.screenElement)),this._instantiationService.setService(At,this._renderService),this._register(this._renderService.onRenderedViewportChange((r)=>this._onRender.fire(r))),this.onResize((r)=>this._renderService.resize(r.cols,r.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Jr,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(sn),this._instantiationService.setService(gn,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(_n,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(Xr,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines((r)=>{super.scrollLines(r,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(nn,this.element,this.screenElement,s)),this._instantiationService.setService(Rc,this._selectionService),this._register(this._selectionService.onRequestScrollLines((r)=>this.scrollLines(r.amount,r.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw((r)=>this._renderService.handleSelectionChanged(r.start,r.end,r.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection((r)=>{this.textarea.value=r,this.textarea.focus(),this.textarea.select()})),this._register(Ne.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Zr,this.screenElement)),this._register(K(this.element,"mousedown",(r)=>this._selectionService.handleMouseDown(r))),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(zs,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",(r)=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Is,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",(r)=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Is,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(en,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(n){let o=e._mouseService.getMouseReportCoords(n,e.screenElement);if(!o)return!1;let a,l;switch(n.overrideType||n.type){case"mousemove":l=32,n.buttons===void 0?(a=3,n.button!==void 0&&(a=n.button<3?n.button:3)):a=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":l=0,a=n.button<3?n.button:3;break;case"mousedown":l=1,a=n.button<3?n.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(n)===!1)return!1;let h=n.deltaY;if(h===0||e.coreMouseService.consumeWheelEvent(n,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;l=h<0?0:1,a=4;break;default:return!1}return l===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:l,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:(n)=>(i(n),n.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(n)),wheel:(n)=>(i(n),this.cancel(n,!0)),mousedrag:(n)=>{n.buttons&&i(n)},mousemove:(n)=>{n.buttons||i(n)}};this._register(this.coreMouseService.onProtocolChange((n)=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),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()),n&8?s.mousemove||(t.addEventListener("mousemove",r.mousemove),s.mousemove=r.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),n&16?s.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),s.wheel=r.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),n&2?s.mouseup||(s.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),n&4?s.mousedrag||(s.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(K(t,"mousedown",(n)=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return i(n),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(n)})),this._register(K(t,"wheel",(n)=>{if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(n,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(n,!0);let o=M.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(o,!0),this.cancel(n,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?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(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Ta(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,i){this._selectionService.setSelection(e,t,i)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let i=F_(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let s=this.rows-1;return this.scrollLines(i.type===2?-s:s),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((i.key===M.ETX||i.key===M.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(V_(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(me));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(M.ESC+"[I"):this.coreService.triggerDataEvent(M.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${M.ESC}[4;${i};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${M.ESC}[6;${r};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function V_(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var j_=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(t===-1)throw Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},G_=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new lt)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},Ra=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new G_(t)}getNullCell(){return new lt}},Y_=class extends Y{constructor(e){super();this._core=e,this._onBufferChange=this._register(new T),this.onBufferChange=this._onBufferChange.event,this._normal=new Ra(this._core.buffers.normal,"normal"),this._alternate=new Ra(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 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)}},X_=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,(i)=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,s)=>t(i,s.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},Z_=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},J_=["cols","rows"],pt=0,ph=class extends Y{constructor(e){super(),this._core=this._register(new q_(e)),this._addonManager=this._register(new j_),this._publicOptions={...this._core.options};let t=(s)=>this._core.options[s],i=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:t.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(e){if(J_.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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 X_(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Z_(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 Y_(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
37
|
-
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return
|
|
34
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Mn&&e&&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(e){let t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s||!t?!1:this._areCoordsInSelection(t,i,s)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,s=this._model.finalSelectionEnd;return!i||!s?!1:this._areCoordsInSelection([e,t],i,s)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let i=this._linkifier.currentLink?.link?.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=ca(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let s=this._getMouseBufferCoords(e);return s?(this._selectWordAt(s,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=En(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-Or),Or),t/=Or,t/Math.abs(t)+Math.round(t*(i_-1)))}shouldForceSelection(e){return $s?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),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(),s_)}_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(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!($s&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}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(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let s=i.lines.get(this._model.selectionEnd[1]);s&&s.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[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});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<r_&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let s=ju(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(s,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim((t)=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let s=0;t>=s;s++){let r=e.loadCell(s,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:r>1&&t!==s&&(i+=r-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,s=!0){if(e[0]>=this._bufferService.cols)return;let r=this._bufferService.buffer,n=r.lines.get(e[1]);if(!n)return;let o=r.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(n,e[0]),h=a,l=e[0]-a,d=0,c=0,f=0,g=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;h<o.length&&o.charAt(h+1)===" ";)h++}else{let E=e[0],R=e[0];n.getWidth(E)===0&&(d++,E--),n.getWidth(R)===2&&(c++,R++);let P=n.getString(R).length;for(P>1&&(g+=P-1,h+=P-1);E>0&&a>0&&!this._isCharWordSeparator(n.loadCell(E-1,this._workCell));){n.loadCell(E-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(d++,E--):A>1&&(f+=A-1,a-=A-1),a--,E--}for(;R<n.length&&h+1<o.length&&!this._isCharWordSeparator(n.loadCell(R+1,this._workCell));){n.loadCell(R+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(c++,R++):A>1&&(g+=A-1,h+=A-1),h++,R++}}h++;let v=a+l-d+f,y=Math.min(this._bufferService.cols,h-a+d+c-f-g);if(!(!t&&o.slice(a,h).trim()==="")){if(i&&v===0&&n.getCodePoint(0)!==32){let E=r.lines.get(e[1]-1);if(E&&n.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let R=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(R){let P=this._bufferService.cols-R.start;v-=P,y+=P}}}if(s&&v+y===this._bufferService.cols&&n.getCodePoint(this._bufferService.cols-1)!==32){let E=r.lines.get(e[1]+1);if(E?.isWrapped&&E.getCodePoint(0)!==32){let R=this._getWordAt([0,e[1]+1],!1,!1,!0);R&&(y+=R.length)}}return{start:v,length:y}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=ca(i,this._bufferService.cols)}};cn=ge([O(3,Ke),O(4,mi),O(5,Sn),O(6,qe),O(7,It),O(8,Ot)],cn);var da=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},ua=class{constructor(){this._color=new da,this._css=new da}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ye=Object.freeze((()=>{let e=[_e.toColor("#2e3436"),_e.toColor("#cc0000"),_e.toColor("#4e9a06"),_e.toColor("#c4a000"),_e.toColor("#3465a4"),_e.toColor("#75507b"),_e.toColor("#06989a"),_e.toColor("#d3d7cf"),_e.toColor("#555753"),_e.toColor("#ef2929"),_e.toColor("#8ae234"),_e.toColor("#fce94f"),_e.toColor("#729fcf"),_e.toColor("#ad7fa8"),_e.toColor("#34e2e2"),_e.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let s=t[i/36%6|0],r=t[i/6%6|0],n=t[i%6];e.push({css:Se.toCss(s,r,n),rgba:Se.toRgba(s,r,n)})}for(let i=0;i<24;i++){let s=8+i*10;e.push({css:Se.toCss(s,s,s),rgba:Se.toRgba(s,s,s)})}return e})()),ui=_e.toColor("#ffffff"),Zi=_e.toColor("#000000"),_a=_e.toColor("#ffffff"),fa=Zi,qi={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},a_=ui,dn=class extends G{constructor(e){super();this._optionsService=e,this._contrastCache=new ua,this._halfContrastCache=new ua,this._onChangeColors=this._register(new T),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ui,background:Zi,cursor:_a,cursorAccent:fa,selectionForeground:void 0,selectionBackgroundTransparent:qi,selectionBackgroundOpaque:he.blend(Zi,qi),selectionInactiveBackgroundTransparent:qi,selectionInactiveBackgroundOpaque:he.blend(Zi,qi),scrollbarSliderBackground:he.opacity(ui,0.2),scrollbarSliderHoverBackground:he.opacity(ui,0.4),scrollbarSliderActiveBackground:he.opacity(ui,0.5),overviewRulerBorder:ui,ansi:ye.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)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=ie(e.foreground,ui),t.background=ie(e.background,Zi),t.cursor=he.blend(t.background,ie(e.cursor,_a)),t.cursorAccent=he.blend(t.background,ie(e.cursorAccent,fa)),t.selectionBackgroundTransparent=ie(e.selectionBackground,qi),t.selectionBackgroundOpaque=he.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ie(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=he.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ie(e.selectionForeground,aa):void 0,t.selectionForeground===aa&&(t.selectionForeground=void 0),he.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=he.opacity(t.selectionBackgroundTransparent,0.3)),he.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=he.opacity(t.selectionInactiveBackgroundTransparent,0.3)),t.scrollbarSliderBackground=ie(e.scrollbarSliderBackground,he.opacity(t.foreground,0.2)),t.scrollbarSliderHoverBackground=ie(e.scrollbarSliderHoverBackground,he.opacity(t.foreground,0.4)),t.scrollbarSliderActiveBackground=ie(e.scrollbarSliderActiveBackground,he.opacity(t.foreground,0.5)),t.overviewRulerBorder=ie(e.overviewRulerBorder,a_),t.ansi=ye.slice(),t.ansi[0]=ie(e.black,ye[0]),t.ansi[1]=ie(e.red,ye[1]),t.ansi[2]=ie(e.green,ye[2]),t.ansi[3]=ie(e.yellow,ye[3]),t.ansi[4]=ie(e.blue,ye[4]),t.ansi[5]=ie(e.magenta,ye[5]),t.ansi[6]=ie(e.cyan,ye[6]),t.ansi[7]=ie(e.white,ye[7]),t.ansi[8]=ie(e.brightBlack,ye[8]),t.ansi[9]=ie(e.brightRed,ye[9]),t.ansi[10]=ie(e.brightGreen,ye[10]),t.ansi[11]=ie(e.brightYellow,ye[11]),t.ansi[12]=ie(e.brightBlue,ye[12]),t.ansi[13]=ie(e.brightMagenta,ye[13]),t.ansi[14]=ie(e.brightCyan,ye[14]),t.ansi[15]=ie(e.brightWhite,ye[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let s=0;s<i;s++)t.ansi[s+16]=ie(e.extendedAnsi[s],ye[s+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){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[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(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()}}};dn=ge([O(0,qe)],dn);function ie(e,t){if(e!==void 0)try{return _e.toColor(e)}catch{}return t}var h_=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},l_=class{constructor(){this._services=new h_,this._services.set(wn,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=Dc(e).sort((n,o)=>n.index-o.index),s=[];for(let n of i){let o=this._services.get(n.id);if(!o)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${n.id._id}.`);s.push(o)}let r=i.length>0?i[0].index:t.length;if(t.length!==r)throw Error(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);return new e(...t,...s)}},c_={trace:0,debug:1,info:2,warn:3,error:4,off:5},d_="xterm.js: ",un=class extends G{constructor(e){super();this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),u_=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=c_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":d_)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};un=ge([O(0,qe)],un);var u_,ga=class extends G{constructor(e){super();this._maxLength=e,this.onDeleteEmitter=this._register(new T),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new T),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new T),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw 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(e,t,...i){if(t){for(let s=e;s<this._length-t;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let s=this._length-1;s>=e;s--)this._array[this._getCyclicIndex(s+i.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<i.length;s++)this._array[this._getCyclicIndex(e+s)]=i[s];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let s=this._length+i.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw Error("start argument out of range");if(e+i<0)throw Error("Cannot shift elements in list beyond index 0");if(i>0){for(let r=t-1;r>=0;r--)this.set(e+r+i,this.get(e+r));let s=e+t+i-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<t;s++)this.set(e+s+i,this.get(e+s))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}};var j=3,we=Object.freeze(new as),Es=0,Ir=2,Ji=class e{constructor(t,i,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*j);let r=i||_t.fromCharData([0,Wa,1,0]);for(let n=0;n<t;++n)this.setCell(n,r);this.length=t}get(t){let i=this._data[t*j+0],s=i&2097151;return[this._data[t*j+1],i&2097152?this._combined[t]:s?Jt(s):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):s]}set(t,i){this._data[t*j+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*j+0]=t|2097152|i[2]<<22):this._data[t*j+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*j+0]>>22}hasWidth(t){return this._data[t*j+0]&12582912}getFg(t){return this._data[t*j+1]}getBg(t){return this._data[t*j+2]}hasContent(t){return this._data[t*j+0]&4194303}getCodePoint(t){let i=this._data[t*j+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*j+0]&2097152}getString(t){let i=this._data[t*j+0];return i&2097152?this._combined[t]:i&2097151?Jt(i&2097151):""}isProtected(t){return this._data[t*j+2]&536870912}loadCell(t,i){return Es=t*j,i.content=this._data[Es+0],i.fg=this._data[Es+1],i.bg=this._data[Es+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*j+0]=i.content,this._data[t*j+1]=i.fg,this._data[t*j+2]=i.bg}setCellFromCodepoint(t,i,s,r){r.bg&268435456&&(this._extendedAttrs[t]=r.extended),this._data[t*j+0]=i|s<<22,this._data[t*j+1]=r.fg,this._data[t*j+2]=r.bg}addCodepointToCell(t,i,s){let r=this._data[t*j+0];r&2097152?this._combined[t]+=Jt(i):r&2097151?(this._combined[t]=Jt(r&2097151)+Jt(i),r&=-2097152,r|=2097152):r=i|4194304,s&&(r&=-12582913,r|=s<<22),this._data[t*j+0]=r}insertCells(t,i,s){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length-t){let r=new _t;for(let n=this.length-t-i-1;n>=0;--n)this.setCell(t+i+n,this.loadCell(t+n,r));for(let n=0;n<i;++n)this.setCell(t+n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(t,i,s){if(t%=this.length,i<this.length-t){let r=new _t;for(let n=0;n<this.length-t-i;++n)this.setCell(t+n,this.loadCell(t+i+n,r));for(let n=this.length-i;n<this.length;++n)this.setCell(n,s)}else for(let r=t;r<this.length;++r)this.setCell(r,s);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,s)}replaceCells(t,i,s,r=!1){if(r){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,s),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,s),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,s);t<i&&t<this.length;)this.setCell(t++,s)}resize(t,i){if(t===this.length)return this._data.length*4*Ir<this._data.buffer.byteLength;let s=t*j;if(t>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<t;++r)this.setCell(r,i)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let o=0;o<r.length;o++){let a=parseInt(r[o],10);a>=t&&delete this._combined[a]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let a=parseInt(n[o],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,s*4*Ir<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Ir<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,t);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*j+0]&4194303)return t+(this._data[t*j+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*j+0]&4194303||this._data[t*j+2]&50331648)return t+(this._data[t*j+0]>>22);return 0}copyCellsFrom(t,i,s,r,n){let o=t._data;if(n)for(let h=r-1;h>=0;h--){for(let l=0;l<j;l++)this._data[(s+h)*j+l]=o[(i+h)*j+l];o[(i+h)*j+2]&268435456&&(this._extendedAttrs[s+h]=t._extendedAttrs[i+h])}else for(let h=0;h<r;h++){for(let l=0;l<j;l++)this._data[(s+h)*j+l]=o[(i+h)*j+l];o[(i+h)*j+2]&268435456&&(this._extendedAttrs[s+h]=t._extendedAttrs[i+h])}let a=Object.keys(t._combined);for(let h=0;h<a.length;h++){let l=parseInt(a[h],10);l>=i&&(this._combined[l-i+s]=t._combined[l])}}translateToString(t,i,s,r){i=i??0,s=s??this.length,t&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;i<s;){let o=this._data[i*j+0],a=o&2097151,h=o&2097152?this._combined[i]:a?Jt(a):Qt;if(n+=h,r)for(let l=0;l<h.length;++l)r.push(i);i+=o>>22||1}return r&&r.push(i),n}};function __(e,t,i,s,r,n){let o=[];for(let a=0;a<e.length-1;a++){let h=a,l=e.get(++h);if(!l.isWrapped)continue;let d=[e.get(a)];for(;h<e.length&&l.isWrapped;)d.push(l),l=e.get(++h);if(!n&&s>=a&&s<h){a+=d.length-1;continue}let c=0,f=os(d,c,t),g=1,v=0;for(;g<d.length;){let E=os(d,g,t),R=E-v,P=i-f,A=Math.min(R,P);d[c].copyCellsFrom(d[g],v,f,A,!1),f+=A,f===i&&(c++,f=0),v+=A,v===E&&(g++,v=0),f===0&&c!==0&&d[c-1].getWidth(i-1)===2&&(d[c].copyCellsFrom(d[c-1],i-1,f++,1,!1),d[c-1].setCell(i-1,r))}d[c].replaceCells(f,i,r);let y=0;for(let E=d.length-1;E>0&&(E>c||d[E].getTrimmedLength()===0);E--)y++;y>0&&(o.push(a+d.length-y),o.push(y)),a+=d.length-1}return o}function f_(e,t){let i=[],s=0,r=t[s],n=0;for(let o=0;o<e.length;o++)if(r===o){let a=t[++s];e.onDeleteEmitter.fire({index:o-n,amount:a}),o+=a-1,n+=a,r=t[++s]}else i.push(o);return{layout:i,countRemoved:n}}function g_(e,t){let i=[];for(let s=0;s<t.length;s++)i.push(e.get(t[s]));for(let s=0;s<i.length;s++)e.set(s,i[s]);e.length=t.length}function p_(e,t,i){let s=[],r=e.map((h,l)=>os(e,l,t)).reduce((h,l)=>h+l),n=0,o=0,a=0;for(;a<r;){if(r-a<i){s.push(r-a);break}n+=i;let h=os(e,o,t);n>h&&(n-=h,o++);let l=e[o].getWidth(n-1)===2;l&&n--;let d=l?i-1:i;s.push(d),a+=d}return s}function os(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let s=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,r=e[t+1].getWidth(0)===2;return s&&r?i-1:i}var vh=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new T),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),pi(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};vh._nextId=1;var v_=vh,xe={},_i=xe.B;xe[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:"≥","{":"π","|":"≠","}":"£","~":"·"};xe.A={"#":"£"};xe.B=void 0;xe[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};xe.C=xe[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};xe.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};xe.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};xe.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};xe.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};xe.E=xe[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};xe.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};xe.H=xe[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};xe["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var pa=4294967295,va=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=we.clone(),this.savedCharset=_i,this.markers=[],this._nullCell=_t.fromCharData([0,Wa,1,0]),this._whitespaceCell=_t.fromCharData([0,Qt,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Us,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new ga(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 Is),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 Is),this._whitespaceCell}getBlankLine(e,t){return new Ji(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>pa?pa:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=we);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new ga(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(we),s=0,r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)s+=+this.lines.get(o).resize(e,i);let n=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Ji(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new Ji(e,i)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let o=this.lines.length-r;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),s>0.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 t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let 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,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=__(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(we),i);if(s.length>0){let r=f_(this.lines,s);g_(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let s=this.getNullCell(we),r=i;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Ji(e,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(we),r=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let h=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),h.unshift(a);if(!i){let A=this.ybase+this.y;if(A>=o&&A<o+h.length)continue}let l=h[h.length-1].getTrimmedLength(),d=p_(h,this._cols,e),c=d.length-h.length,f;this.ybase===0&&this.y!==this.lines.length-1?f=Math.max(0,this.y-this.lines.maxLength+c):f=Math.max(0,this.lines.length-this.lines.maxLength+c);let g=[];for(let A=0;A<c;A++){let b=this.getBlankLine(we,!0);g.push(b)}g.length>0&&(r.push({start:o+h.length+n,newLines:g}),n+=g.length),h.push(...g);let v=d.length-1,y=d[v];y===0&&(v--,y=d[v]);let E=h.length-c-1,R=l;for(;E>=0;){let A=Math.min(R,y);if(h[v]===void 0)break;if(h[v].copyCellsFrom(h[E],R-A,y-A,A,!0),y-=A,y===0&&(v--,y=d[v]),R-=A,R===0){E--;let b=Math.max(E,0);R=os(h,b,this._cols)}}for(let A=0;A<h.length;A++)d[A]<e&&h[A].setCell(d[A],s);let P=c-f;for(;P-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+c,this.ybase+t-1)}if(r.length>0){let o=[],a=[];for(let y=0;y<this.lines.length;y++)a.push(this.lines.get(y));let h=this.lines.length,l=h-1,d=0,c=r[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let f=0;for(let y=Math.min(this.lines.maxLength-1,h+n-1);y>=0;y--)if(c&&c.start>l+f){for(let E=c.newLines.length-1;E>=0;E--)this.lines.set(y--,c.newLines[E]);y++,o.push({index:l+1,amount:c.newLines.length}),f+=c.newLines.length,c=r[++d]}else this.lines.set(y,a[l--]);let g=0;for(let y=o.length-1;y>=0;y--)o[y].index+=g,this.lines.onInsertEmitter.fire(o[y]),g+=o[y].amount;let v=Math.max(0,h+n-this.lines.maxLength);v>0&&this.lines.onTrimEmitter.fire(v)}}translateBufferLineToString(e,t,i=0,s){let r=this.lines.get(e);return r?r.translateToString(t,i,s):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}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 t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new v_(e);return this.markers.push(t),t.register(this.lines.onTrim((i)=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert((i)=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete((i)=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},m_=class extends G{constructor(e,t){super();this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new T),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 va(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new va(!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(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),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(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},mh=2,wh=1,_n=class extends G{constructor(e){super();this.isUserScrolling=!1,this._onResize=this._register(new T),this.onResize=this._onResize.event,this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,mh),this.rows=Math.max(e.rawOptions.rows||0,wh),this.buffers=this._register(new m_(e,this)),this._register(this.buffers.onBufferActivate((t)=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,s=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==e.fg||s.getBg(0)!==e.bg)&&(s=i.getBlankLine(e,t),this._cachedBlankLine=s),s.isWrapped=t;let r=i.ybase+i.scrollTop,n=i.ybase+i.scrollBottom;if(i.scrollTop===0){let o=i.lines.isFull;n===i.lines.length-1?o?i.lines.recycle().copyFrom(s):i.lines.push(s.clone()):i.lines.splice(n+1,0,s.clone()),o?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let o=n-r+1;i.lines.shiftElements(r+1,o-1,-1),i.lines.set(n,s.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let s=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),s!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};_n=ge([O(0,qe)],_n);var yi={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1000,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:$s,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},w_=["normal","bold","100","200","300","400","500","600","700","800","900"],S_=class extends G{constructor(e){super();this._onOptionChange=this._register(new T),this.onOptionChange=this._onOptionChange.event;let t={...yi};for(let i in e)if(i in t)try{let s=e[i];t[i]=this._sanitizeAndValidateOption(i,s)}catch(s){console.error(s)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(le(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange((i)=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange((i)=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=(i)=>{if(!(i in yi))throw Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,s)=>{if(!(i in yi))throw Error(`No option with key "${i}"`);s=this._sanitizeAndValidateOption(i,s),this.rawOptions[i]!==s&&(this.rawOptions[i]=s,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let s={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,s)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=yi[e]),!b_(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=yi[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1000)break;t=w_.includes(t)?t:yi[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function b_(e){return e==="block"||e==="underline"||e==="bar"}function Qi(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let s in e)i[s]=t<=1?e[s]:e[s]&&Qi(e[s],t-1);return i}var ma=Object.freeze({insertMode:!1}),wa=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),fn=class extends G{constructor(e,t,i){super();this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new T),this.onData=this._onData.event,this._onUserInput=this._register(new T),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new T),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new T),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Qi(ma),this.decPrivateModes=Qi(wa)}reset(){this.modes=Qi(ma),this.decPrivateModes=Qi(wa)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map((s)=>s.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map((t)=>t.charCodeAt(0))),this._onBinary.fire(e))}};fn=ge([O(0,Ke),O(1,Ha),O(2,qe)],fn);var Sa={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:(e)=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:(e)=>e.action!==32},DRAG:{events:23,restrict:(e)=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:(e)=>!0}};function Nr(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var Fr=String.fromCharCode,ba={DEFAULT:(e)=>{let t=[Nr(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Fr(t[0])}${Fr(t[1])}${Fr(t[2])}`},SGR:(e)=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Nr(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:(e)=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Nr(e,!0)};${e.x};${e.y}${t}`}},gn=class extends G{constructor(e,t,i){super();this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new T),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(Sa))this.addProtocol(s,Sa[s]);for(let s of Object.keys(ba))this.addEncoding(s,ba[s]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let s=t/i,r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(e.deltaY)<50&&(r*=0.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};gn=ge([O(0,Ke),O(1,mi),O(2,qe)],gn);var Wr=[[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]],y_=[[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]],Ce;function C_(e,t){let i=0,s=t.length-1,r;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=i;)if(r=i+s>>1,e>t[r][1])i=r+1;else if(e<t[r][0])s=r-1;else return!0;return!1}var x_=class{constructor(){if(this.version="6",!Ce){Ce=new Uint8Array(65536),Ce.fill(1),Ce[0]=0,Ce.fill(0,1,32),Ce.fill(0,127,160),Ce.fill(2,4352,4448),Ce[9001]=2,Ce[9002]=2,Ce.fill(2,11904,42192),Ce[12351]=1,Ce.fill(2,44032,55204),Ce.fill(2,63744,64256),Ce.fill(2,65040,65050),Ce.fill(2,65072,65136),Ce.fill(2,65280,65377),Ce.fill(2,65504,65511);for(let e=0;e<Wr.length;++e)Ce.fill(0,Wr[e][0],Wr[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Ce[e]:C_(e,y_)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),s=i===0&&t!==0;if(s){let r=fi.extractWidth(t);r===0?s=!1:r>i&&(i=r)}return fi.createPropertyValue(0,i,s)}},fi=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new T,this.onChange=this._onChange.event;let t=new x_;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,s=!1){return(t&16777215)<<3|(i&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,s=0,r=t.length;for(let n=0;n<r;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return i+this.wcwidth(o);let l=t.charCodeAt(n);56320<=l&&l<=57343?o=(o-55296)*1024+l-56320+65536:i+=this.wcwidth(l)}let a=this.charProperties(o,s),h=e.extractWidth(a);e.extractShouldJoin(a)&&(h-=e.extractWidth(s)),i+=h,s=a}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},k_=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function ya(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var Vi=2147483647,L_=256,Sh=class e{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>L_)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new e;if(!t.length)return i;for(let s=Array.isArray(t[0])?1:0;s<t.length;++s){let r=t[s];if(Array.isArray(r))for(let n=0;n<r.length;++n)i.addSubParam(r[n]);else i.addParam(r)}return i}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let i=0;i<this.length;++i){t.push(this.params[i]);let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&t.push(Array.prototype.slice.call(this._subParams,s,r))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Vi?Vi:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Vi?Vi:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,s=this._subParamsIdx[t]&255;return s-i>0?this._subParams.subarray(i,s):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let s=this._subParamsIdx[i]>>8,r=this._subParamsIdx[i]&255;r-s>0&&(t[i]=this._subParams.slice(s,r))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[i-1];s[i-1]=~r?Math.min(r*10+t,Vi):t}},Gi=[],E_=class{constructor(){this._state=0,this._active=Gi,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Gi}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Gi,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Gi,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,i){if(!this._active.length)this._handlerFb(this._id,"PUT",qs(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let s=e[t++];if(s===59){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+s-48}this._state===2&&i-t>0&&this._put(e,t,i)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].end(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=Gi,this._id=-1,this._state=0}}},nt=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=qs(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then((i)=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},ji=[],M_=class{constructor(){this._handlers=Object.create(null),this._active=ji,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ji}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=ji,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||ji,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",qs(e,t,i));else for(let s=this._active.length-1;s>=0;s--)this._active[s].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,s=this._active.length-1,r=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=t,r=this._stack.fallThrough,this._stack.paused=!1),!r&&i===!1){for(;s>=0&&(i=this._active[s].unhook(e),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}this._active=ji,this._ident=0}},es=new Sh;es.addParam(0);var Ca=class{constructor(e){this._handler=e,this._data="",this._params=es,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():es,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=qs(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then((i)=>(this._params=es,this._data="",this._hitLimit=!1,i));return this._params=es,this._data="",this._hitLimit=!1,t}},D_=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,s){this.table[t<<8|e]=i<<4|s}addMany(e,t,i,s){for(let r=0;r<e.length;r++)this.table[t<<8|e[r]]=i<<4|s}},ut=160,R_=function(){let e=new D_(4095),t=Array.apply(null,Array(256)).map((a,h)=>h),i=(a,h)=>t.slice(a,h),s=i(32,127),r=i(0,24);r.push(25),r.push.apply(r,i(28,32));let n=i(0,14),o;e.setDefault(1,0),e.addMany(s,0,2,0);for(o in n)e.addMany([24,26,153,154],o,3,0),e.addMany(i(128,144),o,3,0),e.addMany(i(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(r,0,3,0),e.addMany(r,1,3,1),e.add(127,1,0,1),e.addMany(r,8,0,8),e.addMany(r,3,3,3),e.add(127,3,0,3),e.addMany(r,4,3,4),e.add(127,4,0,4),e.addMany(r,6,3,6),e.addMany(r,5,3,5),e.add(127,5,0,5),e.addMany(r,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(s,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(s,7,0,7),e.addMany(r,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(r,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(r,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(r,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(r,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(r,13,13,13),e.addMany(s,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(ut,0,2,0),e.add(ut,8,5,8),e.add(ut,6,0,6),e.add(ut,11,0,11),e.add(ut,13,13,13),e}(),A_=class extends G{constructor(e=R_){super();this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Sh,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,s)=>{},this._executeHandlerFb=(t)=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=(t)=>{},this._errorHandlerFb=(t)=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(le(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new E_),this._dcsParser=this._register(new M_),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw Error("only two bytes as intermediates are supported");for(let r=0;r<e.intermediates.length;++r){let n=e.intermediates.charCodeAt(r);if(32>n||n>47)throw Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=n}}if(e.final.length!==1)throw Error("final must be a single byte");let s=e.final.charCodeAt(0);if(t[0]>s||s>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=s,i}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let s=this._escHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let s=this._csiHandlers[i];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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(e,t,i,s,r){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=s,this._parseStack.chunkPos=r}parse(e,t,i){let s=0,r=0,n=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,n=this._parseStack.chunkPos+1;else{if(i===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,h=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&h>-1){for(;h>=0&&(o=a[h](this._params),o!==!0);h--)if(o instanceof Promise)return this._parseStack.handlerPos=h,o}this._parseStack.handlers=[];break;case 4:if(i===!1&&h>-1){for(;h>=0&&(o=a[h](),o!==!0);h--)if(o instanceof Promise)return this._parseStack.handlerPos=h,o}this._parseStack.handlers=[];break;case 6:if(s=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(s!==24&&s!==26,i),o)return o;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(s=e[this._parseStack.chunkPos],o=this._oscParser.end(s!==24&&s!==26,i),o)return o;s===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,n=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=n;a<t;++a){switch(s=e[a],r=this._transitions.table[this.currentState<<8|(s<160?s:ut)],r>>4){case 2:for(let f=a+1;;++f){if(f>=t||(s=e[f])<32||s>126&&s<ut){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<ut){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<ut){this._printHandler(e,a,f),a=f-1;break}if(++f>=t||(s=e[f])<32||s>126&&s<ut){this._printHandler(e,a,f),a=f-1;break}}break;case 3:this._executeHandlers[s]?this._executeHandlers[s]():this._executeHandlerFb(s),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:a,code:s,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let h=this._csiHandlers[this._collect<<8|s],l=h?h.length-1:-1;for(;l>=0&&(o=h[l](this._params),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(3,h,l,r,a),o;l<0&&this._csiHandlerFb(this._collect<<8|s,this._params),this.precedingJoinState=0;break;case 8:do switch(s){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(s-48)}while(++a<t&&(s=e[a])>47&&s<60);a--;break;case 9:this._collect<<=8,this._collect|=s;break;case 10:let d=this._escHandlers[this._collect<<8|s],c=d?d.length-1:-1;for(;c>=0&&(o=d[c](),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(4,d,c,r,a),o;c<0&&this._escHandlerFb(this._collect<<8|s),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|s,this._params);break;case 13:for(let f=a+1;;++f)if(f>=t||(s=e[f])===24||s===26||s===27||s>127&&s<ut){this._dcsParser.put(e,a,f),a=f-1;break}break;case 14:if(o=this._dcsParser.unhook(s!==24&&s!==26),o)return this._preserveStack(6,[],0,r,a),o;s===27&&(r|=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 f=a+1;;f++)if(f>=t||(s=e[f])<32||s>127&&s<ut){this._oscParser.put(e,a,f),a=f-1;break}break;case 6:if(o=this._oscParser.end(s!==24&&s!==26),o)return this._preserveStack(5,[],0,r,a),o;s===27&&(r|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=r&15}}},T_=/^([\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})$/,B_=/^[\da-f]+$/;function xa(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=T_.exec(t);if(i){let s=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/s*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/s*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/s*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),B_.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,s=[0,0,0];for(let r=0;r<3;++r){let n=parseInt(t.slice(i*r,i*r+i),16);s[r]=i===1?n<<4:i===2?n:i===3?n>>4:n>>8}return s}}function zr(e,t){let i=e.toString(16),s=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function P_(e,t=16){let[i,s,r]=e;return`rgb:${zr(i,t)}/${zr(s,t)}/${zr(r,t)}`}var O_={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Zt=131072,ka=10;function La(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var Ea=5000,Ma=0,I_=class extends G{constructor(e,t,i,s,r,n,o,a,h=new A_){super();this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=a,this._parser=h,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Ec,this._utf8Decoder=new Mc,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=we.clone(),this._eraseAttrDataInternal=we.clone(),this._onRequestBell=this._register(new T),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new T),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new T),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new T),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new T),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new T),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new T),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new T),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new T),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new T),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new T),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new T),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new T),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 pn(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate((l)=>this._activeBuffer=l.activeBuffer)),this._parser.setCsiHandlerFallback((l,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(l),params:d.toArray()})}),this._parser.setEscHandlerFallback((l)=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(l)})}),this._parser.setExecuteHandlerFallback((l)=>{this._logService.debug("Unknown EXECUTE code: ",{code:l})}),this._parser.setOscHandlerFallback((l,d,c)=>{this._logService.debug("Unknown OSC code: ",{identifier:l,action:d,data:c})}),this._parser.setDcsHandlerFallback((l,d,c)=>{d==="HOOK"&&(c=c.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(l),action:d,payload:c})}),this._parser.setPrintHandler((l,d,c)=>this.print(l,d,c)),this._parser.registerCsiHandler({final:"@"},(l)=>this.insertChars(l)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(l)=>this.scrollLeft(l)),this._parser.registerCsiHandler({final:"A"},(l)=>this.cursorUp(l)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(l)=>this.scrollRight(l)),this._parser.registerCsiHandler({final:"B"},(l)=>this.cursorDown(l)),this._parser.registerCsiHandler({final:"C"},(l)=>this.cursorForward(l)),this._parser.registerCsiHandler({final:"D"},(l)=>this.cursorBackward(l)),this._parser.registerCsiHandler({final:"E"},(l)=>this.cursorNextLine(l)),this._parser.registerCsiHandler({final:"F"},(l)=>this.cursorPrecedingLine(l)),this._parser.registerCsiHandler({final:"G"},(l)=>this.cursorCharAbsolute(l)),this._parser.registerCsiHandler({final:"H"},(l)=>this.cursorPosition(l)),this._parser.registerCsiHandler({final:"I"},(l)=>this.cursorForwardTab(l)),this._parser.registerCsiHandler({final:"J"},(l)=>this.eraseInDisplay(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},(l)=>this.eraseInDisplay(l,!0)),this._parser.registerCsiHandler({final:"K"},(l)=>this.eraseInLine(l,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},(l)=>this.eraseInLine(l,!0)),this._parser.registerCsiHandler({final:"L"},(l)=>this.insertLines(l)),this._parser.registerCsiHandler({final:"M"},(l)=>this.deleteLines(l)),this._parser.registerCsiHandler({final:"P"},(l)=>this.deleteChars(l)),this._parser.registerCsiHandler({final:"S"},(l)=>this.scrollUp(l)),this._parser.registerCsiHandler({final:"T"},(l)=>this.scrollDown(l)),this._parser.registerCsiHandler({final:"X"},(l)=>this.eraseChars(l)),this._parser.registerCsiHandler({final:"Z"},(l)=>this.cursorBackwardTab(l)),this._parser.registerCsiHandler({final:"`"},(l)=>this.charPosAbsolute(l)),this._parser.registerCsiHandler({final:"a"},(l)=>this.hPositionRelative(l)),this._parser.registerCsiHandler({final:"b"},(l)=>this.repeatPrecedingCharacter(l)),this._parser.registerCsiHandler({final:"c"},(l)=>this.sendDeviceAttributesPrimary(l)),this._parser.registerCsiHandler({prefix:">",final:"c"},(l)=>this.sendDeviceAttributesSecondary(l)),this._parser.registerCsiHandler({final:"d"},(l)=>this.linePosAbsolute(l)),this._parser.registerCsiHandler({final:"e"},(l)=>this.vPositionRelative(l)),this._parser.registerCsiHandler({final:"f"},(l)=>this.hVPosition(l)),this._parser.registerCsiHandler({final:"g"},(l)=>this.tabClear(l)),this._parser.registerCsiHandler({final:"h"},(l)=>this.setMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"h"},(l)=>this.setModePrivate(l)),this._parser.registerCsiHandler({final:"l"},(l)=>this.resetMode(l)),this._parser.registerCsiHandler({prefix:"?",final:"l"},(l)=>this.resetModePrivate(l)),this._parser.registerCsiHandler({final:"m"},(l)=>this.charAttributes(l)),this._parser.registerCsiHandler({final:"n"},(l)=>this.deviceStatus(l)),this._parser.registerCsiHandler({prefix:"?",final:"n"},(l)=>this.deviceStatusPrivate(l)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(l)=>this.softReset(l)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(l)=>this.setCursorStyle(l)),this._parser.registerCsiHandler({final:"r"},(l)=>this.setScrollRegion(l)),this._parser.registerCsiHandler({final:"s"},(l)=>this.saveCursor(l)),this._parser.registerCsiHandler({final:"t"},(l)=>this.windowOptions(l)),this._parser.registerCsiHandler({final:"u"},(l)=>this.restoreCursor(l)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(l)=>this.insertColumns(l)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(l)=>this.deleteColumns(l)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(l)=>this.selectProtected(l)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(l)=>this.requestMode(l,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(l)=>this.requestMode(l,!1)),this._parser.setExecuteHandler(M.BEL,()=>this.bell()),this._parser.setExecuteHandler(M.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(M.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(M.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(M.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(M.BS,()=>this.backspace()),this._parser.setExecuteHandler(M.HT,()=>this.tab()),this._parser.setExecuteHandler(M.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(M.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Ps.IND,()=>this.index()),this._parser.setExecuteHandler(Ps.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Ps.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new nt((l)=>(this.setTitle(l),this.setIconName(l),!0))),this._parser.registerOscHandler(1,new nt((l)=>this.setIconName(l))),this._parser.registerOscHandler(2,new nt((l)=>this.setTitle(l))),this._parser.registerOscHandler(4,new nt((l)=>this.setOrReportIndexedColor(l))),this._parser.registerOscHandler(8,new nt((l)=>this.setHyperlink(l))),this._parser.registerOscHandler(10,new nt((l)=>this.setOrReportFgColor(l))),this._parser.registerOscHandler(11,new nt((l)=>this.setOrReportBgColor(l))),this._parser.registerOscHandler(12,new nt((l)=>this.setOrReportCursorColor(l))),this._parser.registerOscHandler(104,new nt((l)=>this.restoreIndexedColor(l))),this._parser.registerOscHandler(110,new nt((l)=>this.restoreFgColor(l))),this._parser.registerOscHandler(111,new nt((l)=>this.restoreBgColor(l))),this._parser.registerOscHandler(112,new nt((l)=>this.restoreCursorColor(l))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let l in xe)this._parser.registerEscHandler({intermediates:"(",final:l},()=>this.selectCharset("("+l)),this._parser.registerEscHandler({intermediates:")",final:l},()=>this.selectCharset(")"+l)),this._parser.registerEscHandler({intermediates:"*",final:l},()=>this.selectCharset("*"+l)),this._parser.registerEscHandler({intermediates:"+",final:l},()=>this.selectCharset("+"+l)),this._parser.registerEscHandler({intermediates:"-",final:l},()=>this.selectCharset("-"+l)),this._parser.registerEscHandler({intermediates:".",final:l},()=>this.selectCharset("."+l)),this._parser.registerEscHandler({intermediates:"/",final:l},()=>this.selectCharset("/"+l));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler((l)=>(this._logService.error("Parsing error: ",l),l)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Ca((l,d)=>this.requestStatusString(l,d)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=s}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),Ea))]).catch((t)=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Ea} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Zt&&(n=this._parseStack.position+Zt)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,(l)=>String.fromCharCode(l)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map((l)=>l.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Zt&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Zt))),o||this._dirtyRowTracker.clearRange(),e.length>Zt)for(let l=n;l<e.length;l+=Zt){let d=l+Zt<e.length?l+Zt:e.length,c=typeof e=="string"?this._stringDecoder.decode(e.substring(l,d),this._parseBuffer):this._utf8Decoder.decode(e.subarray(l,d),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,c))return this._preserveStack(s,r,c,l),this._logSlowResolvingAsync(i),i}else if(!o){let l=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,l))return this._preserveStack(s,r,l,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),h=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);h<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(h,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,i){let s,r,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,h=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,d=this._curAttrData,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&c.getWidth(this._activeBuffer.x-1)===2&&c.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let f=this._parser.precedingJoinState;for(let g=t;g<i;++g){if(s=e[g],s<127&&n){let R=n[String.fromCharCode(s)];R&&(s=R.charCodeAt(0))}let v=this._unicodeService.charProperties(s,f);r=fi.extractWidth(v);let y=fi.extractShouldJoin(v),E=y?fi.extractWidth(f):0;if(f=v,o&&this._onA11yChar.fire(Jt(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-E>a){if(h){let R=c,P=this._activeBuffer.x-E;for(this._activeBuffer.x=E,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),c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),E>0&&c instanceof Ji&&c.copyCellsFrom(R,P,0,E,!1);P<a;)R.setCellFromCodepoint(P++,0,1,d)}else if(this._activeBuffer.x=a-1,r===2)continue}if(y&&this._activeBuffer.x){let R=c.getWidth(this._activeBuffer.x-1)?1:2;c.addCodepointToCell(this._activeBuffer.x-R,s,r);for(let P=r-E;--P>=0;)c.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(l&&(c.insertCells(this._activeBuffer.x,r-E,this._activeBuffer.getNullCell(d)),c.getWidth(a-1)===2&&c.setCellFromCodepoint(a-1,0,1,d)),c.setCellFromCodepoint(this._activeBuffer.x++,s,r,d),r>0)for(;--r;)c.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=f,this._activeBuffer.x<a&&i-t>0&&c.getWidth(this._activeBuffer.x)===0&&!c.hasContent(this._activeBuffer.x)&&c.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,(i)=>La(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Ca(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new nt(t))}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(){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&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let 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,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,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){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let i;switch(e.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+i)?.getTrimmedLength(););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let s=this._activeBuffer.lines.length-this._bufferService.rows;s>0&&(this._activeBuffer.lines.trimStart(s),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-s,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-s,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!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,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;t--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(i,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 t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(s,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();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)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 t=e.params[0]||1;for(;t--;)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(we));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;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.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;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);s.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.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){let t=this._parser.precedingJoinState;if(!t)return!0;let i=e.params[0]||1,s=fi.extractWidth(t),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(n.length*i),a=0;for(let l=0;l<n.length;){let d=n.codePointAt(l)||0;o[a++]=d,l+=d>65535?2:1}let h=a;for(let l=1;l<i;++l)o.copyWithin(h,0,a),h+=a;return this.print(o,0,h),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(M.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(M.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(M.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(M.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(M.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,_i),this._charsetService.setgCharset(1,_i),this._charsetService.setgCharset(2,_i),this._charsetService.setgCharset(3,_i);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 1000: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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){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 1000: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:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";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[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let i;((y)=>(y[y.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",y[y.SET=1]="SET",y[y.RESET=2]="RESET",y[y.PERMANENTLY_SET=3]="PERMANENTLY_SET",y[y.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(i||={});let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:a,cols:h}=this._bufferService,{active:l,alt:d}=a,c=this._optionsService.rawOptions,f=(y,E)=>(o.triggerDataEvent(`${M.ESC}[${t?"":"?"}${y};${E}$y`),!0),g=(y)=>y?1:2,v=e.params[0];return t?v===2?f(v,4):v===4?f(v,g(o.modes.insertMode)):v===12?f(v,3):v===20?f(v,g(c.convertEol)):f(v,0):v===1?f(v,g(s.applicationCursorKeys)):v===3?f(v,c.windowOptions.setWinLines?h===80?2:h===132?1:0:0):v===6?f(v,g(s.origin)):v===7?f(v,g(s.wraparound)):v===8?f(v,3):v===9?f(v,g(r==="X10")):v===12?f(v,g(c.cursorBlink)):v===25?f(v,g(!o.isCursorHidden)):v===45?f(v,g(s.reverseWraparound)):v===66?f(v,g(s.applicationKeypad)):v===67?f(v,4):v===1000?f(v,g(r==="VT200")):v===1002?f(v,g(r==="DRAG")):v===1003?f(v,g(r==="ANY")):v===1004?f(v,g(s.sendFocus)):v===1005?f(v,4):v===1006?f(v,g(n==="SGR")):v===1015?f(v,4):v===1016?f(v,g(n==="SGR_PIXELS")):v===1048?f(v,1):v===47||v===1047||v===1049?f(v,g(l===d)):v===2004?f(v,g(s.bracketedPasteMode)):v===2026?f(v,g(s.synchronizedOutput)):f(v,0)}_updateAttrColor(e,t,i,s,r){return t===2?(e|=50331648,e&=-16777216,e|=as.fromColorRGB([i,s,r])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=e.params[t+n],e.hasSubParams(t+n)){let o=e.getSubParams(t+n),a=0;do s[1]===5&&(r=1),s[n+a+1+r]=o[a];while(++a<o.length&&a+n+1+r<s.length);break}if(s[1]===5&&n+r>=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+t<e.length&&n+r<s.length);for(let o=2;o<s.length;++o)s[o]===-1&&(s[o]=0);switch(s[0]){case 38:i.fg=this._updateAttrColor(i.fg,s[1],s[3],s[4],s[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,s[1],s[3],s[4],s[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=we.fg,e.bg=we.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;let t=e.length,i,s=this._curAttrData;for(let r=0;r<t;r++)i=e.params[r],i>=30&&i<=37?(s.fg&=-50331904,s.fg|=16777216|i-30):i>=40&&i<=47?(s.bg&=-50331904,s.bg|=16777216|i-40):i>=90&&i<=97?(s.fg&=-50331904,s.fg|=16777216|i-90|8):i>=100&&i<=107?(s.bg&=-50331904,s.bg|=16777216|i-100|8):i===0?this._processSGR0(s):i===1?s.fg|=134217728:i===3?s.bg|=67108864:i===4?(s.fg|=268435456,this._processUnderline(e.hasSubParams(r)?e.getSubParams(r)[0]:1,s)):i===5?s.fg|=536870912:i===7?s.fg|=67108864:i===8?s.fg|=1073741824:i===9?s.fg|=2147483648:i===2?s.bg|=134217728:i===21?this._processUnderline(2,s):i===22?(s.fg&=-134217729,s.bg&=-134217729):i===23?s.bg&=-67108865:i===24?(s.fg&=-268435457,this._processUnderline(0,s)):i===25?s.fg&=-536870913:i===27?s.fg&=-67108865:i===28?s.fg&=-1073741825:i===29?s.fg&=2147483647:i===39?(s.fg&=-67108864,s.fg|=we.fg&16777215):i===49?(s.bg&=-67108864,s.bg|=we.bg&16777215):i===38||i===48||i===58?r+=this._extractColor(e,r,s):i===53?s.bg|=1073741824:i===55?s.bg&=-1073741825:i===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):i===100?(s.fg&=-67108864,s.fg|=we.fg&16777215,s.bg&=-67108864,s.bg|=we.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${M.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${M.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${M.ESC}[?${t};${i}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}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=we.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){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!La(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${M.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>ka&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>ka&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}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){let t=[],i=e.split(";");for(;i.length>1;){let s=i.shift(),r=i.shift();if(/^\d+$/.exec(s)){let n=parseInt(s);if(Da(n))if(r==="?")t.push({type:0,index:n});else{let o=xa(r);o&&t.push({type:1,index:n,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),s=e.slice(t+1);return s?this._createHyperlink(i,s):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),s,r=i.findIndex((n)=>n.startsWith("id="));return r!==-1&&(s=i[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let i=e.split(";");for(let s=0;s<i.length&&!(t>=this._specialColors.length);++s,++t)if(i[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=xa(i[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}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;let t=[],i=e.split(";");for(let s=0;s<i.length;++s)if(/^\d+$/.exec(i[s])){let r=parseInt(i[s]);Da(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!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,_i),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(O_[e[0]],xe[e[1]]||_i),!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){let 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=we.clone(),this._eraseAttrDataInternal=we.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new _t;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,s=this._activeBuffer.lines.get(i);s&&(s.fill(e),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=(o)=>(this._coreService.triggerDataEvent(`${M.ESC}${o}${M.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},pn=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Ma=e,e=t,t=Ma),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};pn=ge([O(0,Ke)],pn);function Da(e){return 0<=e&&e<256}var N_=50000000,Ra=12,F_=50,W_=class extends G{constructor(e){super();this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new T),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let i;for(;i=this._writeBuffer.shift();){this._action(i);let s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>N_)throw Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let s=this._writeBuffer[this._bufferOffset],r=this._action(s,t);if(r){let o=(a)=>performance.now()-i>=Ra?setTimeout(()=>this._innerWrite(0,a)):this._innerWrite(i,a);r.catch((a)=>(queueMicrotask(()=>{throw a}),Promise.resolve(!1))).then(o);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=s.length,performance.now()-i>=Ra)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>F_&&(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()}},vn=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let a=t.addMarker(t.ybase+t.y),h={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(h,a)),this._dataByLinkId.set(h.id,h),h.id}let i=e,s=this._getEntryIdKey(i),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,t.ybase+t.y),r.id;let n=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every((s)=>s.line!==t)){let s=this._bufferService.buffer.addMarker(t);i.lines.push(s),s.onDispose(()=>this._removeMarkerFromLink(i,s))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};vn=ge([O(0,Ke)],vn);var Aa=!1,z_=class extends G{constructor(e){super();this._windowsWrappingHeuristics=this._register(new xi),this._onBinary=this._register(new T),this.onBinary=this._onBinary.event,this._onData=this._register(new T),this.onData=this._onData.event,this._onLineFeed=this._register(new T),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new T),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new T),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new T),this._instantiationService=new l_,this.optionsService=this._register(new S_(e)),this._instantiationService.setService(qe,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(_n)),this._instantiationService.setService(Ke,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(un)),this._instantiationService.setService(Ha,this._logService),this.coreService=this._register(this._instantiationService.createInstance(fn)),this._instantiationService.setService(mi,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(gn)),this._instantiationService.setService(za,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(fi)),this._instantiationService.setService(Tc,this.unicodeService),this._charsetService=this._instantiationService.createInstance(k_),this._instantiationService.setService(Ac,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(vn),this._instantiationService.setService($a,this._oscLinkService),this._inputHandler=this._register(new I_(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ie.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ie.forward(this._bufferService.onResize,this._onResize)),this._register(Ie.forward(this.coreService.onData,this._onData)),this._register(Ie.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new W_((t,i)=>this._inputHandler.parse(t,i))),this._register(Ie.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new T),this._onScroll.event((e)=>{this._onScrollApi?.fire(e.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(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!Aa&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Aa=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,mh),t=Math.max(t,wh),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(ya.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(ya(this._bufferService),!1))),this._windowsWrappingHeuristics.value=le(()=>{for(let t of e)t.dispose()})}}},H_={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:["'",'"']};function $_(e,t,i,s){let r={type:0,cancel:!1,key:void 0},n=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?r.key=M.ESC+"OA":r.key=M.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?r.key=M.ESC+"OD":r.key=M.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?r.key=M.ESC+"OC":r.key=M.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?r.key=M.ESC+"OB":r.key=M.ESC+"[B");break;case 8:r.key=e.ctrlKey?"\b":M.DEL,e.altKey&&(r.key=M.ESC+r.key);break;case 9:if(e.shiftKey){r.key=M.ESC+"[Z";break}r.key=M.HT,r.cancel=!0;break;case 13:r.key=e.altKey?M.ESC+M.CR:M.CR,r.cancel=!0;break;case 27:r.key=M.ESC,e.altKey&&(r.key=M.ESC+M.ESC),r.cancel=!0;break;case 37:if(e.metaKey)break;n?r.key=M.ESC+"[1;"+(n+1)+"D":t?r.key=M.ESC+"OD":r.key=M.ESC+"[D";break;case 39:if(e.metaKey)break;n?r.key=M.ESC+"[1;"+(n+1)+"C":t?r.key=M.ESC+"OC":r.key=M.ESC+"[C";break;case 38:if(e.metaKey)break;n?r.key=M.ESC+"[1;"+(n+1)+"A":t?r.key=M.ESC+"OA":r.key=M.ESC+"[A";break;case 40:if(e.metaKey)break;n?r.key=M.ESC+"[1;"+(n+1)+"B":t?r.key=M.ESC+"OB":r.key=M.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(r.key=M.ESC+"[2~");break;case 46:n?r.key=M.ESC+"[3;"+(n+1)+"~":r.key=M.ESC+"[3~";break;case 36:n?r.key=M.ESC+"[1;"+(n+1)+"H":t?r.key=M.ESC+"OH":r.key=M.ESC+"[H";break;case 35:n?r.key=M.ESC+"[1;"+(n+1)+"F":t?r.key=M.ESC+"OF":r.key=M.ESC+"[F";break;case 33:e.shiftKey?r.type=2:e.ctrlKey?r.key=M.ESC+"[5;"+(n+1)+"~":r.key=M.ESC+"[5~";break;case 34:e.shiftKey?r.type=3:e.ctrlKey?r.key=M.ESC+"[6;"+(n+1)+"~":r.key=M.ESC+"[6~";break;case 112:n?r.key=M.ESC+"[1;"+(n+1)+"P":r.key=M.ESC+"OP";break;case 113:n?r.key=M.ESC+"[1;"+(n+1)+"Q":r.key=M.ESC+"OQ";break;case 114:n?r.key=M.ESC+"[1;"+(n+1)+"R":r.key=M.ESC+"OR";break;case 115:n?r.key=M.ESC+"[1;"+(n+1)+"S":r.key=M.ESC+"OS";break;case 116:n?r.key=M.ESC+"[15;"+(n+1)+"~":r.key=M.ESC+"[15~";break;case 117:n?r.key=M.ESC+"[17;"+(n+1)+"~":r.key=M.ESC+"[17~";break;case 118:n?r.key=M.ESC+"[18;"+(n+1)+"~":r.key=M.ESC+"[18~";break;case 119:n?r.key=M.ESC+"[19;"+(n+1)+"~":r.key=M.ESC+"[19~";break;case 120:n?r.key=M.ESC+"[20;"+(n+1)+"~":r.key=M.ESC+"[20~";break;case 121:n?r.key=M.ESC+"[21;"+(n+1)+"~":r.key=M.ESC+"[21~";break;case 122:n?r.key=M.ESC+"[23;"+(n+1)+"~":r.key=M.ESC+"[23~";break;case 123:n?r.key=M.ESC+"[24;"+(n+1)+"~":r.key=M.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?r.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?r.key=M.NUL:e.keyCode>=51&&e.keyCode<=55?r.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?r.key=M.DEL:e.keyCode===219?r.key=M.ESC:e.keyCode===220?r.key=M.FS:e.keyCode===221&&(r.key=M.GS);else if((!i||s)&&e.altKey&&!e.metaKey){let o=H_[e.keyCode]?.[e.shiftKey?1:0];if(o)r.key=M.ESC+o;else if(e.keyCode>=65&&e.keyCode<=90){let a=e.ctrlKey?e.keyCode-64:e.keyCode+32,h=String.fromCharCode(a);e.shiftKey&&(h=h.toUpperCase()),r.key=M.ESC+h}else if(e.keyCode===32)r.key=M.ESC+(e.ctrlKey?M.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let a=e.code.slice(3,4);e.shiftKey||(a=a.toLowerCase()),r.key=M.ESC+a,r.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(r.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?r.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(r.key=M.US),e.key==="@"&&(r.key=M.NUL));break}return r}var me=0,U_=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Us,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Us,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((r,n)=>this._getKey(r)-this._getKey(n)),t=0,i=0,s=Array(this._array.length+this._insertedValues.length);for(let r=0;r<s.length;r++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(s[r]=e[t],t++):s[r]=this._array[i++];this._array=s,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(me=this._search(t),me===-1)||this._getKey(this._array[me])!==t)return!1;do if(this._array[me]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(me),!0;while(++me<this._array.length&&this._getKey(this._array[me])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((r,n)=>r-n),t=0,i=Array(this._array.length-e.length),s=0;for(let r=0;r<this._array.length;r++)e[t]===r?t++:i[s++]=this._array[r];this._array=i,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(me=this._search(e),!(me<0||me>=this._array.length)&&this._getKey(this._array[me])===e))do yield this._array[me];while(++me<this._array.length&&this._getKey(this._array[me])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(me=this._search(e),!(me<0||me>=this._array.length)&&this._getKey(this._array[me])===e))do t(this._array[me]);while(++me<this._array.length&&this._getKey(this._array[me])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let s=t+i>>1,r=this._getKey(this._array[s]);if(r>e)i=s-1;else if(r<e)t=s+1;else{for(;s>0&&this._getKey(this._array[s-1])===e;)s--;return s}}return t}},Hr=0,Ta=0,K_=class extends G{constructor(){super();this._decorations=new U_((e)=>e?.marker.line),this._onDecorationRegistered=this._register(new T),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new T),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(le(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new q_(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),s=t.onDispose(()=>{s.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let s=0,r=0;for(let n of this._decorations.getKeyIterator(t))s=n.options.x??0,r=s+(n.options.width??1),e>=s&&e<r&&(!i||(n.options.layer??"bottom")===i)&&(yield n)}forEachDecorationAtCell(e,t,i,s){this._decorations.forEachByKey(t,(r)=>{Hr=r.options.x??0,Ta=Hr+(r.options.width??1),e>=Hr&&e<Ta&&(!i||(r.options.layer??"bottom")===i)&&s(r)})}},q_=class extends ei{constructor(e){super();this.options=e,this.onRenderEmitter=this.add(new T),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new T),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")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=_e.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=_e.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},V_=1000,G_=class{constructor(e,t=V_){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let s=performance.now();if(s-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=s,this._innerRefresh();else if(!this._additionalRefreshRequested){let r=s-this._lastRefreshMs,n=this._debounceThresholdMS-r;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},n)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Ba=20,Pa=!1,Ks=class extends G{constructor(e,t,i,s){super();this._terminal=e,this._coreBrowserService=i,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=(n)=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=(n)=>this._handleBoundaryFocus(n,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new G_(this._renderRows.bind(this))),!this._terminal.element)throw Error("Cannot enable accessibility before Terminal.open");Pa?(this._accessibilityContainer.classList.add("debug"),this._rowContainer.classList.add("debug"),this._debugRootContainer=r.createElement("div"),this._debugRootContainer.classList.add("xterm"),this._debugRootContainer.appendChild(r.createTextNode("------start a11y------")),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(r.createTextNode("------end a11y------")),this._terminal.element.insertAdjacentElement("afterend",this._debugRootContainer)):this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize((n)=>this._handleResize(n.rows))),this._register(this._terminal.onRender((n)=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar((n)=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
35
|
+
`))),this._register(this._terminal.onA11yTab((n)=>this._handleTab(n))),this._register(this._terminal.onKey((n)=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(U(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(le(()=>{Pa?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Ba+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
36
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Ba+1&&(this._liveRegion.textContent+=Ur.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,s=i.lines.length.toString();for(let r=e;r<=t;r++){let n=i.lines.get(i.ydisp+r),o=[],a=n?.translateToString(!0,void 0,void 0,o)||"",h=(i.ydisp+r+1).toString(),l=this._rowElements[r];l&&(a.length===0?(l.textContent=" ",this._rowColumns.set(l,[0,1])):(l.textContent=a,this._rowColumns.set(l,o)),l.setAttribute("aria-posinset",h),l.setAttribute("aria-setsize",s),this._alignRowWidth(l))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,s=this._rowElements[t===0?1:this._rowElements.length-2],r=i.getAttribute("aria-posinset"),n=t===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||e.relatedTarget!==s)return;let o,a;if(t===0?(o=i,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=i,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let h=this._createAccessibilityTreeNode();this._rowElements.unshift(h),this._rowContainer.insertAdjacentElement("afterbegin",h)}else{let h=this._createAccessibilityTreeNode();this._rowElements.push(h),this._rowContainer.appendChild(h)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let s=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:s,offset:s.textContent?.length??0}),!this._rowContainer.contains(i.node))return;let r=({node:a,offset:h})=>{let l=a instanceof Text?a.parentNode:a,d=parseInt(l?.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let c=this._rowColumns.get(l);if(!c)return console.warn("columns is null. Race condition?"),null;let f=h<c.length?c[h]:c.slice(-1)[0]+1;return f>=this._terminal.cols&&(++d,f=0),{row:d,column:f}},n=r(t),o=r(i);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let 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){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}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]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,i=this._rowColumns.get(e)?.slice(-1)?.[0];if(!i)return;let s=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${s/t})`}};Ks=ge([O(1,wn),O(2,Ot),O(3,It)],Ks);var mn=class extends G{constructor(e,t,i,s,r){super();this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new T),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new T),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(le(()=>{pi(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(U(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(U(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(U(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(U(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let i=e.composedPath();for(let s=0;s<i.length;s++){let r=i[s];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach((s)=>{s?.forEach((r)=>{r.link.dispose&&r.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[s,r]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(s)&&(i=this._checkLinkProviderResult(s,e,i)):r.provideLinks(e.y,(n)=>{if(this._isMouseOut)return;let o=n?.map((a)=>({link:a}));this._activeProviderReplies?.set(s,o),i=this._checkLinkProviderResult(s,e,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let s=0;s<t.size;s++){let r=t.get(s);if(r)for(let n=0;n<r.length;n++){let o=r[n],a=o.link.range.start.y<e?0:o.link.range.start.x,h=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let l=a;l<=h;l++){if(i.has(l)){r.splice(n--,1);break}i.add(l)}}}}_checkLinkProviderResult(e,t,i){if(!this._activeProviderReplies)return i;let s=this._activeProviderReplies.get(e),r=!1;for(let n=0;n<e;n++)(!this._activeProviderReplies.has(n)||this._activeProviderReplies.get(n))&&(r=!0);if(!r&&s){let n=s.find((o)=>this._linkAtPosition(o.link,t));n&&(i=!0,this._handleNewLink(n))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let n=0;n<this._activeProviderReplies.size;n++){let o=this._activeProviderReplies.get(n)?.find((a)=>this._linkAtPosition(a.link,t));if(o){i=!0,this._handleNewLink(o);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&j_(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,pi(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:(i)=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:(i)=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((i)=>{if(!this._currentLink)return;let s=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-s-1,i.end.x,i.end.y-s-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,s=e.range.end.y*this._bufferService.cols+e.range.end.x,r=t.y*this._bufferService.cols+t.x;return i<=r&&r<=s}_positionFromMouseEvent(e,t,i){let s=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,s,r){return{x1:e,y1:t,x2:i,y2:s,cols:this._bufferService.cols,fg:r}}};mn=ge([O(1,Sn),O(2,It),O(3,Ke),O(4,Ka)],mn);function j_(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Y_=class extends z_{constructor(e={}){super(e);this._linkifier=this._register(new xi),this.browser=lh,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new xi),this._onCursorMove=this._register(new T),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new T),this.onKey=this._onKey.event,this._onRender=this._register(new T),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new T),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new T),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new T),this.onBell=this._onBell.event,this._onFocus=this._register(new T),this._onBlur=this._register(new T),this._onA11yCharEmitter=this._register(new T),this._onA11yTabEmitter=this._register(new T),this._onWillOpen=this._register(new T),this._setup(),this._decorationService=this._instantiationService.createInstance(K_),this._instantiationService.setService(hs,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Nu),this._instantiationService.setService(Ka,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(qr)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows((t)=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport((t)=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor((t)=>this._handleColorEvent(t))),this._register(Ie.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ie.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ie.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ie.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize((t)=>this._afterResize(t.cols,t.rows))),this._register(le(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}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}_handleColorEvent(e){if(this._themeService)for(let t of e){let i,s="";switch(t.index){case 256:i="foreground",s="10";break;case 257:i="background",s="11";break;case 258:i="cursor",s="12";break;default:i="ansi",s="4;"+t.index}switch(t.type){case 0:let r=he.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${M.ESC}]${s};${P_(r)}${ah.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors((n)=>n.ansi[t.index]=Se.toColor(...t.color));else{let n=i;this._themeService.modifyColors((o)=>o[n]=Se.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ks,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(M.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(M.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let i=Math.min(this.buffer.x,this.cols-1),s=this._renderService.dimensions.css.cell.height,r=t.getWidth(i),n=this._renderService.dimensions.css.cell.width*r,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=n+"px",this.textarea.style.height=s+"px",this.textarea.style.lineHeight=s+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(U(this.element,"copy",(t)=>{this.hasSelection()&&kc(t,this._selectionService)}));let e=(t)=>Lc(t,this.textarea,this.coreService,this.optionsService);this._register(U(this.textarea,"paste",e)),this._register(U(this.element,"paste",e)),ch?this._register(U(this.element,"mousedown",(t)=>{t.button===2&&Oo(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(U(this.element,"contextmenu",(t)=>{Oo(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Mn&&this._register(U(this.element,"auxclick",(t)=>{t.button===1&&Fa(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(U(this.textarea,"keyup",(e)=>this._keyUp(e),!0)),this._register(U(this.textarea,"keydown",(e)=>this._keyDown(e),!0)),this._register(U(this.textarea,"keypress",(e)=>this._keyPress(e),!0)),this._register(U(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(U(this.textarea,"compositionupdate",(e)=>this._compositionHelper.compositionupdate(e))),this._register(U(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(U(this.textarea,"input",(e)=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.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"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(U(this.screenElement,"mousemove",(r)=>this.updateCursorStyle(r))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",$r.get()),_h||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._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Ou,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Ot,this._coreBrowserService),this._register(U(this.textarea,"focus",(r)=>this._handleTextAreaFocus(r))),this._register(U(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(an,this._document,this._helperContainer),this._instantiationService.setService(Vs,this._charSizeService),this._themeService=this._instantiationService.createInstance(dn),this._instantiationService.setService(ki,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Hs),this._instantiationService.setService(Ua,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(ln,this.rows,this.screenElement)),this._instantiationService.setService(It,this._renderService),this._register(this._renderService.onRenderedViewportChange((r)=>this._onRender.fire(r))),this.onResize((r)=>this._renderService.resize(r.cols,r.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(rn,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(hn),this._instantiationService.setService(Sn,this._mouseService);let s=this._linkifier.value=this._register(this._instantiationService.createInstance(mn,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),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._viewport=this._register(this._instantiationService.createInstance(tn,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines((r)=>{super.scrollLines(r,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(cn,this.element,this.screenElement,s)),this._instantiationService.setService(Pc,this._selectionService),this._register(this._selectionService.onRequestScrollLines((r)=>this.scrollLines(r.amount,r.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw((r)=>this._renderService.handleSelectionChanged(r.start,r.end,r.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection((r)=>{this.textarea.value=r,this.textarea.focus(),this.textarea.select()})),this._register(Ie.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(sn,this.screenElement)),this._register(U(this.element,"mousedown",(r)=>this._selectionService.handleMouseDown(r))),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(Ks,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",(r)=>this._handleScreenReaderModeOptionChange(r))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(zs,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",(r)=>{!this._overviewRulerRenderer&&r&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(zs,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(on,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(n){let o=e._mouseService.getMouseReportCoords(n,e.screenElement);if(!o)return!1;let a,h;switch(n.overrideType||n.type){case"mousemove":h=32,n.buttons===void 0?(a=3,n.button!==void 0&&(a=n.button<3?n.button:3)):a=n.buttons&1?0:n.buttons&4?1:n.buttons&2?2:3;break;case"mouseup":h=0,a=n.button<3?n.button:3;break;case"mousedown":h=1,a=n.button<3?n.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(n)===!1)return!1;let l=n.deltaY;if(l===0||e.coreMouseService.consumeWheelEvent(n,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;h=l<0?0:1,a=4;break;default:return!1}return h===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:h,ctrl:n.ctrlKey,alt:n.altKey,shift:n.shiftKey})}let s={mouseup:null,wheel:null,mousedrag:null,mousemove:null},r={mouseup:(n)=>(i(n),n.buttons||(this._document.removeEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.removeEventListener("mousemove",s.mousedrag)),this.cancel(n)),wheel:(n)=>(i(n),this.cancel(n,!0)),mousedrag:(n)=>{n.buttons&&i(n)},mousemove:(n)=>{n.buttons||i(n)}};this._register(this.coreMouseService.onProtocolChange((n)=>{n?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(n)),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()),n&8?s.mousemove||(t.addEventListener("mousemove",r.mousemove),s.mousemove=r.mousemove):(t.removeEventListener("mousemove",s.mousemove),s.mousemove=null),n&16?s.wheel||(t.addEventListener("wheel",r.wheel,{passive:!1}),s.wheel=r.wheel):(t.removeEventListener("wheel",s.wheel),s.wheel=null),n&2?s.mouseup||(s.mouseup=r.mouseup):(this._document.removeEventListener("mouseup",s.mouseup),s.mouseup=null),n&4?s.mousedrag||(s.mousedrag=r.mousedrag):(this._document.removeEventListener("mousemove",s.mousedrag),s.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(U(t,"mousedown",(n)=>{if(n.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(n)))return i(n),s.mouseup&&this._document.addEventListener("mouseup",s.mouseup),s.mousedrag&&this._document.addEventListener("mousemove",s.mousedrag),this.cancel(n)})),this._register(U(t,"wheel",(n)=>{if(!s.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(n)===!1)return!1;if(!this.buffer.hasScrollback){if(n.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(n,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(n,!0);let o=M.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(n.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(o,!0),this.cancel(n,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?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(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Na(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,i){this._selectionService.setSelection(e,t,i)}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(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let i=$_(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let s=this.rows-1;return this.scrollLines(i.type===2?-s:s),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((i.key===M.ETX||i.key===M.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(X_(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(we));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(M.ESC+"[I"):this.coreService.triggerDataEvent(M.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${M.ESC}[4;${i};${t}t`);break;case 1:let s=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${M.ESC}[6;${r};${s}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function X_(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Z_=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(t===-1)throw Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},J_=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new _t)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},Oa=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,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(e){let t=this._buffer.lines.get(e);if(t)return new J_(t)}getNullCell(){return new _t}},Q_=class extends G{constructor(e){super();this._core=e,this._onBufferChange=this._register(new T),this.onBufferChange=this._onBufferChange.event,this._normal=new Oa(this._core.buffers.normal,"normal"),this._alternate=new Oa(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 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)}},ef=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,(i)=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,s)=>t(i,s.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},tf=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},sf=["cols","rows"],St=0,bh=class extends G{constructor(e){super(),this._core=this._register(new Y_(e)),this._addonManager=this._register(new Z_),this._publicOptions={...this._core.options};let t=(s)=>this._core.options[s],i=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:t.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(e){if(sf.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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 ef(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new tf(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 Q_(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
37
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return $r.get()},set promptLabel(e){$r.set(e)},get tooMuchOutput(){return Ur.get()},set tooMuchOutput(e){Ur.set(e)}}}_verifyIntegers(...e){for(St of e)if(St===1/0||isNaN(St)||St%1!==0)throw Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(St of e)if(St&&(St===1/0||isNaN(St)||St%1!==0||St<0))throw Error("This API only accepts positive integers")}};var rf=2,nf=1,yh=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(i.getPropertyValue("height")),r=Math.max(0,parseInt(i.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},a=o.top+o.bottom,h=o.right+o.left,l=s-a,d=r-h-t;return{cols:Math.max(rf,Math.floor(d/e.css.cell.width)),rows:Math.max(nf,Math.floor(l/e.css.cell.height))}}};var{defineProperty:of,getOwnPropertyDescriptor:af}=Object,hf=(e,t,i,s)=>{for(var r=s>1?void 0:s?af(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&of(t,i,r),r},lf=(e,t)=>(i,s)=>t(i,s,e),cf=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ch.isErrorNoTelemetry(e)?new Ch(e.message+`
|
|
38
38
|
|
|
39
39
|
`+e.stack):Error(e.message+`
|
|
40
40
|
|
|
41
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach((t)=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},
|
|
42
|
-
`).map((c)=>c.trim().replace("at ","")).filter((c)=>c!=="");return
|
|
43
|
-
`),
|
|
44
|
-
`)).size}/${s.length} leaks) at ${f}`;let
|
|
45
|
-
`)),
|
|
41
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach((t)=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},df=new cf;function tr(e){uf(e)||df.onUnexpectedError(e)}var Un="Canceled";function uf(e){return e instanceof _f?!0:e instanceof Error&&e.name===Un&&e.message===Un}var _f=class extends Error{constructor(){super(Un),this.name=this.message}},Ch=class e extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e)return t;let i=new e;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function ff(e,t,i=0,s=e.length){let r=i,n=s;for(;r<n;){let o=Math.floor((r+n)/2);t(e[o])?r=o+1:n=o}return r-1}var gf=class e{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let s of this._array)if(this._prevFindLastPredicate(s)&&!t(s))throw Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=ff(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};gf.assertInvariants=!1;var ol;((e)=>{function t(n){return n<0}e.isLessThan=t;function i(n){return n<=0}e.isLessThanOrEqual=i;function s(n){return n>0}e.isGreaterThan=s;function r(n){return n===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(ol||={});function pf(e,t){return(i,s)=>t(e(i),e(s))}var vf=(e,t)=>e-t,xh=class e{constructor(t){this.iterate=t}forEach(t){this.iterate((i)=>(t(i),!0))}toArray(){let t=[];return this.iterate((i)=>(t.push(i),!0)),t}filter(t){return new e((i)=>this.iterate((s)=>t(s)?i(s):!0))}map(t){return new e((i)=>this.iterate((s)=>i(t(s))))}some(t){let i=!1;return this.iterate((s)=>(i=t(s),!i)),i}findFirst(t){let i;return this.iterate((s)=>t(s)?(i=s,!1):!0),i}findLast(t){let i;return this.iterate((s)=>(t(s)&&(i=s),!0)),i}findLastMaxBy(t){let i,s=!0;return this.iterate((r)=>((s||ol.isGreaterThan(t(r,i)))&&(s=!1,i=r),!0)),i}};xh.empty=new xh((e)=>{});function mf(e,t){let i=Object.create(null);for(let s of e){let r=t(s),n=i[r];n||(n=i[r]=[]),n.push(s)}return i}var kh,Lh,M1=class{constructor(e,t){this.toKey=t,this._map=new Map,this[kh]="SetWithKey";for(let i of e)this.add(i)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach((i)=>e.call(t,i,i,this))}[(Lh=Symbol.iterator,kh=Symbol.toStringTag,Lh)](){return this.values()}},wf=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}};function Sf(e,t){let i=this,s=!1,r;return function(){if(s)return r;if(s=!0,t)try{r=e.apply(i,arguments)}finally{t()}else r=e.apply(i,arguments);return r}}var al;((e)=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function s(){return i}e.empty=s;function*r(b){yield b}e.single=r;function n(b){return t(b)?b:r(b)}e.wrap=n;function o(b){return b||i}e.from=o;function*a(b){for(let x=b.length-1;x>=0;x--)yield b[x]}e.reverse=a;function h(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=h;function l(b){return b[Symbol.iterator]().next().value}e.first=l;function d(b,x){let L=0;for(let N of b)if(x(N,L++))return!0;return!1}e.some=d;function c(b,x){for(let L of b)if(x(L))return L}e.find=c;function*f(b,x){for(let L of b)x(L)&&(yield L)}e.filter=f;function*g(b,x){let L=0;for(let N of b)yield x(N,L++)}e.map=g;function*v(b,x){let L=0;for(let N of b)yield*x(N,L++)}e.flatMap=v;function*y(...b){for(let x of b)yield*x}e.concat=y;function E(b,x,L){let N=L;for(let q of b)N=x(N,q);return N}e.reduce=E;function*R(b,x,L=b.length){for(x<0&&(x+=b.length),L<0?L+=b.length:L>b.length&&(L=b.length);x<L;x++)yield b[x]}e.slice=R;function P(b,x=Number.POSITIVE_INFINITY){let L=[];if(x===0)return[L,b];let N=b[Symbol.iterator]();for(let q=0;q<x;q++){let Y=N.next();if(Y.done)return[L,e.empty()];L.push(Y.value)}return[L,{[Symbol.iterator](){return N}}]}e.consume=P;async function A(b){let x=[];for await(let L of b)x.push(L);return Promise.resolve(x)}e.asyncToArray=A})(al||={});var bf=!1,Ai=null,yf=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let i=this.livingDisposables.get(t);return i||(i={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,i)),i}trackDisposable(t){let i=this.getDisposableData(t);i.source||(i.source=Error().stack)}setParent(t,i){let s=this.getDisposableData(t);s.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let s=i.get(t);if(s)return s;let r=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,r),r}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,i])=>i.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,i){let s;if(i)s=i;else{let h=new Map,l=[...this.livingDisposables.values()].filter((c)=>c.source!==null&&!this.getRootParent(c,h).isSingleton);if(l.length===0)return;let d=new Set(l.map((c)=>c.value));if(s=l.filter((c)=>!(c.parent&&d.has(c.parent))),s.length===0)throw Error("There are cyclic diposable chains!")}if(!s)return;function r(h){function l(c,f){for(;c.length>0&&f.some((g)=>typeof g=="string"?g===c[0]:c[0].match(g));)c.shift()}let d=h.source.split(`
|
|
42
|
+
`).map((c)=>c.trim().replace("at ","")).filter((c)=>c!=="");return l(d,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),d.reverse()}let n=new wf;for(let h of s){let l=r(h);for(let d=0;d<=l.length;d++)n.add(l.slice(0,d).join(`
|
|
43
|
+
`),h)}s.sort(pf((h)=>h.idx,vf));let o="",a=0;for(let h of s.slice(0,t)){a++;let l=r(h),d=[];for(let c=0;c<l.length;c++){let f=l[c];f=`(shared with ${n.get(l.slice(0,c+1).join(`
|
|
44
|
+
`)).size}/${s.length} leaks) at ${f}`;let g=n.get(l.slice(0,c).join(`
|
|
45
|
+
`)),v=mf([...g].map((y)=>r(y)[c]),(y)=>y);delete v[l[c]];for(let[y,E]of Object.entries(v))d.unshift(` - stacktraces of ${E.length} other leaks continue with ${y}`);d.unshift(f)}o+=`
|
|
46
46
|
|
|
47
47
|
|
|
48
|
-
==================== Leaking disposable ${a}/${s.length}: ${
|
|
48
|
+
==================== Leaking disposable ${a}/${s.length}: ${h.value.constructor.name} ====================
|
|
49
49
|
${d.join(`
|
|
50
50
|
`)}
|
|
51
51
|
============================================================
|
|
@@ -55,12 +55,12 @@ ${d.join(`
|
|
|
55
55
|
|
|
56
56
|
... and ${s.length-t} more leaking disposables
|
|
57
57
|
|
|
58
|
-
`),{leaks:s,details:o}}};mf.idx=0;function wf(e){Li=e}if(vf){let e="__is_disposable_tracked__";wf(new class{trackDisposable(t){let i=Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3000)}setParent(t,i){if(t&&t!==rt.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==rt.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function or(e){return Li?.trackDisposable(e),e}function ar(e){Li?.markAsDisposed(e)}function _s(e,t){Li?.setParent(e,t)}function Sf(e,t){if(Li)for(let i of e)Li.setParent(i,t)}function sl(e){if(il.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function rl(...e){let t=We(()=>sl(e));return Sf(e,t),t}function We(e){let t=or({dispose:pf(()=>{ar(t),e()})});return t}var nl=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,or(this)}dispose(){this._isDisposed||(ar(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{sl(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error("Cannot register a disposable on itself!");return _s(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),_s(t,null))}};nl.DISABLE_DISPOSED_WARNING=!1;var ki=nl,rt=class{constructor(){this._store=new ki,or(this),_s(this._store,this)}dispose(){ar(this),this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}};rt.None=Object.freeze({dispose(){}});var as=class{constructor(){this._isDisposed=!1,or(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&_s(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,ar(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&_s(e,null),e}},qn=typeof process<"u"&&"title"in process,gs=qn?"node":navigator.userAgent,Vn=qn?"node":navigator.platform,bf=gs.includes("Firefox"),yf=gs.includes("Edge"),ol=/^((?!chrome|android).)*safari/i.test(gs);function Cf(){if(!ol)return 0;let e=gs.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var C1=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Vn),x1=["Windows","Win16","Win32","WinCE"].includes(Vn),k1=Vn.indexOf("Linux")>=0,L1=/\bCrOS\b/.test(gs),xf="",Be=0,Pe=0,Oe=0,ge=0,ct={css:"#00000000",rgba:0},qe;((e)=>{function t(r,n,o,a){return a!==void 0?`#${_i(r)}${_i(n)}${_i(o)}${_i(a)}`:`#${_i(r)}${_i(n)}${_i(o)}`}e.toCss=t;function i(r,n,o,a=255){return(r<<24|n<<16|o<<8|a)>>>0}e.toRgba=i;function s(r,n,o,a){return{css:e.toCss(r,n,o,a),rgba:e.toRgba(r,n,o,a)}}e.toColor=s})(qe||={});var us;((e)=>{function t(l,h){if(ge=(h.rgba&255)/255,ge===1)return{css:h.css,rgba:h.rgba};let d=h.rgba>>24&255,c=h.rgba>>16&255,f=h.rgba>>8&255,p=l.rgba>>24&255,w=l.rgba>>16&255,y=l.rgba>>8&255;Be=p+Math.round((d-p)*ge),Pe=w+Math.round((c-w)*ge),Oe=y+Math.round((f-y)*ge);let E=qe.toCss(Be,Pe,Oe),B=qe.toRgba(Be,Pe,Oe);return{css:E,rgba:B}}e.blend=t;function i(l){return(l.rgba&255)===255}e.isOpaque=i;function s(l,h,d){let c=fi.ensureContrastRatio(l.rgba,h.rgba,d);if(c)return qe.toColor(c>>24&255,c>>16&255,c>>8&255)}e.ensureContrastRatio=s;function r(l){let h=(l.rgba|255)>>>0;return[Be,Pe,Oe]=fi.toChannels(h),{css:qe.toCss(Be,Pe,Oe),rgba:h}}e.opaque=r;function n(l,h){return ge=Math.round(h*255),[Be,Pe,Oe]=fi.toChannels(l.rgba),{css:qe.toCss(Be,Pe,Oe,ge),rgba:qe.toRgba(Be,Pe,Oe,ge)}}e.opacity=n;function o(l,h){return ge=l.rgba&255,n(l,ge*h/255)}e.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}e.toColorRGB=a})(us||={});var kf;((e)=>{let t,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Be=parseInt(r.slice(1,2).repeat(2),16),Pe=parseInt(r.slice(2,3).repeat(2),16),Oe=parseInt(r.slice(3,4).repeat(2),16),qe.toColor(Be,Pe,Oe);case 5:return Be=parseInt(r.slice(1,2).repeat(2),16),Pe=parseInt(r.slice(2,3).repeat(2),16),Oe=parseInt(r.slice(3,4).repeat(2),16),ge=parseInt(r.slice(4,5).repeat(2),16),qe.toColor(Be,Pe,Oe,ge);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Be=parseInt(n[1]),Pe=parseInt(n[2]),Oe=parseInt(n[3]),ge=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),qe.toColor(Be,Pe,Oe,ge);if(!t||!i)throw Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=r,typeof t.fillStyle!="string")throw Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Be,Pe,Oe,ge]=t.getImageData(0,0,1,1).data,ge!==255)throw Error("css.toColor: Unsupported css format");return{rgba:qe.toRgba(Be,Pe,Oe,ge),css:r}}e.toColor=s})(kf||={});var Ke;((e)=>{function t(s){return i(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function i(s,r,n){let o=s/255,a=r/255,l=n/255,h=o<=0.03928?o/12.92:Math.pow((o+0.055)/1.055,2.4),d=a<=0.03928?a/12.92:Math.pow((a+0.055)/1.055,2.4),c=l<=0.03928?l/12.92:Math.pow((l+0.055)/1.055,2.4);return h*0.2126+d*0.7152+c*0.0722}e.relativeLuminance2=i})(Ke||={});var fi;((e)=>{function t(o,a){if(ge=(a&255)/255,ge===1)return a;let l=a>>24&255,h=a>>16&255,d=a>>8&255,c=o>>24&255,f=o>>16&255,p=o>>8&255;return Be=c+Math.round((l-c)*ge),Pe=f+Math.round((h-f)*ge),Oe=p+Math.round((d-p)*ge),qe.toRgba(Be,Pe,Oe)}e.blend=t;function i(o,a,l){let h=Ke.relativeLuminance(o>>8),d=Ke.relativeLuminance(a>>8);if(Tt(h,d)<l){if(d<h){let p=s(o,a,l),w=Tt(h,Ke.relativeLuminance(p>>8));if(w<l){let y=r(o,a,l),E=Tt(h,Ke.relativeLuminance(y>>8));return w>E?p:y}return p}let c=r(o,a,l),f=Tt(h,Ke.relativeLuminance(c>>8));if(f<l){let p=s(o,a,l),w=Tt(h,Ke.relativeLuminance(p>>8));return f>w?c:p}return c}}e.ensureContrastRatio=i;function s(o,a,l){let h=o>>24&255,d=o>>16&255,c=o>>8&255,f=a>>24&255,p=a>>16&255,w=a>>8&255,y=Tt(Ke.relativeLuminance2(f,p,w),Ke.relativeLuminance2(h,d,c));for(;y<l&&(f>0||p>0||w>0);)f-=Math.max(0,Math.ceil(f*0.1)),p-=Math.max(0,Math.ceil(p*0.1)),w-=Math.max(0,Math.ceil(w*0.1)),y=Tt(Ke.relativeLuminance2(f,p,w),Ke.relativeLuminance2(h,d,c));return(f<<24|p<<16|w<<8|255)>>>0}e.reduceLuminance=s;function r(o,a,l){let h=o>>24&255,d=o>>16&255,c=o>>8&255,f=a>>24&255,p=a>>16&255,w=a>>8&255,y=Tt(Ke.relativeLuminance2(f,p,w),Ke.relativeLuminance2(h,d,c));for(;y<l&&(f<255||p<255||w<255);)f=Math.min(255,f+Math.ceil((255-f)*0.1)),p=Math.min(255,p+Math.ceil((255-p)*0.1)),w=Math.min(255,w+Math.ceil((255-w)*0.1)),y=Tt(Ke.relativeLuminance2(f,p,w),Ke.relativeLuminance2(h,d,c));return(f<<24|p<<16|w<<8|255)>>>0}e.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=n})(fi||={});function _i(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Tt(e,t){return e<t?(t+0.05)/(e+0.05):(e+0.05)/(t+0.05)}function Se(e){if(!e)throw Error("value must not be falsy");return e}function jn(e){return 57508<=e&&e<=57558}function Lf(e){return 57520<=e&&e<=57527}function Ef(e){return 57344<=e&&e<=63743}function Mf(e){return 9472<=e&&e<=9631}function Df(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function Rf(e,t,i,s){return t===1&&i>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!Df(e)&&!jn(e)&&!Ef(e)}function al(e){return jn(e)||Mf(e)}function Af(){return{css:{canvas:js(),cell:js()},device:{canvas:js(),cell:js(),char:{width:0,height:0,left:0,top:0}}}}function js(){return{width:0,height:0}}function Tf(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var Fe=0,Te=0,St=!1,Bt=!1,Gs=!1,Xe,xn=0,Bf=class{constructor(e,t,i,s,r,n){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=s,this._coreBrowserService=r,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,s){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Te=0,Fe=0,Bt=!1,St=!1,Gs=!1,Xe=this._themeService.colors,xn=0,e.getCode()!==0&&e.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));xn=t*s%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",(r)=>{r.backgroundColorRGB&&(Te=r.backgroundColorRGB.rgba>>8&16777215,Bt=!0),r.foregroundColorRGB&&(Fe=r.foregroundColorRGB.rgba>>8&16777215,St=!0)}),Gs=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Gs){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Te=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Te=(this.result.fg&16777215)<<8|255;break;case 0:default:Te=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Te=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Te=(this.result.bg&16777215)<<8|255;break}Te=fi.blend(Te,(this._coreBrowserService.isFocused?Xe.selectionBackgroundOpaque:Xe.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Te=(this._coreBrowserService.isFocused?Xe.selectionBackgroundOpaque:Xe.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Bt=!0,Xe.selectionForeground&&(Fe=Xe.selectionForeground.rgba>>8&16777215,St=!0),al(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Fe=(this._coreBrowserService.isFocused?Xe.selectionBackgroundOpaque:Xe.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Fe=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Fe=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Fe=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Fe=(this.result.fg&16777215)<<8|255;break;case 0:default:Fe=this._themeService.colors.foreground.rgba}Fe=fi.blend(Fe,(this._coreBrowserService.isFocused?Xe.selectionBackgroundOpaque:Xe.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}St=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",(r)=>{r.backgroundColorRGB&&(Te=r.backgroundColorRGB.rgba>>8&16777215,Bt=!0),r.foregroundColorRGB&&(Fe=r.foregroundColorRGB.rgba>>8&16777215,St=!0)}),Bt&&(Gs?Te=e.bg&-16777216&-134217729|Te|50331648:Te=e.bg&-16777216|Te|50331648),St&&(Fe=e.fg&-16777216&-67108865|Fe|50331648),this.result.fg&67108864&&(Bt&&!St&&((this.result.bg&50331648)===0?Fe=this.result.fg&-134217728|Xe.background.rgba>>8&16777215&16777215|50331648:Fe=this.result.fg&-134217728|this.result.bg&67108863,St=!0),!Bt&&St&&((this.result.fg&50331648)===0?Te=this.result.bg&-67108864|Xe.foreground.rgba>>8&16777215&16777215|50331648:Te=this.result.bg&-67108864|this.result.fg&67108863,Bt=!0)),Xe=void 0,this.result.bg=Bt?Te:this.result.bg,this.result.fg=St?Fe:this.result.fg,this.result.ext&=536870911,this.result.ext|=xn<<29&3758096384}},Pf=0.5,hl=bf||yf?"bottom":"ideographic",Of={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\uD83E\uDF70":[{x:1,y:0,w:1,h:8}],"\uD83E\uDF71":[{x:2,y:0,w:1,h:8}],"\uD83E\uDF72":[{x:3,y:0,w:1,h:8}],"\uD83E\uDF73":[{x:4,y:0,w:1,h:8}],"\uD83E\uDF74":[{x:5,y:0,w:1,h:8}],"\uD83E\uDF75":[{x:6,y:0,w:1,h:8}],"\uD83E\uDF76":[{x:0,y:1,w:8,h:1}],"\uD83E\uDF77":[{x:0,y:2,w:8,h:1}],"\uD83E\uDF78":[{x:0,y:3,w:8,h:1}],"\uD83E\uDF79":[{x:0,y:4,w:8,h:1}],"\uD83E\uDF7A":[{x:0,y:5,w:8,h:1}],"\uD83E\uDF7B":[{x:0,y:6,w:8,h:1}],"\uD83E\uDF7C":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\uD83E\uDF7D":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\uD83E\uDF7E":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\uD83E\uDF7F":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\uD83E\uDF80":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"\uD83E\uDF81":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"\uD83E\uDF82":[{x:0,y:0,w:8,h:2}],"\uD83E\uDF83":[{x:0,y:0,w:8,h:3}],"\uD83E\uDF84":[{x:0,y:0,w:8,h:5}],"\uD83E\uDF85":[{x:0,y:0,w:8,h:6}],"\uD83E\uDF86":[{x:0,y:0,w:8,h:7}],"\uD83E\uDF87":[{x:6,y:0,w:2,h:8}],"\uD83E\uDF88":[{x:5,y:0,w:3,h:8}],"\uD83E\uDF89":[{x:3,y:0,w:5,h:8}],"\uD83E\uDF8A":[{x:2,y:0,w:6,h:8}],"\uD83E\uDF8B":[{x:1,y:0,w:7,h:8}],"\uD83E\uDF95":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"\uD83E\uDF96":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"\uD83E\uDF97":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},If={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},Nf={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${0.5-t} L1,${0.5-t} M0,${0.5+t} L1,${0.5+t}`},"║":{1:(e,t)=>`M${0.5-e},0 L${0.5-e},1 M${0.5+e},0 L${0.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${0.5-t} L1,${0.5-t} M.5,${0.5+t} L1,${0.5+t}`},"╓":{1:(e,t)=>`M${0.5-e},1 L${0.5-e},.5 L1,.5 M${0.5+e},.5 L${0.5+e},1`},"╔":{1:(e,t)=>`M1,${0.5-t} L${0.5-e},${0.5-t} L${0.5-e},1 M1,${0.5+t} L${0.5+e},${0.5+t} L${0.5+e},1`},"╕":{1:(e,t)=>`M0,${0.5-t} L.5,${0.5-t} L.5,1 M0,${0.5+t} L.5,${0.5+t}`},"╖":{1:(e,t)=>`M${0.5+e},1 L${0.5+e},.5 L0,.5 M${0.5-e},.5 L${0.5-e},1`},"╗":{1:(e,t)=>`M0,${0.5+t} L${0.5-e},${0.5+t} L${0.5-e},1 M0,${0.5-t} L${0.5+e},${0.5-t} L${0.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${0.5+t} L1,${0.5+t} M.5,${0.5-t} L1,${0.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${0.5-e},.5 L${0.5-e},0 M${0.5+e},.5 L${0.5+e},0`},"╚":{1:(e,t)=>`M1,${0.5-t} L${0.5+e},${0.5-t} L${0.5+e},0 M1,${0.5+t} L${0.5-e},${0.5+t} L${0.5-e},0`},"╛":{1:(e,t)=>`M0,${0.5+t} L.5,${0.5+t} L.5,0 M0,${0.5-t} L.5,${0.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${0.5+e},.5 L${0.5+e},0 M${0.5-e},.5 L${0.5-e},0`},"╝":{1:(e,t)=>`M0,${0.5-t} L${0.5-e},${0.5-t} L${0.5-e},0 M0,${0.5+t} L${0.5+e},${0.5+t} L${0.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${0.5-t} L1,${0.5-t} M.5,${0.5+t} L1,${0.5+t}`},"╟":{1:(e,t)=>`M${0.5-e},0 L${0.5-e},1 M${0.5+e},0 L${0.5+e},1 M${0.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${0.5-e},0 L${0.5-e},1 M1,${0.5+t} L${0.5+e},${0.5+t} L${0.5+e},1 M1,${0.5-t} L${0.5+e},${0.5-t} L${0.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${0.5-t} L.5,${0.5-t} M0,${0.5+t} L.5,${0.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${0.5-e},.5 M${0.5-e},0 L${0.5-e},1 M${0.5+e},0 L${0.5+e},1`},"╣":{1:(e,t)=>`M${0.5+e},0 L${0.5+e},1 M0,${0.5+t} L${0.5-e},${0.5+t} L${0.5-e},1 M0,${0.5-t} L${0.5-e},${0.5-t} L${0.5-e},0`},"╤":{1:(e,t)=>`M0,${0.5-t} L1,${0.5-t} M0,${0.5+t} L1,${0.5+t} M.5,${0.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${0.5-e},.5 L${0.5-e},1 M${0.5+e},.5 L${0.5+e},1`},"╦":{1:(e,t)=>`M0,${0.5-t} L1,${0.5-t} M0,${0.5+t} L${0.5-e},${0.5+t} L${0.5-e},1 M1,${0.5+t} L${0.5+e},${0.5+t} L${0.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${0.5-t} M0,${0.5-t} L1,${0.5-t} M0,${0.5+t} L1,${0.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${0.5-e},.5 L${0.5-e},0 M${0.5+e},.5 L${0.5+e},0`},"╩":{1:(e,t)=>`M0,${0.5+t} L1,${0.5+t} M0,${0.5-t} L${0.5-e},${0.5-t} L${0.5-e},0 M1,${0.5-t} L${0.5+e},${0.5-t} L${0.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${0.5-t} L1,${0.5-t} M0,${0.5+t} L1,${0.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${0.5-e},0 L${0.5-e},1 M${0.5+e},0 L${0.5+e},1`},"╬":{1:(e,t)=>`M0,${0.5+t} L${0.5-e},${0.5+t} L${0.5-e},1 M1,${0.5+t} L${0.5+e},${0.5+t} L${0.5+e},1 M0,${0.5-t} L${0.5-e},${0.5-t} L${0.5-e},0 M1,${0.5-t} L${0.5+e},${0.5-t} L${0.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${0.5+t/0.15*0.5} C.5,${0.5+t/0.15*0.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${0.5+t/0.15*0.5} C.5,${0.5+t/0.15*0.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${0.5-t/0.15*0.5} C.5,${0.5-t/0.15*0.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${0.5-t/0.15*0.5} C.5,${0.5-t/0.15*0.5},.5,.5,1,.5`}},fs={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};fs[""]=fs[""];fs[""]=fs[""];function Ff(e,t,i,s,r,n,o,a){let l=Of[t];if(l)return Wf(e,l,i,s,r,n),!0;let h=If[t];if(h)return zf(e,h,i,s,r,n),!0;let d=Nf[t];if(d)return Hf(e,d,i,s,r,n,a),!0;let c=fs[t];return c?($f(e,c,i,s,r,n,o,a),!0):!1}function Wf(e,t,i,s,r,n){for(let o=0;o<t.length;o++){let a=t[o],l=r/8,h=n/8;e.fillRect(i+a.x*l,s+a.y*h,a.w*l,a.h*h)}}var yh=new Map;function zf(e,t,i,s,r,n){let o=yh.get(t);o||(o=new Map,yh.set(t,o));let a=e.fillStyle;if(typeof a!="string")throw Error(`Unexpected fillStyle type "${a}"`);let l=o.get(a);if(!l){let h=t[0].length,d=t.length,c=e.canvas.ownerDocument.createElement("canvas");c.width=h,c.height=d;let f=Se(c.getContext("2d")),p=new ImageData(h,d),w,y,E,B;if(a.startsWith("#"))w=parseInt(a.slice(1,3),16),y=parseInt(a.slice(3,5),16),E=parseInt(a.slice(5,7),16),B=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[w,y,E,B]=a.substring(5,a.length-1).split(",").map((P)=>parseFloat(P));else throw Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);for(let P=0;P<d;P++)for(let R=0;R<h;R++)p.data[(P*h+R)*4]=w,p.data[(P*h+R)*4+1]=y,p.data[(P*h+R)*4+2]=E,p.data[(P*h+R)*4+3]=t[P][R]*(B*255);f.putImageData(p,0,0),l=Se(e.createPattern(c,null)),o.set(a,l)}e.fillStyle=l,e.fillRect(i,s,r,n)}function Hf(e,t,i,s,r,n,o){e.strokeStyle=e.fillStyle;for(let[a,l]of Object.entries(t)){e.beginPath(),e.lineWidth=o*Number.parseInt(a);let h;if(typeof l=="function"){let d=0.15/n*r;h=l(0.15,d)}else h=l;for(let d of h.split(" ")){let c=d[0],f=ll[c];if(!f){console.error(`Could not find drawing instructions for "${c}"`);continue}let p=d.substring(1).split(",");!p[0]||!p[1]||f(e,cl(p,r,n,i,s,!0,o))}e.stroke(),e.closePath()}}function $f(e,t,i,s,r,n,o,a){let l=new Path2D;l.rect(i,s,r,n),e.clip(l),e.beginPath();let h=o/12;e.lineWidth=a*h;for(let d of t.d.split(" ")){let c=d[0],f=ll[c];if(!f){console.error(`Could not find drawing instructions for "${c}"`);continue}let p=d.substring(1).split(",");!p[0]||!p[1]||f(e,cl(p,r,n,i,s,!1,a,(t.leftPadding??0)*(h/2),(t.rightPadding??0)*(h/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function Ch(e,t,i=0){return Math.max(Math.min(e,t),i)}var ll={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function cl(e,t,i,s,r,n,o,a=0,l=0){let h=e.map((d)=>parseFloat(d)||parseInt(d));if(h.length<2)throw Error("Too few arguments for instruction");for(let d=0;d<h.length;d+=2)h[d]*=t-a*o-l*o,n&&h[d]!==0&&(h[d]=Ch(Math.round(h[d]+0.5)-0.5,t,0)),h[d]+=s+a*o;for(let d=1;d<h.length;d+=2)h[d]*=i,n&&h[d]!==0&&(h[d]=Ch(Math.round(h[d]+0.5)-0.5,i,0)),h[d]+=r;return h}var xh=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},kh=class{constructor(){this._data=new xh}set(e,t,i,s,r){this._data.get(e,t)||this._data.set(e,t,new xh),this._data.get(e,t).set(i,s,r)}get(e,t,i,s){return this._data.get(e,t)?.get(i,s)}clear(){this._data.clear()}},dl=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),r=e.timeRemaining(),i*1.5>r){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=r}this.clear()}},Uf=class extends dl{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},Kf=class extends dl{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},qf=!qn&&"requestIdleCallback"in window?Kf:Uf,Ci=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ul}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ul=class e{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Lh=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Lh.Undefined=new Lh(void 0);var Vf=globalThis.performance&&typeof globalThis.performance.now=="function",jf=class e{static create(t){return new e(t)}constructor(t){this._now=Vf&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Gf=!1,Eh=!1,Yf=!1,Nt;((e)=>{e.None=()=>rt.None;function t(u){if(Yf){let{onDidAddListener:_}=u,S=zn.create(),g=0;u.onDidAddListener=()=>{++g===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),S.print()),_?.()}}}function i(u,_){return f(u,()=>{},0,void 0,!0,void 0,_)}e.defer=i;function s(u){return(_,S=null,g)=>{let m=!1,v;return v=u((C)=>{if(!m)return v?v.dispose():m=!0,_.call(S,C)},null,g),m&&v.dispose(),v}}e.once=s;function r(u,_,S){return d((g,m=null,v)=>u((C)=>g.call(m,_(C)),null,v),S)}e.map=r;function n(u,_,S){return d((g,m=null,v)=>u((C)=>{_(C),g.call(m,C)},null,v),S)}e.forEach=n;function o(u,_,S){return d((g,m=null,v)=>u((C)=>_(C)&&g.call(m,C),null,v),S)}e.filter=o;function a(u){return u}e.signal=a;function l(...u){return(_,S=null,g)=>{let m=rl(...u.map((v)=>v((C)=>_.call(S,C))));return c(m,g)}}e.any=l;function h(u,_,S,g){let m=S;return r(u,(v)=>(m=_(m,v),m),g)}e.reduce=h;function d(u,_){let S,g={onWillAddFirstListener(){S=u(m.fire,m)},onDidRemoveLastListener(){S?.dispose()}};_||t(g);let m=new se(g);return _?.add(m),m.event}function c(u,_){return _ instanceof Array?_.push(u):_&&_.add(u),u}function f(u,_,S=100,g=!1,m=!1,v,C){let k,D,U,H=0,q,ee={leakWarningThreshold:v,onWillAddFirstListener(){k=u((te)=>{H++,D=_(D,te),g&&!U&&(G.fire(D),D=void 0),q=()=>{let Z=D;D=void 0,U=void 0,(!g||H>1)&&G.fire(Z),H=0},typeof S=="number"?(clearTimeout(U),U=setTimeout(q,S)):U===void 0&&(U=0,queueMicrotask(q))})},onWillRemoveListener(){m&&H>0&&q?.()},onDidRemoveLastListener(){q=void 0,k.dispose()}};C||t(ee);let G=new se(ee);return C?.add(G),G.event}e.debounce=f;function p(u,_=0,S){return e.debounce(u,(g,m)=>g?(g.push(m),g):[m],_,void 0,!0,void 0,S)}e.accumulate=p;function w(u,_=(g,m)=>g===m,S){let g=!0,m;return o(u,(v)=>{let C=g||!_(v,m);return g=!1,m=v,C},S)}e.latch=w;function y(u,_,S){return[e.filter(u,_,S),e.filter(u,(g)=>!_(g),S)]}e.split=y;function E(u,_=!1,S=[],g){let m=S.slice(),v=u((D)=>{m?m.push(D):k.fire(D)});g&&g.add(v);let C=()=>{m?.forEach((D)=>k.fire(D)),m=null},k=new se({onWillAddFirstListener(){v||(v=u((D)=>k.fire(D)),g&&g.add(v))},onDidAddFirstListener(){m&&(_?setTimeout(C):C())},onDidRemoveLastListener(){v&&v.dispose(),v=null}});return g&&g.add(k),k.event}e.buffer=E;function B(u,_){return(S,g,m)=>{let v=_(new R);return u(function(C){let k=v.evaluate(C);k!==P&&S.call(g,k)},void 0,m)}}e.chain=B;let P=Symbol("HaltChainable");class R{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push((_)=>(u(_),_)),this}filter(u){return this.steps.push((_)=>u(_)?_:P),this}reduce(u,_){let S=_;return this.steps.push((g)=>(S=u(S,g),S)),this}latch(u=(_,S)=>_===S){let _=!0,S;return this.steps.push((g)=>{let m=_||!u(g,S);return _=!1,S=g,m?g:P}),this}evaluate(u){for(let _ of this.steps)if(u=_(u),u===P)break;return u}}function b(u,_,S=(g)=>g){let g=(...k)=>C.fire(S(...k)),m=()=>u.on(_,g),v=()=>u.removeListener(_,g),C=new se({onWillAddFirstListener:m,onDidRemoveLastListener:v});return C.event}e.fromNodeEventEmitter=b;function x(u,_,S=(g)=>g){let g=(...k)=>C.fire(S(...k)),m=()=>u.addEventListener(_,g),v=()=>u.removeEventListener(_,g),C=new se({onWillAddFirstListener:m,onDidRemoveLastListener:v});return C.event}e.fromDOMEventEmitter=x;function L(u){return new Promise((_)=>s(u)(_))}e.toPromise=L;function O(u){let _=new se;return u.then((S)=>{_.fire(S)},()=>{_.fire(void 0)}).finally(()=>{_.dispose()}),_.event}e.fromPromise=O;function V(u,_){return u((S)=>_.fire(S))}e.forward=V;function j(u,_,S){return _(S),u((g)=>_(g))}e.runAndSubscribe=j;class he{constructor(u,_){this._observable=u,this._counter=0,this._hasChanged=!1;let S={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};_||t(S),this.emitter=new se(S),_&&_.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,_){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function F(u,_){return new he(u,_).emitter.event}e.fromObservable=F;function be(u){return(_,S,g)=>{let m=0,v=!1,C={beginUpdate(){m++},endUpdate(){m--,m===0&&(u.reportChanges(),v&&(v=!1,_.call(S)))},handlePossibleChange(){},handleChange(){v=!0}};u.addObserver(C),u.reportChanges();let k={dispose(){u.removeObserver(C)}};return g instanceof ki?g.add(k):Array.isArray(g)&&g.push(k),k}}e.fromObservableLight=be})(Nt||={});var Wn=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(t){this._stopWatch=new jf,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Wn.all=new Set,Wn._idPool=0;var Xf=Wn,Mh=-1,_l=class e{constructor(t,i,s=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*0.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let l=new Jf(a,n);this._errorHandler(l)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,r]of this._stacks)(!t||i<r)&&(t=[s,r],i=r);return t}};_l._idPool=1;var Zf=_l,zn=class e{constructor(t){this.value=t}static create(){let t=Error();return new e(t.stack??"")}print(){console.warn(this.value.split(`
|
|
58
|
+
`),{leaks:s,details:o}}};yf.idx=0;function Cf(e){Ai=e}if(bf){let e="__is_disposable_tracked__";Cf(new class{trackDisposable(t){let i=Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3000)}setParent(t,i){if(t&&t!==lt.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==lt.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function cr(e){return Ai?.trackDisposable(e),e}function dr(e){Ai?.markAsDisposed(e)}function vs(e,t){Ai?.setParent(e,t)}function xf(e,t){if(Ai)for(let i of e)Ai.setParent(i,t)}function hl(e){if(al.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function ll(...e){let t=Fe(()=>hl(e));return xf(e,t),t}function Fe(e){let t=cr({dispose:Sf(()=>{dr(t),e()})});return t}var cl=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,cr(this)}dispose(){this._isDisposed||(dr(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{hl(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error("Cannot register a disposable on itself!");return vs(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),vs(t,null))}};cl.DISABLE_DISPOSED_WARNING=!1;var Ri=cl,lt=class{constructor(){this._store=new Ri,cr(this),vs(this._store,this)}dispose(){dr(this),this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}};lt.None=Object.freeze({dispose(){}});var ds=class{constructor(){this._isDisposed=!1,cr(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&vs(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,dr(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&vs(e,null),e}},Xn=typeof process<"u"&&"title"in process,ws=Xn?"node":navigator.userAgent,Zn=Xn?"node":navigator.platform,kf=ws.includes("Firefox"),Lf=ws.includes("Edge"),dl=/^((?!chrome|android).)*safari/i.test(ws);function Ef(){if(!dl)return 0;let e=ws.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var D1=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Zn),R1=["Windows","Win16","Win32","WinCE"].includes(Zn),A1=Zn.indexOf("Linux")>=0,T1=/\bCrOS\b/.test(ws),Mf="",Be=0,Pe=0,Oe=0,ve=0,ft={css:"#00000000",rgba:0},Ge;((e)=>{function t(r,n,o,a){return a!==void 0?`#${wi(r)}${wi(n)}${wi(o)}${wi(a)}`:`#${wi(r)}${wi(n)}${wi(o)}`}e.toCss=t;function i(r,n,o,a=255){return(r<<24|n<<16|o<<8|a)>>>0}e.toRgba=i;function s(r,n,o,a){return{css:e.toCss(r,n,o,a),rgba:e.toRgba(r,n,o,a)}}e.toColor=s})(Ge||={});var ps;((e)=>{function t(h,l){if(ve=(l.rgba&255)/255,ve===1)return{css:l.css,rgba:l.rgba};let d=l.rgba>>24&255,c=l.rgba>>16&255,f=l.rgba>>8&255,g=h.rgba>>24&255,v=h.rgba>>16&255,y=h.rgba>>8&255;Be=g+Math.round((d-g)*ve),Pe=v+Math.round((c-v)*ve),Oe=y+Math.round((f-y)*ve);let E=Ge.toCss(Be,Pe,Oe),R=Ge.toRgba(Be,Pe,Oe);return{css:E,rgba:R}}e.blend=t;function i(h){return(h.rgba&255)===255}e.isOpaque=i;function s(h,l,d){let c=Si.ensureContrastRatio(h.rgba,l.rgba,d);if(c)return Ge.toColor(c>>24&255,c>>16&255,c>>8&255)}e.ensureContrastRatio=s;function r(h){let l=(h.rgba|255)>>>0;return[Be,Pe,Oe]=Si.toChannels(l),{css:Ge.toCss(Be,Pe,Oe),rgba:l}}e.opaque=r;function n(h,l){return ve=Math.round(l*255),[Be,Pe,Oe]=Si.toChannels(h.rgba),{css:Ge.toCss(Be,Pe,Oe,ve),rgba:Ge.toRgba(Be,Pe,Oe,ve)}}e.opacity=n;function o(h,l){return ve=h.rgba&255,n(h,ve*l/255)}e.multiplyOpacity=o;function a(h){return[h.rgba>>24&255,h.rgba>>16&255,h.rgba>>8&255]}e.toColorRGB=a})(ps||={});var Df;((e)=>{let t,i;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Be=parseInt(r.slice(1,2).repeat(2),16),Pe=parseInt(r.slice(2,3).repeat(2),16),Oe=parseInt(r.slice(3,4).repeat(2),16),Ge.toColor(Be,Pe,Oe);case 5:return Be=parseInt(r.slice(1,2).repeat(2),16),Pe=parseInt(r.slice(2,3).repeat(2),16),Oe=parseInt(r.slice(3,4).repeat(2),16),ve=parseInt(r.slice(4,5).repeat(2),16),Ge.toColor(Be,Pe,Oe,ve);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Be=parseInt(n[1]),Pe=parseInt(n[2]),Oe=parseInt(n[3]),ve=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ge.toColor(Be,Pe,Oe,ve);if(!t||!i)throw Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=r,typeof t.fillStyle!="string")throw Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Be,Pe,Oe,ve]=t.getImageData(0,0,1,1).data,ve!==255)throw Error("css.toColor: Unsupported css format");return{rgba:Ge.toRgba(Be,Pe,Oe,ve),css:r}}e.toColor=s})(Df||={});var Ve;((e)=>{function t(s){return i(s>>16&255,s>>8&255,s&255)}e.relativeLuminance=t;function i(s,r,n){let o=s/255,a=r/255,h=n/255,l=o<=0.03928?o/12.92:Math.pow((o+0.055)/1.055,2.4),d=a<=0.03928?a/12.92:Math.pow((a+0.055)/1.055,2.4),c=h<=0.03928?h/12.92:Math.pow((h+0.055)/1.055,2.4);return l*0.2126+d*0.7152+c*0.0722}e.relativeLuminance2=i})(Ve||={});var Si;((e)=>{function t(o,a){if(ve=(a&255)/255,ve===1)return a;let h=a>>24&255,l=a>>16&255,d=a>>8&255,c=o>>24&255,f=o>>16&255,g=o>>8&255;return Be=c+Math.round((h-c)*ve),Pe=f+Math.round((l-f)*ve),Oe=g+Math.round((d-g)*ve),Ge.toRgba(Be,Pe,Oe)}e.blend=t;function i(o,a,h){let l=Ve.relativeLuminance(o>>8),d=Ve.relativeLuminance(a>>8);if(Nt(l,d)<h){if(d<l){let g=s(o,a,h),v=Nt(l,Ve.relativeLuminance(g>>8));if(v<h){let y=r(o,a,h),E=Nt(l,Ve.relativeLuminance(y>>8));return v>E?g:y}return g}let c=r(o,a,h),f=Nt(l,Ve.relativeLuminance(c>>8));if(f<h){let g=s(o,a,h),v=Nt(l,Ve.relativeLuminance(g>>8));return f>v?c:g}return c}}e.ensureContrastRatio=i;function s(o,a,h){let l=o>>24&255,d=o>>16&255,c=o>>8&255,f=a>>24&255,g=a>>16&255,v=a>>8&255,y=Nt(Ve.relativeLuminance2(f,g,v),Ve.relativeLuminance2(l,d,c));for(;y<h&&(f>0||g>0||v>0);)f-=Math.max(0,Math.ceil(f*0.1)),g-=Math.max(0,Math.ceil(g*0.1)),v-=Math.max(0,Math.ceil(v*0.1)),y=Nt(Ve.relativeLuminance2(f,g,v),Ve.relativeLuminance2(l,d,c));return(f<<24|g<<16|v<<8|255)>>>0}e.reduceLuminance=s;function r(o,a,h){let l=o>>24&255,d=o>>16&255,c=o>>8&255,f=a>>24&255,g=a>>16&255,v=a>>8&255,y=Nt(Ve.relativeLuminance2(f,g,v),Ve.relativeLuminance2(l,d,c));for(;y<h&&(f<255||g<255||v<255);)f=Math.min(255,f+Math.ceil((255-f)*0.1)),g=Math.min(255,g+Math.ceil((255-g)*0.1)),v=Math.min(255,v+Math.ceil((255-v)*0.1)),y=Nt(Ve.relativeLuminance2(f,g,v),Ve.relativeLuminance2(l,d,c));return(f<<24|g<<16|v<<8|255)>>>0}e.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=n})(Si||={});function wi(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Nt(e,t){return e<t?(t+0.05)/(e+0.05):(e+0.05)/(t+0.05)}function be(e){if(!e)throw Error("value must not be falsy");return e}function Jn(e){return 57508<=e&&e<=57558}function Rf(e){return 57520<=e&&e<=57527}function Af(e){return 57344<=e&&e<=63743}function Tf(e){return 9472<=e&&e<=9631}function Bf(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function Pf(e,t,i,s){return t===1&&i>Math.ceil(s*1.5)&&e!==void 0&&e>255&&!Bf(e)&&!Jn(e)&&!Af(e)}function ul(e){return Jn(e)||Tf(e)}function Of(){return{css:{canvas:Zs(),cell:Zs()},device:{canvas:Zs(),cell:Zs(),char:{width:0,height:0,left:0,top:0}}}}function Zs(){return{width:0,height:0}}function If(e,t,i=0){return(e-(Math.round(t)*2-i))%(Math.round(t)*2)}var Ne=0,Te=0,xt=!1,Ft=!1,Js=!1,Xe,Dn=0,Nf=class{constructor(e,t,i,s,r,n){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=s,this._coreBrowserService=r,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,s){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Te=0,Ne=0,Ft=!1,xt=!1,Js=!1,Xe=this._themeService.colors,Dn=0,e.getCode()!==0&&e.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));Dn=t*s%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",(r)=>{r.backgroundColorRGB&&(Te=r.backgroundColorRGB.rgba>>8&16777215,Ft=!0),r.foregroundColorRGB&&(Ne=r.foregroundColorRGB.rgba>>8&16777215,xt=!0)}),Js=this._selectionRenderModel.isCellSelected(this._terminal,t,i),Js){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Te=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Te=(this.result.fg&16777215)<<8|255;break;case 0:default:Te=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Te=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Te=(this.result.bg&16777215)<<8|255;break}Te=Si.blend(Te,(this._coreBrowserService.isFocused?Xe.selectionBackgroundOpaque:Xe.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Te=(this._coreBrowserService.isFocused?Xe.selectionBackgroundOpaque:Xe.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Ft=!0,Xe.selectionForeground&&(Ne=Xe.selectionForeground.rgba>>8&16777215,xt=!0),ul(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Ne=(this._coreBrowserService.isFocused?Xe.selectionBackgroundOpaque:Xe.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Ne=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Ne=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Ne=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Ne=(this.result.fg&16777215)<<8|255;break;case 0:default:Ne=this._themeService.colors.foreground.rgba}Ne=Si.blend(Ne,(this._coreBrowserService.isFocused?Xe.selectionBackgroundOpaque:Xe.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}xt=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",(r)=>{r.backgroundColorRGB&&(Te=r.backgroundColorRGB.rgba>>8&16777215,Ft=!0),r.foregroundColorRGB&&(Ne=r.foregroundColorRGB.rgba>>8&16777215,xt=!0)}),Ft&&(Js?Te=e.bg&-16777216&-134217729|Te|50331648:Te=e.bg&-16777216|Te|50331648),xt&&(Ne=e.fg&-16777216&-67108865|Ne|50331648),this.result.fg&67108864&&(Ft&&!xt&&((this.result.bg&50331648)===0?Ne=this.result.fg&-134217728|Xe.background.rgba>>8&16777215&16777215|50331648:Ne=this.result.fg&-134217728|this.result.bg&67108863,xt=!0),!Ft&&xt&&((this.result.fg&50331648)===0?Te=this.result.bg&-67108864|Xe.foreground.rgba>>8&16777215&16777215|50331648:Te=this.result.bg&-67108864|this.result.fg&67108863,Ft=!0)),Xe=void 0,this.result.bg=Ft?Te:this.result.bg,this.result.fg=xt?Ne:this.result.fg,this.result.ext&=536870911,this.result.ext|=Dn<<29&3758096384}},Ff=0.5,_l=kf||Lf?"bottom":"ideographic",Wf={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\uD83E\uDF70":[{x:1,y:0,w:1,h:8}],"\uD83E\uDF71":[{x:2,y:0,w:1,h:8}],"\uD83E\uDF72":[{x:3,y:0,w:1,h:8}],"\uD83E\uDF73":[{x:4,y:0,w:1,h:8}],"\uD83E\uDF74":[{x:5,y:0,w:1,h:8}],"\uD83E\uDF75":[{x:6,y:0,w:1,h:8}],"\uD83E\uDF76":[{x:0,y:1,w:8,h:1}],"\uD83E\uDF77":[{x:0,y:2,w:8,h:1}],"\uD83E\uDF78":[{x:0,y:3,w:8,h:1}],"\uD83E\uDF79":[{x:0,y:4,w:8,h:1}],"\uD83E\uDF7A":[{x:0,y:5,w:8,h:1}],"\uD83E\uDF7B":[{x:0,y:6,w:8,h:1}],"\uD83E\uDF7C":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\uD83E\uDF7D":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\uD83E\uDF7E":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\uD83E\uDF7F":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\uD83E\uDF80":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"\uD83E\uDF81":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"\uD83E\uDF82":[{x:0,y:0,w:8,h:2}],"\uD83E\uDF83":[{x:0,y:0,w:8,h:3}],"\uD83E\uDF84":[{x:0,y:0,w:8,h:5}],"\uD83E\uDF85":[{x:0,y:0,w:8,h:6}],"\uD83E\uDF86":[{x:0,y:0,w:8,h:7}],"\uD83E\uDF87":[{x:6,y:0,w:2,h:8}],"\uD83E\uDF88":[{x:5,y:0,w:3,h:8}],"\uD83E\uDF89":[{x:3,y:0,w:5,h:8}],"\uD83E\uDF8A":[{x:2,y:0,w:6,h:8}],"\uD83E\uDF8B":[{x:1,y:0,w:7,h:8}],"\uD83E\uDF95":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"\uD83E\uDF96":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"\uD83E\uDF97":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},zf={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},Hf={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${0.5-t} L1,${0.5-t} M0,${0.5+t} L1,${0.5+t}`},"║":{1:(e,t)=>`M${0.5-e},0 L${0.5-e},1 M${0.5+e},0 L${0.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${0.5-t} L1,${0.5-t} M.5,${0.5+t} L1,${0.5+t}`},"╓":{1:(e,t)=>`M${0.5-e},1 L${0.5-e},.5 L1,.5 M${0.5+e},.5 L${0.5+e},1`},"╔":{1:(e,t)=>`M1,${0.5-t} L${0.5-e},${0.5-t} L${0.5-e},1 M1,${0.5+t} L${0.5+e},${0.5+t} L${0.5+e},1`},"╕":{1:(e,t)=>`M0,${0.5-t} L.5,${0.5-t} L.5,1 M0,${0.5+t} L.5,${0.5+t}`},"╖":{1:(e,t)=>`M${0.5+e},1 L${0.5+e},.5 L0,.5 M${0.5-e},.5 L${0.5-e},1`},"╗":{1:(e,t)=>`M0,${0.5+t} L${0.5-e},${0.5+t} L${0.5-e},1 M0,${0.5-t} L${0.5+e},${0.5-t} L${0.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${0.5+t} L1,${0.5+t} M.5,${0.5-t} L1,${0.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${0.5-e},.5 L${0.5-e},0 M${0.5+e},.5 L${0.5+e},0`},"╚":{1:(e,t)=>`M1,${0.5-t} L${0.5+e},${0.5-t} L${0.5+e},0 M1,${0.5+t} L${0.5-e},${0.5+t} L${0.5-e},0`},"╛":{1:(e,t)=>`M0,${0.5+t} L.5,${0.5+t} L.5,0 M0,${0.5-t} L.5,${0.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${0.5+e},.5 L${0.5+e},0 M${0.5-e},.5 L${0.5-e},0`},"╝":{1:(e,t)=>`M0,${0.5-t} L${0.5-e},${0.5-t} L${0.5-e},0 M0,${0.5+t} L${0.5+e},${0.5+t} L${0.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${0.5-t} L1,${0.5-t} M.5,${0.5+t} L1,${0.5+t}`},"╟":{1:(e,t)=>`M${0.5-e},0 L${0.5-e},1 M${0.5+e},0 L${0.5+e},1 M${0.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${0.5-e},0 L${0.5-e},1 M1,${0.5+t} L${0.5+e},${0.5+t} L${0.5+e},1 M1,${0.5-t} L${0.5+e},${0.5-t} L${0.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${0.5-t} L.5,${0.5-t} M0,${0.5+t} L.5,${0.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${0.5-e},.5 M${0.5-e},0 L${0.5-e},1 M${0.5+e},0 L${0.5+e},1`},"╣":{1:(e,t)=>`M${0.5+e},0 L${0.5+e},1 M0,${0.5+t} L${0.5-e},${0.5+t} L${0.5-e},1 M0,${0.5-t} L${0.5-e},${0.5-t} L${0.5-e},0`},"╤":{1:(e,t)=>`M0,${0.5-t} L1,${0.5-t} M0,${0.5+t} L1,${0.5+t} M.5,${0.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${0.5-e},.5 L${0.5-e},1 M${0.5+e},.5 L${0.5+e},1`},"╦":{1:(e,t)=>`M0,${0.5-t} L1,${0.5-t} M0,${0.5+t} L${0.5-e},${0.5+t} L${0.5-e},1 M1,${0.5+t} L${0.5+e},${0.5+t} L${0.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${0.5-t} M0,${0.5-t} L1,${0.5-t} M0,${0.5+t} L1,${0.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${0.5-e},.5 L${0.5-e},0 M${0.5+e},.5 L${0.5+e},0`},"╩":{1:(e,t)=>`M0,${0.5+t} L1,${0.5+t} M0,${0.5-t} L${0.5-e},${0.5-t} L${0.5-e},0 M1,${0.5-t} L${0.5+e},${0.5-t} L${0.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${0.5-t} L1,${0.5-t} M0,${0.5+t} L1,${0.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${0.5-e},0 L${0.5-e},1 M${0.5+e},0 L${0.5+e},1`},"╬":{1:(e,t)=>`M0,${0.5+t} L${0.5-e},${0.5+t} L${0.5-e},1 M1,${0.5+t} L${0.5+e},${0.5+t} L${0.5+e},1 M0,${0.5-t} L${0.5-e},${0.5-t} L${0.5-e},0 M1,${0.5-t} L${0.5+e},${0.5-t} L${0.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${0.5+t/0.15*0.5} C.5,${0.5+t/0.15*0.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${0.5+t/0.15*0.5} C.5,${0.5+t/0.15*0.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${0.5-t/0.15*0.5} C.5,${0.5-t/0.15*0.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${0.5-t/0.15*0.5} C.5,${0.5-t/0.15*0.5},.5,.5,1,.5`}},ms={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};ms[""]=ms[""];ms[""]=ms[""];function $f(e,t,i,s,r,n,o,a){let h=Wf[t];if(h)return Uf(e,h,i,s,r,n),!0;let l=zf[t];if(l)return Kf(e,l,i,s,r,n),!0;let d=Hf[t];if(d)return qf(e,d,i,s,r,n,a),!0;let c=ms[t];return c?(Vf(e,c,i,s,r,n,o,a),!0):!1}function Uf(e,t,i,s,r,n){for(let o=0;o<t.length;o++){let a=t[o],h=r/8,l=n/8;e.fillRect(i+a.x*h,s+a.y*l,a.w*h,a.h*l)}}var Eh=new Map;function Kf(e,t,i,s,r,n){let o=Eh.get(t);o||(o=new Map,Eh.set(t,o));let a=e.fillStyle;if(typeof a!="string")throw Error(`Unexpected fillStyle type "${a}"`);let h=o.get(a);if(!h){let l=t[0].length,d=t.length,c=e.canvas.ownerDocument.createElement("canvas");c.width=l,c.height=d;let f=be(c.getContext("2d")),g=new ImageData(l,d),v,y,E,R;if(a.startsWith("#"))v=parseInt(a.slice(1,3),16),y=parseInt(a.slice(3,5),16),E=parseInt(a.slice(5,7),16),R=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[v,y,E,R]=a.substring(5,a.length-1).split(",").map((P)=>parseFloat(P));else throw Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);for(let P=0;P<d;P++)for(let A=0;A<l;A++)g.data[(P*l+A)*4]=v,g.data[(P*l+A)*4+1]=y,g.data[(P*l+A)*4+2]=E,g.data[(P*l+A)*4+3]=t[P][A]*(R*255);f.putImageData(g,0,0),h=be(e.createPattern(c,null)),o.set(a,h)}e.fillStyle=h,e.fillRect(i,s,r,n)}function qf(e,t,i,s,r,n,o){e.strokeStyle=e.fillStyle;for(let[a,h]of Object.entries(t)){e.beginPath(),e.lineWidth=o*Number.parseInt(a);let l;if(typeof h=="function"){let d=0.15/n*r;l=h(0.15,d)}else l=h;for(let d of l.split(" ")){let c=d[0],f=fl[c];if(!f){console.error(`Could not find drawing instructions for "${c}"`);continue}let g=d.substring(1).split(",");!g[0]||!g[1]||f(e,gl(g,r,n,i,s,!0,o))}e.stroke(),e.closePath()}}function Vf(e,t,i,s,r,n,o,a){let h=new Path2D;h.rect(i,s,r,n),e.clip(h),e.beginPath();let l=o/12;e.lineWidth=a*l;for(let d of t.d.split(" ")){let c=d[0],f=fl[c];if(!f){console.error(`Could not find drawing instructions for "${c}"`);continue}let g=d.substring(1).split(",");!g[0]||!g[1]||f(e,gl(g,r,n,i,s,!1,a,(t.leftPadding??0)*(l/2),(t.rightPadding??0)*(l/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function Mh(e,t,i=0){return Math.max(Math.min(e,t),i)}var fl={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function gl(e,t,i,s,r,n,o,a=0,h=0){let l=e.map((d)=>parseFloat(d)||parseInt(d));if(l.length<2)throw Error("Too few arguments for instruction");for(let d=0;d<l.length;d+=2)l[d]*=t-a*o-h*o,n&&l[d]!==0&&(l[d]=Mh(Math.round(l[d]+0.5)-0.5,t,0)),l[d]+=s+a*o;for(let d=1;d<l.length;d+=2)l[d]*=i,n&&l[d]!==0&&(l[d]=Mh(Math.round(l[d]+0.5)-0.5,i,0)),l[d]+=r;return l}var Dh=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Rh=class{constructor(){this._data=new Dh}set(e,t,i,s,r){this._data.get(e,t)||this._data.set(e,t,new Dh),this._data.get(e,t).set(i,s,r)}get(e,t,i,s){return this._data.get(e,t)?.get(i,s)}clear(){this._data.clear()}},pl=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),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(e){this._idleCallback=void 0;let t=0,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),r=e.timeRemaining(),i*1.5>r){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=r}this.clear()}},Gf=class extends pl{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},jf=class extends pl{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Yf=!Xn&&"requestIdleCallback"in window?jf:Gf,Mi=class e{constructor(){this.fg=0,this.bg=0,this.extended=new vl}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},vl=class e{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ah=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Ah.Undefined=new Ah(void 0);var Xf=globalThis.performance&&typeof globalThis.performance.now=="function",Zf=class e{static create(t){return new e(t)}constructor(t){this._now=Xf&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Jf=!1,Th=!1,Qf=!1,$t;((e)=>{e.None=()=>lt.None;function t(u){if(Qf){let{onDidAddListener:_}=u,w=qn.create(),p=0;u.onDidAddListener=()=>{++p===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),w.print()),_?.()}}}function i(u,_){return f(u,()=>{},0,void 0,!0,void 0,_)}e.defer=i;function s(u){return(_,w=null,p)=>{let S=!1,m;return m=u((C)=>{if(!S)return m?m.dispose():S=!0,_.call(w,C)},null,p),S&&m.dispose(),m}}e.once=s;function r(u,_,w){return d((p,S=null,m)=>u((C)=>p.call(S,_(C)),null,m),w)}e.map=r;function n(u,_,w){return d((p,S=null,m)=>u((C)=>{_(C),p.call(S,C)},null,m),w)}e.forEach=n;function o(u,_,w){return d((p,S=null,m)=>u((C)=>_(C)&&p.call(S,C),null,m),w)}e.filter=o;function a(u){return u}e.signal=a;function h(...u){return(_,w=null,p)=>{let S=ll(...u.map((m)=>m((C)=>_.call(w,C))));return c(S,p)}}e.any=h;function l(u,_,w,p){let S=w;return r(u,(m)=>(S=_(S,m),S),p)}e.reduce=l;function d(u,_){let w,p={onWillAddFirstListener(){w=u(S.fire,S)},onDidRemoveLastListener(){w?.dispose()}};_||t(p);let S=new ne(p);return _?.add(S),S.event}function c(u,_){return _ instanceof Array?_.push(u):_&&_.add(u),u}function f(u,_,w=100,p=!1,S=!1,m,C){let k,B,H,z=0,K,se={leakWarningThreshold:m,onWillAddFirstListener(){k=u((Q)=>{z++,B=_(B,Q),p&&!H&&(V.fire(B),B=void 0),K=()=>{let Z=B;B=void 0,H=void 0,(!p||z>1)&&V.fire(Z),z=0},typeof w=="number"?(clearTimeout(H),H=setTimeout(K,w)):H===void 0&&(H=0,queueMicrotask(K))})},onWillRemoveListener(){S&&z>0&&K?.()},onDidRemoveLastListener(){K=void 0,k.dispose()}};C||t(se);let V=new ne(se);return C?.add(V),V.event}e.debounce=f;function g(u,_=0,w){return e.debounce(u,(p,S)=>p?(p.push(S),p):[S],_,void 0,!0,void 0,w)}e.accumulate=g;function v(u,_=(p,S)=>p===S,w){let p=!0,S;return o(u,(m)=>{let C=p||!_(m,S);return p=!1,S=m,C},w)}e.latch=v;function y(u,_,w){return[e.filter(u,_,w),e.filter(u,(p)=>!_(p),w)]}e.split=y;function E(u,_=!1,w=[],p){let S=w.slice(),m=u((B)=>{S?S.push(B):k.fire(B)});p&&p.add(m);let C=()=>{S?.forEach((B)=>k.fire(B)),S=null},k=new ne({onWillAddFirstListener(){m||(m=u((B)=>k.fire(B)),p&&p.add(m))},onDidAddFirstListener(){S&&(_?setTimeout(C):C())},onDidRemoveLastListener(){m&&m.dispose(),m=null}});return p&&p.add(k),k.event}e.buffer=E;function R(u,_){return(w,p,S)=>{let m=_(new A);return u(function(C){let k=m.evaluate(C);k!==P&&w.call(p,k)},void 0,S)}}e.chain=R;let P=Symbol("HaltChainable");class A{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push((_)=>(u(_),_)),this}filter(u){return this.steps.push((_)=>u(_)?_:P),this}reduce(u,_){let w=_;return this.steps.push((p)=>(w=u(w,p),w)),this}latch(u=(_,w)=>_===w){let _=!0,w;return this.steps.push((p)=>{let S=_||!u(p,w);return _=!1,w=p,S?p:P}),this}evaluate(u){for(let _ of this.steps)if(u=_(u),u===P)break;return u}}function b(u,_,w=(p)=>p){let p=(...k)=>C.fire(w(...k)),S=()=>u.on(_,p),m=()=>u.removeListener(_,p),C=new ne({onWillAddFirstListener:S,onDidRemoveLastListener:m});return C.event}e.fromNodeEventEmitter=b;function x(u,_,w=(p)=>p){let p=(...k)=>C.fire(w(...k)),S=()=>u.addEventListener(_,p),m=()=>u.removeEventListener(_,p),C=new ne({onWillAddFirstListener:S,onDidRemoveLastListener:m});return C.event}e.fromDOMEventEmitter=x;function L(u){return new Promise((_)=>s(u)(_))}e.toPromise=L;function N(u){let _=new ne;return u.then((w)=>{_.fire(w)},()=>{_.fire(void 0)}).finally(()=>{_.dispose()}),_.event}e.fromPromise=N;function q(u,_){return u((w)=>_.fire(w))}e.forward=q;function Y(u,_,w){return _(w),u((p)=>_(p))}e.runAndSubscribe=Y;class oe{constructor(u,_){this._observable=u,this._counter=0,this._hasChanged=!1;let w={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};_||t(w),this.emitter=new ne(w),_&&_.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,_){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function F(u,_){return new oe(u,_).emitter.event}e.fromObservable=F;function Le(u){return(_,w,p)=>{let S=0,m=!1,C={beginUpdate(){S++},endUpdate(){S--,S===0&&(u.reportChanges(),m&&(m=!1,_.call(w)))},handlePossibleChange(){},handleChange(){m=!0}};u.addObserver(C),u.reportChanges();let k={dispose(){u.removeObserver(C)}};return p instanceof Ri?p.add(k):Array.isArray(p)&&p.push(k),k}}e.fromObservableLight=Le})($t||={});var Kn=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(t){this._stopWatch=new Zf,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Kn.all=new Set,Kn._idPool=0;var eg=Kn,Bh=-1,ml=class e{constructor(t,i,s=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*0.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let h=new ig(a,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,r]of this._stacks)(!t||i<r)&&(t=[s,r],i=r);return t}};ml._idPool=1;var tg=ml,qn=class e{constructor(t){this.value=t}static create(){let t=Error();return new e(t.stack??"")}print(){console.warn(this.value.split(`
|
|
59
59
|
`).slice(2).join(`
|
|
60
|
-
`))}},
|
|
61
|
-
`)),e.length=0)},3000),
|
|
60
|
+
`))}},ig=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},sg=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},rg=0,ir=class{constructor(e){this.value=e,this.id=rg++}},ng=2,og=(e,t)=>{if(e instanceof ir)t(e);else for(let i=0;i<e.length;i++){let s=e[i];s&&t(s)}},sr;if(Jf){let e=[];setInterval(()=>{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(`
|
|
61
|
+
`)),e.length=0)},3000),sr=new FinalizationRegistry((t)=>{typeof t=="string"&&e.push(t)})}var ne=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Bh>0||this._options?.leakWarningThreshold?new tg(e?.onListenerError??tr,this._options?.leakWarningThreshold??Bh):void 0,this._perfMon=this._options?._profName?new eg(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Th){let e=this._listeners;queueMicrotask(()=>{og(e,(t)=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new sg(`${a}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||tr)(l),lt.None}if(this._disposed)return lt.None;t&&(e=e.bind(t));let s=new ir(e),r,n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*0.2)&&(s.stack=qn.create(),r=this._leakageMon.check(s.stack,this._size+1)),Th&&(s.stack=n??qn.create()),this._listeners?this._listeners instanceof ir?(this._deliveryQueue??=new ag,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=Fe(()=>{sr?.unregister(o),r?.(),this._removeListener(s)});if(i instanceof Ri?i.add(o):Array.isArray(i)&&i.push(o),sr){let a=Error().stack.split(`
|
|
62
62
|
`).slice(2,3).join(`
|
|
63
|
-
`).trim(),l=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);Qs.register(o,l?.[2]??a,o)}return o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*tg<=t.length){let r=0;for(let n=0;n<t.length;n++)t[n]?t[r++]=t[n]:s&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=r}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||Zs;if(!i){e.value(t);return}try{e.value(t)}catch(s){i(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Js)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},sg=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Dh={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},hs=2,ls,Jt=class e{constructor(t,i,s){this._document=t,this._config=i,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new kh,this._cacheMapCombined=new kh,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Ci,this._textureSize=512,this._onAddTextureAtlasCanvas=new se,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new se,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=fl(t,this._config.deviceCellWidth*4+hs*2,this._config.deviceCellHeight+hs*2),this._tmpCtx=Se(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new qf;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let s=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,s)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let i=this._pages.filter((h)=>h.canvas.width*2<=(e.maxTextureSize||4096)).sort((h,d)=>d.canvas.width!==h.canvas.width?d.canvas.width-h.canvas.width:d.percentageUsed-h.percentageUsed),s=-1,r=0;for(let h=0;h<i.length;h++)if(i[h].canvas.width!==r)s=h,r=i[h].canvas.width;else if(h-s===3)break;let n=i.slice(s,s+4),o=n.map((h)=>h.glyphs[0].texturePage).sort((h,d)=>h>d?1:-1),a=this.pages.length-n.length,l=this._mergePages(n,a);l.version++;for(let h=o.length-1;h>=0;h--)this._deletePage(o[h]);this.pages.push(l),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(l.canvas)}let t=new kn(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let s=t[0].canvas.width*2,r=new kn(this._document,s,t);for(let[n,o]of t.entries()){let a=n*o.canvas.width%s,l=Math.floor(n/2)*o.canvas.height;r.ctx.drawImage(o.canvas,a,l);for(let d of o.glyphs)d.texturePage=i,d.sizeClipSpace.x=d.size.x/s,d.sizeClipSpace.y=d.size.y/s,d.texturePosition.x+=a,d.texturePosition.y+=l,d.texturePositionClipSpace.x=d.texturePosition.x/s,d.texturePositionClipSpace.y=d.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let h=this._activePages.indexOf(o);h!==-1&&this._activePages.splice(h,1)}return r}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let s=this._pages[i];for(let r of s.glyphs)r.texturePage--;s.version++}}getRasterizedGlyphCombinedChar(t,i,s,r,n,o){return this._getFromCacheMap(this._cacheMapCombined,t,i,s,r,n,o)}getRasterizedGlyph(t,i,s,r,n,o){return this._getFromCacheMap(this._cacheMap,t,i,s,r,n,o)}_getFromCacheMap(t,i,s,r,n,o,a){return ls=t.get(i,s,r,n),ls||(ls=this._drawToCache(i,s,r,n,o,a),t.set(i,s,r,n,ls)),ls}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,i,s,r){if(this._config.allowTransparency)return ct;let n;switch(t){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(i);break;case 50331648:let o=Ci.toColorRGB(i);n=qe.toColor(o[0],o[1],o[2]);break;case 0:default:s?n=us.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=us.opaque(n)),n}_getForegroundColor(t,i,s,r,n,o,a,l,h,d){let c=this._getMinimumContrastColor(t,i,s,r,n,o,a,h,l,d);if(c)return c;let f;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&h&&o<8&&(o+=8),f=this._getColorFromAnsiIndex(o);break;case 50331648:let p=Ci.toColorRGB(o);f=qe.toColor(p[0],p[1],p[2]);break;case 0:default:a?f=this._config.colors.background:f=this._config.colors.foreground}return this._config.allowTransparency&&(f=us.opaque(f)),l&&(f=us.multiplyOpacity(f,Pf)),f}_resolveBackgroundRgba(t,i,s){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,s,r){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,s,r,n,o,a,l,h,d){if(this._config.minimumContrastRatio===1||d)return;let c=this._getContrastCache(h),f=c.getColor(t,r);if(f!==void 0)return f||void 0;let p=this._resolveBackgroundRgba(i,s,a),w=this._resolveForegroundRgba(n,o,a,l),y=fi.ensureContrastRatio(p,w,this._config.minimumContrastRatio/(h?2:1));if(!y){c.setColor(t,r,null);return}let E=qe.toColor(y>>24&255,y>>16&255,y>>8&255);return c.setColor(t,r,E),E}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,s,r,n,o){let a=typeof t=="number"?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let l=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+hs*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let h=Math.min(this._config.deviceCellHeight+hs*4,this._textureSize);if(this._tmpCanvas.height<h&&(this._tmpCanvas.height=h),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=r,!!this._workAttributeData.isInvisible())return Dh;let d=!!this._workAttributeData.isBold(),c=!!this._workAttributeData.isInverse(),f=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),w=!!this._workAttributeData.isUnderline(),y=!!this._workAttributeData.isStrikethrough(),E=!!this._workAttributeData.isOverline(),B=this._workAttributeData.getFgColor(),P=this._workAttributeData.getFgColorMode(),R=this._workAttributeData.getBgColor(),b=this._workAttributeData.getBgColorMode();if(c){let k=B;B=R,R=k;let D=P;P=b,b=D}let x=this._getBackgroundColor(b,R,c,f);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let L=d?this._config.fontWeightBold:this._config.fontWeight,O=p?"italic":"";this._tmpCtx.font=`${O} ${L} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=hl;let V=a.length===1&&jn(a.charCodeAt(0)),j=a.length===1&&Lf(a.charCodeAt(0)),he=this._getForegroundColor(i,b,R,s,P,B,c,f,d,al(a.charCodeAt(0)));this._tmpCtx.fillStyle=he.css;let F=j?0:hs*2,be=!1;this._config.customGlyphs!==!1&&(be=Ff(this._tmpCtx,a,F,F,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let u=!V,_;if(typeof t=="number"?_=this._unicodeService.wcwidth(t):_=this._unicodeService.getStringCellWidth(t),w){this._tmpCtx.save();let k=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=k%2===1?0.5:0;if(this._tmpCtx.lineWidth=k,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())u=!1,this._tmpCtx.strokeStyle=`rgb(${Ci.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{u=!1;let te=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&te<8&&(te+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(te).css}this._tmpCtx.beginPath();let U=F,H=Math.ceil(F+this._config.deviceCharHeight)-D-(n?k*2:0),q=H+k,ee=H+k*2,G=this._workAttributeData.getUnderlineVariantOffset();for(let te=0;te<_;te++){this._tmpCtx.save();let Z=U+te*this._config.deviceCellWidth,re=U+(te+1)*this._config.deviceCellWidth,A=Z+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Z,H),this._tmpCtx.lineTo(re,H),this._tmpCtx.moveTo(Z,ee),this._tmpCtx.lineTo(re,ee);break;case 3:let Q=k<=1?ee:Math.ceil(F+this._config.deviceCharHeight-k/2)-D,de=k<=1?H:Math.ceil(F+this._config.deviceCharHeight+k/2)-D,W=new Path2D;W.rect(Z,H,this._config.deviceCellWidth,ee-H),this._tmpCtx.clip(W),this._tmpCtx.moveTo(Z-this._config.deviceCellWidth/2,q),this._tmpCtx.bezierCurveTo(Z-this._config.deviceCellWidth/2,de,Z,de,Z,q),this._tmpCtx.bezierCurveTo(Z,Q,A,Q,A,q),this._tmpCtx.bezierCurveTo(A,de,re,de,re,q),this._tmpCtx.bezierCurveTo(re,Q,re+this._config.deviceCellWidth/2,Q,re+this._config.deviceCellWidth/2,q);break;case 4:let Le=G===0?0:G>=k?k*2-G:k-G;!(G>=k)===!1||Le===0?(this._tmpCtx.setLineDash([Math.round(k),Math.round(k)]),this._tmpCtx.moveTo(Z+Le,H),this._tmpCtx.lineTo(re,H)):(this._tmpCtx.setLineDash([Math.round(k),Math.round(k)]),this._tmpCtx.moveTo(Z,H),this._tmpCtx.lineTo(Z+Le,H),this._tmpCtx.moveTo(Z+Le+k,H),this._tmpCtx.lineTo(re,H)),G=Tf(re-Z,k,G);break;case 5:let ve=0.6,Ie=0.3,ft=re-Z,Ve=Math.floor(ve*ft),je=Math.floor(Ie*ft),Ze=ft-Ve-je;this._tmpCtx.setLineDash([Ve,je,Ze]),this._tmpCtx.moveTo(Z,H),this._tmpCtx.lineTo(re,H);break;case 1:default:this._tmpCtx.moveTo(Z,H),this._tmpCtx.lineTo(re,H);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!be&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let te=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in te&&te.actualBoundingBoxDescent>0){this._tmpCtx.save();let Z=new Path2D;Z.rect(U,H-Math.ceil(k/2),this._config.deviceCellWidth*_,ee-H+Math.ceil(k/2)),this._tmpCtx.clip(Z),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(a,F,F+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(E){let k=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=k%2===1?0.5:0;this._tmpCtx.lineWidth=k,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(F,F+D),this._tmpCtx.lineTo(F+this._config.deviceCharWidth*_,F+D),this._tmpCtx.stroke()}if(be||this._tmpCtx.fillText(a,F,F+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let k=Ln(this._tmpCtx.getImageData(F,F,this._config.deviceCellWidth,this._config.deviceCellHeight),x,he,u);if(k)for(let D=1;D<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,F,F+this._config.deviceCharHeight-D),k=Ln(this._tmpCtx.getImageData(F,F,this._config.deviceCellWidth,this._config.deviceCellHeight),x,he,u),!!k);D++);}if(y){let k=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),D=this._tmpCtx.lineWidth%2===1?0.5:0;this._tmpCtx.lineWidth=k,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(F,F+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.lineTo(F+this._config.deviceCharWidth*_,F+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.stroke()}this._tmpCtx.restore();let S=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),g;if(this._config.allowTransparency?g=rg(S):g=Ln(S,x,he,u),g)return Dh;let m=this._findGlyphBoundingBox(S,this._workBoundingBox,l,j,be,F),v,C;for(;;){if(this._activePages.length===0){let k=this._createNewPage();v=k,C=k.currentRow,C.height=m.size.y;break}v=this._activePages[this._activePages.length-1],C=v.currentRow;for(let k of this._activePages)m.size.y<=k.currentRow.height&&(v=k,C=k.currentRow);for(let k=this._activePages.length-1;k>=0;k--)for(let D of this._activePages[k].fixedRows)D.height<=C.height&&m.size.y<=D.height&&(v=this._activePages[k],C=D);if(m.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new kn(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),v=this._overflowSizePage,C=this._overflowSizePage.currentRow,C.x+m.size.x>=v.canvas.width&&(C.x=0,C.y+=C.height,C.height=0);break}if(C.y+m.size.y>=v.canvas.height||C.height>m.size.y+2){let k=!1;if(v.currentRow.y+v.currentRow.height+m.size.y>=v.canvas.height){let D;for(let U of this._activePages)if(U.currentRow.y+U.currentRow.height+m.size.y<U.canvas.height){D=U;break}if(D)v=D;else if(e.maxAtlasPages&&this._pages.length>=e.maxAtlasPages&&C.y+m.size.y<=v.canvas.height&&C.height>=m.size.y&&C.x+m.size.x<=v.canvas.width)k=!0;else{let U=this._createNewPage();v=U,C=U.currentRow,C.height=m.size.y,k=!0}}k||(v.currentRow.height>0&&v.fixedRows.push(v.currentRow),C={x:0,y:v.currentRow.y+v.currentRow.height,height:m.size.y},v.fixedRows.push(C),v.currentRow={x:0,y:C.y+C.height,height:0})}if(C.x+m.size.x<=v.canvas.width)break;C===v.currentRow?(C.x=0,C.y+=C.height,C.height=0):v.fixedRows.splice(v.fixedRows.indexOf(C),1)}return m.texturePage=this._pages.indexOf(v),m.texturePosition.x=C.x,m.texturePosition.y=C.y,m.texturePositionClipSpace.x=C.x/v.canvas.width,m.texturePositionClipSpace.y=C.y/v.canvas.height,m.sizeClipSpace.x/=v.canvas.width,m.sizeClipSpace.y/=v.canvas.height,C.height=Math.max(C.height,m.size.y),C.x+=m.size.x,v.ctx.putImageData(S,m.texturePosition.x-this._workBoundingBox.left,m.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,m.size.x,m.size.y),v.addGlyph(m),v.version++,m}_findGlyphBoundingBox(t,i,s,r,n,o){i.top=0;let a=r?this._config.deviceCellHeight:this._tmpCanvas.height,l=r?this._config.deviceCellWidth:s,h=!1;for(let d=0;d<a;d++){for(let c=0;c<l;c++){let f=d*this._tmpCanvas.width*4+c*4+3;if(t.data[f]!==0){i.top=d,h=!0;break}}if(h)break}i.left=0,h=!1;for(let d=0;d<o+l;d++){for(let c=0;c<a;c++){let f=c*this._tmpCanvas.width*4+d*4+3;if(t.data[f]!==0){i.left=d,h=!0;break}}if(h)break}i.right=l,h=!1;for(let d=o+l-1;d>=o;d--){for(let c=0;c<a;c++){let f=c*this._tmpCanvas.width*4+d*4+3;if(t.data[f]!==0){i.right=d,h=!0;break}}if(h)break}i.bottom=a,h=!1;for(let d=a-1;d>=0;d--){for(let c=0;c<l;c++){let f=d*this._tmpCanvas.width*4+c*4+3;if(t.data[f]!==0){i.bottom=d,h=!0;break}}if(h)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+o+(r||n?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+o+(r||n?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},kn=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let s of i)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=fl(e,t,t),this.ctx=Se(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function Ln(e,t,i,s){let r=t.rgba>>>24,n=t.rgba>>>16&255,o=t.rgba>>>8&255,a=i.rgba>>>24,l=i.rgba>>>16&255,h=i.rgba>>>8&255,d=Math.floor((Math.abs(r-a)+Math.abs(n-l)+Math.abs(o-h))/12),c=!0;for(let f=0;f<e.data.length;f+=4)e.data[f]===r&&e.data[f+1]===n&&e.data[f+2]===o||s&&Math.abs(e.data[f]-r)+Math.abs(e.data[f+1]-n)+Math.abs(e.data[f+2]-o)<d?e.data[f+3]=0:c=!1;return c}function rg(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function fl(e,t,i){let s=e.createElement("canvas");return s.width=t,s.height=i,s}function ng(e,t,i,s,r,n,o,a){let l={foreground:n.foreground,background:n.background,cursor:ct,cursorAccent:ct,selectionForeground:ct,selectionBackgroundTransparent:ct,selectionBackgroundOpaque:ct,selectionInactiveBackgroundTransparent:ct,selectionInactiveBackgroundOpaque:ct,overviewRulerBorder:ct,scrollbarSliderBackground:ct,scrollbarSliderHoverBackground:ct,scrollbarSliderActiveBackground:ct,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:a,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:s,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:l}}function Rh(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function og(e){return(e&50331648)===16777216||(e&50331648)===33554432}var dt=[];function gl(e,t,i,s,r,n,o,a,l){let h=ng(s,r,n,o,t,i,a,l);for(let f=0;f<dt.length;f++){let p=dt[f],w=p.ownedBy.indexOf(e);if(w>=0){if(Rh(p.config,h))return p.atlas;p.ownedBy.length===1?(p.atlas.dispose(),dt.splice(f,1)):p.ownedBy.splice(w,1);break}}for(let f=0;f<dt.length;f++){let p=dt[f];if(Rh(p.config,h))return p.ownedBy.push(e),p.atlas}let d=e._core,c={atlas:new Jt(document,h,d.unicodeService),config:h,ownedBy:[e]};return dt.push(c),c.atlas}function Ah(e){for(let t=0;t<dt.length;t++){let i=dt[t].ownedBy.indexOf(e);if(i!==-1){dt[t].ownedBy.length===1?(dt[t].atlas.dispose(),dt.splice(t,1)):dt[t].ownedBy.splice(i,1);break}}}var Ys=600,ag=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=Ys){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Ys-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=Ys-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Ys)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function Th(e,t,i){let s=new t.ResizeObserver((r)=>{let n=r.find((l)=>l.target===e);if(!n)return;if(!("devicePixelContentBoxSize"in n)){s?.disconnect(),s=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,a=n.devicePixelContentBoxSize[0].blockSize;o>0&&a>0&&i(o,a)});try{s.observe(e,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return We(()=>s?.disconnect())}function hg(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Bh=class e extends Ci{constructor(){super(...arguments);this.content=0,this.fg=0,this.bg=0,this.extended=new ul,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?hg(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},pl=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function vl(e,t,i){let s=Se(e.createProgram());if(e.attachShader(s,Se(Ph(e,e.VERTEX_SHADER,t))),e.attachShader(s,Se(Ph(e,e.FRAGMENT_SHADER,i))),e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS))return s;console.error(e.getProgramInfoLog(s)),e.deleteProgram(s)}function Ph(e,t,i){let s=Se(e.createShader(t));if(e.shaderSource(s,i),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS))return s;console.error(e.getShaderInfoLog(s)),e.deleteShader(s)}function lg(e,t){let i=Math.min(e.length*2,t),s=new Float32Array(i);for(let r=0;r<e.length;r++)s[r]=e[r];return s}var cg=class{constructor(e){this.texture=e,this.version=-1}},dg=`#version 300 es
|
|
63
|
+
`).trim(),h=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);sr.register(o,h?.[2]??a,o)}return o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*ng<=t.length){let r=0;for(let n=0;n<t.length;n++)t[n]?t[r++]=t[n]:s&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=r}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||tr;if(!i){e.value(t);return}try{e.value(t)}catch(s){i(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof ir)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},ag=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ph={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},us=2,_s,si=class e{constructor(t,i,s){this._document=t,this._config=i,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new Rh,this._cacheMapCombined=new Rh,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Mi,this._textureSize=512,this._onAddTextureAtlasCanvas=new ne,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new ne,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=wl(t,this._config.deviceCellWidth*4+us*2,this._config.deviceCellHeight+us*2),this._tmpCtx=be(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let t of this.pages)t.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let t=new Yf;for(let i=33;i<126;i++)t.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let s=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,s)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let t of this._pages)t.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let i=this._pages.filter((l)=>l.canvas.width*2<=(e.maxTextureSize||4096)).sort((l,d)=>d.canvas.width!==l.canvas.width?d.canvas.width-l.canvas.width:d.percentageUsed-l.percentageUsed),s=-1,r=0;for(let l=0;l<i.length;l++)if(i[l].canvas.width!==r)s=l,r=i[l].canvas.width;else if(l-s===3)break;let n=i.slice(s,s+4),o=n.map((l)=>l.glyphs[0].texturePage).sort((l,d)=>l>d?1:-1),a=this.pages.length-n.length,h=this._mergePages(n,a);h.version++;for(let l=o.length-1;l>=0;l--)this._deletePage(o[l]);this.pages.push(h),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(h.canvas)}let t=new Rn(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(t,i){let s=t[0].canvas.width*2,r=new Rn(this._document,s,t);for(let[n,o]of t.entries()){let a=n*o.canvas.width%s,h=Math.floor(n/2)*o.canvas.height;r.ctx.drawImage(o.canvas,a,h);for(let d of o.glyphs)d.texturePage=i,d.sizeClipSpace.x=d.size.x/s,d.sizeClipSpace.y=d.size.y/s,d.texturePosition.x+=a,d.texturePosition.y+=h,d.texturePositionClipSpace.x=d.texturePosition.x/s,d.texturePositionClipSpace.y=d.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let l=this._activePages.indexOf(o);l!==-1&&this._activePages.splice(l,1)}return r}_deletePage(t){this._pages.splice(t,1);for(let i=t;i<this._pages.length;i++){let s=this._pages[i];for(let r of s.glyphs)r.texturePage--;s.version++}}getRasterizedGlyphCombinedChar(t,i,s,r,n,o){return this._getFromCacheMap(this._cacheMapCombined,t,i,s,r,n,o)}getRasterizedGlyph(t,i,s,r,n,o){return this._getFromCacheMap(this._cacheMap,t,i,s,r,n,o)}_getFromCacheMap(t,i,s,r,n,o,a){return _s=t.get(i,s,r,n),_s||(_s=this._drawToCache(i,s,r,n,o,a),t.set(i,s,r,n,_s)),_s}_getColorFromAnsiIndex(t){if(t>=this._config.colors.ansi.length)throw Error("No color found for idx "+t);return this._config.colors.ansi[t]}_getBackgroundColor(t,i,s,r){if(this._config.allowTransparency)return ft;let n;switch(t){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(i);break;case 50331648:let o=Mi.toColorRGB(i);n=Ge.toColor(o[0],o[1],o[2]);break;case 0:default:s?n=ps.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=ps.opaque(n)),n}_getForegroundColor(t,i,s,r,n,o,a,h,l,d){let c=this._getMinimumContrastColor(t,i,s,r,n,o,a,l,h,d);if(c)return c;let f;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&l&&o<8&&(o+=8),f=this._getColorFromAnsiIndex(o);break;case 50331648:let g=Mi.toColorRGB(o);f=Ge.toColor(g[0],g[1],g[2]);break;case 0:default:a?f=this._config.colors.background:f=this._config.colors.foreground}return this._config.allowTransparency&&(f=ps.opaque(f)),h&&(f=ps.multiplyOpacity(f,Ff)),f}_resolveBackgroundRgba(t,i,s){switch(t){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(t,i,s,r){switch(t){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;case 0:default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(t,i,s,r,n,o,a,h,l,d){if(this._config.minimumContrastRatio===1||d)return;let c=this._getContrastCache(l),f=c.getColor(t,r);if(f!==void 0)return f||void 0;let g=this._resolveBackgroundRgba(i,s,a),v=this._resolveForegroundRgba(n,o,a,h),y=Si.ensureContrastRatio(g,v,this._config.minimumContrastRatio/(l?2:1));if(!y){c.setColor(t,r,null);return}let E=Ge.toColor(y>>24&255,y>>16&255,y>>8&255);return c.setColor(t,r,E),E}_getContrastCache(t){return t?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,s,r,n,o){let a=typeof t=="number"?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let h=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+us*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<h&&(this._tmpCanvas.width=h);let l=Math.min(this._config.deviceCellHeight+us*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=r,!!this._workAttributeData.isInvisible())return Ph;let d=!!this._workAttributeData.isBold(),c=!!this._workAttributeData.isInverse(),f=!!this._workAttributeData.isDim(),g=!!this._workAttributeData.isItalic(),v=!!this._workAttributeData.isUnderline(),y=!!this._workAttributeData.isStrikethrough(),E=!!this._workAttributeData.isOverline(),R=this._workAttributeData.getFgColor(),P=this._workAttributeData.getFgColorMode(),A=this._workAttributeData.getBgColor(),b=this._workAttributeData.getBgColorMode();if(c){let k=R;R=A,A=k;let B=P;P=b,b=B}let x=this._getBackgroundColor(b,A,c,f);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let L=d?this._config.fontWeightBold:this._config.fontWeight,N=g?"italic":"";this._tmpCtx.font=`${N} ${L} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=_l;let q=a.length===1&&Jn(a.charCodeAt(0)),Y=a.length===1&&Rf(a.charCodeAt(0)),oe=this._getForegroundColor(i,b,A,s,P,R,c,f,d,ul(a.charCodeAt(0)));this._tmpCtx.fillStyle=oe.css;let F=Y?0:us*2,Le=!1;this._config.customGlyphs!==!1&&(Le=$f(this._tmpCtx,a,F,F,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let u=!q,_;if(typeof t=="number"?_=this._unicodeService.wcwidth(t):_=this._unicodeService.getStringCellWidth(t),v){this._tmpCtx.save();let k=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),B=k%2===1?0.5:0;if(this._tmpCtx.lineWidth=k,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())u=!1,this._tmpCtx.strokeStyle=`rgb(${Mi.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{u=!1;let Q=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Q<8&&(Q+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Q).css}this._tmpCtx.beginPath();let H=F,z=Math.ceil(F+this._config.deviceCharHeight)-B-(n?k*2:0),K=z+k,se=z+k*2,V=this._workAttributeData.getUnderlineVariantOffset();for(let Q=0;Q<_;Q++){this._tmpCtx.save();let Z=H+Q*this._config.deviceCellWidth,re=H+(Q+1)*this._config.deviceCellWidth,Ze=Z+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Z,z),this._tmpCtx.lineTo(re,z),this._tmpCtx.moveTo(Z,se),this._tmpCtx.lineTo(re,se);break;case 3:let Je=k<=1?se:Math.ceil(F+this._config.deviceCharHeight-k/2)-B,ze=k<=1?z:Math.ceil(F+this._config.deviceCharHeight+k/2)-B,J=new Path2D;J.rect(Z,z,this._config.deviceCellWidth,se-z),this._tmpCtx.clip(J),this._tmpCtx.moveTo(Z-this._config.deviceCellWidth/2,K),this._tmpCtx.bezierCurveTo(Z-this._config.deviceCellWidth/2,ze,Z,ze,Z,K),this._tmpCtx.bezierCurveTo(Z,Je,Ze,Je,Ze,K),this._tmpCtx.bezierCurveTo(Ze,ze,re,ze,re,K),this._tmpCtx.bezierCurveTo(re,Je,re+this._config.deviceCellWidth/2,Je,re+this._config.deviceCellWidth/2,K);break;case 4:let D=V===0?0:V>=k?k*2-V:k-V;!(V>=k)===!1||D===0?(this._tmpCtx.setLineDash([Math.round(k),Math.round(k)]),this._tmpCtx.moveTo(Z+D,z),this._tmpCtx.lineTo(re,z)):(this._tmpCtx.setLineDash([Math.round(k),Math.round(k)]),this._tmpCtx.moveTo(Z,z),this._tmpCtx.lineTo(Z+D,z),this._tmpCtx.moveTo(Z+D+k,z),this._tmpCtx.lineTo(re,z)),V=If(re-Z,k,V);break;case 5:let ae=0.6,Qe=0.3,te=re-Z,He=Math.floor(ae*te),ee=Math.floor(Qe*te),de=te-He-ee;this._tmpCtx.setLineDash([He,ee,de]),this._tmpCtx.moveTo(Z,z),this._tmpCtx.lineTo(re,z);break;case 1:default:this._tmpCtx.moveTo(Z,z),this._tmpCtx.lineTo(re,z);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Le&&this._config.fontSize>=12&&!this._config.allowTransparency&&a!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let Q=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Q&&Q.actualBoundingBoxDescent>0){this._tmpCtx.save();let Z=new Path2D;Z.rect(H,z-Math.ceil(k/2),this._config.deviceCellWidth*_,se-z+Math.ceil(k/2)),this._tmpCtx.clip(Z),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(a,F,F+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(E){let k=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),B=k%2===1?0.5:0;this._tmpCtx.lineWidth=k,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(F,F+B),this._tmpCtx.lineTo(F+this._config.deviceCharWidth*_,F+B),this._tmpCtx.stroke()}if(Le||this._tmpCtx.fillText(a,F,F+this._config.deviceCharHeight),a==="_"&&!this._config.allowTransparency){let k=An(this._tmpCtx.getImageData(F,F,this._config.deviceCellWidth,this._config.deviceCellHeight),x,oe,u);if(k)for(let B=1;B<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,F,F+this._config.deviceCharHeight-B),k=An(this._tmpCtx.getImageData(F,F,this._config.deviceCellWidth,this._config.deviceCellHeight),x,oe,u),!!k);B++);}if(y){let k=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),B=this._tmpCtx.lineWidth%2===1?0.5:0;this._tmpCtx.lineWidth=k,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(F,F+Math.floor(this._config.deviceCharHeight/2)-B),this._tmpCtx.lineTo(F+this._config.deviceCharWidth*_,F+Math.floor(this._config.deviceCharHeight/2)-B),this._tmpCtx.stroke()}this._tmpCtx.restore();let w=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),p;if(this._config.allowTransparency?p=hg(w):p=An(w,x,oe,u),p)return Ph;let S=this._findGlyphBoundingBox(w,this._workBoundingBox,h,Y,Le,F),m,C;for(;;){if(this._activePages.length===0){let k=this._createNewPage();m=k,C=k.currentRow,C.height=S.size.y;break}m=this._activePages[this._activePages.length-1],C=m.currentRow;for(let k of this._activePages)S.size.y<=k.currentRow.height&&(m=k,C=k.currentRow);for(let k=this._activePages.length-1;k>=0;k--)for(let B of this._activePages[k].fixedRows)B.height<=C.height&&S.size.y<=B.height&&(m=this._activePages[k],C=B);if(S.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Rn(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),m=this._overflowSizePage,C=this._overflowSizePage.currentRow,C.x+S.size.x>=m.canvas.width&&(C.x=0,C.y+=C.height,C.height=0);break}if(C.y+S.size.y>=m.canvas.height||C.height>S.size.y+2){let k=!1;if(m.currentRow.y+m.currentRow.height+S.size.y>=m.canvas.height){let B;for(let H of this._activePages)if(H.currentRow.y+H.currentRow.height+S.size.y<H.canvas.height){B=H;break}if(B)m=B;else if(e.maxAtlasPages&&this._pages.length>=e.maxAtlasPages&&C.y+S.size.y<=m.canvas.height&&C.height>=S.size.y&&C.x+S.size.x<=m.canvas.width)k=!0;else{let H=this._createNewPage();m=H,C=H.currentRow,C.height=S.size.y,k=!0}}k||(m.currentRow.height>0&&m.fixedRows.push(m.currentRow),C={x:0,y:m.currentRow.y+m.currentRow.height,height:S.size.y},m.fixedRows.push(C),m.currentRow={x:0,y:C.y+C.height,height:0})}if(C.x+S.size.x<=m.canvas.width)break;C===m.currentRow?(C.x=0,C.y+=C.height,C.height=0):m.fixedRows.splice(m.fixedRows.indexOf(C),1)}return S.texturePage=this._pages.indexOf(m),S.texturePosition.x=C.x,S.texturePosition.y=C.y,S.texturePositionClipSpace.x=C.x/m.canvas.width,S.texturePositionClipSpace.y=C.y/m.canvas.height,S.sizeClipSpace.x/=m.canvas.width,S.sizeClipSpace.y/=m.canvas.height,C.height=Math.max(C.height,S.size.y),C.x+=S.size.x,m.ctx.putImageData(w,S.texturePosition.x-this._workBoundingBox.left,S.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,S.size.x,S.size.y),m.addGlyph(S),m.version++,S}_findGlyphBoundingBox(t,i,s,r,n,o){i.top=0;let a=r?this._config.deviceCellHeight:this._tmpCanvas.height,h=r?this._config.deviceCellWidth:s,l=!1;for(let d=0;d<a;d++){for(let c=0;c<h;c++){let f=d*this._tmpCanvas.width*4+c*4+3;if(t.data[f]!==0){i.top=d,l=!0;break}}if(l)break}i.left=0,l=!1;for(let d=0;d<o+h;d++){for(let c=0;c<a;c++){let f=c*this._tmpCanvas.width*4+d*4+3;if(t.data[f]!==0){i.left=d,l=!0;break}}if(l)break}i.right=h,l=!1;for(let d=o+h-1;d>=o;d--){for(let c=0;c<a;c++){let f=c*this._tmpCanvas.width*4+d*4+3;if(t.data[f]!==0){i.right=d,l=!0;break}}if(l)break}i.bottom=a,l=!1;for(let d=a-1;d>=0;d--){for(let c=0;c<h;c++){let f=d*this._tmpCanvas.width*4+c*4+3;if(t.data[f]!==0){i.bottom=d,l=!0;break}}if(l)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+o+(r||n?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+o+(r||n?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Rn=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let s of i)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=wl(e,t,t),this.ctx=be(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function An(e,t,i,s){let r=t.rgba>>>24,n=t.rgba>>>16&255,o=t.rgba>>>8&255,a=i.rgba>>>24,h=i.rgba>>>16&255,l=i.rgba>>>8&255,d=Math.floor((Math.abs(r-a)+Math.abs(n-h)+Math.abs(o-l))/12),c=!0;for(let f=0;f<e.data.length;f+=4)e.data[f]===r&&e.data[f+1]===n&&e.data[f+2]===o||s&&Math.abs(e.data[f]-r)+Math.abs(e.data[f+1]-n)+Math.abs(e.data[f+2]-o)<d?e.data[f+3]=0:c=!1;return c}function hg(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function wl(e,t,i){let s=e.createElement("canvas");return s.width=t,s.height=i,s}function lg(e,t,i,s,r,n,o,a){let h={foreground:n.foreground,background:n.background,cursor:ft,cursorAccent:ft,selectionForeground:ft,selectionBackgroundTransparent:ft,selectionBackgroundOpaque:ft,selectionInactiveBackgroundTransparent:ft,selectionInactiveBackgroundOpaque:ft,overviewRulerBorder:ft,scrollbarSliderBackground:ft,scrollbarSliderHoverBackground:ft,scrollbarSliderActiveBackground:ft,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:a,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:s,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:h}}function Oh(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function cg(e){return(e&50331648)===16777216||(e&50331648)===33554432}var gt=[];function Sl(e,t,i,s,r,n,o,a,h){let l=lg(s,r,n,o,t,i,a,h);for(let f=0;f<gt.length;f++){let g=gt[f],v=g.ownedBy.indexOf(e);if(v>=0){if(Oh(g.config,l))return g.atlas;g.ownedBy.length===1?(g.atlas.dispose(),gt.splice(f,1)):g.ownedBy.splice(v,1);break}}for(let f=0;f<gt.length;f++){let g=gt[f];if(Oh(g.config,l))return g.ownedBy.push(e),g.atlas}let d=e._core,c={atlas:new si(document,l,d.unicodeService),config:l,ownedBy:[e]};return gt.push(c),c.atlas}function Ih(e){for(let t=0;t<gt.length;t++){let i=gt[t].ownedBy.indexOf(e);if(i!==-1){gt[t].ownedBy.length===1?(gt[t].atlas.dispose(),gt.splice(t,1)):gt[t].ownedBy.splice(i,1);break}}}var Qs=600,dg=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=Qs){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Qs-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=Qs-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Qs)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function Nh(e,t,i){let s=new t.ResizeObserver((r)=>{let n=r.find((h)=>h.target===e);if(!n)return;if(!("devicePixelContentBoxSize"in n)){s?.disconnect(),s=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,a=n.devicePixelContentBoxSize[0].blockSize;o>0&&a>0&&i(o,a)});try{s.observe(e,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return Fe(()=>s?.disconnect())}function ug(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var Fh=class e extends Mi{constructor(){super(...arguments);this.content=0,this.fg=0,this.bg=0,this.extended=new vl,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ug(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},bl=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function yl(e,t,i){let s=be(e.createProgram());if(e.attachShader(s,be(Wh(e,e.VERTEX_SHADER,t))),e.attachShader(s,be(Wh(e,e.FRAGMENT_SHADER,i))),e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS))return s;console.error(e.getProgramInfoLog(s)),e.deleteProgram(s)}function Wh(e,t,i){let s=be(e.createShader(t));if(e.shaderSource(s,i),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS))return s;console.error(e.getShaderInfoLog(s)),e.deleteShader(s)}function _g(e,t){let i=Math.min(e.length*2,t),s=new Float32Array(i);for(let r=0;r<e.length;r++)s[r]=e[r];return s}var fg=class{constructor(e){this.texture=e,this.version=-1}},gg=`#version 300 es
|
|
64
64
|
layout (location = 0) in vec2 a_unitquad;
|
|
65
65
|
layout (location = 1) in vec2 a_cellpos;
|
|
66
66
|
layout (location = 2) in vec2 a_offset;
|
|
@@ -80,7 +80,7 @@ void main() {
|
|
|
80
80
|
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
81
81
|
v_texpage = int(a_texpage);
|
|
82
82
|
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
83
|
-
}`;function
|
|
83
|
+
}`;function pg(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
|
|
84
84
|
precision lowp float;
|
|
85
85
|
|
|
86
86
|
in vec2 v_texcoord;
|
|
@@ -94,7 +94,7 @@ void main() {
|
|
|
94
94
|
if (v_texpage == 0) {
|
|
95
95
|
outColor = texture(u_texture[0], v_texcoord);
|
|
96
96
|
} ${t}
|
|
97
|
-
}`}var
|
|
97
|
+
}`}var ri=11,Ei=ri*Float32Array.BYTES_PER_ELEMENT,vg=2,pe=0,ce,Tn=0,fs=0,mg=class extends lt{constructor(e,t,i,s){super();this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let r=this._gl;si.maxAtlasPages===void 0&&(si.maxAtlasPages=Math.min(32,be(r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS))),si.maxTextureSize=be(r.getParameter(r.MAX_TEXTURE_SIZE))),this._program=be(yl(r,gg,pg(si.maxAtlasPages))),this._register(Fe(()=>r.deleteProgram(this._program))),this._projectionLocation=be(r.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=be(r.getUniformLocation(this._program,"u_resolution")),this._textureLocation=be(r.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(Fe(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),h=r.createBuffer();this._register(Fe(()=>r.deleteBuffer(h))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h),r.bufferData(r.ELEMENT_ARRAY_BUFFER,a,r.STATIC_DRAW),this._attributesBuffer=be(r.createBuffer()),this._register(Fe(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,2,r.FLOAT,!1,Ei,0),r.vertexAttribDivisor(2,1),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,r.FLOAT,!1,Ei,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(3,1),r.enableVertexAttribArray(4),r.vertexAttribPointer(4,1,r.FLOAT,!1,Ei,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(4,1),r.enableVertexAttribArray(5),r.vertexAttribPointer(5,2,r.FLOAT,!1,Ei,5*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(5,1),r.enableVertexAttribArray(6),r.vertexAttribPointer(6,2,r.FLOAT,!1,Ei,7*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(6,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,Ei,9*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.useProgram(this._program);let l=new Int32Array(si.maxAtlasPages);for(let d=0;d<si.maxAtlasPages;d++)l[d]=d;r.uniform1iv(this._textureLocation,l),r.uniformMatrix4fv(this._projectionLocation,!1,bl),this._atlasTextures=[];for(let d=0;d<si.maxAtlasPages;d++){let c=new fg(be(r.createTexture()));this._register(Fe(()=>r.deleteTexture(c.texture))),r.activeTexture(r.TEXTURE0+d),r.bindTexture(r.TEXTURE_2D,c.texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[d]=c}r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,i,s,r,n,o,a,h){this._updateCell(this._vertices.attributes,e,t,i,s,r,n,o,a,h)}_updateCell(e,t,i,s,r,n,o,a,h,l){if(pe=(i*this._terminal.cols+t)*ri,s===0||s===void 0){e.fill(0,pe,pe+ri-1-vg);return}this._atlas&&(a&&a.length>1?ce=this._atlas.getRasterizedGlyphCombinedChar(a,r,n,o,!1,this._terminal.element):ce=this._atlas.getRasterizedGlyph(s,r,n,o,!1,this._terminal.element),Tn=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),r!==l&&ce.offset.x>Tn?(fs=ce.offset.x-Tn,e[pe]=-(ce.offset.x-fs)+this._dimensions.device.char.left,e[pe+1]=-ce.offset.y+this._dimensions.device.char.top,e[pe+2]=(ce.size.x-fs)/this._dimensions.device.canvas.width,e[pe+3]=ce.size.y/this._dimensions.device.canvas.height,e[pe+4]=ce.texturePage,e[pe+5]=ce.texturePositionClipSpace.x+fs/this._atlas.pages[ce.texturePage].canvas.width,e[pe+6]=ce.texturePositionClipSpace.y,e[pe+7]=ce.sizeClipSpace.x-fs/this._atlas.pages[ce.texturePage].canvas.width,e[pe+8]=ce.sizeClipSpace.y):(e[pe]=-ce.offset.x+this._dimensions.device.char.left,e[pe+1]=-ce.offset.y+this._dimensions.device.char.top,e[pe+2]=ce.size.x/this._dimensions.device.canvas.width,e[pe+3]=ce.size.y/this._dimensions.device.canvas.height,e[pe+4]=ce.texturePage,e[pe+5]=ce.texturePositionClipSpace.x,e[pe+6]=ce.texturePositionClipSpace.y,e[pe+7]=ce.sizeClipSpace.x,e[pe+8]=ce.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Pf(s,h,ce.size.x,this._dimensions.device.cell.width)&&(e[pe+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*ri;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==t?this._vertices.attributesBuffers[i]=new Float32Array(t):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=t,i=0;for(let s=0;s<e.rows;s++)for(let r=0;r<e.cols;r++)this._vertices.attributes[i+9]=r/e.cols,this._vertices.attributes[i+10]=s/e.rows,i+=ri}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],s=0;for(let r=0;r<e.lineLengths.length;r++){let n=r*this._terminal.cols*ri,o=this._vertices.attributes.subarray(n,n+e.lineLengths[r]*ri);i.set(o,s),s+=o.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,s),t.STREAM_DRAW);for(let r=0;r<this._atlas.pages.length;r++)this._atlas.pages[r].version!==this._atlasTextures[r].version&&this._bindAtlasPageTexture(t,this._atlas,r);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,s/ri)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[i].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[i].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[i].version=t.pages[i].version}setDimensions(e){this._dimensions=e}},wg=class{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(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let r=e.buffers.active.ydisp,n=t[1]-r,o=i[1]-r,a=Math.max(n,0),h=Math.min(o,e.rows-1);if(a>=e.rows||h<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function Sg(){return new wg}var lr=4,rr=1,nr=2,Bn=3,bg=2147483648,yg=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=Sg()}resize(e,t){let i=e*t*lr;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},Cg=`#version 300 es
|
|
98
98
|
layout (location = 0) in vec2 a_position;
|
|
99
99
|
layout (location = 1) in vec2 a_size;
|
|
100
100
|
layout (location = 2) in vec4 a_color;
|
|
@@ -108,7 +108,7 @@ void main() {
|
|
|
108
108
|
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
109
109
|
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
110
110
|
v_color = a_color;
|
|
111
|
-
}`,
|
|
111
|
+
}`,xg=`#version 300 es
|
|
112
112
|
precision lowp float;
|
|
113
113
|
|
|
114
114
|
in vec4 v_color;
|
|
@@ -117,18 +117,18 @@ out vec4 outColor;
|
|
|
117
117
|
|
|
118
118
|
void main() {
|
|
119
119
|
outColor = v_color;
|
|
120
|
-
}`,It=8,Dn=It*Float32Array.BYTES_PER_ELEMENT,bg=20*It,Oh=class{constructor(){this.attributes=new Float32Array(bg),this.count=0}},Pt=0,Ih=0,Nh=0,Fh=0,Wh=0,zh=0,Hh=0,yg=class extends rt{constructor(e,t,i,s){super();this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=s,this._vertices=new Oh,this._verticesCursor=new Oh;let r=this._gl;this._program=Se(vl(r,wg,Sg)),this._register(We(()=>r.deleteProgram(this._program))),this._projectionLocation=Se(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(We(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),l=r.createBuffer();this._register(We(()=>r.deleteBuffer(l))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,l),r.bufferData(r.ELEMENT_ARRAY_BUFFER,a,r.STATIC_DRAW),this._attributesBuffer=Se(r.createBuffer()),this._register(We(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,Dn,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,Dn,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,Dn,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors((h)=>{this._updateCachedColors(h),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,pl),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,i=this._vertices,s=1,r,n,o,a,l,h,d,c,f,p,w;for(r=0;r<t.rows;r++){for(o=-1,a=0,l=0,h=!1,n=0;n<t.cols;n++)d=(r*t.cols+n)*nr,c=e.cells[d+er],f=e.cells[d+tr],p=!!(f&67108864),(c!==a||f!==l&&(h||p))&&((a!==0||h&&l!==0)&&(w=s++*It,this._updateRectangle(i,w,l,a,o,n,r)),o=n,a=c,l=f,h=p);(a!==0||h&&l!==0)&&(w=s++*It,this._updateRectangle(i,w,l,a,o,t.cols,r))}i.count=s}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let s,r=0;(i.style==="bar"||i.style==="outline")&&(s=r++*It,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(s=r++*It,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(s=r++*It,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),s=r++*It,this._addRectangleFloat(t.attributes,s,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=r}_updateRectangle(e,t,i,s,r,n,o){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:Pt=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Pt=(i&16777215)<<8;break;case 0:default:Pt=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:Pt=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Pt=(s&16777215)<<8;break;case 0:default:Pt=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=lg(e.attributes,this._terminal.rows*this._terminal.cols*It)),Ih=r*this._dimensions.device.cell.width,Nh=o*this._dimensions.device.cell.height,Fh=(Pt>>24&255)/255,Wh=(Pt>>16&255)/255,zh=(Pt>>8&255)/255,Hh=1,this._addRectangle(e.attributes,t,Ih,Nh,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Fh,Wh,zh,Hh)}_addRectangle(e,t,i,s,r,n,o,a,l,h){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=a,e[t+6]=l,e[t+7]=h}_addRectangleFloat(e,t,i,s,r,n,o){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},Cg=class extends rt{constructor(e,t,i,s,r,n,o,a){super();this._container=t,this._alpha=r,this._coreBrowserService=n,this._optionsService=o,this._themeService=a,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors((l)=>{this._refreshCharAtlas(e,l),this.reset(e)})),this._register(We(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Se(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,s=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=gl(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,i,s){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,s){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=hl,this._clipCell(i,s,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let s=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${s} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},xg=class extends Cg{constructor(e,t,i,s,r,n,o){super(i,e,"link",t,!0,r,n,o),this._register(s.onShowLinkUnderline((a)=>this._handleShowLinkUnderline(a))),this._register(s.onHideLinkUnderline((a)=>this._handleHideLinkUnderline(a)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&og(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},_t=typeof window=="object"?window:globalThis,Hn=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new se,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new se,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Hn.INSTANCE=new Hn;var ml=Hn;function kg(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var E1=ml.INSTANCE.onDidChangeZoomLevel,M1=ml.INSTANCE.onDidChangeFullscreen,Ei=typeof navigator=="object"?navigator.userAgent:"",D1=Ei.indexOf("Firefox")>=0,Rn=Ei.indexOf("AppleWebKit")>=0,Lg=Ei.indexOf("Chrome")>=0,Eg=!Lg&&Ei.indexOf("Safari")>=0,R1=Ei.indexOf("Electron/")>=0,A1=Ei.indexOf("Android")>=0,ir=!1;if(typeof _t.matchMedia=="function"){let e=_t.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=_t.matchMedia("(display-mode: fullscreen)");ir=e.matches,kg(_t,e,({matches:i})=>{ir&&t.matches||(ir=i)})}function Mg(){return ir}var xi="en",$n=!1,Un=!1,sr=!1,Dg=!1,wl=!1,Sl=!1,Rg=!1,Ag=!1,Tg=!1,Bg=!1,Xs,rr=xi,$h=xi,Pg,Ot,Wt=globalThis,st;typeof Wt.vscode<"u"&&typeof Wt.vscode.process<"u"?st=Wt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(st=process);var bl=typeof st?.versions?.electron=="string",Og=bl&&st?.type==="renderer";if(typeof st=="object"){$n=st.platform==="win32",Un=st.platform==="darwin",sr=st.platform==="linux",Dg=sr&&!!st.env.SNAP&&!!st.env.SNAP_REVISION,Rg=bl,Tg=!!st.env.CI||!!st.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Xs=xi,rr=xi;let e=st.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Xs=t.userLocale,$h=t.osLocale,rr=t.resolvedLanguage||xi,Pg=t.languagePack?.translationsConfigFile}catch{}wl=!0}else typeof navigator=="object"&&!Og?(Ot=navigator.userAgent,$n=Ot.indexOf("Windows")>=0,Un=Ot.indexOf("Macintosh")>=0,Ag=(Ot.indexOf("Macintosh")>=0||Ot.indexOf("iPad")>=0||Ot.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,sr=Ot.indexOf("Linux")>=0,Bg=Ot?.indexOf("Mobi")>=0,Sl=!0,rr=globalThis._VSCODE_NLS_LANGUAGE||xi,Xs=navigator.language.toLowerCase(),$h=Xs):console.error("Unable to resolve platform.");var An=0;Un?An=1:$n?An=3:sr&&(An=2);var Tn=wl,Ig=Sl&&typeof Wt.importScripts=="function",T1=Ig?Wt.origin:void 0,bt=Ot,Xt=rr,Ng;((e)=>{function t(){return Xt}e.value=t;function i(){return Xt.length===2?Xt==="en":Xt.length>=3?Xt[0]==="e"&&Xt[1]==="n"&&Xt[2]==="-":!1}e.isDefaultVariant=i;function s(){return Xt==="en"}e.isDefault=s})(Ng||={});var Fg=typeof Wt.postMessage=="function"&&!Wt.importScripts,Wg=(()=>{if(Fg){let e=[];Wt.addEventListener("message",(i)=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let n=e[s];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),n.callback();return}}});let t=0;return(i)=>{let s=++t;e.push({id:s,callback:i}),Wt.postMessage({vscodeScheduleAsyncWork:s},"*")}}return(e)=>setTimeout(e)})(),zg=!!(bt&&bt.indexOf("Chrome")>=0),B1=!!(bt&&bt.indexOf("Firefox")>=0),P1=!!(!zg&&bt&&bt.indexOf("Safari")>=0),O1=!!(bt&&bt.indexOf("Edg/")>=0),I1=!!(bt&&bt.indexOf("Android")>=0),Zt=typeof navigator=="object"?navigator:{},N1={clipboard:{writeText:Tn||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(Zt&&Zt.clipboard&&Zt.clipboard.writeText),readText:Tn||!!(Zt&&Zt.clipboard&&Zt.clipboard.readText)},keyboard:Tn||Mg()?0:Zt.keyboard||Eg?1:2,touch:"ontouchstart"in _t||Zt.maxTouchPoints>0,pointerEvents:_t.PointerEvent&&(("ontouchstart"in _t)||navigator.maxTouchPoints>0)},Gn=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Bn=new Gn,Uh=new Gn,Kh=new Gn,F1=Array(230),Hg;((e)=>{function t(a){return Bn.keyCodeToStr(a)}e.toString=t;function i(a){return Bn.strToKeyCode(a)}e.fromString=i;function s(a){return Uh.keyCodeToStr(a)}e.toUserSettingsUS=s;function r(a){return Kh.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function n(a){return Uh.strToKeyCode(a)||Kh.strToKeyCode(a)}e.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Bn.keyCodeToStr(a)}e.toElectronAccelerator=o})(Hg||={});var yl=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),$g;((e)=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Ug?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Nt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:yl})})($g||={});var Ug=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?yl:(this._emitter||(this._emitter=new se),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},W1=Symbol("MicrotaskDelay"),Kg,Pn;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Pn=(e,t)=>{Wg(()=>{if(i)return;let s=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,s-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Pn=(e,t,i)=>{let s=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(s))}}},Kg=(e)=>Pn(globalThis,e)})();var qg;((e)=>{async function t(s){let r,n=await Promise.all(s.map((o)=>o.then((a)=>a,(a)=>{r||(r=a)})));if(typeof r<"u")throw r;return n}e.settled=t;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}e.withAsyncBody=i})(qg||={});var qh=class e{static fromArray(t){return new e((i)=>{i.emitMany(t)})}static fromPromise(t){return new e(async(i)=>{i.emitMany(await t)})}static fromPromises(t){return new e(async(i)=>{await Promise.all(t.map(async(s)=>i.emitOne(await s)))})}static merge(t){return new e(async(i)=>{await Promise.all(t.map(async(s)=>{for await(let r of s)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new se,queueMicrotask(async()=>{let s={emitOne:(r)=>this.emitOne(r),emitMany:(r)=>this.emitMany(r),reject:(r)=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Nt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new e(async(s)=>{for await(let r of t)s.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async(s)=>{for await(let r of t)i(r)&&s.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,(i)=>!!i)}coalesce(){return e.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return e.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};qh.EMPTY=qh.fromArray([]);function Vg(e){return 55296<=e&&e<=56319}function Vh(e){return 56320<=e&&e<=57343}function jg(e,t){return(e-55296<<10)+(t-56320)+65536}function Gg(e){return Yn(e,0)}function Yn(e,t){switch(typeof e){case"object":return e===null?Ft(349,t):Array.isArray(e)?Xg(e,t):Zg(e,t);case"string":return Cl(e,t);case"boolean":return Yg(e,t);case"number":return Ft(e,t);case"undefined":return Ft(937,t);default:return Ft(617,t)}}function Ft(e,t){return(t<<5)-t+e|0}function Yg(e,t){return Ft(e?433:863,t)}function Cl(e,t){t=Ft(149417,t);for(let i=0,s=e.length;i<s;i++)t=Ft(e.charCodeAt(i),t);return t}function Xg(e,t){return t=Ft(104579,t),e.reduce((i,s)=>Yn(s,i),t)}function Zg(e,t){return t=Ft(181387,t),Object.keys(e).sort().reduce((i,s)=>(i=Cl(s,i),Yn(e[s],i)),t)}function On(e,t,i=32){let s=i-t,r=~((1<<s)-1);return(e<<t|(r&e)>>>s)>>>0}function jh(e,t=0,i=e.byteLength,s=0){for(let r=0;r<i;r++)e[t+r]=s}function Jg(e,t,i="0"){for(;e.length<t;)e=i+e;return e}function ds(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map((i)=>i.toString(16).padStart(2,"0")).join(""):Jg((e>>>0).toString(16),t/4)}var Qg=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let i=t.length;if(i===0)return;let s=this._buff,r=this._buffLen,n=this._leftoverHighSurrogate,o,a;for(n!==0?(o=n,a=-1,n=0):(o=t.charCodeAt(0),a=0);;){let l=o;if(Vg(o))if(a+1<i){let h=t.charCodeAt(a+1);Vh(h)?(a++,l=jg(o,h)):l=65533}else{n=o;break}else Vh(o)&&(l=65533);if(r=this._push(s,r,l),a++,a<i)o=t.charCodeAt(a);else break}this._buffLen=r,this._leftoverHighSurrogate=n}_push(t,i,s){return s<128?t[i++]=s:s<2048?(t[i++]=192|(s&1984)>>>6,t[i++]=128|(s&63)>>>0):s<65536?(t[i++]=224|(s&61440)>>>12,t[i++]=128|(s&4032)>>>6,t[i++]=128|(s&63)>>>0):(t[i++]=240|(s&1835008)>>>18,t[i++]=128|(s&258048)>>>12,t[i++]=128|(s&4032)>>>6,t[i++]=128|(s&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),i}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),ds(this._h0)+ds(this._h1)+ds(this._h2)+ds(this._h3)+ds(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,jh(this._buff,this._buffLen),this._buffLen>56&&(this._step(),jh(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,i=this._buffDV;for(let c=0;c<64;c+=4)t.setUint32(c,i.getUint32(c,!1),!1);for(let c=64;c<320;c+=4)t.setUint32(c,On(t.getUint32(c-12,!1)^t.getUint32(c-32,!1)^t.getUint32(c-56,!1)^t.getUint32(c-64,!1),1),!1);let s=this._h0,r=this._h1,n=this._h2,o=this._h3,a=this._h4,l,h,d;for(let c=0;c<80;c++)c<20?(l=r&n|~r&o,h=1518500249):c<40?(l=r^n^o,h=1859775393):c<60?(l=r&n|r&o|n&o,h=2400959708):(l=r^n^o,h=3395469782),d=On(s,5)+l+a+h+t.getUint32(c*4,!1)&4294967295,a=o,o=n,n=On(r,30),r=s,s=d;this._h0=this._h0+s&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+n&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+a&4294967295}};Qg._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:z1,getWindow:ep,getDocument:H1,getWindows:$1,getWindowsCount:U1,getWindowId:Gh,getWindowById:K1,hasWindow:q1,onDidRegisterWindow:V1,onWillUnregisterWindow:j1,onDidUnregisterWindow:G1}=function(){let e=new Map,t={window:_t,disposables:new ki};e.set(_t.vscodeWindowId,t);let i=new se,s=new se,r=new se;function n(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(e.has(o.vscodeWindowId))return rt.None;let a=new ki,l={window:o,disposables:a.add(new ki)};return e.set(o.vscodeWindowId,l),a.add(We(()=>{e.delete(o.vscodeWindowId),s.fire(o)})),a.add(Kn(o,sp.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(l),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:n,getWindow(o){let a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let l=o;return l?.view?l.view.window:_t},getDocument(o){return ep(o).document}}}(),tp=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Kn(e,t,i,s){return new tp(e,t,i,s)}var ip,Yh,In=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Zs(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,s=new Map,r=(n)=>{i.set(n,!1);let o=e.get(n)??[];for(t.set(n,o),e.set(n,[]),s.set(n,!0);o.length>0;)o.sort(In.sort),o.shift().execute();s.set(n,!1)};Yh=(n,o,a=0)=>{let l=Gh(n),h=new In(o,a),d=e.get(l);return d||(d=[],e.set(l,d)),d.push(h),i.get(l)||(i.set(l,!0),n.requestAnimationFrame(()=>r(l))),h},ip=(n,o,a)=>{let l=Gh(n);if(s.get(l)){let h=new In(o,a),d=t.get(l);return d||(d=[],t.set(l,d)),d.push(h),h}else return Yh(n,o,a)}})();var Xh=class e{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new e(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};Xh.None=new Xh(0,0);var Y1=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let s=this.mutationObservers.get(e);s||(s=new Map,this.mutationObservers.set(e,s));let r=Gg(i),n=s.get(r);if(n)n.users+=1;else{let o=new se,a=new MutationObserver((h)=>o.fire(h));a.observe(e,i);let l=n={users:1,observer:a,onDidMutate:o.event};t.add(We(()=>{l.users-=1,l.users===0&&(o.dispose(),a.disconnect(),s?.delete(r),s?.size===0&&this.mutationObservers.delete(e))})),s.set(r,n)}return n.onDidMutate}},sp={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:Rn?"webkitAnimationStart":"animationstart",ANIMATION_END:Rn?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:Rn?"webkitAnimationIteration":"animationiteration"},rp=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function xl(e,t,i,...s){let r=rp.exec(t);if(!r)throw Error("Bad use of emmet");let n=r[1]||"div",o;return e!=="http://www.w3.org/1999/xhtml"?o=document.createElementNS(e,n):o=document.createElement(n),r[3]&&(o.id=r[3]),r[4]&&(o.className=r[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([a,l])=>{typeof l>"u"||(/^on\w+$/.test(a)?o[a]=l:a==="selected"?l&&o.setAttribute(a,"true"):o.setAttribute(a,l))}),o.append(...s),o}function np(e,t,...i){return xl("http://www.w3.org/1999/xhtml",e,t,...i)}np.SVG=function(e,t,...i){return xl("http://www.w3.org/2000/svg",e,t,...i)};var op=class extends rt{constructor(e,t,i,s,r,n,o,a,l){super();this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._optionsService=o,this._themeService=a,this._cursorBlinkStateManager=new as,this._charAtlasDisposable=this._register(new as),this._observerDisposable=this._register(new as),this._model=new mg,this._workCell=new Bh,this._workCell2=new Bh,this._rectangleRenderer=this._register(new as),this._glyphRenderer=this._register(new as),this._onChangeTextureAtlas=this._register(new se),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new se),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new se),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new se),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new se),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let h={antialias:!1,depth:!1,preserveDrawingBuffer:l};if(this._gl=this._canvas.getContext("webgl2",h),!this._gl)throw Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Bf(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new xg(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=Af(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Kn(this._canvas,"webglcontextlost",(d)=>{console.log("webglcontextlost event received"),d.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(d)},3000)})),this._register(Kn(this._canvas,"webglcontextrestored",(d)=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Ah(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Th(this._canvas,this._coreBrowserService.window,(d,c)=>this._setCanvasDevicePixelDimensions(d,c)),this._register(this._coreBrowserService.onWindowChange((d)=>{this._observerDisposable.value=Th(this._canvas,d,(c,f)=>this._setCanvasDevicePixelDimensions(c,f))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(We(()=>{for(let d of this._renderLayers)d.dispose();this._canvas.parentElement?.removeChild(this._canvas),Ah(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new yg(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new fg(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=gl(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=rl(Nt.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Nt.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new ag(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,s=this._workCell,r,n,o,a,l,h,d=0,c=!0,f,p,w,y,E,B,P,R,b;e=Zh(e,i.rows-1,0),t=Zh(t,i.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",L=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,O=L-i.buffer.ydisp,V=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),j=-1,he=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let F=!1;for(n=e;n<=t;n++)for(o=n+i.buffer.ydisp,a=i.buffer.lines.get(o),this._model.lineLengths[n]=0,w=L===o,d=0,l=this._characterJoinerService.getJoinedCharacters(o),R=0;R<i.cols;R++){if(r=this._cellColorResolver.result.bg,a.loadCell(R,s),R===0&&(r=this._cellColorResolver.result.bg),h=!1,c=R>=d,f=R,l.length>0&&R===l[0][0]&&c){p=l.shift();let be=this._model.selection.isCellSelected(this._terminal,p[0],o);for(P=p[0]+1;P<p[1];P++)c&&=be===this._model.selection.isCellSelected(this._terminal,P,o);c&&=!w||V<p[0]||V>=p[1],c?(h=!0,s=new ap(s,a.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):d=p[1]}if(y=s.getChars(),E=s.getCode(),P=(n*i.cols+R)*nr,this._cellColorResolver.resolve(s,R,o,this.dimensions.device.cell.width),he&&o===L&&(R===V&&(this._model.cursor={x:V,y:O,width:s.getWidth(),style:this._coreBrowserService.isFocused?x:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},j=V+s.getWidth()-1),R>=V&&R<=j&&(this._coreBrowserService.isFocused&&x==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),E!==0&&(this._model.lineLengths[n]=R+1),!(this._model.cells[P]===E&&this._model.cells[P+er]===this._cellColorResolver.result.bg&&this._model.cells[P+tr]===this._cellColorResolver.result.fg&&this._model.cells[P+Mn]===this._cellColorResolver.result.ext)&&(F=!0,y.length>1&&(E|=vg),this._model.cells[P]=E,this._model.cells[P+er]=this._cellColorResolver.result.bg,this._model.cells[P+tr]=this._cellColorResolver.result.fg,this._model.cells[P+Mn]=this._cellColorResolver.result.ext,B=s.getWidth(),this._glyphRenderer.value.updateCell(R,n,E,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,y,B,r),h)){for(s=this._workCell,R++;R<=f;R++)b=(n*i.cols+R)*nr,this._glyphRenderer.value.updateCell(R,n,0,0,0,0,xf,0,0),this._model.cells[b]=0,this._model.cells[b+er]=this._cellColorResolver.result.bg,this._model.cells[b+tr]=this._cellColorResolver.result.fg,this._model.cells[b+Mn]=this._cellColorResolver.result.ext;R--}}F&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},ap=class extends Ci{constructor(e,t,i){super();this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Zh(e,t,i=0){return Math.max(Math.min(e,t),i)}var Jh="di$target",Qh="di$dependencies",Nn=new Map;function yt(e){if(Nn.has(e))return Nn.get(e);let t=function(i,s,r){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");hp(t,i,r)};return t._id=e,Nn.set(e,t),t}function hp(e,t,i){t[Jh]===t?t[Qh].push({id:e,index:i}):(t[Qh]=[{id:e,index:i}],t[Jh]=t)}var X1=yt("BufferService"),Z1=yt("CoreMouseService"),J1=yt("CoreService"),Q1=yt("CharsetService"),ew=yt("InstantiationService"),tw=yt("LogService"),lp=yt("OptionsService"),iw=yt("OscLinkService"),sw=yt("UnicodeService"),rw=yt("DecorationService"),cp={trace:0,debug:1,info:2,warn:3,error:4,off:5},dp="xterm.js: ",el=class extends rt{constructor(e){super();this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),kl=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=cp[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":dp)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};el=rf([nf(0,lp)],el);var kl;function up(e){kl=e}var Ll=class extends rt{constructor(e){if(ol&&Cf()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw Error("Webgl2 is only supported on Safari 16 and above")}super();this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new se),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new se),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new se),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new se),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let{coreService:i,optionsService:s}=t,r=t,{_renderService:n,_characterJoinerService:o,_charSizeService:a,_coreBrowserService:l,_decorationService:h,_logService:d,_themeService:c}=r;up(d),this._renderer=this._register(new op(e,o,a,l,i,h,s,c,this._preserveDrawingBuffer)),this._register(Nt.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Nt.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Nt.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Nt.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(We(()=>{if(this._terminal._core._store._isDisposed)return;let f=this._terminal._core._renderService;f.setRenderer(this._terminal._core._createRenderer()),f.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var _p=class{constructor(e,t,i,s={}){this._terminal=e,this._regex=t,this._handler=i,this._options=s}provideLinks(e,t){let i=gp.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map((t)=>(t.leave=this._options.leave,t.hover=(i,s)=>{if(this._options.hover){let{range:r}=t;this._options.hover(i,s,r)}},t))}};function fp(e){try{let t=new URL(e),i=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var gp=class e{static computeLink(t,i,s,r){let n=new RegExp(i.source,(i.flags||"")+"g"),[o,a]=e._getWindowedLineStrings(t-1,s),l=o.join(""),h,d=[];for(;h=n.exec(l);){let c=h[0];if(!fp(c))continue;let[f,p]=e._mapStrIdx(s,a,0,h.index),[w,y]=e._mapStrIdx(s,f,p,c.length);if(f===-1||p===-1||w===-1||y===-1)continue;let E={start:{x:p+1,y:f+1},end:{x:y,y:w+1}};d.push({range:E,text:c,activate:r})}return d}static _getWindowedLineStrings(t,i){let s,r=t,n=t,o=0,a="",l=[];if(s=i.buffer.active.getLine(t)){let h=s.translateToString(!0);if(s.isWrapped&&h[0]!==" "){for(o=0;(s=i.buffer.active.getLine(--r))&&o<2048&&(a=s.translateToString(!0),o+=a.length,l.push(a),!(!s.isWrapped||a.indexOf(" ")!==-1)););l.reverse()}for(l.push(h),o=0;(s=i.buffer.active.getLine(++n))&&s.isWrapped&&o<2048&&(a=s.translateToString(!0),o+=a.length,l.push(a),a.indexOf(" ")===-1););}return[l,r]}static _mapStrIdx(t,i,s,r){let n=t.buffer.active,o=n.getNullCell(),a=s;for(;r;){let l=n.getLine(i);if(!l)return[-1,-1];for(let h=a;h<l.length;++h){l.getCell(h,o);let d=o.getChars();if(o.getWidth()&&(r-=d.length||1,h===l.length-1&&d==="")){let c=n.getLine(i+1);c&&c.isWrapped&&(c.getCell(0,o),o.getWidth()===2&&(r+=1))}if(r<0)return[i,h]}i++,a=0}return[i,a]}},pp=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function vp(e,t){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var El=class{constructor(e=vp,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||pp;this._linkProvider=this._terminal.registerLinkProvider(new _p(this._terminal,i,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var mp=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Ml.isErrorNoTelemetry(e)?new Ml(e.message+`
|
|
120
|
+
}`,Ht=8,Pn=Ht*Float32Array.BYTES_PER_ELEMENT,kg=20*Ht,zh=class{constructor(){this.attributes=new Float32Array(kg),this.count=0}},Wt=0,Hh=0,$h=0,Uh=0,Kh=0,qh=0,Vh=0,Lg=class extends lt{constructor(e,t,i,s){super();this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=s,this._vertices=new zh,this._verticesCursor=new zh;let r=this._gl;this._program=be(yl(r,Cg,xg)),this._register(Fe(()=>r.deleteProgram(this._program))),this._projectionLocation=be(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(Fe(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),h=r.createBuffer();this._register(Fe(()=>r.deleteBuffer(h))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h),r.bufferData(r.ELEMENT_ARRAY_BUFFER,a,r.STATIC_DRAW),this._attributesBuffer=be(r.createBuffer()),this._register(Fe(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,Pn,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,Pn,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,Pn,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors((l)=>{this._updateCachedColors(l),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,bl),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,i=this._vertices,s=1,r,n,o,a,h,l,d,c,f,g,v;for(r=0;r<t.rows;r++){for(o=-1,a=0,h=0,l=!1,n=0;n<t.cols;n++)d=(r*t.cols+n)*lr,c=e.cells[d+rr],f=e.cells[d+nr],g=!!(f&67108864),(c!==a||f!==h&&(l||g))&&((a!==0||l&&h!==0)&&(v=s++*Ht,this._updateRectangle(i,v,h,a,o,n,r)),o=n,a=c,h=f,l=g);(a!==0||l&&h!==0)&&(v=s++*Ht,this._updateRectangle(i,v,h,a,o,t.cols,r))}i.count=s}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let s,r=0;(i.style==="bar"||i.style==="outline")&&(s=r++*Ht,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(s=r++*Ht,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(s=r++*Ht,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),s=r++*Ht,this._addRectangleFloat(t.attributes,s,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=r}_updateRectangle(e,t,i,s,r,n,o){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:Wt=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Wt=(i&16777215)<<8;break;case 0:default:Wt=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:Wt=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Wt=(s&16777215)<<8;break;case 0:default:Wt=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=_g(e.attributes,this._terminal.rows*this._terminal.cols*Ht)),Hh=r*this._dimensions.device.cell.width,$h=o*this._dimensions.device.cell.height,Uh=(Wt>>24&255)/255,Kh=(Wt>>16&255)/255,qh=(Wt>>8&255)/255,Vh=1,this._addRectangle(e.attributes,t,Hh,$h,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Uh,Kh,qh,Vh)}_addRectangle(e,t,i,s,r,n,o,a,h,l){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=a,e[t+6]=h,e[t+7]=l}_addRectangleFloat(e,t,i,s,r,n,o){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},Eg=class extends lt{constructor(e,t,i,s,r,n,o,a){super();this._container=t,this._alpha=r,this._coreBrowserService=n,this._optionsService=o,this._themeService=a,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors((h)=>{this._refreshCharAtlas(e,h),this.reset(e)})),this._register(Fe(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=be(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,s=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Sl(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,i,s){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,s){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=_l,this._clipCell(i,s,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let s=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${s} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Mg=class extends Eg{constructor(e,t,i,s,r,n,o){super(i,e,"link",t,!0,r,n,o),this._register(s.onShowLinkUnderline((a)=>this._handleShowLinkUnderline(a))),this._register(s.onHideLinkUnderline((a)=>this._handleHideLinkUnderline(a)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&cg(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},mt=typeof window=="object"?window:globalThis,Vn=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ne,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ne,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Vn.INSTANCE=new Vn;var Cl=Vn;function Dg(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var B1=Cl.INSTANCE.onDidChangeZoomLevel,P1=Cl.INSTANCE.onDidChangeFullscreen,Ti=typeof navigator=="object"?navigator.userAgent:"",O1=Ti.indexOf("Firefox")>=0,On=Ti.indexOf("AppleWebKit")>=0,Rg=Ti.indexOf("Chrome")>=0,Ag=!Rg&&Ti.indexOf("Safari")>=0,I1=Ti.indexOf("Electron/")>=0,N1=Ti.indexOf("Android")>=0,or=!1;if(typeof mt.matchMedia=="function"){let e=mt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=mt.matchMedia("(display-mode: fullscreen)");or=e.matches,Dg(mt,e,({matches:i})=>{or&&t.matches||(or=i)})}function Tg(){return or}var Di="en",Gn=!1,jn=!1,ar=!1,Bg=!1,xl=!1,kl=!1,Pg=!1,Og=!1,Ig=!1,Ng=!1,er,hr=Di,Gh=Di,Fg,zt,Kt=globalThis,ht;typeof Kt.vscode<"u"&&typeof Kt.vscode.process<"u"?ht=Kt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ht=process);var Ll=typeof ht?.versions?.electron=="string",Wg=Ll&&ht?.type==="renderer";if(typeof ht=="object"){Gn=ht.platform==="win32",jn=ht.platform==="darwin",ar=ht.platform==="linux",Bg=ar&&!!ht.env.SNAP&&!!ht.env.SNAP_REVISION,Pg=Ll,Ig=!!ht.env.CI||!!ht.env.BUILD_ARTIFACTSTAGINGDIRECTORY,er=Di,hr=Di;let e=ht.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);er=t.userLocale,Gh=t.osLocale,hr=t.resolvedLanguage||Di,Fg=t.languagePack?.translationsConfigFile}catch{}xl=!0}else typeof navigator=="object"&&!Wg?(zt=navigator.userAgent,Gn=zt.indexOf("Windows")>=0,jn=zt.indexOf("Macintosh")>=0,Og=(zt.indexOf("Macintosh")>=0||zt.indexOf("iPad")>=0||zt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,ar=zt.indexOf("Linux")>=0,Ng=zt?.indexOf("Mobi")>=0,kl=!0,hr=globalThis._VSCODE_NLS_LANGUAGE||Di,er=navigator.language.toLowerCase(),Gh=er):console.error("Unable to resolve platform.");var In=0;jn?In=1:Gn?In=3:ar&&(In=2);var Nn=xl,zg=kl&&typeof Kt.importScripts=="function",F1=zg?Kt.origin:void 0,kt=zt,ti=hr,Hg;((e)=>{function t(){return ti}e.value=t;function i(){return ti.length===2?ti==="en":ti.length>=3?ti[0]==="e"&&ti[1]==="n"&&ti[2]==="-":!1}e.isDefaultVariant=i;function s(){return ti==="en"}e.isDefault=s})(Hg||={});var $g=typeof Kt.postMessage=="function"&&!Kt.importScripts,Ug=(()=>{if($g){let e=[];Kt.addEventListener("message",(i)=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let n=e[s];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),n.callback();return}}});let t=0;return(i)=>{let s=++t;e.push({id:s,callback:i}),Kt.postMessage({vscodeScheduleAsyncWork:s},"*")}}return(e)=>setTimeout(e)})(),Kg=!!(kt&&kt.indexOf("Chrome")>=0),W1=!!(kt&&kt.indexOf("Firefox")>=0),z1=!!(!Kg&&kt&&kt.indexOf("Safari")>=0),H1=!!(kt&&kt.indexOf("Edg/")>=0),$1=!!(kt&&kt.indexOf("Android")>=0),ii=typeof navigator=="object"?navigator:{},U1={clipboard:{writeText:Nn||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(ii&&ii.clipboard&&ii.clipboard.writeText),readText:Nn||!!(ii&&ii.clipboard&&ii.clipboard.readText)},keyboard:Nn||Tg()?0:ii.keyboard||Ag?1:2,touch:"ontouchstart"in mt||ii.maxTouchPoints>0,pointerEvents:mt.PointerEvent&&(("ontouchstart"in mt)||navigator.maxTouchPoints>0)},Qn=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Fn=new Qn,jh=new Qn,Yh=new Qn,K1=Array(230),qg;((e)=>{function t(a){return Fn.keyCodeToStr(a)}e.toString=t;function i(a){return Fn.strToKeyCode(a)}e.fromString=i;function s(a){return jh.keyCodeToStr(a)}e.toUserSettingsUS=s;function r(a){return Yh.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function n(a){return jh.strToKeyCode(a)||Yh.strToKeyCode(a)}e.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Fn.keyCodeToStr(a)}e.toElectronAccelerator=o})(qg||={});var El=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Vg;((e)=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Gg?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:$t.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:El})})(Vg||={});var Gg=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?El:(this._emitter||(this._emitter=new ne),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},q1=Symbol("MicrotaskDelay"),jg,Wn;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Wn=(e,t)=>{Ug(()=>{if(i)return;let s=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,s-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Wn=(e,t,i)=>{let s=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(s))}}},jg=(e)=>Wn(globalThis,e)})();var Yg;((e)=>{async function t(s){let r,n=await Promise.all(s.map((o)=>o.then((a)=>a,(a)=>{r||(r=a)})));if(typeof r<"u")throw r;return n}e.settled=t;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}e.withAsyncBody=i})(Yg||={});var Xh=class e{static fromArray(t){return new e((i)=>{i.emitMany(t)})}static fromPromise(t){return new e(async(i)=>{i.emitMany(await t)})}static fromPromises(t){return new e(async(i)=>{await Promise.all(t.map(async(s)=>i.emitOne(await s)))})}static merge(t){return new e(async(i)=>{await Promise.all(t.map(async(s)=>{for await(let r of s)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ne,queueMicrotask(async()=>{let s={emitOne:(r)=>this.emitOne(r),emitMany:(r)=>this.emitMany(r),reject:(r)=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await $t.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new e(async(s)=>{for await(let r of t)s.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async(s)=>{for await(let r of t)i(r)&&s.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,(i)=>!!i)}coalesce(){return e.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return e.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Xh.EMPTY=Xh.fromArray([]);function Xg(e){return 55296<=e&&e<=56319}function Zh(e){return 56320<=e&&e<=57343}function Zg(e,t){return(e-55296<<10)+(t-56320)+65536}function Jg(e){return eo(e,0)}function eo(e,t){switch(typeof e){case"object":return e===null?Ut(349,t):Array.isArray(e)?ep(e,t):tp(e,t);case"string":return Ml(e,t);case"boolean":return Qg(e,t);case"number":return Ut(e,t);case"undefined":return Ut(937,t);default:return Ut(617,t)}}function Ut(e,t){return(t<<5)-t+e|0}function Qg(e,t){return Ut(e?433:863,t)}function Ml(e,t){t=Ut(149417,t);for(let i=0,s=e.length;i<s;i++)t=Ut(e.charCodeAt(i),t);return t}function ep(e,t){return t=Ut(104579,t),e.reduce((i,s)=>eo(s,i),t)}function tp(e,t){return t=Ut(181387,t),Object.keys(e).sort().reduce((i,s)=>(i=Ml(s,i),eo(e[s],i)),t)}function zn(e,t,i=32){let s=i-t,r=~((1<<s)-1);return(e<<t|(r&e)>>>s)>>>0}function Jh(e,t=0,i=e.byteLength,s=0){for(let r=0;r<i;r++)e[t+r]=s}function ip(e,t,i="0"){for(;e.length<t;)e=i+e;return e}function gs(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map((i)=>i.toString(16).padStart(2,"0")).join(""):ip((e>>>0).toString(16),t/4)}var sp=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let i=t.length;if(i===0)return;let s=this._buff,r=this._buffLen,n=this._leftoverHighSurrogate,o,a;for(n!==0?(o=n,a=-1,n=0):(o=t.charCodeAt(0),a=0);;){let h=o;if(Xg(o))if(a+1<i){let l=t.charCodeAt(a+1);Zh(l)?(a++,h=Zg(o,l)):h=65533}else{n=o;break}else Zh(o)&&(h=65533);if(r=this._push(s,r,h),a++,a<i)o=t.charCodeAt(a);else break}this._buffLen=r,this._leftoverHighSurrogate=n}_push(t,i,s){return s<128?t[i++]=s:s<2048?(t[i++]=192|(s&1984)>>>6,t[i++]=128|(s&63)>>>0):s<65536?(t[i++]=224|(s&61440)>>>12,t[i++]=128|(s&4032)>>>6,t[i++]=128|(s&63)>>>0):(t[i++]=240|(s&1835008)>>>18,t[i++]=128|(s&258048)>>>12,t[i++]=128|(s&4032)>>>6,t[i++]=128|(s&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),i}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),gs(this._h0)+gs(this._h1)+gs(this._h2)+gs(this._h3)+gs(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Jh(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Jh(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,i=this._buffDV;for(let c=0;c<64;c+=4)t.setUint32(c,i.getUint32(c,!1),!1);for(let c=64;c<320;c+=4)t.setUint32(c,zn(t.getUint32(c-12,!1)^t.getUint32(c-32,!1)^t.getUint32(c-56,!1)^t.getUint32(c-64,!1),1),!1);let s=this._h0,r=this._h1,n=this._h2,o=this._h3,a=this._h4,h,l,d;for(let c=0;c<80;c++)c<20?(h=r&n|~r&o,l=1518500249):c<40?(h=r^n^o,l=1859775393):c<60?(h=r&n|r&o|n&o,l=2400959708):(h=r^n^o,l=3395469782),d=zn(s,5)+h+a+l+t.getUint32(c*4,!1)&4294967295,a=o,o=n,n=zn(r,30),r=s,s=d;this._h0=this._h0+s&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+n&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+a&4294967295}};sp._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:V1,getWindow:rp,getDocument:G1,getWindows:j1,getWindowsCount:Y1,getWindowId:Qh,getWindowById:X1,hasWindow:Z1,onDidRegisterWindow:J1,onWillUnregisterWindow:Q1,onDidUnregisterWindow:ew}=function(){let e=new Map,t={window:mt,disposables:new Ri};e.set(mt.vscodeWindowId,t);let i=new ne,s=new ne,r=new ne;function n(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(e.has(o.vscodeWindowId))return lt.None;let a=new Ri,h={window:o,disposables:a.add(new Ri)};return e.set(o.vscodeWindowId,h),a.add(Fe(()=>{e.delete(o.vscodeWindowId),s.fire(o)})),a.add(Yn(o,ap.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(h),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:n,getWindow(o){let a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let h=o;return h?.view?h.view.window:mt},getDocument(o){return rp(o).document}}}(),np=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Yn(e,t,i,s){return new np(e,t,i,s)}var op,el,Hn=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){tr(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,s=new Map,r=(n)=>{i.set(n,!1);let o=e.get(n)??[];for(t.set(n,o),e.set(n,[]),s.set(n,!0);o.length>0;)o.sort(Hn.sort),o.shift().execute();s.set(n,!1)};el=(n,o,a=0)=>{let h=Qh(n),l=new Hn(o,a),d=e.get(h);return d||(d=[],e.set(h,d)),d.push(l),i.get(h)||(i.set(h,!0),n.requestAnimationFrame(()=>r(h))),l},op=(n,o,a)=>{let h=Qh(n);if(s.get(h)){let l=new Hn(o,a),d=t.get(h);return d||(d=[],t.set(h,d)),d.push(l),l}else return el(n,o,a)}})();var tl=class e{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new e(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};tl.None=new tl(0,0);var tw=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let s=this.mutationObservers.get(e);s||(s=new Map,this.mutationObservers.set(e,s));let r=Jg(i),n=s.get(r);if(n)n.users+=1;else{let o=new ne,a=new MutationObserver((l)=>o.fire(l));a.observe(e,i);let h=n={users:1,observer:a,onDidMutate:o.event};t.add(Fe(()=>{h.users-=1,h.users===0&&(o.dispose(),a.disconnect(),s?.delete(r),s?.size===0&&this.mutationObservers.delete(e))})),s.set(r,n)}return n.onDidMutate}},ap={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:On?"webkitAnimationStart":"animationstart",ANIMATION_END:On?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:On?"webkitAnimationIteration":"animationiteration"},hp=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Dl(e,t,i,...s){let r=hp.exec(t);if(!r)throw Error("Bad use of emmet");let n=r[1]||"div",o;return e!=="http://www.w3.org/1999/xhtml"?o=document.createElementNS(e,n):o=document.createElement(n),r[3]&&(o.id=r[3]),r[4]&&(o.className=r[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([a,h])=>{typeof h>"u"||(/^on\w+$/.test(a)?o[a]=h:a==="selected"?h&&o.setAttribute(a,"true"):o.setAttribute(a,h))}),o.append(...s),o}function lp(e,t,...i){return Dl("http://www.w3.org/1999/xhtml",e,t,...i)}lp.SVG=function(e,t,...i){return Dl("http://www.w3.org/2000/svg",e,t,...i)};var cp=class extends lt{constructor(e,t,i,s,r,n,o,a,h){super();this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._optionsService=o,this._themeService=a,this._cursorBlinkStateManager=new ds,this._charAtlasDisposable=this._register(new ds),this._observerDisposable=this._register(new ds),this._model=new yg,this._workCell=new Fh,this._workCell2=new Fh,this._rectangleRenderer=this._register(new ds),this._glyphRenderer=this._register(new ds),this._onChangeTextureAtlas=this._register(new ne),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ne),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ne),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ne),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ne),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let l={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",l),!this._gl)throw Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Nf(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Mg(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=Of(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Yn(this._canvas,"webglcontextlost",(d)=>{console.log("webglcontextlost event received"),d.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(d)},3000)})),this._register(Yn(this._canvas,"webglcontextrestored",(d)=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Ih(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=Nh(this._canvas,this._coreBrowserService.window,(d,c)=>this._setCanvasDevicePixelDimensions(d,c)),this._register(this._coreBrowserService.onWindowChange((d)=>{this._observerDisposable.value=Nh(this._canvas,d,(c,f)=>this._setCanvasDevicePixelDimensions(c,f))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Fe(()=>{for(let d of this._renderLayers)d.dispose();this._canvas.parentElement?.removeChild(this._canvas),Ih(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Lg(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new mg(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=Sl(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=ll($t.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),$t.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new dg(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,s=this._workCell,r,n,o,a,h,l,d=0,c=!0,f,g,v,y,E,R,P,A,b;e=il(e,i.rows-1,0),t=il(t,i.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",L=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,N=L-i.buffer.ydisp,q=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),Y=-1,oe=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let F=!1;for(n=e;n<=t;n++)for(o=n+i.buffer.ydisp,a=i.buffer.lines.get(o),this._model.lineLengths[n]=0,v=L===o,d=0,h=this._characterJoinerService.getJoinedCharacters(o),A=0;A<i.cols;A++){if(r=this._cellColorResolver.result.bg,a.loadCell(A,s),A===0&&(r=this._cellColorResolver.result.bg),l=!1,c=A>=d,f=A,h.length>0&&A===h[0][0]&&c){g=h.shift();let Le=this._model.selection.isCellSelected(this._terminal,g[0],o);for(P=g[0]+1;P<g[1];P++)c&&=Le===this._model.selection.isCellSelected(this._terminal,P,o);c&&=!v||q<g[0]||q>=g[1],c?(l=!0,s=new dp(s,a.translateToString(!0,g[0],g[1]),g[1]-g[0]),f=g[1]-1):d=g[1]}if(y=s.getChars(),E=s.getCode(),P=(n*i.cols+A)*lr,this._cellColorResolver.resolve(s,A,o,this.dimensions.device.cell.width),oe&&o===L&&(A===q&&(this._model.cursor={x:q,y:N,width:s.getWidth(),style:this._coreBrowserService.isFocused?x:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},Y=q+s.getWidth()-1),A>=q&&A<=Y&&(this._coreBrowserService.isFocused&&x==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),E!==0&&(this._model.lineLengths[n]=A+1),!(this._model.cells[P]===E&&this._model.cells[P+rr]===this._cellColorResolver.result.bg&&this._model.cells[P+nr]===this._cellColorResolver.result.fg&&this._model.cells[P+Bn]===this._cellColorResolver.result.ext)&&(F=!0,y.length>1&&(E|=bg),this._model.cells[P]=E,this._model.cells[P+rr]=this._cellColorResolver.result.bg,this._model.cells[P+nr]=this._cellColorResolver.result.fg,this._model.cells[P+Bn]=this._cellColorResolver.result.ext,R=s.getWidth(),this._glyphRenderer.value.updateCell(A,n,E,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,y,R,r),l)){for(s=this._workCell,A++;A<=f;A++)b=(n*i.cols+A)*lr,this._glyphRenderer.value.updateCell(A,n,0,0,0,0,Mf,0,0),this._model.cells[b]=0,this._model.cells[b+rr]=this._cellColorResolver.result.bg,this._model.cells[b+nr]=this._cellColorResolver.result.fg,this._model.cells[b+Bn]=this._cellColorResolver.result.ext;A--}}F&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},dp=class extends Mi{constructor(e,t,i){super();this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function il(e,t,i=0){return Math.max(Math.min(e,t),i)}var sl="di$target",rl="di$dependencies",$n=new Map;function Lt(e){if($n.has(e))return $n.get(e);let t=function(i,s,r){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");up(t,i,r)};return t._id=e,$n.set(e,t),t}function up(e,t,i){t[sl]===t?t[rl].push({id:e,index:i}):(t[rl]=[{id:e,index:i}],t[sl]=t)}var iw=Lt("BufferService"),sw=Lt("CoreMouseService"),rw=Lt("CoreService"),nw=Lt("CharsetService"),ow=Lt("InstantiationService"),aw=Lt("LogService"),_p=Lt("OptionsService"),hw=Lt("OscLinkService"),lw=Lt("UnicodeService"),cw=Lt("DecorationService"),fp={trace:0,debug:1,info:2,warn:3,error:4,off:5},gp="xterm.js: ",nl=class extends lt{constructor(e){super();this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Rl=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=fp[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":gp)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};nl=hf([lf(0,_p)],nl);var Rl;function pp(e){Rl=e}var Al=class extends lt{constructor(e){if(dl&&Ef()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw Error("Webgl2 is only supported on Safari 16 and above")}super();this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new ne),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ne),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ne),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ne),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let{coreService:i,optionsService:s}=t,r=t,{_renderService:n,_characterJoinerService:o,_charSizeService:a,_coreBrowserService:h,_decorationService:l,_logService:d,_themeService:c}=r;pp(d),this._renderer=this._register(new cp(e,o,a,h,i,l,s,c,this._preserveDrawingBuffer)),this._register($t.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register($t.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register($t.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register($t.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(Fe(()=>{if(this._terminal._core._store._isDisposed)return;let f=this._terminal._core._renderService;f.setRenderer(this._terminal._core._createRenderer()),f.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var vp=class{constructor(e,t,i,s={}){this._terminal=e,this._regex=t,this._handler=i,this._options=s}provideLinks(e,t){let i=wp.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(i))}_addCallbacks(e){return e.map((t)=>(t.leave=this._options.leave,t.hover=(i,s)=>{if(this._options.hover){let{range:r}=t;this._options.hover(i,s,r)}},t))}};function mp(e){try{let t=new URL(e),i=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var wp=class e{static computeLink(t,i,s,r){let n=new RegExp(i.source,(i.flags||"")+"g"),[o,a]=e._getWindowedLineStrings(t-1,s),h=o.join(""),l,d=[];for(;l=n.exec(h);){let c=l[0];if(!mp(c))continue;let[f,g]=e._mapStrIdx(s,a,0,l.index),[v,y]=e._mapStrIdx(s,f,g,c.length);if(f===-1||g===-1||v===-1||y===-1)continue;let E={start:{x:g+1,y:f+1},end:{x:y,y:v+1}};d.push({range:E,text:c,activate:r})}return d}static _getWindowedLineStrings(t,i){let s,r=t,n=t,o=0,a="",h=[];if(s=i.buffer.active.getLine(t)){let l=s.translateToString(!0);if(s.isWrapped&&l[0]!==" "){for(o=0;(s=i.buffer.active.getLine(--r))&&o<2048&&(a=s.translateToString(!0),o+=a.length,h.push(a),!(!s.isWrapped||a.indexOf(" ")!==-1)););h.reverse()}for(h.push(l),o=0;(s=i.buffer.active.getLine(++n))&&s.isWrapped&&o<2048&&(a=s.translateToString(!0),o+=a.length,h.push(a),a.indexOf(" ")===-1););}return[h,r]}static _mapStrIdx(t,i,s,r){let n=t.buffer.active,o=n.getNullCell(),a=s;for(;r;){let h=n.getLine(i);if(!h)return[-1,-1];for(let l=a;l<h.length;++l){h.getCell(l,o);let d=o.getChars();if(o.getWidth()&&(r-=d.length||1,l===h.length-1&&d==="")){let c=n.getLine(i+1);c&&c.isWrapped&&(c.getCell(0,o),o.getWidth()===2&&(r+=1))}if(r<0)return[i,l]}i++,a=0}return[i,a]}},Sp=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function bp(e,t){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}var Tl=class{constructor(e=bp,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,i=t.urlRegex||Sp;this._linkProvider=this._terminal.registerLinkProvider(new vp(this._terminal,i,this._handler,t))}dispose(){this._linkProvider?.dispose()}};var yp=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Bl.isErrorNoTelemetry(e)?new Bl(e.message+`
|
|
121
121
|
|
|
122
122
|
`+e.stack):Error(e.message+`
|
|
123
123
|
|
|
124
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach((t)=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},
|
|
125
|
-
`).map((c)=>c.trim().replace("at ","")).filter((c)=>c!=="");return
|
|
126
|
-
`),
|
|
127
|
-
`)).size}/${s.length} leaks) at ${f}`;let
|
|
128
|
-
`)),
|
|
124
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach((t)=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Cp=new yp;function to(e){xp(e)||Cp.onUnexpectedError(e)}var ro="Canceled";function xp(e){return e instanceof kp?!0:e instanceof Error&&e.name===ro&&e.message===ro}var kp=class extends Error{constructor(){super(ro),this.name=this.message}},Bl=class e extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e)return t;let i=new e;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function Lp(e,t,i=0,s=e.length){let r=i,n=s;for(;r<n;){let o=Math.floor((r+n)/2);t(e[o])?r=o+1:n=o}return r-1}var Ep=class e{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let s of this._array)if(this._prevFindLastPredicate(s)&&!t(s))throw Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=Lp(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};Ep.assertInvariants=!1;var $l;((e)=>{function t(n){return n<0}e.isLessThan=t;function i(n){return n<=0}e.isLessThanOrEqual=i;function s(n){return n>0}e.isGreaterThan=s;function r(n){return n===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})($l||={});function Mp(e,t){return(i,s)=>t(e(i),e(s))}var Dp=(e,t)=>e-t,Pl=class e{constructor(t){this.iterate=t}forEach(t){this.iterate((i)=>(t(i),!0))}toArray(){let t=[];return this.iterate((i)=>(t.push(i),!0)),t}filter(t){return new e((i)=>this.iterate((s)=>t(s)?i(s):!0))}map(t){return new e((i)=>this.iterate((s)=>i(t(s))))}some(t){let i=!1;return this.iterate((s)=>(i=t(s),!i)),i}findFirst(t){let i;return this.iterate((s)=>t(s)?(i=s,!1):!0),i}findLast(t){let i;return this.iterate((s)=>(t(s)&&(i=s),!0)),i}findLastMaxBy(t){let i,s=!0;return this.iterate((r)=>((s||$l.isGreaterThan(t(r,i)))&&(s=!1,i=r),!0)),i}};Pl.empty=new Pl((e)=>{});function Rp(e,t){let i=Object.create(null);for(let s of e){let r=t(s),n=i[r];n||(n=i[r]=[]),n.push(s)}return i}var Ol,Il,Jw=class{constructor(e,t){this.toKey=t,this._map=new Map,this[Ol]="SetWithKey";for(let i of e)this.add(i)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach((i)=>e.call(t,i,i,this))}[(Il=Symbol.iterator,Ol=Symbol.toStringTag,Il)](){return this.values()}},Ap=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}};function Tp(e,t){let i=this,s=!1,r;return function(){if(s)return r;if(s=!0,t)try{r=e.apply(i,arguments)}finally{t()}else r=e.apply(i,arguments);return r}}var Ul;((e)=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function s(){return i}e.empty=s;function*r(b){yield b}e.single=r;function n(b){return t(b)?b:r(b)}e.wrap=n;function o(b){return b||i}e.from=o;function*a(b){for(let x=b.length-1;x>=0;x--)yield b[x]}e.reverse=a;function h(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=h;function l(b){return b[Symbol.iterator]().next().value}e.first=l;function d(b,x){let L=0;for(let N of b)if(x(N,L++))return!0;return!1}e.some=d;function c(b,x){for(let L of b)if(x(L))return L}e.find=c;function*f(b,x){for(let L of b)x(L)&&(yield L)}e.filter=f;function*g(b,x){let L=0;for(let N of b)yield x(N,L++)}e.map=g;function*v(b,x){let L=0;for(let N of b)yield*x(N,L++)}e.flatMap=v;function*y(...b){for(let x of b)yield*x}e.concat=y;function E(b,x,L){let N=L;for(let q of b)N=x(N,q);return N}e.reduce=E;function*R(b,x,L=b.length){for(x<0&&(x+=b.length),L<0?L+=b.length:L>b.length&&(L=b.length);x<L;x++)yield b[x]}e.slice=R;function P(b,x=Number.POSITIVE_INFINITY){let L=[];if(x===0)return[L,b];let N=b[Symbol.iterator]();for(let q=0;q<x;q++){let Y=N.next();if(Y.done)return[L,e.empty()];L.push(Y.value)}return[L,{[Symbol.iterator](){return N}}]}e.consume=P;async function A(b){let x=[];for await(let L of b)x.push(L);return Promise.resolve(x)}e.asyncToArray=A})(Ul||={});var Bp=!1,Pi=null,Pp=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let i=this.livingDisposables.get(t);return i||(i={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,i)),i}trackDisposable(t){let i=this.getDisposableData(t);i.source||(i.source=Error().stack)}setParent(t,i){let s=this.getDisposableData(t);s.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let s=i.get(t);if(s)return s;let r=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,r),r}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,i])=>i.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,i){let s;if(i)s=i;else{let h=new Map,l=[...this.livingDisposables.values()].filter((c)=>c.source!==null&&!this.getRootParent(c,h).isSingleton);if(l.length===0)return;let d=new Set(l.map((c)=>c.value));if(s=l.filter((c)=>!(c.parent&&d.has(c.parent))),s.length===0)throw Error("There are cyclic diposable chains!")}if(!s)return;function r(h){function l(c,f){for(;c.length>0&&f.some((g)=>typeof g=="string"?g===c[0]:c[0].match(g));)c.shift()}let d=h.source.split(`
|
|
125
|
+
`).map((c)=>c.trim().replace("at ","")).filter((c)=>c!=="");return l(d,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),d.reverse()}let n=new Ap;for(let h of s){let l=r(h);for(let d=0;d<=l.length;d++)n.add(l.slice(0,d).join(`
|
|
126
|
+
`),h)}s.sort(Mp((h)=>h.idx,Dp));let o="",a=0;for(let h of s.slice(0,t)){a++;let l=r(h),d=[];for(let c=0;c<l.length;c++){let f=l[c];f=`(shared with ${n.get(l.slice(0,c+1).join(`
|
|
127
|
+
`)).size}/${s.length} leaks) at ${f}`;let g=n.get(l.slice(0,c).join(`
|
|
128
|
+
`)),v=Rp([...g].map((y)=>r(y)[c]),(y)=>y);delete v[l[c]];for(let[y,E]of Object.entries(v))d.unshift(` - stacktraces of ${E.length} other leaks continue with ${y}`);d.unshift(f)}o+=`
|
|
129
129
|
|
|
130
130
|
|
|
131
|
-
==================== Leaking disposable ${a}/${s.length}: ${
|
|
131
|
+
==================== Leaking disposable ${a}/${s.length}: ${h.value.constructor.name} ====================
|
|
132
132
|
${d.join(`
|
|
133
133
|
`)}
|
|
134
134
|
============================================================
|
|
@@ -138,23 +138,23 @@ ${d.join(`
|
|
|
138
138
|
|
|
139
139
|
... and ${s.length-t} more leaking disposables
|
|
140
140
|
|
|
141
|
-
`),{leaks:s,details:o}}};
|
|
141
|
+
`),{leaks:s,details:o}}};Pp.idx=0;function Op(e){Pi=e}if(Bp){let e="__is_disposable_tracked__";Op(new class{trackDisposable(t){let i=Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3000)}setParent(t,i){if(t&&t!==Mt.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Mt.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function mr(e){return Pi?.trackDisposable(e),e}function wr(e){Pi?.markAsDisposed(e)}function bs(e,t){Pi?.setParent(e,t)}function Ip(e,t){if(Pi)for(let i of e)Pi.setParent(i,t)}function Ss(e){if(Ul.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Kl(...e){let t=Oi(()=>Ss(e));return Ip(e,t),t}function Oi(e){let t=mr({dispose:Tp(()=>{wr(t),e()})});return t}var ql=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,mr(this)}dispose(){this._isDisposed||(wr(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ss(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error("Cannot register a disposable on itself!");return bs(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),bs(t,null))}};ql.DISABLE_DISPOSED_WARNING=!1;var lo=ql,Mt=class{constructor(){this._store=new lo,mr(this),bs(this._store,this)}dispose(){wr(this),this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}};Mt.None=Object.freeze({dispose(){}});var vr=class{constructor(){this._isDisposed=!1,mr(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&bs(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,wr(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&bs(e,null),e}},Nl=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Nl.Undefined=new Nl(void 0);var Np=globalThis.performance&&typeof globalThis.performance.now=="function",Fp=class e{static create(t){return new e(t)}constructor(t){this._now=Np&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Wp=!1,Fl=!1,zp=!1,co;((e)=>{e.None=()=>Mt.None;function t(u){if(zp){let{onDidAddListener:_}=u,w=oo.create(),p=0;u.onDidAddListener=()=>{++p===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),w.print()),_?.()}}}function i(u,_){return f(u,()=>{},0,void 0,!0,void 0,_)}e.defer=i;function s(u){return(_,w=null,p)=>{let S=!1,m;return m=u((C)=>{if(!S)return m?m.dispose():S=!0,_.call(w,C)},null,p),S&&m.dispose(),m}}e.once=s;function r(u,_,w){return d((p,S=null,m)=>u((C)=>p.call(S,_(C)),null,m),w)}e.map=r;function n(u,_,w){return d((p,S=null,m)=>u((C)=>{_(C),p.call(S,C)},null,m),w)}e.forEach=n;function o(u,_,w){return d((p,S=null,m)=>u((C)=>_(C)&&p.call(S,C),null,m),w)}e.filter=o;function a(u){return u}e.signal=a;function h(...u){return(_,w=null,p)=>{let S=Kl(...u.map((m)=>m((C)=>_.call(w,C))));return c(S,p)}}e.any=h;function l(u,_,w,p){let S=w;return r(u,(m)=>(S=_(S,m),S),p)}e.reduce=l;function d(u,_){let w,p={onWillAddFirstListener(){w=u(S.fire,S)},onDidRemoveLastListener(){w?.dispose()}};_||t(p);let S=new Et(p);return _?.add(S),S.event}function c(u,_){return _ instanceof Array?_.push(u):_&&_.add(u),u}function f(u,_,w=100,p=!1,S=!1,m,C){let k,B,H,z=0,K,se={leakWarningThreshold:m,onWillAddFirstListener(){k=u((Q)=>{z++,B=_(B,Q),p&&!H&&(V.fire(B),B=void 0),K=()=>{let Z=B;B=void 0,H=void 0,(!p||z>1)&&V.fire(Z),z=0},typeof w=="number"?(clearTimeout(H),H=setTimeout(K,w)):H===void 0&&(H=0,queueMicrotask(K))})},onWillRemoveListener(){S&&z>0&&K?.()},onDidRemoveLastListener(){K=void 0,k.dispose()}};C||t(se);let V=new Et(se);return C?.add(V),V.event}e.debounce=f;function g(u,_=0,w){return e.debounce(u,(p,S)=>p?(p.push(S),p):[S],_,void 0,!0,void 0,w)}e.accumulate=g;function v(u,_=(p,S)=>p===S,w){let p=!0,S;return o(u,(m)=>{let C=p||!_(m,S);return p=!1,S=m,C},w)}e.latch=v;function y(u,_,w){return[e.filter(u,_,w),e.filter(u,(p)=>!_(p),w)]}e.split=y;function E(u,_=!1,w=[],p){let S=w.slice(),m=u((B)=>{S?S.push(B):k.fire(B)});p&&p.add(m);let C=()=>{S?.forEach((B)=>k.fire(B)),S=null},k=new Et({onWillAddFirstListener(){m||(m=u((B)=>k.fire(B)),p&&p.add(m))},onDidAddFirstListener(){S&&(_?setTimeout(C):C())},onDidRemoveLastListener(){m&&m.dispose(),m=null}});return p&&p.add(k),k.event}e.buffer=E;function R(u,_){return(w,p,S)=>{let m=_(new A);return u(function(C){let k=m.evaluate(C);k!==P&&w.call(p,k)},void 0,S)}}e.chain=R;let P=Symbol("HaltChainable");class A{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push((_)=>(u(_),_)),this}filter(u){return this.steps.push((_)=>u(_)?_:P),this}reduce(u,_){let w=_;return this.steps.push((p)=>(w=u(w,p),w)),this}latch(u=(_,w)=>_===w){let _=!0,w;return this.steps.push((p)=>{let S=_||!u(p,w);return _=!1,w=p,S?p:P}),this}evaluate(u){for(let _ of this.steps)if(u=_(u),u===P)break;return u}}function b(u,_,w=(p)=>p){let p=(...k)=>C.fire(w(...k)),S=()=>u.on(_,p),m=()=>u.removeListener(_,p),C=new Et({onWillAddFirstListener:S,onDidRemoveLastListener:m});return C.event}e.fromNodeEventEmitter=b;function x(u,_,w=(p)=>p){let p=(...k)=>C.fire(w(...k)),S=()=>u.addEventListener(_,p),m=()=>u.removeEventListener(_,p),C=new Et({onWillAddFirstListener:S,onDidRemoveLastListener:m});return C.event}e.fromDOMEventEmitter=x;function L(u){return new Promise((_)=>s(u)(_))}e.toPromise=L;function N(u){let _=new Et;return u.then((w)=>{_.fire(w)},()=>{_.fire(void 0)}).finally(()=>{_.dispose()}),_.event}e.fromPromise=N;function q(u,_){return u((w)=>_.fire(w))}e.forward=q;function Y(u,_,w){return _(w),u((p)=>_(p))}e.runAndSubscribe=Y;class oe{constructor(u,_){this._observable=u,this._counter=0,this._hasChanged=!1;let w={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};_||t(w),this.emitter=new Et(w),_&&_.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,_){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function F(u,_){return new oe(u,_).emitter.event}e.fromObservable=F;function Le(u){return(_,w,p)=>{let S=0,m=!1,C={beginUpdate(){S++},endUpdate(){S--,S===0&&(u.reportChanges(),m&&(m=!1,_.call(w)))},handlePossibleChange(){},handleChange(){m=!0}};u.addObserver(C),u.reportChanges();let k={dispose(){u.removeObserver(C)}};return p instanceof lo?p.add(k):Array.isArray(p)&&p.push(k),k}}e.fromObservableLight=Le})(co||={});var no=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(t){this._stopWatch=new Fp,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};no.all=new Set,no._idPool=0;var Hp=no,Wl=-1,Vl=class e{constructor(t,i,s=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*0.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let h=new Up(a,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,r]of this._stacks)(!t||i<r)&&(t=[s,r],i=r);return t}};Vl._idPool=1;var $p=Vl,oo=class e{constructor(t){this.value=t}static create(){let t=Error();return new e(t.stack??"")}print(){console.warn(this.value.split(`
|
|
142
142
|
`).slice(2).join(`
|
|
143
|
-
`))}},
|
|
144
|
-
`)),e.length=0)},3000),
|
|
143
|
+
`))}},Up=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Kp=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},qp=0,_r=class{constructor(e){this.value=e,this.id=qp++}},Vp=2,Gp=(e,t)=>{if(e instanceof _r)t(e);else for(let i=0;i<e.length;i++){let s=e[i];s&&t(s)}},fr;if(Wp){let e=[];setInterval(()=>{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(`
|
|
144
|
+
`)),e.length=0)},3000),fr=new FinalizationRegistry((t)=>{typeof t=="string"&&e.push(t)})}var Et=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Wl>0||this._options?.leakWarningThreshold?new $p(e?.onListenerError??to,this._options?.leakWarningThreshold??Wl):void 0,this._perfMon=this._options?._profName?new Hp(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Fl){let e=this._listeners;queueMicrotask(()=>{Gp(e,(t)=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new Kp(`${a}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||to)(l),Mt.None}if(this._disposed)return Mt.None;t&&(e=e.bind(t));let s=new _r(e),r,n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*0.2)&&(s.stack=oo.create(),r=this._leakageMon.check(s.stack,this._size+1)),Fl&&(s.stack=n??oo.create()),this._listeners?this._listeners instanceof _r?(this._deliveryQueue??=new jp,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=Oi(()=>{fr?.unregister(o),r?.(),this._removeListener(s)});if(i instanceof lo?i.add(o):Array.isArray(i)&&i.push(o),fr){let a=Error().stack.split(`
|
|
145
145
|
`).slice(2,3).join(`
|
|
146
|
-
`).trim(),l=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);cr.register(o,l?.[2]??a,o)}return o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*$p<=t.length){let r=0;for(let n=0;n<t.length;n++)t[n]?t[r++]=t[n]:s&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=r}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||Xn;if(!i){e.value(t);return}try{e.value(t)}catch(s){i(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof lr)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Kp=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},$l=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),qp;((e)=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Vp?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:no.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:$l})})(qp||={});var Vp=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?$l:(this._emitter||(this._emitter=new Ct),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Mi="en",io=!1,so=!1,dr=!1,jp=!1,Gp=!1,Ul=!1,Yp=!1,Xp=!1,Zp=!1,Jp=!1,hr,ur=Mi,Ol=Mi,Qp,zt,Ht=globalThis,nt;typeof Ht.vscode<"u"&&typeof Ht.vscode.process<"u"?nt=Ht.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(nt=process);var Kl=typeof nt?.versions?.electron=="string",ev=Kl&&nt?.type==="renderer";if(typeof nt=="object"){io=nt.platform==="win32",so=nt.platform==="darwin",dr=nt.platform==="linux",jp=dr&&!!nt.env.SNAP&&!!nt.env.SNAP_REVISION,Yp=Kl,Zp=!!nt.env.CI||!!nt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,hr=Mi,ur=Mi;let e=nt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);hr=t.userLocale,Ol=t.osLocale,ur=t.resolvedLanguage||Mi,Qp=t.languagePack?.translationsConfigFile}catch{}Gp=!0}else typeof navigator=="object"&&!ev?(zt=navigator.userAgent,io=zt.indexOf("Windows")>=0,so=zt.indexOf("Macintosh")>=0,Xp=(zt.indexOf("Macintosh")>=0||zt.indexOf("iPad")>=0||zt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,dr=zt.indexOf("Linux")>=0,Jp=zt?.indexOf("Mobi")>=0,Ul=!0,ur=globalThis._VSCODE_NLS_LANGUAGE||Mi,hr=navigator.language.toLowerCase(),Ol=hr):console.error("Unable to resolve platform.");var Zn=0;so?Zn=1:io?Zn=3:dr&&(Zn=2);var tv=Ul&&typeof Ht.importScripts=="function",jw=tv?Ht.origin:void 0,kt=zt,ei=ur,iv;((e)=>{function t(){return ei}e.value=t;function i(){return ei.length===2?ei==="en":ei.length>=3?ei[0]==="e"&&ei[1]==="n"&&ei[2]==="-":!1}e.isDefaultVariant=i;function s(){return ei==="en"}e.isDefault=s})(iv||={});var sv=typeof Ht.postMessage=="function"&&!Ht.importScripts,rv=(()=>{if(sv){let e=[];Ht.addEventListener("message",(i)=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let n=e[s];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),n.callback();return}}});let t=0;return(i)=>{let s=++t;e.push({id:s,callback:i}),Ht.postMessage({vscodeScheduleAsyncWork:s},"*")}}return(e)=>setTimeout(e)})(),nv=!!(kt&&kt.indexOf("Chrome")>=0),Gw=!!(kt&&kt.indexOf("Firefox")>=0),Yw=!!(!nv&&kt&&kt.indexOf("Safari")>=0),Xw=!!(kt&&kt.indexOf("Edg/")>=0),Zw=!!(kt&&kt.indexOf("Android")>=0),Jw=Symbol("MicrotaskDelay");function ql(e,t=0,i){let s=setTimeout(()=>{e(),i&&r.dispose()},t),r=Ri(()=>{clearTimeout(s),i?.deleteAndLeak(r)});return i?.add(r),r}var ov,Jn;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Jn=(e,t)=>{rv(()=>{if(i)return;let s=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,s-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Jn=(e,t,i)=>{let s=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(s))}}},ov=(e)=>Jn(globalThis,e)})();var av;((e)=>{async function t(s){let r,n=await Promise.all(s.map((o)=>o.then((a)=>a,(a)=>{r||(r=a)})));if(typeof r<"u")throw r;return n}e.settled=t;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}e.withAsyncBody=i})(av||={});var Il=class e{static fromArray(t){return new e((i)=>{i.emitMany(t)})}static fromPromise(t){return new e(async(i)=>{i.emitMany(await t)})}static fromPromises(t){return new e(async(i)=>{await Promise.all(t.map(async(s)=>i.emitOne(await s)))})}static merge(t){return new e(async(i)=>{await Promise.all(t.map(async(s)=>{for await(let r of s)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new Ct,queueMicrotask(async()=>{let s={emitOne:(r)=>this.emitOne(r),emitMany:(r)=>this.emitMany(r),reject:(r)=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await no.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new e(async(s)=>{for await(let r of t)s.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async(s)=>{for await(let r of t)i(r)&&s.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,(i)=>!!i)}coalesce(){return e.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return e.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Il.EMPTY=Il.fromArray([]);var hv=class extends xt{constructor(e){super();this._terminal=e,this._linesCacheTimeout=this._register(new _r),this._linesCacheDisposables=this._register(new _r),this._register(Ri(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Wl(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=ql(()=>this._destroyLinesCache(),15000)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let i=[],s=[0],r=this._terminal.buffer.active.getLine(e);for(;r;){let n=this._terminal.buffer.active.getLine(e+1),o=n?n.isWrapped:!1,a=r.translateToString(!o&&t);if(o&&n){let l=r.getCell(r.length-1);l&&l.getCode()===0&&l.getWidth()===1&&n.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(i.push(a),o)s.push(s[s.length-1]+a.length);else break;e++,r=n}return[i.join(""),s]}},lv=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},cv=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,i,s){if(!e||e.length===0){this._terminal.clearSelection();return}if(i>this._terminal.cols)throw Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let r={startRow:t,startCol:i},n=this._findInLine(e,r,s);if(!n)for(let o=t+1;o<this._terminal.buffer.active.baseY+this._terminal.rows&&(r.startRow=o,r.startCol=0,n=this._findInLine(e,r,s),!n);o++);return n}findNextWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=0,n=0;s&&(i===e?(r=s.end.x,n=s.end.y):(r=s.start.x,n=s.start.y)),this._lineCache.initLinesCache();let o={startRow:n,startCol:r},a=this._findInLine(e,o,t);if(!a)for(let l=n+1;l<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=l,o.startCol=0,a=this._findInLine(e,o,t),!a);l++);if(!a&&n!==0)for(let l=0;l<n&&(o.startRow=l,o.startCol=0,a=this._findInLine(e,o,t),!a);l++);return!a&&s&&(o.startRow=s.start.y,o.startCol=0,a=this._findInLine(e,o,t)),a}findPreviousWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=this._terminal.buffer.active.baseY+this._terminal.rows-1,n=this._terminal.cols,o=!0;this._lineCache.initLinesCache();let a={startRow:r,startCol:n},l;if(s&&(a.startRow=r=s.start.y,a.startCol=n=s.start.x,i!==e&&(l=this._findInLine(e,a,t,!1),l||(a.startRow=r=s.end.y,a.startCol=n=s.end.x))),l||(l=this._findInLine(e,a,t,o)),!l){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let h=r-1;h>=0&&(a.startRow=h,l=this._findInLine(e,a,t,o),!l);h--);}if(!l&&r!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let h=this._terminal.buffer.active.baseY+this._terminal.rows-1;h>=r&&(a.startRow=h,l=this._findInLine(e,a,t,o),!l);h--);return l}_isWholeWord(e,t,i){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+i.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+i.length]))}_findInLine(e,t,i={},s=!1){let{startRow:r,startCol:n}=t;if(this._terminal.buffer.active.getLine(r)?.isWrapped){if(s){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,i)}let o=this._lineCache.getLineFromCache(r);o||(o=this._lineCache.translateBufferLineToStringWithWrap(r,!0),this._lineCache.setLineInCache(r,o));let[a,l]=o,h=this._bufferColsToStringOffset(r,n),d=e,c=a;i.regex||(d=i.caseSensitive?e:e.toLowerCase(),c=i.caseSensitive?a:a.toLowerCase());let f=-1;if(i.regex){let p=RegExp(d,i.caseSensitive?"g":"gi"),w;if(s)for(;w=p.exec(c.slice(0,h));)f=p.lastIndex-w[0].length,e=w[0],p.lastIndex-=e.length-1;else w=p.exec(c.slice(h)),w&&w[0].length>0&&(f=h+(p.lastIndex-w[0].length),e=w[0])}else s?h-d.length>=0&&(f=c.lastIndexOf(d,h-d.length)):f=c.indexOf(d,h);if(f>=0){if(i.wholeWord&&!this._isWholeWord(f,c,e))return;let p=0;for(;p<l.length-1&&f>=l[p+1];)p++;let w=p;for(;w<l.length-1&&f+e.length>=l[w+1];)w++;let y=f-l[p],E=f+e.length-l[w],B=this._stringLengthToBufferSize(r+p,y),P=this._stringLengthToBufferSize(r+w,E)-B+this._terminal.cols*(w-p);return{term:e,col:B,row:r+p,size:P}}}_stringLengthToBufferSize(e,t){let i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let s=0;s<t;s++){let r=i.getCell(s);if(!r)break;let n=r.getChars();n.length>1&&(t-=n.length-1);let o=i.getCell(s+1);o&&o.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let i=e,s=0,r=this._terminal.buffer.active.getLine(i);for(;t>0&&r;){for(let n=0;n<t&&n<this._terminal.cols;n++){let o=r.getCell(n);if(!o)break;o.getWidth()&&(s+=o.getCode()===0?1:o.getChars().length)}if(i++,r=this._terminal.buffer.active.getLine(i),r&&!r.isWrapped)break;t-=this._terminal.cols}return s}},dv=class extends xt{constructor(e){super();this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Ri(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let i of e){let s=this._createResultDecorations(i,t,!1);if(s)for(let r of s)this._storeDecoration(r,i)}}createActiveDecoration(e,t){let i=this._createResultDecorations(e,t,!0);if(i)return{decorations:i,match:e,dispose(){ps(i)}}}clearHighlightDecorations(){ps(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,i){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),i&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,i){let s=[],{col:r,size:n}=e,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;n>0;){let l=Math.min(this._terminal.cols-r,n);s.push([o,r,l]),r=0,n-=l,o++}let a=[];for(let l of s){let h=this._terminal.registerMarker(l[0]),d=this._terminal.registerDecoration({marker:h,x:l[1],width:l[2],backgroundColor:i?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(h.line)?void 0:{color:i?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(d){let c=[];c.push(h),c.push(d.onRender((f)=>this._applyStyles(f,i?t.activeMatchBorder:t.matchBorder,!1))),c.push(d.onDispose(()=>ps(c))),a.push(d)}}return a.length===0?void 0:a}},uv=class extends xt{constructor(){super(...arguments);this._searchResults=[],this._onDidChangeResults=this._register(new Ct)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let i=this._searchResults[t];if(i.row===e.row&&i.col===e.col&&i.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},Vl=class extends xt{constructor(e){super();this._highlightTimeout=this._register(new _r),this._lineCache=this._register(new _r),this._state=new lv,this._resultTracker=this._register(new uv),this._highlightLimit=e?.highlightLimit??1000}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new hv(e),this._engine=new cv(e,this._lineCache.value),this._decorationManager=new dv(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Ri(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=ql(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,i){if(!this._terminal||!this._engine)throw Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let s=this._findNextAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,s}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let i=[],s,r=this._engine.find(e,0,0,t);for(;r&&(s?.row!==r.row||s?.col!==r.col)&&!(i.length>=this._highlightLimit);)s=r,i.push(s),r=this._engine.find(e,s.col+s.term.length>=this._terminal.cols?s.row+1:s.row,s.col+s.term.length>=this._terminal.cols?0:s.col+1,t);this._resultTracker.updateResults(i,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(i,t.decorations)}_findNextAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let s=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(s,t?.decorations,i?.noScroll)}findPrevious(e,t,i){if(!this._terminal||!this._engine)throw Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let s=this._findPreviousAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,s}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let s=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(s,t?.decorations,i?.noScroll)}_selectResult(e,t,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let s=this._decorationManager.createActiveDecoration(e,t);s&&(this._resultTracker.selectedDecoration=s)}if(!i&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let s=e.row-this._terminal.buffer.active.viewportY;s-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(s)}return!0}};var oo=[[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]],_v=[[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]],ke;function fv(e,t){let i=0,s=t.length-1,r;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=i;)if(r=i+s>>1,e>t[r][1])i=r+1;else if(e<t[r][0])s=r-1;else return!0;return!1}var gv=class{constructor(){if(this.version="6",!ke){ke=new Uint8Array(65536),ke.fill(1),ke[0]=0,ke.fill(0,1,32),ke.fill(0,127,160),ke.fill(2,4352,4448),ke[9001]=2,ke[9002]=2,ke.fill(2,11904,42192),ke[12351]=1,ke.fill(2,44032,55204),ke.fill(2,63744,64256),ke.fill(2,65040,65050),ke.fill(2,65072,65136),ke.fill(2,65280,65377),ke.fill(2,65504,65511);for(let e=0;e<oo.length;++e)ke.fill(0,oo[e][0],oo[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ke[e]:fv(e,_v)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),s=i===0&&t!==0;if(s){let r=mr.extractWidth(t);r===0?s=!1:r>i&&(i=r)}return mr.createPropertyValue(0,i,s)}},pv=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?jl.isErrorNoTelemetry(e)?new jl(e.message+`
|
|
146
|
+
`).trim(),h=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);fr.register(o,h?.[2]??a,o)}return o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*Vp<=t.length){let r=0;for(let n=0;n<t.length;n++)t[n]?t[r++]=t[n]:s&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=r}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||to;if(!i){e.value(t);return}try{e.value(t)}catch(s){i(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof _r)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},jp=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Gl=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),Yp;((e)=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof Xp?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:co.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Gl})})(Yp||={});var Xp=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Gl:(this._emitter||(this._emitter=new Et),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Bi="en",ao=!1,ho=!1,gr=!1,Zp=!1,Jp=!1,jl=!1,Qp=!1,ev=!1,tv=!1,iv=!1,ur,pr=Bi,zl=Bi,sv,qt,Vt=globalThis,ct;typeof Vt.vscode<"u"&&typeof Vt.vscode.process<"u"?ct=Vt.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ct=process);var Yl=typeof ct?.versions?.electron=="string",rv=Yl&&ct?.type==="renderer";if(typeof ct=="object"){ao=ct.platform==="win32",ho=ct.platform==="darwin",gr=ct.platform==="linux",Zp=gr&&!!ct.env.SNAP&&!!ct.env.SNAP_REVISION,Qp=Yl,tv=!!ct.env.CI||!!ct.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ur=Bi,pr=Bi;let e=ct.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);ur=t.userLocale,zl=t.osLocale,pr=t.resolvedLanguage||Bi,sv=t.languagePack?.translationsConfigFile}catch{}Jp=!0}else typeof navigator=="object"&&!rv?(qt=navigator.userAgent,ao=qt.indexOf("Windows")>=0,ho=qt.indexOf("Macintosh")>=0,ev=(qt.indexOf("Macintosh")>=0||qt.indexOf("iPad")>=0||qt.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,gr=qt.indexOf("Linux")>=0,iv=qt?.indexOf("Mobi")>=0,jl=!0,pr=globalThis._VSCODE_NLS_LANGUAGE||Bi,ur=navigator.language.toLowerCase(),zl=ur):console.error("Unable to resolve platform.");var io=0;ho?io=1:ao?io=3:gr&&(io=2);var nv=jl&&typeof Vt.importScripts=="function",Qw=nv?Vt.origin:void 0,Dt=qt,ni=pr,ov;((e)=>{function t(){return ni}e.value=t;function i(){return ni.length===2?ni==="en":ni.length>=3?ni[0]==="e"&&ni[1]==="n"&&ni[2]==="-":!1}e.isDefaultVariant=i;function s(){return ni==="en"}e.isDefault=s})(ov||={});var av=typeof Vt.postMessage=="function"&&!Vt.importScripts,hv=(()=>{if(av){let e=[];Vt.addEventListener("message",(i)=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let n=e[s];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),n.callback();return}}});let t=0;return(i)=>{let s=++t;e.push({id:s,callback:i}),Vt.postMessage({vscodeScheduleAsyncWork:s},"*")}}return(e)=>setTimeout(e)})(),lv=!!(Dt&&Dt.indexOf("Chrome")>=0),eS=!!(Dt&&Dt.indexOf("Firefox")>=0),tS=!!(!lv&&Dt&&Dt.indexOf("Safari")>=0),iS=!!(Dt&&Dt.indexOf("Edg/")>=0),sS=!!(Dt&&Dt.indexOf("Android")>=0),rS=Symbol("MicrotaskDelay");function Xl(e,t=0,i){let s=setTimeout(()=>{e(),i&&r.dispose()},t),r=Oi(()=>{clearTimeout(s),i?.deleteAndLeak(r)});return i?.add(r),r}var cv,so;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?so=(e,t)=>{hv(()=>{if(i)return;let s=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,s-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:so=(e,t,i)=>{let s=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(s))}}},cv=(e)=>so(globalThis,e)})();var dv;((e)=>{async function t(s){let r,n=await Promise.all(s.map((o)=>o.then((a)=>a,(a)=>{r||(r=a)})));if(typeof r<"u")throw r;return n}e.settled=t;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}e.withAsyncBody=i})(dv||={});var Hl=class e{static fromArray(t){return new e((i)=>{i.emitMany(t)})}static fromPromise(t){return new e(async(i)=>{i.emitMany(await t)})}static fromPromises(t){return new e(async(i)=>{await Promise.all(t.map(async(s)=>i.emitOne(await s)))})}static merge(t){return new e(async(i)=>{await Promise.all(t.map(async(s)=>{for await(let r of s)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new Et,queueMicrotask(async()=>{let s={emitOne:(r)=>this.emitOne(r),emitMany:(r)=>this.emitMany(r),reject:(r)=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await co.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new e(async(s)=>{for await(let r of t)s.emitOne(i(r))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async(s)=>{for await(let r of t)i(r)&&s.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,(i)=>!!i)}coalesce(){return e.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return e.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Hl.EMPTY=Hl.fromArray([]);var uv=class extends Mt{constructor(e){super();this._terminal=e,this._linesCacheTimeout=this._register(new vr),this._linesCacheDisposables=this._register(new vr),this._register(Oi(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Kl(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Xl(()=>this._destroyLinesCache(),15000)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let i=[],s=[0],r=this._terminal.buffer.active.getLine(e);for(;r;){let n=this._terminal.buffer.active.getLine(e+1),o=n?n.isWrapped:!1,a=r.translateToString(!o&&t);if(o&&n){let h=r.getCell(r.length-1);h&&h.getCode()===0&&h.getWidth()===1&&n.getCell(0)?.getWidth()===2&&(a=a.slice(0,-1))}if(i.push(a),o)s.push(s[s.length-1]+a.length);else break;e++,r=n}return[i.join(""),s]}},_v=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},fv=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,i,s){if(!e||e.length===0){this._terminal.clearSelection();return}if(i>this._terminal.cols)throw Error(`Invalid col: ${i} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let r={startRow:t,startCol:i},n=this._findInLine(e,r,s);if(!n)for(let o=t+1;o<this._terminal.buffer.active.baseY+this._terminal.rows&&(r.startRow=o,r.startCol=0,n=this._findInLine(e,r,s),!n);o++);return n}findNextWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=0,n=0;s&&(i===e?(r=s.end.x,n=s.end.y):(r=s.start.x,n=s.start.y)),this._lineCache.initLinesCache();let o={startRow:n,startCol:r},a=this._findInLine(e,o,t);if(!a)for(let h=n+1;h<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=h,o.startCol=0,a=this._findInLine(e,o,t),!a);h++);if(!a&&n!==0)for(let h=0;h<n&&(o.startRow=h,o.startCol=0,a=this._findInLine(e,o,t),!a);h++);return!a&&s&&(o.startRow=s.start.y,o.startCol=0,a=this._findInLine(e,o,t)),a}findPreviousWithSelection(e,t,i){if(!e||e.length===0){this._terminal.clearSelection();return}let s=this._terminal.getSelectionPosition();this._terminal.clearSelection();let r=this._terminal.buffer.active.baseY+this._terminal.rows-1,n=this._terminal.cols,o=!0;this._lineCache.initLinesCache();let a={startRow:r,startCol:n},h;if(s&&(a.startRow=r=s.start.y,a.startCol=n=s.start.x,i!==e&&(h=this._findInLine(e,a,t,!1),h||(a.startRow=r=s.end.y,a.startCol=n=s.end.x))),h||(h=this._findInLine(e,a,t,o)),!h){a.startCol=Math.max(a.startCol,this._terminal.cols);for(let l=r-1;l>=0&&(a.startRow=l,h=this._findInLine(e,a,t,o),!h);l--);}if(!h&&r!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let l=this._terminal.buffer.active.baseY+this._terminal.rows-1;l>=r&&(a.startRow=l,h=this._findInLine(e,a,t,o),!h);l--);return h}_isWholeWord(e,t,i){return(e===0||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e-1]))&&(e+i.length===t.length||" ~!@#$%^&*()+`-=[]{}|\\;:\"',./<>?".includes(t[e+i.length]))}_findInLine(e,t,i={},s=!1){let{startRow:r,startCol:n}=t;if(this._terminal.buffer.active.getLine(r)?.isWrapped){if(s){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,i)}let o=this._lineCache.getLineFromCache(r);o||(o=this._lineCache.translateBufferLineToStringWithWrap(r,!0),this._lineCache.setLineInCache(r,o));let[a,h]=o,l=this._bufferColsToStringOffset(r,n),d=e,c=a;i.regex||(d=i.caseSensitive?e:e.toLowerCase(),c=i.caseSensitive?a:a.toLowerCase());let f=-1;if(i.regex){let g=RegExp(d,i.caseSensitive?"g":"gi"),v;if(s)for(;v=g.exec(c.slice(0,l));)f=g.lastIndex-v[0].length,e=v[0],g.lastIndex-=e.length-1;else v=g.exec(c.slice(l)),v&&v[0].length>0&&(f=l+(g.lastIndex-v[0].length),e=v[0])}else s?l-d.length>=0&&(f=c.lastIndexOf(d,l-d.length)):f=c.indexOf(d,l);if(f>=0){if(i.wholeWord&&!this._isWholeWord(f,c,e))return;let g=0;for(;g<h.length-1&&f>=h[g+1];)g++;let v=g;for(;v<h.length-1&&f+e.length>=h[v+1];)v++;let y=f-h[g],E=f+e.length-h[v],R=this._stringLengthToBufferSize(r+g,y),P=this._stringLengthToBufferSize(r+v,E)-R+this._terminal.cols*(v-g);return{term:e,col:R,row:r+g,size:P}}}_stringLengthToBufferSize(e,t){let i=this._terminal.buffer.active.getLine(e);if(!i)return 0;for(let s=0;s<t;s++){let r=i.getCell(s);if(!r)break;let n=r.getChars();n.length>1&&(t-=n.length-1);let o=i.getCell(s+1);o&&o.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let i=e,s=0,r=this._terminal.buffer.active.getLine(i);for(;t>0&&r;){for(let n=0;n<t&&n<this._terminal.cols;n++){let o=r.getCell(n);if(!o)break;o.getWidth()&&(s+=o.getCode()===0?1:o.getChars().length)}if(i++,r=this._terminal.buffer.active.getLine(i),r&&!r.isWrapped)break;t-=this._terminal.cols}return s}},gv=class extends Mt{constructor(e){super();this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(Oi(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let i of e){let s=this._createResultDecorations(i,t,!1);if(s)for(let r of s)this._storeDecoration(r,i)}}createActiveDecoration(e,t){let i=this._createResultDecorations(e,t,!0);if(i)return{decorations:i,match:e,dispose(){Ss(i)}}}clearHighlightDecorations(){Ss(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,i){e.classList.contains("xterm-find-result-decoration")||(e.classList.add("xterm-find-result-decoration"),t&&(e.style.outline=`1px solid ${t}`)),i&&e.classList.add("xterm-find-active-result-decoration")}_createResultDecorations(e,t,i){let s=[],{col:r,size:n}=e,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;n>0;){let h=Math.min(this._terminal.cols-r,n);s.push([o,r,h]),r=0,n-=h,o++}let a=[];for(let h of s){let l=this._terminal.registerMarker(h[0]),d=this._terminal.registerDecoration({marker:l,x:h[1],width:h[2],backgroundColor:i?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(l.line)?void 0:{color:i?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:"center"}});if(d){let c=[];c.push(l),c.push(d.onRender((f)=>this._applyStyles(f,i?t.activeMatchBorder:t.matchBorder,!1))),c.push(d.onDispose(()=>Ss(c))),a.push(d)}}return a.length===0?void 0:a}},pv=class extends Mt{constructor(){super(...arguments);this._searchResults=[],this._onDidChangeResults=this._register(new Et)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&(this._selectedDecoration.dispose(),this._selectedDecoration=void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let i=this._searchResults[t];if(i.row===e.row&&i.col===e.col&&i.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},Zl=class extends Mt{constructor(e){super();this._highlightTimeout=this._register(new vr),this._lineCache=this._register(new vr),this._state=new _v,this._resultTracker=this._register(new pv),this._highlightLimit=e?.highlightLimit??1000}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new uv(e),this._engine=new fv(e,this._lineCache.value),this._decorationManager=new gv(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(Oi(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Xl(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,i){if(!this._terminal||!this._engine)throw Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let s=this._findNextAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,s}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error("Cannot use addon until it has been loaded");if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let i=[],s,r=this._engine.find(e,0,0,t);for(;r&&(s?.row!==r.row||s?.col!==r.col)&&!(i.length>=this._highlightLimit);)s=r,i.push(s),r=this._engine.find(e,s.col+s.term.length>=this._terminal.cols?s.row+1:s.row,s.col+s.term.length>=this._terminal.cols?0:s.col+1,t);this._resultTracker.updateResults(i,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(i,t.decorations)}_findNextAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let s=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(s,t?.decorations,i?.noScroll)}findPrevious(e,t,i){if(!this._terminal||!this._engine)throw Error("Cannot use addon until it has been loaded");this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let s=this._findPreviousAndSelect(e,t,i);return this._fireResults(t),this._state.cachedSearchTerm=e,s}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,i){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let s=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(s,t?.decorations,i?.noScroll)}_selectResult(e,t,i){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let s=this._decorationManager.createActiveDecoration(e,t);s&&(this._resultTracker.selectedDecoration=s)}if(!i&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let s=e.row-this._terminal.buffer.active.viewportY;s-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(s)}return!0}};var uo=[[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]],vv=[[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]],ke;function mv(e,t){let i=0,s=t.length-1,r;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=i;)if(r=i+s>>1,e>t[r][1])i=r+1;else if(e<t[r][0])s=r-1;else return!0;return!1}var wv=class{constructor(){if(this.version="6",!ke){ke=new Uint8Array(65536),ke.fill(1),ke[0]=0,ke.fill(0,1,32),ke.fill(0,127,160),ke.fill(2,4352,4448),ke[9001]=2,ke[9002]=2,ke.fill(2,11904,42192),ke[12351]=1,ke.fill(2,44032,55204),ke.fill(2,63744,64256),ke.fill(2,65040,65050),ke.fill(2,65072,65136),ke.fill(2,65280,65377),ke.fill(2,65504,65511);for(let e=0;e<uo.length;++e)ke.fill(0,uo[e][0],uo[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ke[e]:mv(e,vv)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),s=i===0&&t!==0;if(s){let r=yr.extractWidth(t);r===0?s=!1:r>i&&(i=r)}return yr.createPropertyValue(0,i,s)}},Sv=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Jl.isErrorNoTelemetry(e)?new Jl(e.message+`
|
|
147
147
|
|
|
148
148
|
`+e.stack):Error(e.message+`
|
|
149
149
|
|
|
150
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach((t)=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},
|
|
151
|
-
`).map((c)=>c.trim().replace("at ","")).filter((c)=>c!=="");return
|
|
152
|
-
`),
|
|
153
|
-
`)).size}/${s.length} leaks) at ${f}`;let
|
|
154
|
-
`)),
|
|
150
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach((t)=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},bv=new Sv;function _o(e){yv(e)||bv.onUnexpectedError(e)}var po="Canceled";function yv(e){return e instanceof Cv?!0:e instanceof Error&&e.name===po&&e.message===po}var Cv=class extends Error{constructor(){super(po),this.name=this.message}},Jl=class e extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e)return t;let i=new e;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}};function xv(e,t){let i=this,s=!1,r;return function(){if(s)return r;if(s=!0,t)try{r=e.apply(i,arguments)}finally{t()}else r=e.apply(i,arguments);return r}}function kv(e,t,i=0,s=e.length){let r=i,n=s;for(;r<n;){let o=Math.floor((r+n)/2);t(e[o])?r=o+1:n=o}return r-1}var Lv=class e{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let s of this._array)if(this._prevFindLastPredicate(s)&&!t(s))throw Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}let i=kv(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=i+1,i===-1?void 0:this._array[i]}};Lv.assertInvariants=!1;var oc;((e)=>{function t(n){return n<0}e.isLessThan=t;function i(n){return n<=0}e.isLessThanOrEqual=i;function s(n){return n>0}e.isGreaterThan=s;function r(n){return n===0}e.isNeitherLessOrGreaterThan=r,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(oc||={});function Ev(e,t){return(i,s)=>t(e(i),e(s))}var Mv=(e,t)=>e-t,Ql=class e{constructor(t){this.iterate=t}forEach(t){this.iterate((i)=>(t(i),!0))}toArray(){let t=[];return this.iterate((i)=>(t.push(i),!0)),t}filter(t){return new e((i)=>this.iterate((s)=>t(s)?i(s):!0))}map(t){return new e((i)=>this.iterate((s)=>i(t(s))))}some(t){let i=!1;return this.iterate((s)=>(i=t(s),!i)),i}findFirst(t){let i;return this.iterate((s)=>t(s)?(i=s,!1):!0),i}findLast(t){let i;return this.iterate((s)=>(t(s)&&(i=s),!0)),i}findLastMaxBy(t){let i,s=!0;return this.iterate((r)=>((s||oc.isGreaterThan(t(r,i)))&&(s=!1,i=r),!0)),i}};Ql.empty=new Ql((e)=>{});function Dv(e,t){let i=Object.create(null);for(let s of e){let r=t(s),n=i[r];n||(n=i[r]=[]),n.push(s)}return i}var ec,tc,kS=class{constructor(e,t){this.toKey=t,this._map=new Map,this[ec]="SetWithKey";for(let i of e)this.add(i)}get size(){return this._map.size}add(e){let t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(let e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(let e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach((i)=>e.call(t,i,i,this))}[(tc=Symbol.iterator,ec=Symbol.toStringTag,tc)](){return this.values()}},Rv=class{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){let i=this.map.get(e);i&&i.forEach(t)}get(e){return this.map.get(e)||new Set}},ac;((e)=>{function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function s(){return i}e.empty=s;function*r(b){yield b}e.single=r;function n(b){return t(b)?b:r(b)}e.wrap=n;function o(b){return b||i}e.from=o;function*a(b){for(let x=b.length-1;x>=0;x--)yield b[x]}e.reverse=a;function h(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=h;function l(b){return b[Symbol.iterator]().next().value}e.first=l;function d(b,x){let L=0;for(let N of b)if(x(N,L++))return!0;return!1}e.some=d;function c(b,x){for(let L of b)if(x(L))return L}e.find=c;function*f(b,x){for(let L of b)x(L)&&(yield L)}e.filter=f;function*g(b,x){let L=0;for(let N of b)yield x(N,L++)}e.map=g;function*v(b,x){let L=0;for(let N of b)yield*x(N,L++)}e.flatMap=v;function*y(...b){for(let x of b)yield*x}e.concat=y;function E(b,x,L){let N=L;for(let q of b)N=x(N,q);return N}e.reduce=E;function*R(b,x,L=b.length){for(x<0&&(x+=b.length),L<0?L+=b.length:L>b.length&&(L=b.length);x<L;x++)yield b[x]}e.slice=R;function P(b,x=Number.POSITIVE_INFINITY){let L=[];if(x===0)return[L,b];let N=b[Symbol.iterator]();for(let q=0;q<x;q++){let Y=N.next();if(Y.done)return[L,e.empty()];L.push(Y.value)}return[L,{[Symbol.iterator](){return N}}]}e.consume=P;async function A(b){let x=[];for await(let L of b)x.push(L);return Promise.resolve(x)}e.asyncToArray=A})(ac||={});var Av=!1,Ii=null,Tv=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let i=this.livingDisposables.get(t);return i||(i={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,i)),i}trackDisposable(t){let i=this.getDisposableData(t);i.source||(i.source=Error().stack)}setParent(t,i){let s=this.getDisposableData(t);s.parent=i}markAsDisposed(t){this.livingDisposables.delete(t)}markAsSingleton(t){this.getDisposableData(t).isSingleton=!0}getRootParent(t,i){let s=i.get(t);if(s)return s;let r=t.parent?this.getRootParent(this.getDisposableData(t.parent),i):t;return i.set(t,r),r}getTrackedDisposables(){let t=new Map;return[...this.livingDisposables.entries()].filter(([,i])=>i.source!==null&&!this.getRootParent(i,t).isSingleton).flatMap(([i])=>i)}computeLeakingDisposables(t=10,i){let s;if(i)s=i;else{let h=new Map,l=[...this.livingDisposables.values()].filter((c)=>c.source!==null&&!this.getRootParent(c,h).isSingleton);if(l.length===0)return;let d=new Set(l.map((c)=>c.value));if(s=l.filter((c)=>!(c.parent&&d.has(c.parent))),s.length===0)throw Error("There are cyclic diposable chains!")}if(!s)return;function r(h){function l(c,f){for(;c.length>0&&f.some((g)=>typeof g=="string"?g===c[0]:c[0].match(g));)c.shift()}let d=h.source.split(`
|
|
151
|
+
`).map((c)=>c.trim().replace("at ","")).filter((c)=>c!=="");return l(d,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),d.reverse()}let n=new Rv;for(let h of s){let l=r(h);for(let d=0;d<=l.length;d++)n.add(l.slice(0,d).join(`
|
|
152
|
+
`),h)}s.sort(Ev((h)=>h.idx,Mv));let o="",a=0;for(let h of s.slice(0,t)){a++;let l=r(h),d=[];for(let c=0;c<l.length;c++){let f=l[c];f=`(shared with ${n.get(l.slice(0,c+1).join(`
|
|
153
|
+
`)).size}/${s.length} leaks) at ${f}`;let g=n.get(l.slice(0,c).join(`
|
|
154
|
+
`)),v=Dv([...g].map((y)=>r(y)[c]),(y)=>y);delete v[l[c]];for(let[y,E]of Object.entries(v))d.unshift(` - stacktraces of ${E.length} other leaks continue with ${y}`);d.unshift(f)}o+=`
|
|
155
155
|
|
|
156
156
|
|
|
157
|
-
==================== Leaking disposable ${a}/${s.length}: ${
|
|
157
|
+
==================== Leaking disposable ${a}/${s.length}: ${h.value.constructor.name} ====================
|
|
158
158
|
${d.join(`
|
|
159
159
|
`)}
|
|
160
160
|
============================================================
|
|
@@ -164,15 +164,15 @@ ${d.join(`
|
|
|
164
164
|
|
|
165
165
|
... and ${s.length-t} more leaking disposables
|
|
166
166
|
|
|
167
|
-
`),{leaks:s,details:o}}};
|
|
167
|
+
`),{leaks:s,details:o}}};Tv.idx=0;function Bv(e){Ii=e}if(Av){let e="__is_disposable_tracked__";Bv(new class{trackDisposable(t){let i=Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(i)},3000)}setParent(t,i){if(t&&t!==Ni.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Ni.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function So(e){return Ii?.trackDisposable(e),e}function bo(e){Ii?.markAsDisposed(e)}function vo(e,t){Ii?.setParent(e,t)}function Pv(e,t){if(Ii)for(let i of e)Ii.setParent(i,t)}function hc(e){if(ac.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(s){t.push(s)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Ov(...e){let t=lc(()=>hc(e));return Pv(e,t),t}function lc(e){let t=So({dispose:xv(()=>{bo(t),e()})});return t}var cc=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,So(this)}dispose(){this._isDisposed||(bo(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{hc(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error("Cannot register a disposable on itself!");return vo(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),vo(t,null))}};cc.DISABLE_DISPOSED_WARNING=!1;var yo=cc,Ni=class{constructor(){this._store=new yo,So(this),vo(this._store,this)}dispose(){bo(this),this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ni.None=Object.freeze({dispose(){}});var ic=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};ic.Undefined=new ic(void 0);var Iv=globalThis.performance&&typeof globalThis.performance.now=="function",Nv=class e{static create(t){return new e(t)}constructor(t){this._now=Iv&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},Fv=!1,sc=!1,Wv=!1,zv;((e)=>{e.None=()=>Ni.None;function t(u){if(Wv){let{onDidAddListener:_}=u,w=wo.create(),p=0;u.onDidAddListener=()=>{++p===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),w.print()),_?.()}}}function i(u,_){return f(u,()=>{},0,void 0,!0,void 0,_)}e.defer=i;function s(u){return(_,w=null,p)=>{let S=!1,m;return m=u((C)=>{if(!S)return m?m.dispose():S=!0,_.call(w,C)},null,p),S&&m.dispose(),m}}e.once=s;function r(u,_,w){return d((p,S=null,m)=>u((C)=>p.call(S,_(C)),null,m),w)}e.map=r;function n(u,_,w){return d((p,S=null,m)=>u((C)=>{_(C),p.call(S,C)},null,m),w)}e.forEach=n;function o(u,_,w){return d((p,S=null,m)=>u((C)=>_(C)&&p.call(S,C),null,m),w)}e.filter=o;function a(u){return u}e.signal=a;function h(...u){return(_,w=null,p)=>{let S=Ov(...u.map((m)=>m((C)=>_.call(w,C))));return c(S,p)}}e.any=h;function l(u,_,w,p){let S=w;return r(u,(m)=>(S=_(S,m),S),p)}e.reduce=l;function d(u,_){let w,p={onWillAddFirstListener(){w=u(S.fire,S)},onDidRemoveLastListener(){w?.dispose()}};_||t(p);let S=new oi(p);return _?.add(S),S.event}function c(u,_){return _ instanceof Array?_.push(u):_&&_.add(u),u}function f(u,_,w=100,p=!1,S=!1,m,C){let k,B,H,z=0,K,se={leakWarningThreshold:m,onWillAddFirstListener(){k=u((Q)=>{z++,B=_(B,Q),p&&!H&&(V.fire(B),B=void 0),K=()=>{let Z=B;B=void 0,H=void 0,(!p||z>1)&&V.fire(Z),z=0},typeof w=="number"?(clearTimeout(H),H=setTimeout(K,w)):H===void 0&&(H=0,queueMicrotask(K))})},onWillRemoveListener(){S&&z>0&&K?.()},onDidRemoveLastListener(){K=void 0,k.dispose()}};C||t(se);let V=new oi(se);return C?.add(V),V.event}e.debounce=f;function g(u,_=0,w){return e.debounce(u,(p,S)=>p?(p.push(S),p):[S],_,void 0,!0,void 0,w)}e.accumulate=g;function v(u,_=(p,S)=>p===S,w){let p=!0,S;return o(u,(m)=>{let C=p||!_(m,S);return p=!1,S=m,C},w)}e.latch=v;function y(u,_,w){return[e.filter(u,_,w),e.filter(u,(p)=>!_(p),w)]}e.split=y;function E(u,_=!1,w=[],p){let S=w.slice(),m=u((B)=>{S?S.push(B):k.fire(B)});p&&p.add(m);let C=()=>{S?.forEach((B)=>k.fire(B)),S=null},k=new oi({onWillAddFirstListener(){m||(m=u((B)=>k.fire(B)),p&&p.add(m))},onDidAddFirstListener(){S&&(_?setTimeout(C):C())},onDidRemoveLastListener(){m&&m.dispose(),m=null}});return p&&p.add(k),k.event}e.buffer=E;function R(u,_){return(w,p,S)=>{let m=_(new A);return u(function(C){let k=m.evaluate(C);k!==P&&w.call(p,k)},void 0,S)}}e.chain=R;let P=Symbol("HaltChainable");class A{constructor(){this.steps=[]}map(u){return this.steps.push(u),this}forEach(u){return this.steps.push((_)=>(u(_),_)),this}filter(u){return this.steps.push((_)=>u(_)?_:P),this}reduce(u,_){let w=_;return this.steps.push((p)=>(w=u(w,p),w)),this}latch(u=(_,w)=>_===w){let _=!0,w;return this.steps.push((p)=>{let S=_||!u(p,w);return _=!1,w=p,S?p:P}),this}evaluate(u){for(let _ of this.steps)if(u=_(u),u===P)break;return u}}function b(u,_,w=(p)=>p){let p=(...k)=>C.fire(w(...k)),S=()=>u.on(_,p),m=()=>u.removeListener(_,p),C=new oi({onWillAddFirstListener:S,onDidRemoveLastListener:m});return C.event}e.fromNodeEventEmitter=b;function x(u,_,w=(p)=>p){let p=(...k)=>C.fire(w(...k)),S=()=>u.addEventListener(_,p),m=()=>u.removeEventListener(_,p),C=new oi({onWillAddFirstListener:S,onDidRemoveLastListener:m});return C.event}e.fromDOMEventEmitter=x;function L(u){return new Promise((_)=>s(u)(_))}e.toPromise=L;function N(u){let _=new oi;return u.then((w)=>{_.fire(w)},()=>{_.fire(void 0)}).finally(()=>{_.dispose()}),_.event}e.fromPromise=N;function q(u,_){return u((w)=>_.fire(w))}e.forward=q;function Y(u,_,w){return _(w),u((p)=>_(p))}e.runAndSubscribe=Y;class oe{constructor(u,_){this._observable=u,this._counter=0,this._hasChanged=!1;let w={onWillAddFirstListener:()=>{u.addObserver(this)},onDidRemoveLastListener:()=>{u.removeObserver(this)}};_||t(w),this.emitter=new oi(w),_&&_.add(this.emitter)}beginUpdate(u){this._counter++}handlePossibleChange(u){}handleChange(u,_){this._hasChanged=!0}endUpdate(u){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function F(u,_){return new oe(u,_).emitter.event}e.fromObservable=F;function Le(u){return(_,w,p)=>{let S=0,m=!1,C={beginUpdate(){S++},endUpdate(){S--,S===0&&(u.reportChanges(),m&&(m=!1,_.call(w)))},handlePossibleChange(){},handleChange(){m=!0}};u.addObserver(C),u.reportChanges();let k={dispose(){u.removeObserver(C)}};return p instanceof yo?p.add(k):Array.isArray(p)&&p.push(k),k}}e.fromObservableLight=Le})(zv||={});var mo=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(t){this._stopWatch=new Nv,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};mo.all=new Set,mo._idPool=0;var Hv=mo,rc=-1,dc=class e{constructor(t,i,s=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let s=this.threshold;if(s<=0||i<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*0.5;let[n,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(n);let h=new Uv(a,n);this._errorHandler(h)}return()=>{let n=this._stacks.get(t.value)||0;this._stacks.set(t.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[s,r]of this._stacks)(!t||i<r)&&(t=[s,r],i=r);return t}};dc._idPool=1;var $v=dc,wo=class e{constructor(t){this.value=t}static create(){let t=Error();return new e(t.stack??"")}print(){console.warn(this.value.split(`
|
|
168
168
|
`).slice(2).join(`
|
|
169
|
-
`))}},
|
|
170
|
-
`)),e.length=0)},3000),
|
|
169
|
+
`))}},Uv=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Kv=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},qv=0,Sr=class{constructor(e){this.value=e,this.id=qv++}},Vv=2,Gv=(e,t)=>{if(e instanceof Sr)t(e);else for(let i=0;i<e.length;i++){let s=e[i];s&&t(s)}},br;if(Fv){let e=[];setInterval(()=>{e.length!==0&&(console.warn("[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:"),console.warn(e.join(`
|
|
170
|
+
`)),e.length=0)},3000),br=new FinalizationRegistry((t)=>{typeof t=="string"&&e.push(t)})}var oi=class{constructor(e){this._size=0,this._options=e,this._leakageMon=rc>0||this._options?.leakWarningThreshold?new $v(e?.onListenerError??_o,this._options?.leakWarningThreshold??rc):void 0,this._perfMon=this._options?._profName?new Hv(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(sc){let e=this._listeners;queueMicrotask(()=>{Gv(e,(t)=>t.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);let h=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],l=new Kv(`${a}. HINT: Stack shows most frequent listener (${h[1]}-times)`,h[0]);return(this._options?.onListenerError||_o)(l),Ni.None}if(this._disposed)return Ni.None;t&&(e=e.bind(t));let s=new Sr(e),r,n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*0.2)&&(s.stack=wo.create(),r=this._leakageMon.check(s.stack,this._size+1)),sc&&(s.stack=n??wo.create()),this._listeners?this._listeners instanceof Sr?(this._deliveryQueue??=new jv,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=lc(()=>{br?.unregister(o),r?.(),this._removeListener(s)});if(i instanceof yo?i.add(o):Array.isArray(i)&&i.push(o),br){let a=Error().stack.split(`
|
|
171
171
|
`).slice(2,3).join(`
|
|
172
|
-
`).trim(),l=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);vr.register(o,l?.[2]??a,o)}return o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*$v<=t.length){let r=0;for(let n=0;n<t.length;n++)t[n]?t[r++]=t[n]:s&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=r}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||ao;if(!i){e.value(t);return}try{e.value(t)}catch(s){i(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof pr)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Kv=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},mr=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ti,this.onChange=this._onChange.event;let t=new gv;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,s=!1){return(t&16777215)<<3|(i&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,s=0,r=t.length;for(let n=0;n<r;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return i+this.wcwidth(o);let h=t.charCodeAt(n);56320<=h&&h<=57343?o=(o-55296)*1024+h-56320+65536:i+=this.wcwidth(h)}let a=this.charProperties(o,s),l=e.extractWidth(a);e.extractShouldJoin(a)&&(l-=e.extractWidth(s)),i+=l,s=a}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},ho=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],qv=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],lo=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],Vv=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],$t;function ec(e,t){let i=0,s=t.length-1,r;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=i;)if(r=i+s>>1,e>t[r][1])i=r+1;else if(e<t[r][0])s=r-1;else return!0;return!1}var jv=class{constructor(){if(this.version="11",!$t){$t=new Uint8Array(65536),$t.fill(1),$t[0]=0,$t.fill(0,1,32),$t.fill(0,127,160);for(let e=0;e<ho.length;++e)$t.fill(0,ho[e][0],ho[e][1]+1);for(let e=0;e<lo.length;++e)$t.fill(2,lo[e][0],lo[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?$t[e]:ec(e,qv)?0:ec(e,Vv)?2:1}charProperties(e,t){let i=this.wcwidth(e),s=i===0&&t!==0;if(s){let r=mr.extractWidth(t);r===0?s=!1:r>i&&(i=r)}return mr.createPropertyValue(0,i,s)}},ac=class{activate(e){e.unicode.register(new jv)}dispose(){}};function hc(){try{let e=Number(localStorage.getItem("kz-term-font"));if(Number.isInteger(e)&&e>=8&&e<=24)return e}catch{}return 12}function lc(e){try{localStorage.setItem("kz-term-font",String(e))}catch{}dispatchEvent(new CustomEvent("kz-term-font",{detail:e}))}function cc(e,t){if(t.altKey||!(t.ctrlKey||t.metaKey))return null;if(t.code==="Equal")return Math.min(24,e+1);if(t.code==="Minus")return Math.max(8,e-1);if(t.code==="Digit0"&&!t.shiftKey)return 12;return null}function Gv(e,t,i){let s=getComputedStyle(e),r=(A)=>s.getPropertyValue(A).trim()||void 0,n=()=>({background:r("--bg"),foreground:r("--ink-hi"),cursor:r("--accent"),selectionBackground:(r("--dim")??"#808080")+"59"}),o=new ph({cursorBlink:!0,fontFamily:`"JetBrainsMono Nerd Font",${r("--mono")}`,fontSize:hc(),scrollback:5000,allowProposedApi:!0,theme:n()}),a=()=>requestAnimationFrame(()=>{o.options.theme=n(),P()}),l=matchMedia("(prefers-color-scheme: dark)");addEventListener("kz-theme",a),l.addEventListener("change",a);let h=new vh;o.loadAddon(h),o.loadAddon(new El((A,Q)=>window.open(Q,"_blank","noopener")));let d=new Vl;o.loadAddon(d),o.loadAddon(new ac),o.unicode.activeVersion="11",o.open(e);try{let A=new Ll;A.onContextLoss(()=>A.dispose()),o.loadAddon(A)}catch{}let c=[1,2,4,8,15],f,p=0,w,y=!1,E=(A)=>{if(f?.readyState===WebSocket.OPEN)f.send(JSON.stringify(A))},B=!1,P=()=>{if(!B)return;let A=document.documentElement.dataset.theme;E({t:"i",d:`\x1B[?997;${(A?A==="dark":l.matches)?1:2}n`})},R=(A)=>(Q)=>{if(Q.includes(2031)){if(B=A,A)P()}return!1};o.parser.registerCsiHandler({prefix:"?",final:"h"},R(!0)),o.parser.registerCsiHandler({prefix:"?",final:"l"},R(!1)),o.parser.registerCsiHandler({prefix:"?",final:"n"},(A)=>{if(A[0]===996)P();return!1});let b=null,x=0,L=0,O=(A=!1)=>{if(!e.offsetWidth)return;if(!f)return V();if(h.fit(),!A&&b===f&&x===o.cols&&L===o.rows)return;if(b=f,x=o.cols,L=o.rows,A&&o.rows>5)E({t:"r",c:o.cols,r:o.rows-1}),setTimeout(()=>E({t:"r",c:o.cols,r:o.rows}),80);else E({t:"r",c:o.cols,r:o.rows})},V=()=>{if(clearTimeout(w),f)f.onopen=f.onmessage=f.onclose=null,f.close();f=new WebSocket(`${location.protocol==="https:"?"wss":"ws"}://${location.host}/pty?key=${encodeURIComponent(t)}`),f.onopen=()=>{if(y)o.reset(),B=!1;y=!1,p=0,ee.hidden=!0,O(!0)},f.onmessage=(A)=>o.write(String(A.data)),f.onclose=(A)=>{if(A.reason==="ended")o.write(`\r
|
|
172
|
+
`).trim(),h=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(a);br.register(o,h?.[2]??a,o)}return o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let s=this._deliveryQueue.current===this;if(this._size*Vv<=t.length){let r=0;for(let n=0;n<t.length;n++)t[n]?t[r++]=t[n]:s&&(this._deliveryQueue.end--,r<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=r}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||_o;if(!i){e.value(t);return}try{e.value(t)}catch(s){i(s)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Sr)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},jv=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},yr=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new oi,this.onChange=this._onChange.event;let t=new wv;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,s=!1){return(t&16777215)<<3|(i&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,s=0,r=t.length;for(let n=0;n<r;++n){let o=t.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return i+this.wcwidth(o);let l=t.charCodeAt(n);56320<=l&&l<=57343?o=(o-55296)*1024+l-56320+65536:i+=this.wcwidth(l)}let a=this.charProperties(o,s),h=e.extractWidth(a);e.extractShouldJoin(a)&&(h-=e.extractWidth(s)),i+=h,s=a}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},fo=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],Yv=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],go=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],Xv=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],Gt;function nc(e,t){let i=0,s=t.length-1,r;if(e<t[0][0]||e>t[s][1])return!1;for(;s>=i;)if(r=i+s>>1,e>t[r][1])i=r+1;else if(e<t[r][0])s=r-1;else return!0;return!1}var Zv=class{constructor(){if(this.version="11",!Gt){Gt=new Uint8Array(65536),Gt.fill(1),Gt[0]=0,Gt.fill(0,1,32),Gt.fill(0,127,160);for(let e=0;e<fo.length;++e)Gt.fill(0,fo[e][0],fo[e][1]+1);for(let e=0;e<go.length;++e)Gt.fill(2,go[e][0],go[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Gt[e]:nc(e,Yv)?0:nc(e,Xv)?2:1}charProperties(e,t){let i=this.wcwidth(e),s=i===0&&t!==0;if(s){let r=yr.extractWidth(t);r===0?s=!1:r>i&&(i=r)}return yr.createPropertyValue(0,i,s)}},uc=class{activate(e){e.unicode.register(new Zv)}dispose(){}};function _c(){try{let e=Number(localStorage.getItem("kz-term-font"));if(Number.isInteger(e)&&e>=8&&e<=24)return e}catch{}return 12}function fc(e){try{localStorage.setItem("kz-term-font",String(e))}catch{}dispatchEvent(new CustomEvent("kz-term-font",{detail:e}))}function gc(e,t){if(t.altKey||!(t.ctrlKey||t.metaKey))return null;if(t.code==="Equal")return Math.min(24,e+1);if(t.code==="Minus")return Math.max(8,e-1);if(t.code==="Digit0"&&!t.shiftKey)return 12;return null}var Jv={background:"#282c34",foreground:"#ffffff",cursor:"#ffffff",cursorAccent:"#282c34",selectionBackground:"#5a7898",selectionForeground:"#ffffff",black:"#1d1f21",red:"#cc6666",green:"#b5bd68",yellow:"#f0c674",blue:"#81a2be",magenta:"#b294bb",cyan:"#8abeb7",white:"#c5c8c6",brightBlack:"#666666",brightRed:"#d54e53",brightGreen:"#b9ca4a",brightYellow:"#e7c547",brightBlue:"#7aa6da",brightMagenta:"#c397d8",brightCyan:"#70c0b1",brightWhite:"#eaeaea"},Qv={background:"#ffffff",foreground:"#2e3434",cursor:"#2e3434",cursorAccent:"#ffffff",selectionBackground:"#accef7",selectionForeground:"#2e3434",black:"#2e3436",red:"#cc0000",green:"#4e9a06",yellow:"#8e7700",blue:"#3465a4",magenta:"#75507b",cyan:"#05727e",white:"#6a6a6a",brightBlack:"#555753",brightRed:"#ef2929",brightGreen:"#1b7a1b",brightYellow:"#6d5a00",brightBlue:"#204a87",brightMagenta:"#ad7fa8",brightCyan:"#034b50",brightWhite:"#3d3d3d"};function em(e,t,i){let s=getComputedStyle(e),r=(D)=>s.getPropertyValue(D).trim()||void 0,n=matchMedia("(prefers-color-scheme: dark)"),o=()=>{let D=document.documentElement.dataset.theme;return D?D==="dark":n.matches},a=()=>{let D=o()?Jv:Qv;return document.documentElement.style.setProperty("--term-bg",D.background),D},h=new bh({cursorBlink:!0,cursorStyle:"block",fontWeight:"500",fontWeightBold:"700",lineHeight:1,fontFamily:`"JetBrainsMono Nerd Font",${r("--mono")}`,fontSize:_c(),scrollback:5000,allowProposedApi:!0,theme:a()}),l=()=>requestAnimationFrame(()=>{h.options.theme=a(),A()});addEventListener("kz-theme",l),n.addEventListener("change",l);let d=new yh;h.loadAddon(d),h.loadAddon(new Tl((D,ae)=>window.open(ae,"_blank","noopener")));let c=new Zl;h.loadAddon(c),h.loadAddon(new uc),h.unicode.activeVersion="11",h.open(e);try{let D=new Al;D.onContextLoss(()=>D.dispose()),h.loadAddon(D)}catch{}let f=[1,2,4,8,15],g,v=0,y,E=!1,R=(D)=>{if(g?.readyState===WebSocket.OPEN)g.send(JSON.stringify(D))},P=!1,A=()=>{if(!P)return;let D=document.documentElement.dataset.theme;R({t:"i",d:`\x1B[?997;${(D?D==="dark":n.matches)?1:2}n`})},b=(D)=>(ae)=>{if(ae.includes(2031)){if(P=D,D)A()}return!1};h.parser.registerCsiHandler({prefix:"?",final:"h"},b(!0)),h.parser.registerCsiHandler({prefix:"?",final:"l"},b(!1)),h.parser.registerCsiHandler({prefix:"?",final:"n"},(D)=>{if(D[0]===996)A();return!1});let x=null,L=0,N=0,q=()=>{let D=h._core?._renderService?.dimensions,ae=devicePixelRatio||1,Qe=D?.device?.cell?.width/ae,te=D?.device?.cell?.height/ae,He=h.element?.parentElement;if(!(Qe>0&&te>0)||!He)return d.fit();let ee=(ai,Cr)=>parseFloat(ai.getPropertyValue(Cr))||0,de=getComputedStyle(He),pt=getComputedStyle(h.element),et=h.options.scrollback===0?0:h.options.overviewRuler?.width||14,tt=ee(de,"width")-ee(de,"padding-left")-ee(de,"padding-right")-ee(pt,"padding-left")-ee(pt,"padding-right")-et,it=ee(de,"height")-ee(de,"padding-top")-ee(de,"padding-bottom")-ee(pt,"padding-top")-ee(pt,"padding-bottom"),Rt=Math.max(2,Math.floor(tt/Qe)),$e=Math.max(1,Math.floor(it/te));if(Rt===h.cols&&$e===h.rows)return;h._core?._renderService?.clear(),h.resize(Rt,$e)},Y=(D=!1)=>{if(!e.offsetWidth)return;if(!g)return oe();if(q(),!D&&x===g&&L===h.cols&&N===h.rows)return;if(x=g,L=h.cols,N=h.rows,D&&h.rows>5)R({t:"r",c:h.cols,r:h.rows-1}),setTimeout(()=>R({t:"r",c:h.cols,r:h.rows}),80);else R({t:"r",c:h.cols,r:h.rows})},oe=()=>{if(clearTimeout(y),g)g.onopen=g.onmessage=g.onclose=null,g.close();g=new WebSocket(`${location.protocol==="https:"?"wss":"ws"}://${location.host}/pty?key=${encodeURIComponent(t)}`),g.onopen=()=>{if(E)h.reset(),P=!1;E=!1,v=0,Q.hidden=!0,Y(!0)},g.onmessage=(D)=>h.write(String(D.data)),g.onclose=(D)=>{if(D.reason==="ended")h.write(`\r
|
|
173
173
|
\x1B[2m[agent ended]\x1B[0m\r
|
|
174
|
-
`),
|
|
174
|
+
`),Q.hidden=!0;else{if(!E)h.write(`\r
|
|
175
175
|
\x1B[2m[connection to the board lost]\x1B[0m\r
|
|
176
|
-
`);if(
|
|
176
|
+
`);if(E=!0,Q.hidden=!1,v<f.length)y=setTimeout(oe,f[v++]*1000);else h.write(`\r
|
|
177
177
|
\x1B[2m[session ended: open a new tab, or press Reconnect if the board is back]\x1B[0m\r
|
|
178
|
-
`)}i?.()}},j={alt:!1},he=o.onData((A)=>{if(j.alt)A="\x1B"+A;j.alt=!1,F?.querySelector(".alt")?.classList.remove("on"),E({t:"i",d:A})}),F=null,be=()=>{};if(matchMedia("(pointer: coarse)").matches){let A=(N)=>()=>`\x1B${o.modes.applicationCursorKeysMode?"O":"["}${N}`,Q=async(N)=>{let z=await fetch("/term-image",{method:"POST",headers:{"content-type":N.type||"image/png"},body:N}).catch(()=>null),J=z?.ok?(await z.json()).path:"";if(J)o.paste(/\s/.test(J)?`"${J}" `:`${J} `)},de=async()=>{let N=await navigator.clipboard?.read?.().catch(()=>[])??[];for(let z of N){let J=z.types.find((ze)=>ze.startsWith("image/"));if(J)return Q(await z.getType(J))}navigator.clipboard?.readText().then((z)=>z&&o.paste(z),()=>{})},W=document.createElement("input");W.type="file",W.accept="image/*",W.hidden=!0,W.onchange=()=>{if(W.files?.[0])Q(W.files[0]);W.value=""};let Le=[["1","1"],["2","2"],["3","3"],["Esc","\x1B"],["^C","\x03"],["↑",A("A")],["↓",A("B")],["←",A("D")],["→",A("C")],["↵","\r"],["⇧⇥","\x1B[Z"],["Ctrl","ctrl"],["Alt","alt"],["⋯","more"]];F=document.createElement("div"),F.className="termkeys";let ve=document.createElement("input"),Ie=(N,z,J=!0)=>{let ze=document.createElement("button");return ze.type="button",ze.textContent=N,ze.addEventListener("pointerdown",(Ni)=>Ni.preventDefault()),ze.addEventListener("click",()=>{if(z(),J&&document.activeElement!==ve)o.focus()}),ze},ft=document.createElement("div");ft.className="chips";let Ve=document.createElement("div");Ve.className="ctrlpad",Ve.hidden=!0;for(let N of["qwertyuiop","asdfghjkl","zxcvbnm✕"]){let z=document.createElement("div");for(let J of N)z.append(Ie(J,()=>{if(J!=="✕")E({t:"i",d:String.fromCharCode(J.charCodeAt(0)&31)});Ve.hidden=!0}));Ve.append(z)}let je=o.textarea;if(je)je.inputMode="none";let Ze=document.createElement("div");Ze.className="tmore",Ze.hidden=!0,Ze.append(Ie("Search",()=>{Ze.hidden=!0,H()}),Ie("Paste",()=>{Ze.hidden=!0,de()}),Ie("Pick image",()=>{Ze.hidden=!0,W.click()}));for(let[N,z]of Le){let J=Ie(N,()=>{if(z==="alt")J.classList.toggle("on",j.alt=!j.alt);else if(z==="ctrl")Ve.hidden=!Ve.hidden,Ze.hidden=!0;else if(z==="more")Ze.hidden=!Ze.hidden,Ve.hidden=!0;else E({t:"i",d:typeof z==="function"?z():z})});if(z==="alt")J.classList.add(z);ft.append(J)}let gi=document.createElement("form");gi.className="compose",ve.placeholder="Paste text here...",ve.enterKeyHint="send",ve.autocomplete="off",ve.setAttribute("aria-label","Message the agent");let ot=document.createElement("button");ot.type="button",ot.className="rawkeyboard",ot.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><rect x="2" y="5" width="20" height="13" rx="2"/><path d="M6 9h.01M10 9h.01M14 9h.01M18 9h.01M6 12h.01M10 12h.01M14 12h.01M18 12h.01M7 15h10"/></svg>',ot.setAttribute("aria-label","Type directly in terminal"),ot.title="Raw keyboard",ot.setAttribute("aria-pressed","false"),ot.onclick=()=>{if(Ii(""),!je)return;let N=je.inputMode!=="text";if(je.inputMode=N?"text":"none",je.blur(),ot.setAttribute("aria-pressed",String(N)),N)o.focus()},ot.addEventListener("pointerdown",(N)=>N.preventDefault()),gi.append(ve,ot),ve.addEventListener("keydown",(N)=>{if(N.key==="Enter"&&!N.isComposing)N.preventDefault(),gi.requestSubmit()}),gi.addEventListener("submit",(N)=>{if(N.preventDefault(),ve.value){let z=ve.value;try{localStorage.setItem("kz-term-history",JSON.stringify([z,...So().filter((J)=>J!==z)].slice(0,100)))}catch{}E({t:"i",d:z})}ve.value="",setTimeout(()=>E({t:"i",d:"\r"}),60)});let Bi=document.createElement("div");Bi.className="termgrid",Bi.hidden=!0;let dc=(N)=>{E({t:"i",d:(j.alt?"\x1B":"")+(typeof N==="function"?N():N)}),j.alt=!1,F?.querySelectorAll(".alt").forEach((z)=>z.classList.remove("on"))},ms=(N)=>{let z=document.createElement("div");return z.className="termkeygroup "+N,Bi.append(z),z},Ge=(N,z,J,ze)=>{let Ni=Ie(z,()=>dc(J));if(ze)Ni.style.gridArea=ze;return N.append(Ni),Ni},Je=ms("primary");Ge(Je,"Esc","\x1B","1 / 1"),Ge(Je,"Tab","\t","1 / 2"),Ge(Je,"⇧ Tab","\x1B[Z","1 / 3"),Je.append(Ie("Ctrl",()=>{Ve.hidden=!Ve.hidden})),Ge(Je,"^C","\x03","2 / 1"),Ge(Je,"^D","\x04","2 / 2"),Ge(Je,"^Z","\x1A","2 / 3");let wr=Ie("Alt",()=>{j.alt=!j.alt,F?.querySelectorAll(".alt").forEach((N)=>N.classList.toggle("on",j.alt))});wr.className="alt",wr.style.gridArea="2 / 4",Je.append(wr),Ge(Je,"↑",A("A"),"1 / 6"),Ge(Je,"←",A("D"),"2 / 5"),Ge(Je,"↓",A("B"),"2 / 6"),Ge(Je,"→",A("C"),"2 / 7");let mo=Ge(Je,"↵","\r","1 / 8 / span 2 / 9");mo.setAttribute("aria-label","Enter"),mo.className="enter";let wo=ms("navigation");for(let[N,z]of[["Home","\x1B[H"],["End","\x1B[F"],["PgUp","\x1B[5~"],["PgDn","\x1B[6~"],["Ins","\x1B[2~"],["Del","\x1B[3~"]])Ge(wo,N,z);wo.append(Ie("Paste",()=>{de()}),Ie("Image",()=>W.click()));let uc=ms("symbols");for(let N of"? / = : ; ! * $ % ^ < > ( ) { } [ ] | ~ - @".split(" "))Ge(uc,N,N);let _c=ms("functions");for(let N=0;N<12;N++)Ge(_c,`F${N+1}`,N<4?`\x1BO${"PQRS"[N]}`:`\x1B[${[15,17,18,19,20,21,23,24][N-4]}~`);let Pi=document.createElement("div");Pi.className="termhistory",Pi.hidden=!0;let ii=document.createElement("input");ii.type="search",ii.placeholder="Search history",ii.setAttribute("aria-label","Search terminal message history");let pi=document.createElement("div"),So=()=>{try{let N=JSON.parse(localStorage.getItem("kz-term-history")??"[]");return Array.isArray(N)?N.filter((z)=>typeof z==="string").slice(0,100):[]}catch{return[]}},bo=[],Oi="",fc=async()=>{Oi="Loading shell history…",Sr();try{let N=await fetch("/pty/history",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:Ie})});if(!N.ok)throw Error("history unavailable");let z=await N.json();bo=Array.isArray(z.history)?z.history.filter((J)=>typeof J==="string"):[],Oi=""}catch{Oi="Could not load shell history. Reopen History to retry."}Sr()},Sr=()=>{pi.replaceChildren();let N=[...new Set([...So(),...bo])];for(let z of N.filter((J)=>J.toLowerCase().includes(ii.value.toLowerCase()))){let J=document.createElement("button");J.type="button",J.textContent=z,J.title="Load into message field",J.onclick=()=>{ve.value=z,Ii(""),ve.focus()},pi.append(J)}if(Oi){let z=document.createElement("p");z.textContent=Oi,pi.append(z)}else if(!pi.childElementCount)pi.textContent=ii.value?"No matching commands.":"No saved shell commands or messages yet."};ii.oninput=Sr,Pi.append(ii,pi);let si=document.createElement("nav");si.className="termdock",si.hidden=!0,si.setAttribute("aria-label","Terminal accessory panel");let yo=(N)=>`<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${N}</svg>`,Co=yo('<rect x="3" y="4" width="7" height="7" rx="1"/><rect x="14" y="4" width="7" height="7" rx="1"/><rect x="3" y="15" width="7" height="7" rx="1"/><rect x="14" y="15" width="7" height="7" rx="1"/>'),gc=yo('<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>'),ri=Ie("",()=>Ii(xo?"":"keys"),!1);ri.className="termtoggle",ri.innerHTML=Co,ri.setAttribute("aria-label","Show keyboard and history"),ri.setAttribute("aria-expanded","false"),gi.append(ri);let xo="",Ii=(N)=>{xo=N,Bi.hidden=N!=="keys",Pi.hidden=N!=="history",si.hidden=!N,ft.hidden=!!N,Ve.hidden=Ze.hidden=!0,ri.classList.toggle("on",!!N),ri.setAttribute("aria-expanded",String(!!N));for(let z of si.querySelectorAll("[data-panel]")){let J=z.dataset.panel===N;z.classList.toggle("on",J),z.setAttribute("aria-pressed",String(J))}if(N){if(je)je.inputMode="none";ot.setAttribute("aria-pressed","false"),ve.blur(),je?.blur()}if(N==="history")fc()};for(let[N,z,J]of[["Keyboard","keys",Co],["History","history",gc]]){let ze=Ie("",()=>Ii(z),!1);ze.innerHTML=J,ze.dataset.panel=z,ze.setAttribute("aria-label",N),ze.title=N,si.append(ze)}ve.addEventListener("focus",()=>{if(Ii(""),je)je.inputMode="none";ot.setAttribute("aria-pressed","false")}),F.append(gi,Ve,Ze,ft,Bi,Pi,si,W),e.after(F),be=Eo()}let u=null,_=(A)=>{u=A.touches.length===1?A.touches[0].clientY:null},S=(A)=>{if(u===null||A.touches.length!==1)return;let Q=e.querySelector(".xterm-screen"),de=(Q?.clientHeight||e.clientHeight)/o.rows,W=A.touches[0],Le=Math.trunc((u-W.clientY)/de);if(A.preventDefault(),!Le)return;if(u-=Le*de,o.modes.mouseTrackingMode==="none")return o.scrollLines(Le);let ve=(Q??e).getBoundingClientRect(),Ie=Math.min(o.cols,Math.max(1,Math.ceil((W.clientX-ve.left)/(ve.width/o.cols)))),ft=Math.min(o.rows,Math.max(1,Math.ceil((W.clientY-ve.top)/de)));E({t:"i",d:`\x1B[<${Le>0?65:64};${Ie};${ft}M`.repeat(Math.abs(Le))})};e.addEventListener("touchstart",_,{passive:!0}),e.addEventListener("touchmove",S,{passive:!1});let g=document.createElement("div");g.className="termtools";let m=(A,Q,de)=>{let W=document.createElement("button");return W.type="button",W.textContent=A,W.title=Q,W.addEventListener("mousedown",(Le)=>Le.preventDefault()),W.addEventListener("click",de),W},v=document.createElement("input");v.type="search",v.placeholder="Search";let C={matchBackground:"#7a5c00",activeMatchBackground:"#d08000",matchOverviewRuler:"#d08000",activeMatchColorOverviewRuler:"#ff9900"},k=(A=!1)=>{if(!v.value)return d.clearDecorations();let Q={decorations:C};A?d.findPrevious(v.value,Q):d.findNext(v.value,Q)},D=document.createElement("span");D.className="tsearch",D.hidden=!0;let U=()=>{D.hidden=!0,d.clearDecorations(),o.focus()},H=()=>{D.hidden=!1,v.select(),v.focus()};v.addEventListener("input",()=>k()),v.addEventListener("keydown",(A)=>{if(A.key==="Enter")A.preventDefault(),k(A.shiftKey);else if(A.key==="Escape")A.preventDefault(),U()}),D.append(v,m("↑","Previous (Shift+Enter)",()=>k(!0)),m("↓","Next (Enter)",()=>k()),m("✕","Close (Esc)",U)),g.append(D,m("⌕","Search (Ctrl+Shift+F)",()=>D.hidden?H():U()));let q=m("Paste","Paste from clipboard",()=>{let A=()=>{q.textContent="Blocked",setTimeout(()=>q.textContent="Paste",1500)};if(!navigator.clipboard?.readText)A();else navigator.clipboard.readText().then((Q)=>Q&&o.paste(Q),A);o.focus()});if(!F)g.append(q);let ee=m("Reconnect","Reconnect to the board",()=>{p=0,V(),o.focus()});ee.className="recon",ee.hidden=!0,g.prepend(ee),e.append(g),O(),o.attachCustomKeyEventHandler((A)=>{if(A.type==="keydown"&&(A.ctrlKey||A.metaKey)&&!A.altKey&&A.code==="KeyC"&&(A.shiftKey||o.hasSelection())){if(o.hasSelection())navigator.clipboard?.writeText(o.getSelection()).catch(()=>{});return o.clearSelection(),A.preventDefault(),!1}if(A.type==="keydown"&&(A.ctrlKey||A.metaKey)&&A.shiftKey&&A.code==="KeyF")return A.preventDefault(),H(),!1;let Q=cc(o.options.fontSize,A);if(Q===null)return!0;if(A.preventDefault(),A.type==="keydown")lc(Q);return!1});let G=(A)=>{o.options.fontSize=A.detail,O()};addEventListener("kz-term-font",G);let te,Z=0,re=new ResizeObserver(()=>{clearTimeout(te);let A=60-(Date.now()-Z);if(A<=0)Z=Date.now(),O();else te=setTimeout(()=>{Z=Date.now(),O()},A)});return re.observe(e),o.focus(),()=>{if(re.disconnect(),clearTimeout(te),e.removeEventListener("touchstart",_),e.removeEventListener("touchmove",S),he.dispose(),be(),F?.remove(),g.remove(),clearTimeout(w),f)f.onclose=null,f.close();removeEventListener("kz-theme",a),removeEventListener("kz-term-font",G),l.removeEventListener("change",a),o.dispose()}}window.kzTerm=Gv;})();
|
|
178
|
+
`)}i?.()}},F={alt:!1},Le=h.onData((D)=>{if(F.alt)D="\x1B"+D;F.alt=!1,u?.querySelector(".alt")?.classList.remove("on"),R({t:"i",d:D})}),u=null,_=()=>{};if(matchMedia("(pointer: coarse)").matches){let D=(I)=>()=>`\x1B${h.modes.applicationCursorKeysMode?"O":"["}${I}`,ae=async(I)=>{let W=await fetch("/term-image",{method:"POST",headers:{"content-type":I.type||"image/png"},body:I}).catch(()=>null),X=W?.ok?(await W.json()).path:"";if(X)h.paste(/\s/.test(X)?`"${X}" `:`${X} `)},Qe=async()=>{let I=await navigator.clipboard?.read?.().catch(()=>[])??[];for(let W of I){let X=W.types.find((We)=>We.startsWith("image/"));if(X)return ae(await W.getType(X))}navigator.clipboard?.readText().then((W)=>W&&h.paste(W),()=>{})},te=document.createElement("input");te.type="file",te.accept="image/*",te.hidden=!0,te.onchange=()=>{if(te.files?.[0])ae(te.files[0]);te.value=""};let He=[["1","1"],["2","2"],["3","3"],["Esc","\x1B"],["^C","\x03"],["↑",D("A")],["↓",D("B")],["←",D("D")],["→",D("C")],["↵","\r"],["⇧⇥","\x1B[Z"],["Ctrl","ctrl"],["Alt","alt"],["⋯","more"]];u=document.createElement("div"),u.className="termkeys";let ee=document.createElement("input"),de=(I,W,X=!0)=>{let We=document.createElement("button");return We.type="button",We.textContent=I,We.addEventListener("pointerdown",(Hi)=>Hi.preventDefault()),We.addEventListener("click",()=>{if(W(),X&&document.activeElement!==ee)h.focus()}),We},pt=document.createElement("div");pt.className="chips";let et=document.createElement("div");et.className="ctrlpad",et.hidden=!0;for(let I of["qwertyuiop","asdfghjkl","zxcvbnm✕"]){let W=document.createElement("div");for(let X of I)W.append(de(X,()=>{if(X!=="✕")R({t:"i",d:String.fromCharCode(X.charCodeAt(0)&31)});et.hidden=!0}));et.append(W)}let tt=h.textarea;if(tt)tt.inputMode="none";let it=document.createElement("div");it.className="tmore",it.hidden=!0,it.append(de("Search",()=>{it.hidden=!0,se()}),de("Paste",()=>{it.hidden=!0,Qe()}),de("Pick image",()=>{it.hidden=!0,te.click()}));for(let[I,W]of He){let X=de(I,()=>{if(W==="alt")X.classList.toggle("on",F.alt=!F.alt);else if(W==="ctrl")et.hidden=!et.hidden,it.hidden=!0;else if(W==="more")it.hidden=!it.hidden,et.hidden=!0;else R({t:"i",d:typeof W==="function"?W():W})});if(W==="alt")X.classList.add(W);pt.append(X)}let Rt=document.createElement("form");Rt.className="compose",ee.placeholder="Paste text here...",ee.enterKeyHint="send",ee.autocomplete="off",ee.setAttribute("aria-label","Message the agent");let $e=document.createElement("button");$e.type="button",$e.className="rawkeyboard",$e.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><rect x="2" y="5" width="20" height="13" rx="2"/><path d="M6 9h.01M10 9h.01M14 9h.01M18 9h.01M6 12h.01M10 12h.01M14 12h.01M18 12h.01M7 15h10"/></svg>',$e.setAttribute("aria-label","Type directly in terminal"),$e.title="Raw keyboard",$e.setAttribute("aria-pressed","false"),$e.onclick=()=>{if(zi(""),!tt)return;let I=tt.inputMode!=="text";if(tt.inputMode=I?"text":"none",tt.blur(),$e.setAttribute("aria-pressed",String(I)),I)h.focus()},$e.addEventListener("pointerdown",(I)=>I.preventDefault()),Rt.append(ee,$e),ee.addEventListener("keydown",(I)=>{if(I.key==="Enter"&&!I.isComposing)I.preventDefault(),Rt.requestSubmit()}),Rt.addEventListener("submit",(I)=>{if(I.preventDefault(),ee.value){let W=ee.value;try{localStorage.setItem("kz-term-history",JSON.stringify([W,...ko().filter((X)=>X!==W)].slice(0,100)))}catch{}R({t:"i",d:W})}ee.value="",setTimeout(()=>R({t:"i",d:"\r"}),60)});let ai=document.createElement("div");ai.className="termgrid",ai.hidden=!0;let Cr=(I)=>{R({t:"i",d:(F.alt?"\x1B":"")+(typeof I==="function"?I():I)}),F.alt=!1,u?.querySelectorAll(".alt").forEach((W)=>W.classList.remove("on"))},ys=(I)=>{let W=document.createElement("div");return W.className="termkeygroup "+I,ai.append(W),W},je=(I,W,X,We)=>{let Hi=de(W,()=>Cr(X));if(We)Hi.style.gridArea=We;return I.append(Hi),Hi},st=ys("primary");je(st,"Esc","\x1B","1 / 1"),je(st,"Tab","\t","1 / 2"),je(st,"⇧ Tab","\x1B[Z","1 / 3"),st.append(de("Ctrl",()=>{et.hidden=!et.hidden})),je(st,"^C","\x03","2 / 1"),je(st,"^D","\x04","2 / 2"),je(st,"^Z","\x1A","2 / 3");let xr=de("Alt",()=>{F.alt=!F.alt,u?.querySelectorAll(".alt").forEach((I)=>I.classList.toggle("on",F.alt))});xr.className="alt",xr.style.gridArea="2 / 4",st.append(xr),je(st,"↑",D("A"),"1 / 6"),je(st,"←",D("D"),"2 / 5"),je(st,"↓",D("B"),"2 / 6"),je(st,"→",D("C"),"2 / 7");let Co=je(st,"↵","\r","1 / 8 / span 2 / 9");Co.setAttribute("aria-label","Enter"),Co.className="enter";let xo=ys("navigation");for(let[I,W]of[["Home","\x1B[H"],["End","\x1B[F"],["PgUp","\x1B[5~"],["PgDn","\x1B[6~"],["Ins","\x1B[2~"],["Del","\x1B[3~"]])je(xo,I,W);xo.append(de("Paste",()=>{Qe()}),de("Image",()=>te.click()));let pc=ys("symbols");for(let I of"? / = : ; ! * $ % ^ < > ( ) { } [ ] | ~ - @".split(" "))je(pc,I,I);let vc=ys("functions");for(let I=0;I<12;I++)je(vc,`F${I+1}`,I<4?`\x1BO${"PQRS"[I]}`:`\x1B[${[15,17,18,19,20,21,23,24][I-4]}~`);let Fi=document.createElement("div");Fi.className="termhistory",Fi.hidden=!0;let hi=document.createElement("input");hi.type="search",hi.placeholder="Search history",hi.setAttribute("aria-label","Search terminal message history");let bi=document.createElement("div"),ko=()=>{try{let I=JSON.parse(localStorage.getItem("kz-term-history")??"[]");return Array.isArray(I)?I.filter((W)=>typeof W==="string").slice(0,100):[]}catch{return[]}},Lo=[],Wi="",mc=async()=>{Wi="Loading shell history…",kr();try{let I=await fetch("/pty/history",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({key:de})});if(!I.ok)throw Error("history unavailable");let W=await I.json();Lo=Array.isArray(W.history)?W.history.filter((X)=>typeof X==="string"):[],Wi=""}catch{Wi="Could not load shell history. Reopen History to retry."}kr()},kr=()=>{bi.replaceChildren();let I=[...new Set([...ko(),...Lo])];for(let W of I.filter((X)=>X.toLowerCase().includes(hi.value.toLowerCase()))){let X=document.createElement("button");X.type="button",X.textContent=W,X.title="Load into message field",X.onclick=()=>{ee.value=W,zi(""),ee.focus()},bi.append(X)}if(Wi){let W=document.createElement("p");W.textContent=Wi,bi.append(W)}else if(!bi.childElementCount)bi.textContent=hi.value?"No matching commands.":"No saved shell commands or messages yet."};hi.oninput=kr,Fi.append(hi,bi);let li=document.createElement("nav");li.className="termdock",li.hidden=!0,li.setAttribute("aria-label","Terminal accessory panel");let Eo=(I)=>`<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${I}</svg>`,Mo=Eo('<rect x="3" y="4" width="7" height="7" rx="1"/><rect x="14" y="4" width="7" height="7" rx="1"/><rect x="3" y="15" width="7" height="7" rx="1"/><rect x="14" y="15" width="7" height="7" rx="1"/>'),wc=Eo('<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>'),ci=de("",()=>zi(Do?"":"keys"),!1);ci.className="termtoggle",ci.innerHTML=Mo,ci.setAttribute("aria-label","Show keyboard and history"),ci.setAttribute("aria-expanded","false"),Rt.append(ci);let Do="",zi=(I)=>{Do=I,ai.hidden=I!=="keys",Fi.hidden=I!=="history",li.hidden=!I,pt.hidden=!!I,et.hidden=it.hidden=!0,ci.classList.toggle("on",!!I),ci.setAttribute("aria-expanded",String(!!I));for(let W of li.querySelectorAll("[data-panel]")){let X=W.dataset.panel===I;W.classList.toggle("on",X),W.setAttribute("aria-pressed",String(X))}if(I){if(tt)tt.inputMode="none";$e.setAttribute("aria-pressed","false"),ee.blur(),tt?.blur()}if(I==="history")mc()};for(let[I,W,X]of[["Keyboard","keys",Mo],["History","history",wc]]){let We=de("",()=>zi(W),!1);We.innerHTML=X,We.dataset.panel=W,We.setAttribute("aria-label",I),We.title=I,li.append(We)}ee.addEventListener("focus",()=>{if(zi(""),tt)tt.inputMode="none";$e.setAttribute("aria-pressed","false")}),u.append(Rt,et,it,pt,ai,Fi,li,te),e.after(u),_=To()}let w=null,p=(D)=>{w=D.touches.length===1?D.touches[0].clientY:null},S=(D)=>{if(w===null||D.touches.length!==1)return;let ae=e.querySelector(".xterm-screen"),Qe=(ae?.clientHeight||e.clientHeight)/h.rows,te=D.touches[0],He=Math.trunc((w-te.clientY)/Qe);if(D.preventDefault(),!He)return;if(w-=He*Qe,h.modes.mouseTrackingMode==="none")return h.scrollLines(He);let ee=(ae??e).getBoundingClientRect(),de=Math.min(h.cols,Math.max(1,Math.ceil((te.clientX-ee.left)/(ee.width/h.cols)))),pt=Math.min(h.rows,Math.max(1,Math.ceil((te.clientY-ee.top)/Qe)));R({t:"i",d:`\x1B[<${He>0?65:64};${de};${pt}M`.repeat(Math.abs(He))})};e.addEventListener("touchstart",p,{passive:!0}),e.addEventListener("touchmove",S,{passive:!1});let m=document.createElement("div");m.className="termtools";let C=(D,ae,Qe)=>{let te=document.createElement("button");return te.type="button",te.textContent=D,te.title=ae,te.addEventListener("mousedown",(He)=>He.preventDefault()),te.addEventListener("click",Qe),te},k=document.createElement("input");k.type="search",k.placeholder="Search";let B={matchBackground:"#7a5c00",activeMatchBackground:"#d08000",matchOverviewRuler:"#d08000",activeMatchColorOverviewRuler:"#ff9900"},H=(D=!1)=>{if(!k.value)return c.clearDecorations();let ae={decorations:B};D?c.findPrevious(k.value,ae):c.findNext(k.value,ae)},z=document.createElement("span");z.className="tsearch",z.hidden=!0;let K=()=>{z.hidden=!0,c.clearDecorations(),h.focus()},se=()=>{z.hidden=!1,k.select(),k.focus()};k.addEventListener("input",()=>H()),k.addEventListener("keydown",(D)=>{if(D.key==="Enter")D.preventDefault(),H(D.shiftKey);else if(D.key==="Escape")D.preventDefault(),K()}),z.append(k,C("↑","Previous (Shift+Enter)",()=>H(!0)),C("↓","Next (Enter)",()=>H()),C("✕","Close (Esc)",K)),m.append(z,C("⌕","Search (Ctrl+Shift+F)",()=>z.hidden?se():K()));let V=C("Paste","Paste from clipboard",()=>{let D=()=>{V.textContent="Blocked",setTimeout(()=>V.textContent="Paste",1500)};if(!navigator.clipboard?.readText)D();else navigator.clipboard.readText().then((ae)=>ae&&h.paste(ae),D);h.focus()});if(!u)m.append(V);let Q=C("Reconnect","Reconnect to the board",()=>{v=0,oe(),h.focus()});Q.className="recon",Q.hidden=!0,m.prepend(Q),e.append(m),Y(),h.attachCustomKeyEventHandler((D)=>{if(D.type==="keydown"&&(D.ctrlKey||D.metaKey)&&!D.altKey&&D.code==="KeyC"&&(D.shiftKey||h.hasSelection())){if(h.hasSelection())navigator.clipboard?.writeText(h.getSelection()).catch(()=>{});return h.clearSelection(),D.preventDefault(),!1}if(D.type==="keydown"&&(D.ctrlKey||D.metaKey)&&D.shiftKey&&D.code==="KeyF")return D.preventDefault(),se(),!1;let ae=gc(h.options.fontSize,D);if(ae===null)return!0;if(D.preventDefault(),D.type==="keydown")fc(ae);return!1});let Z=(D)=>{h.options.fontSize=D.detail,Y()};addEventListener("kz-term-font",Z);let re,Ze=0,Je=0,ze=()=>{Ze=0,Y()},J=new ResizeObserver(()=>{clearTimeout(re);let D=!Je&&e.offsetWidth>0;if(Je=e.offsetWidth,D)return Y();re=setTimeout(()=>{cancelAnimationFrame(Ze),Ze=requestAnimationFrame(ze)},150)});return J.observe(e),h.focus(),()=>{if(J.disconnect(),clearTimeout(re),cancelAnimationFrame(Ze),e.removeEventListener("touchstart",p),e.removeEventListener("touchmove",S),Le.dispose(),_(),u?.remove(),m.remove(),clearTimeout(y),g)g.onclose=null,g.close();removeEventListener("kz-theme",l),removeEventListener("kz-term-font",Z),n.removeEventListener("change",l),h.dispose()}}window.kzTerm=em;})();
|