@puddle-code/cli 0.0.26 → 0.0.27

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +13 -71
  2. package/dist/index.js +1 -1
  3. package/dist/public/assets/{Dashboard-BUnrgas5.js → Dashboard-CnreZDWT.js} +1 -1
  4. package/dist/public/assets/{EditorTabClose-CjErAowj.js → EditorTabClose-Cf6Ithkd.js} +1 -1
  5. package/dist/public/assets/{LazyTerminal-DxhIC2Nd.js → LazyTerminal-CBUKfCRA.js} +2 -2
  6. package/dist/public/assets/{ModelRefcount-CaVxm0RR.js → ModelRefcount-BlBx1A4I.js} +1 -1
  7. package/dist/public/assets/{PaneEditorBody-Cq9x4ltz.js → PaneEditorBody-yHuXb_2i.js} +2 -2
  8. package/dist/public/assets/SettingsDialog-D0Dg6hYk.js +1 -0
  9. package/dist/public/assets/{Terminal-C_kcg9jE.js → Terminal-B7B5s9of.js} +2 -2
  10. package/dist/public/assets/Workspace-1pzIYqz0.js +7 -0
  11. package/dist/public/assets/{buffer-store-C3LJGH7k.js → buffer-store-ZpUFG5SK.js} +2 -2
  12. package/dist/public/assets/{context-menu-BGAaNEMX.js → context-menu-BqdZKIwP.js} +1 -1
  13. package/dist/public/assets/{cssMode-C1IwZzN_.js → cssMode-Bx7_D8TV.js} +1 -1
  14. package/dist/public/assets/{editor-sync-CAMaBaiL.js → editor-sync-BnwyuZGE.js} +1 -1
  15. package/dist/public/assets/hotkeys-VY-O_esT.js +1 -0
  16. package/dist/public/assets/{htmlMode-N9d27SHn.js → htmlMode-DIhfisqE.js} +1 -1
  17. package/dist/public/assets/index-C4dEk1bI.js +10 -0
  18. package/dist/public/assets/index-CBZ-vDvn.css +2 -0
  19. package/dist/public/assets/{jsonMode-B1gdVgf-.js → jsonMode-CUZib3Ic.js} +1 -1
  20. package/dist/public/assets/preview-kind-BKn8hI4T.js +1 -0
  21. package/dist/public/assets/{session-seed-CfFYYvJs.js → session-seed-c86Sck-7.js} +1 -1
  22. package/dist/public/assets/ssh-mode-zTe6dpiB.js +1 -0
  23. package/dist/public/assets/{tsMode-4JF_U1_g.js → tsMode-D0SpNQhC.js} +1 -1
  24. package/dist/public/index.html +41 -4
  25. package/package.json +1 -1
  26. package/dist/public/assets/SettingsDialog-nnJ84hPv.js +0 -1
  27. package/dist/public/assets/Workspace-C9y2p7Dj.js +0 -7
  28. package/dist/public/assets/hotkeys-Bmah7TAT.js +0 -1
  29. package/dist/public/assets/index-B-Y2TXDs.js +0 -10
  30. package/dist/public/assets/index-dPbjsp9J.css +0 -2
  31. package/dist/public/assets/preview-kind-CsZyJGBK.js +0 -1
  32. package/dist/public/assets/ssh-mode-DKvSDsWf.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{S as r,n as i,s as a,y as o}from"./api-B3lAdmrV.js";import{t as s}from"./utils-B6KiDbIe.js";import{Ft as c,K as l,Nt as u,at as d,jt as f}from"./index-B-Y2TXDs.js";import{t as p}from"./ssh-mode-DKvSDsWf.js";var m=e(t(),1),h=Object.defineProperty,g=Object.getOwnPropertyDescriptor,_=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,r)=>{for(var i=r>1?void 0:r?g(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&h(t,n,i),i},y=(e,t)=>(n,r)=>t(n,r,e),b=`Terminal input`,ee={get:()=>b,set:e=>b=e},te=`Too much output to announce, navigate to rows manually to read`,ne={get:()=>te,set:e=>te=e};function x(e){return e.replace(/\r?\n/g,`\r`)}function re(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ie(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function S(e,t,n,r){e.stopPropagation(),e.clipboardData&&ae(e.clipboardData.getData(`text/plain`),t,n,r)}function ae(e,t,n,r){e=x(e),e=re(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function C(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function oe(e,t,n,r,i){C(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function w(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function se(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var T=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},E=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},D=``,ce=` `,le=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ue}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[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}},ue=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},de=class e extends le{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ue,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?w(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},fe=`di$target`,pe=`di$dependencies`,me=new Map;function he(e){return e[pe]||[]}function O(e){if(me.has(e))return me.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);ge(t,e,r)};return t._id=e,me.set(e,t),t}function ge(e,t,n){t[fe]===t?t[pe].push({id:e,index:n}):(t[pe]=[{id:e,index:n}],t[fe]=t)}var k=O(`BufferService`),_e=O(`CoreMouseService`),ve=O(`CoreService`),ye=O(`CharsetService`),be=O(`InstantiationService`),xe=O(`LogService`),Se=O(`OptionsService`),Ce=O(`OscLinkService`),we=O(`UnicodeService`),Te=O(`DecorationService`),Ee=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new de,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):De(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Ee=v([y(0,k),y(1,Se),y(2,Ce)],Ee);function De(e,t){if(confirm(`Do you want to navigate to ${t}?
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{S as r,n as i,s as a,y as o}from"./api-B3lAdmrV.js";import{t as s}from"./utils-B6KiDbIe.js";import{It as c,Mt as l,Pt as u,ot as d,q as f}from"./index-C4dEk1bI.js";import{t as p}from"./ssh-mode-zTe6dpiB.js";var m=e(t(),1),h=Object.defineProperty,g=Object.getOwnPropertyDescriptor,_=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,r)=>{for(var i=r>1?void 0:r?g(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&h(t,n,i),i},y=(e,t)=>(n,r)=>t(n,r,e),b=`Terminal input`,ee={get:()=>b,set:e=>b=e},te=`Too much output to announce, navigate to rows manually to read`,ne={get:()=>te,set:e=>te=e};function x(e){return e.replace(/\r?\n/g,`\r`)}function re(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ie(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function S(e,t,n,r){e.stopPropagation(),e.clipboardData&&ae(e.clipboardData.getData(`text/plain`),t,n,r)}function ae(e,t,n,r){e=x(e),e=re(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function C(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function oe(e,t,n,r,i){C(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function w(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function se(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var T=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},E=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},D=``,ce=` `,le=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ue}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[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}},ue=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},de=class e extends le{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ue,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?w(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},fe=`di$target`,pe=`di$dependencies`,me=new Map;function he(e){return e[pe]||[]}function O(e){if(me.has(e))return me.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);ge(t,e,r)};return t._id=e,me.set(e,t),t}function ge(e,t,n){t[fe]===t?t[pe].push({id:e,index:n}):(t[pe]=[{id:e,index:n}],t[fe]=t)}var k=O(`BufferService`),_e=O(`CoreMouseService`),ve=O(`CoreService`),ye=O(`CharsetService`),be=O(`InstantiationService`),xe=O(`LogService`),Se=O(`OptionsService`),Ce=O(`OscLinkService`),we=O(`UnicodeService`),Te=O(`DecorationService`),Ee=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new de,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):De(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Ee=v([y(0,k),y(1,Se),y(2,Ce)],Ee);function De(e,t){if(confirm(`Do you want to navigate to ${t}?
2
2
 
3
3
  WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Oe=O(`CharSizeService`),ke=O(`CoreBrowserService`),Ae=O(`MouseService`),je=O(`RenderService`),Me=O(`SelectionService`),Ne=O(`CharacterJoinerService`),Pe=O(`ThemeService`),Fe=O(`LinkProviderService`),Ie=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?He.isErrorNoTelemetry(e)?new He(e.message+`
4
4
 
@@ -114,4 +114,4 @@ out vec4 outColor;
114
114
 
115
115
  void main() {
116
116
  outColor = v_color;
117
- }`,zu=8,Bu=zu*Float32Array.BYTES_PER_ELEMENT,Vu=20*zu,Hu=class{constructor(){this.attributes=new Float32Array(Vu),this.count=0}},Uu=0,Wu=0,Gu=0,Ku=0,qu=0,Ju=0,Yu=0,Xu=class extends Ec{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new Hu,this._verticesCursor=new Hu;let i=this._gl;this._program=X(_u(i,Lu,Ru)),this._register(Cc(()=>i.deleteProgram(this._program))),this._projectionLocation=X(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(Cc(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(Cc(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=X(i.createBuffer()),this._register(Cc(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,Bu,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,Bu,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,Bu,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),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,gu),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,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i<t.rows;i++){for(o=-1,s=0,c=0,l=!1,a=0;a<t.cols;a++)u=(i*t.cols+a)*ju,d=e.cells[u+Mu],f=e.cells[u+Nu],p=!!(f&67108864),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=r++*zu,this._updateRectangle(n,m,c,s,o,a,i)),o=a,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=r++*zu,this._updateRectangle(n,m,c,s,o,t.cols,i))}n.count=r}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`){t.count=0;return}let r,i=0;(n.style===`bar`||n.style===`outline`)&&(r=i++*zu,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style===`underline`||n.style===`outline`)&&(r=i++*zu,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=i++*zu,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=i++*zu,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,o){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:Uu=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Uu=(n&16777215)<<8;break;case 0:default:Uu=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:Uu=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:Uu=(r&16777215)<<8;break;case 0:default:Uu=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=yu(e.attributes,this._terminal.rows*this._terminal.cols*zu)),Wu=i*this._dimensions.device.cell.width,Gu=o*this._dimensions.device.cell.height,Ku=(Uu>>24&255)/255,qu=(Uu>>16&255)/255,Ju=(Uu>>8&255)/255,Yu=1,this._addRectangle(e.attributes,t,Wu,Gu,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Ku,qu,Ju,Yu)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/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])}},Zu=class extends Ec{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,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-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(Cc(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=X(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=lu(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,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*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,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=fl,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Qu=class extends Zu{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}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&&su(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()}},$u=typeof window==`object`?window:globalThis,ed=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Z,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Z,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};ed.INSTANCE=new ed;var td=ed;function nd(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}td.INSTANCE.onDidChangeZoomLevel,td.INSTANCE.onDidChangeFullscreen;var rd=typeof navigator==`object`?navigator.userAgent:``;rd.indexOf(`Firefox`);var id=rd.indexOf(`AppleWebKit`)>=0;!(rd.indexOf(`Chrome`)>=0)&&rd.indexOf(`Safari`),rd.indexOf(`Electron/`),rd.indexOf(`Android`);var ad=!1;if(typeof $u.matchMedia==`function`){let e=$u.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=$u.matchMedia(`(display-mode: fullscreen)`);ad=e.matches,nd($u,e,({matches:e})=>{ad&&t.matches||(ad=e)})}function od(){return ad}var sd=`en`,cd=!1,ld=!1,ud=!1,dd=sd,fd,pd=globalThis,md;typeof pd.vscode<`u`&&typeof pd.vscode.process<`u`?md=pd.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(md=process);var hd=typeof md?.versions?.electron==`string`&&md?.type===`renderer`;if(typeof md==`object`){md.platform,md.platform,cd=md.platform===`linux`,cd&&md.env.SNAP&&md.env.SNAP_REVISION,md.env.CI||md.env.BUILD_ARTIFACTSTAGINGDIRECTORY,dd=sd;let e=md.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,dd=t.resolvedLanguage||sd,t.languagePack?.translationsConfigFile}catch{}ld=!0}else typeof navigator==`object`&&!hd?(fd=navigator.userAgent,fd.indexOf(`Windows`),fd.indexOf(`Macintosh`),(fd.indexOf(`Macintosh`)>=0||fd.indexOf(`iPad`)>=0||fd.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,cd=fd.indexOf(`Linux`)>=0,fd?.indexOf(`Mobi`),ud=!0,dd=globalThis._VSCODE_NLS_LANGUAGE||sd,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var gd=ld;ud&&typeof pd.importScripts==`function`&&pd.origin;var _d=fd,vd=dd,yd;(e=>{function t(){return vd}e.value=t;function n(){return vd.length===2?vd===`en`:vd.length>=3&&vd[0]===`e`&&vd[1]===`n`&&vd[2]===`-`}e.isDefaultVariant=n;function r(){return vd===`en`}e.isDefault=r})(yd||={});var bd=typeof pd.postMessage==`function`&&!pd.importScripts;(()=>{if(bd){let e=[];pd.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),pd.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var xd=!!(_d&&_d.indexOf(`Chrome`)>=0);_d&&_d.indexOf(`Firefox`),!xd&&_d&&_d.indexOf(`Safari`),_d&&_d.indexOf(`Edg/`),_d&&_d.indexOf(`Android`);var Sd=typeof navigator==`object`?navigator:{};gd||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||Sd&&Sd.clipboard&&Sd.clipboard.writeText,gd||Sd&&Sd.clipboard&&Sd.clipboard.readText,gd||od()||Sd.keyboard,`ontouchstart`in $u||Sd.maxTouchPoints,$u.PointerEvent&&(`ontouchstart`in $u||navigator.maxTouchPoints);var Cd=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}},wd=new Cd,Td=new Cd,Ed=new Cd;Array(230);var Dd;(e=>{function t(e){return wd.keyCodeToStr(e)}e.toString=t;function n(e){return wd.strToKeyCode(e)}e.fromString=n;function r(e){return Td.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Ed.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Td.strToKeyCode(e)||Ed.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return wd.keyCodeToStr(e)}e.toElectronAccelerator=o})(Dd||={});var Od=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),kd;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof Ad?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ll.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Od})})(kd||={});var Ad=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?Od:(this._emitter||=new Z,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var jd;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(jd||={});var Md=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Z,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Ll.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Md.EMPTY=Md.fromArray([]);function Nd(e){return 55296<=e&&e<=56319}function Pd(e){return 56320<=e&&e<=57343}function Fd(e,t){return(e-55296<<10)+(t-56320)+65536}function Id(e){return Ld(e,0)}function Ld(e,t){switch(typeof e){case`object`:return e===null?Rd(349,t):Array.isArray(e)?Vd(e,t):Hd(e,t);case`string`:return Bd(e,t);case`boolean`:return zd(e,t);case`number`:return Rd(e,t);case`undefined`:return Rd(937,t);default:return Rd(617,t)}}function Rd(e,t){return(t<<5)-t+e|0}function zd(e,t){return Rd(e?433:863,t)}function Bd(e,t){t=Rd(149417,t);for(let n=0,r=e.length;n<r;n++)t=Rd(e.charCodeAt(n),t);return t}function Vd(e,t){return t=Rd(104579,t),e.reduce((e,t)=>Ld(t,e),t)}function Hd(e,t){return t=Rd(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Bd(n,t),Ld(e[n],t)),t)}function Ud(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function Wd(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function Gd(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function Kd(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):Gd((e>>>0).toString(16),t/4)}var qd=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(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(Nd(a))if(o+1<t){let t=e.charCodeAt(o+1);Pd(t)?(o++,s=Fd(a,t)):s=65533}else{i=a;break}else Pd(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}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()),Kd(this._h0)+Kd(this._h1)+Kd(this._h2)+Kd(this._h3)+Kd(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Wd(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Wd(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,Ud(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=Ud(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=Ud(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};qd._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:Jd,getWindow:Yd,getDocument:Xd,getWindows:Zd,getWindowsCount:Qd,getWindowId:$d,getWindowById:ef,hasWindow:tf,onDidRegisterWindow:nf,onWillUnregisterWindow:rf,onDidUnregisterWindow:af}=function(){let e=new Map,t={window:$u,disposables:new Tc};e.set($u.vscodeWindowId,t);let n=new Z,r=new Z,i=new Z;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return Ec.None;let a=new Tc,o={window:t,disposables:a.add(new Tc)};return e.set(t.vscodeWindowId,o),a.add(Cc(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(sf(t,lf.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:$u},getDocument(e){return Yd(e).document}}}(),of=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!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,null)}};function sf(e,t,n,r){return new of(e,t,n,r)}var cf=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};cf.None=new cf(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Id(n),a=r.get(i);if(a)a.users+=1;else{let o=new Z,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(Cc(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var lf={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:id?`webkitAnimationStart`:`animationstart`,ANIMATION_END:id?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:id?`webkitAnimationIteration`:`animationiteration`},uf=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function df(e,t,n,...r){let i=uf.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function ff(e,t,...n){return df(`http://www.w3.org/1999/xhtml`,e,t,...n)}ff.SVG=function(e,t,...n){return df(`http://www.w3.org/2000/svg`,e,t,...n)};var pf=class extends Ec{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new Dc,this._charAtlasDisposable=this._register(new Dc),this._observerDisposable=this._register(new Dc),this._model=new Iu,this._workCell=new hu,this._workCell2=new hu,this._rectangleRenderer=this._register(new Dc),this._glyphRenderer=this._register(new Dc),this._onChangeTextureAtlas=this._register(new Z),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Z),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Z),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Z),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Z),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};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 ul(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Qu(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=el(),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(sf(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(sf(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,uu(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=pu(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=pu(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Cc(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),uu(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 e of this._renderLayers)e.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,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),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 Xu(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Ou(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=lu(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=Sc(Ll.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ll.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 n of this._renderLayers)n.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 fu(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=hf(e,n.rows-1,0),t=hf(t,n.rows-1,0);let ee=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,te=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,ne=te-n.buffer.ydisp,x=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),re=-1,ie=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let S=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=te===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y<n.cols;y++){if(i=this._cellColorResolver.result.bg,s.loadCell(y,r),y===0&&(i=this._cellColorResolver.result.bg),l=!1,d=y>=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)d&&=e===this._model.selection.isCellSelected(this._terminal,v,o);d&&=!m||x<p[0]||x>=p[1],d?(l=!0,r=new mf(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*ju,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),ie&&o===te&&(y===x&&(this._model.cursor={x,y:ne,width:r.getWidth(),style:this._coreBrowserService.isFocused?ee:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},re=x+r.getWidth()-1),y>=x&&y<=re&&(this._coreBrowserService.isFocused&&ee===`block`||this._coreBrowserService.isFocused===!1&&n.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)),g!==0&&(this._model.lineLengths[a]=y+1),!(this._model.cells[v]===g&&this._model.cells[v+Mu]===this._cellColorResolver.result.bg&&this._model.cells[v+Nu]===this._cellColorResolver.result.fg&&this._model.cells[v+Pu]===this._cellColorResolver.result.ext)&&(S=!0,h.length>1&&(g|=Fu),this._model.cells[v]=g,this._model.cells[v+Mu]=this._cellColorResolver.result.bg,this._model.cells[v+Nu]=this._cellColorResolver.result.fg,this._model.cells[v+Pu]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*ju,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,Fc,0,0),this._model.cells[b]=0,this._model.cells[b+Mu]=this._cellColorResolver.result.bg,this._model.cells[b+Nu]=this._cellColorResolver.result.fg,this._model.cells[b+Pu]=this._cellColorResolver.result.ext;y--}}S&&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})}},mf=class extends Ml{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}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 hf(e,t,n=0){return Math.max(Math.min(e,t),n)}var gf=`di$target`,_f=`di$dependencies`,vf=new Map;function yf(e){if(vf.has(e))return vf.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);bf(t,e,r)};return t._id=e,vf.set(e,t),t}function bf(e,t,n){t[gf]===t?t[_f].push({id:e,index:n}):(t[_f]=[{id:e,index:n}],t[gf]=t)}yf(`BufferService`),yf(`CoreMouseService`),yf(`CoreService`),yf(`CharsetService`),yf(`InstantiationService`),yf(`LogService`);var xf=yf(`OptionsService`);yf(`OscLinkService`),yf(`UnicodeService`),yf(`DecorationService`);var Sf={trace:0,debug:1,info:2,warn:3,error:4,off:5},Cf=`xterm.js: `,wf=class extends Ec{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),Tf=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Sf[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,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:Cf)+t,...n)}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)}};wf=Qs([$s(0,xf)],wf);var Tf,Ef=class extends Ec{constructor(e){if(Nc&&Pc()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new Z),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Z),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Z),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Z),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 n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new pf(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(Ll.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ll.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ll.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ll.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(Cc(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};function Df(e){return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)}function Of(){return(0,m.useSyncExternalStore)(Df,()=>document.visibilityState===`visible`)}function kf(e){let t=/^#?([0-9a-fA-F]{6})(?:[0-9a-fA-F]{2})?$/.exec(e.trim());if(!t)return null;let n=t[1].toLowerCase(),r=e=>n.slice(e,e+2).repeat(2);return`rgb:${r(0)}/${r(2)}/${r(4)}`}function Af(e,t){let n=kf(t);return n?`\x1b]${e};${n}\x1b\\`:null}function jf(e,t){return e.type===`keydown`?t?e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&e.key===`c`:e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`:!1}function Mf(e,t,n){if(t.startsWith(`login-`)||t===`home`)return!1;let i=Array.from(e.clipboardData?.items??[]);if(i.some(e=>e.type===`text/plain`))return!1;let o=i.find(e=>e.kind===`file`&&e.type.startsWith(`image/`));if(!o)return!1;let s=o.getAsFile();if(!s)return!1;let c=a.safeParse(o.type);return c.success?(Nf(s,c.data,t,n),!0):(r.error(`Cannot paste ${o.type} — png, jpeg, gif, and webp are supported`),!0)}async function Nf(e,t,n,a){try{let r=await Pf(e),o=await i(`POST`,`/api/worktrees/${n}/paste`,{mime:t,data:r});d.write(n,a,`${o.path} `)}catch(e){r.error(e instanceof Error?`Image paste failed: ${e.message}`:`Image paste failed`)}}function Pf(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).replace(/^data:[^,]*,/,``)),r.onerror=()=>n(r.error??Error(`could not read the clipboard image`)),r.readAsDataURL(e)})}var Ff=new Set([`localhost`,`127.0.0.1`,`::1`,`[::1]`]);function If(e,t,n,r){if(!n)return e;let i;try{i=new URL(e)}catch{return e}if(i.protocol!==`http:`&&i.protocol!==`https:`||!Ff.has(i.hostname))return e;let a=i.port===``?i.protocol===`https:`?`443`:`80`:i.port,o=r?`puddle_token=${r}`:``,s=i.search?`${i.search}${o?`&${o}`:``}`:o?`?${o}`:``;return`/proxy/${t}/${a}${i.pathname}${s}${i.hash}`}var Lf=/(?:^|[\s"'`([<])((?:(?:\/|\.{1,2}\/|~\/)(?:[\w.+@~-]+\/)*[\w.+@~-]+|(?:[\w.+@~-]+\/)+[\w.+@~-]*|[\w.+@~-]+\.[A-Za-z]\w{0,11}))(?::(\d{1,6})(?::(\d{1,6}))?)?/dg,Rf=new Set([`.`,`,`,`;`,`:`,`)`,`]`,`'`,`"`]);function zf(e){let t=[],n=new RegExp(Lf.source,Lf.flags),r;for(;r=n.exec(e);){let e=r.indices,n=r[1];if(!e?.[1]||n===void 0)continue;let i=e[1][0],a=e[1][1],o=n;for(o.startsWith(`@`)&&(o=o.slice(1),i++);o.length>0&&Rf.has(o[o.length-1]);)o=o.slice(0,-1),a--;if(o.length===0)continue;let s=r[2]===void 0?void 0:Number.parseInt(r[2],10),c=r[3]===void 0?void 0:Number.parseInt(r[3],10),l=c!==void 0&&e[3]?e[3][1]:s!==void 0&&e[2]?e[2][1]:a;t.push({path:o,line:s,column:c,start:i,end:l})}return t}var Bf=class{fetcher;now;positiveTtlMs;negativeTtlMs;maxEntries;maxConcurrent;entries=new Map;inflight=new Map;inUse=0;waiters=[];constructor(e){this.fetcher=e.fetcher,this.now=e.now??Date.now,this.positiveTtlMs=e.positiveTtlMs??15e3,this.negativeTtlMs=e.negativeTtlMs??5e3,this.maxEntries=e.maxEntries??500,this.maxConcurrent=e.maxConcurrent??4}resolve(e,t,n){let r=`${e}\0${t}`,i=this.entries.get(r);if(i){if(this.now()<i.expiresAt)return Promise.resolve(i.value);this.entries.delete(r)}let a=this.inflight.get(r);if(a)return a;let o=this.withSlot(()=>this.fetcher(e,t,n)).then(e=>(this.store(r,e),e)).finally(()=>{this.inflight.delete(r)});return this.inflight.set(r,o),o}store(e,t){let n=t?this.positiveTtlMs:this.negativeTtlMs;for(this.entries.set(e,{value:t,expiresAt:this.now()+n});this.entries.size>this.maxEntries;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e)}}async withSlot(e){this.inUse>=this.maxConcurrent&&await new Promise(e=>this.waiters.push(e)),this.inUse++;try{return await e()}finally{this.inUse--,this.waiters.shift()?.()}}};function Vf(e,t){let n=t;for(;n>0&&e.getLine(n)?.isWrapped;)n--;let r=``;for(let t=n;;t++){let i=e.getLine(t);if(!i||t!==n&&!i.isWrapped||(r+=i.translateToString(!0),r.length>2048))break}return{text:r,startRow:n}}function Hf(e,t,n,r){let i=e.getNullCell(),a=t,o=n,s=r;for(;s>=0;){let t=e.getLine(a);if(!t)return null;for(;o<t.length;o++){if(t.getCell(o,i),i.getWidth()&&(s-=i.getChars().length||1,o===t.length-1&&i.getChars()===``)){let t=e.getLine(a+1);t?.isWrapped&&(t.getCell(0,i),i.getWidth()===2&&(s+=1))}if(s<0)return{row:a,col:o}}a++,o=0}return{row:a,col:o}}async function Uf(e,t,n){let r=new URLSearchParams({path:t});n!==void 0&&r.set(`line`,String(n));try{return await i(`GET`,`/api/worktrees/${e}/resolve?${r}`)}catch{return null}}function Wf(e,t,n){let r=new Bf({fetcher:Uf});return e.registerLinkProvider({provideLinks(i,a){let o=e.buffer.active,{text:s,startRow:c}=Vf(o,i-1),l=zf(s);if(l.length===0){a(void 0);return}Promise.all(l.map(async e=>{let i=await r.resolve(t,e.path,e.line);if(!i)return null;let a=Hf(o,c,0,e.start),l=Hf(o,a?.row??c,a?.col??0,e.end-e.start);return!a||!l?null:{range:{start:{x:a.col+1,y:a.row+1},end:{x:l.col,y:l.row+1}},text:s.slice(e.start,e.end),decorations:{underline:!0,pointerCursor:!0},activate:t=>{!t.metaKey&&!t.ctrlKey||n(i.path,e.line===void 0?void 0:Math.max(1,e.line),e.column)}}})).then(e=>{let t=e.filter(e=>e!==null);a(t.length>0?t:void 0)})}})}var Gf=n(),Kf=/Mac|iPhone|iPad/.test(navigator.platform),qf=[`starting`,`running`,`waiting_input`],Jf={ArrowLeft:``,ArrowRight:``,Backspace:``,Delete:`\v`};function Yf(e,t){let[n,r]=(0,m.useState)(e);return(0,m.useEffect)(()=>{if(e){r(!0);return}let n=setTimeout(()=>r(!1),t);return()=>clearTimeout(n)},[e,t]),n}var Xf=1500;function Zf({stream:e,term:t=`agent`,className:n,onExit:r,onOpenFile:i,paused:a=!1}){let h=(0,m.useRef)(null),g=(0,m.useRef)(null),_=(0,m.useRef)(null),v=(0,m.useRef)(!1),y=l(),b=(0,m.useRef)(r);b.current=r;let ee=(0,m.useRef)(i);ee.current=i;let te=Of(),ne=Yf(!a&&te,Xf),x=(0,m.useCallback)(()=>{let n=g.current,r=h.current;!n||!r||r.clientWidth===0||(_.current?.fit(),n.resize(n.cols,n.rows),n.refresh(0,n.rows-1),d.resize(e,t,n.cols,n.rows))},[e,t]);return(0,m.useEffect)(()=>{let n=h.current;if(!n)return;let r=new Bs({theme:c(),fontFamily:`'Ubuntu Sans Mono', ui-monospace, monospace`,fontSize:y.terminalFontSize,scrollback:y.terminalScrollback,cursorBlink:!0,macOptionClickForcesSelection:Kf});g.current=r;let i=new Us;r.loadAddon(i);let a=e.startsWith(`login-`)||e===`home`;r.loadAddon(new Ys((t,n)=>{let r=a?n:If(n,e,p()!==null,o.get());window.open(r,`_blank`,`noopener,noreferrer`)})),r.open(n),i.fit(),_.current=i;let s=ee.current&&!a?Wf(r,e,(e,t,n)=>ee.current?.(e,t,n)):null,l={stash:null},m=r.onData(n=>{n.startsWith(`\x1B[<`)||(l.stash=null),d.write(e,t,n)}),b=(n,r)=>i=>{if(i!==`?`)return!1;if(v.current)return!0;let a=Af(n,f()(r));return a&&d.write(e,t,a),!0},te=r.parser.registerOscHandler(10,b(10,`--text-primary`)),ne=r.parser.registerOscHandler(11,b(11,`--bg-base`)),re=r.parser.registerOscHandler(52,e=>{if(v.current)return!0;let t=e.indexOf(`;`),n=t===-1?``:e.slice(t+1);if(!n||n===`?`)return!0;try{let e=Uint8Array.from(atob(n),e=>e.charCodeAt(0));l.stash=new TextDecoder().decode(e)}catch{}return!0});r.attachCustomKeyEventHandler(n=>{if(jf(n,Kf)){let e=r.getSelection()||l.stash;return e?(navigator.clipboard?.writeText(e),n.preventDefault(),!1):!0}if(!Kf||n.type!==`keydown`||!n.metaKey||n.ctrlKey||n.altKey||n.shiftKey)return!0;let i=Jf[n.key];return i?(n.preventDefault(),d.write(e,t,i),!1):!0});let ie=n=>{Mf(n,e,t)&&(n.preventDefault(),n.stopPropagation())};n.addEventListener(`paste`,ie,!0);let S=new ResizeObserver(()=>x());S.observe(n);let ae=u(()=>{r.options.theme=c()});return()=>{n.removeEventListener(`paste`,ie,!0),S.disconnect(),ae(),te.dispose(),ne.dispose(),re.dispose(),s?.dispose(),m.dispose(),r.dispose(),g.current=null,_.current=null}},[e,t,x]),(0,m.useEffect)(()=>{let n=g.current;if(!n||!ne)return;let r=h.current;r&&r.clientWidth>0&&(_.current?.fit(),n.resize(n.cols,n.rows));let i=null;try{i=new Ef,i.onContextLoss(()=>{i?.dispose(),i=null,n.refresh(0,n.rows-1)}),n.loadAddon(i)}catch{i=null}n.refresh(0,n.rows-1);let a=d.attach(e,t,n.cols,n.rows,{onData:(e,t)=>{if(t===`replay`){v.current=!0,n.reset(),n.write(e,()=>{v.current=!1});return}n.write(e)},onExit:e=>b.current?.(e)});return()=>{i?.dispose(),i=null,a()}},[e,t,ne]),(0,m.useEffect)(()=>{let e=g.current;e&&(e.options.fontSize=y.terminalFontSize,e.options.scrollback=y.terminalScrollback,x())},[y.terminalFontSize,y.terminalScrollback,x]),(0,m.useEffect)(()=>{let t=!1;return d.onStatus(n=>{if(n.session!==e)return;let r=qf.includes(n.status);r&&!t&&x(),t=r})},[e,x]),(0,Gf.jsx)(`div`,{ref:h,className:s(`size-full`,n)})}export{Zf as Terminal};
117
+ }`,zu=8,Bu=zu*Float32Array.BYTES_PER_ELEMENT,Vu=20*zu,Hu=class{constructor(){this.attributes=new Float32Array(Vu),this.count=0}},Uu=0,Wu=0,Gu=0,Ku=0,qu=0,Ju=0,Yu=0,Xu=class extends Ec{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new Hu,this._verticesCursor=new Hu;let i=this._gl;this._program=X(_u(i,Lu,Ru)),this._register(Cc(()=>i.deleteProgram(this._program))),this._projectionLocation=X(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(Cc(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(Cc(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=X(i.createBuffer()),this._register(Cc(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,Bu,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,Bu,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,Bu,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),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,gu),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,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i<t.rows;i++){for(o=-1,s=0,c=0,l=!1,a=0;a<t.cols;a++)u=(i*t.cols+a)*ju,d=e.cells[u+Mu],f=e.cells[u+Nu],p=!!(f&67108864),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=r++*zu,this._updateRectangle(n,m,c,s,o,a,i)),o=a,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=r++*zu,this._updateRectangle(n,m,c,s,o,t.cols,i))}n.count=r}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`){t.count=0;return}let r,i=0;(n.style===`bar`||n.style===`outline`)&&(r=i++*zu,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style===`underline`||n.style===`outline`)&&(r=i++*zu,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=i++*zu,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=i++*zu,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,o){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:Uu=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Uu=(n&16777215)<<8;break;case 0:default:Uu=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:Uu=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:Uu=(r&16777215)<<8;break;case 0:default:Uu=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=yu(e.attributes,this._terminal.rows*this._terminal.cols*zu)),Wu=i*this._dimensions.device.cell.width,Gu=o*this._dimensions.device.cell.height,Ku=(Uu>>24&255)/255,qu=(Uu>>16&255)/255,Ju=(Uu>>8&255)/255,Yu=1,this._addRectangle(e.attributes,t,Wu,Gu,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Ku,qu,Ju,Yu)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/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])}},Zu=class extends Ec{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,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-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(Cc(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=X(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=lu(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,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*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,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=fl,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Qu=class extends Zu{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}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&&su(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()}},$u=typeof window==`object`?window:globalThis,ed=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Z,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Z,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};ed.INSTANCE=new ed;var td=ed;function nd(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}td.INSTANCE.onDidChangeZoomLevel,td.INSTANCE.onDidChangeFullscreen;var rd=typeof navigator==`object`?navigator.userAgent:``;rd.indexOf(`Firefox`);var id=rd.indexOf(`AppleWebKit`)>=0;!(rd.indexOf(`Chrome`)>=0)&&rd.indexOf(`Safari`),rd.indexOf(`Electron/`),rd.indexOf(`Android`);var ad=!1;if(typeof $u.matchMedia==`function`){let e=$u.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=$u.matchMedia(`(display-mode: fullscreen)`);ad=e.matches,nd($u,e,({matches:e})=>{ad&&t.matches||(ad=e)})}function od(){return ad}var sd=`en`,cd=!1,ld=!1,ud=!1,dd=sd,fd,pd=globalThis,md;typeof pd.vscode<`u`&&typeof pd.vscode.process<`u`?md=pd.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(md=process);var hd=typeof md?.versions?.electron==`string`&&md?.type===`renderer`;if(typeof md==`object`){md.platform,md.platform,cd=md.platform===`linux`,cd&&md.env.SNAP&&md.env.SNAP_REVISION,md.env.CI||md.env.BUILD_ARTIFACTSTAGINGDIRECTORY,dd=sd;let e=md.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,dd=t.resolvedLanguage||sd,t.languagePack?.translationsConfigFile}catch{}ld=!0}else typeof navigator==`object`&&!hd?(fd=navigator.userAgent,fd.indexOf(`Windows`),fd.indexOf(`Macintosh`),(fd.indexOf(`Macintosh`)>=0||fd.indexOf(`iPad`)>=0||fd.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,cd=fd.indexOf(`Linux`)>=0,fd?.indexOf(`Mobi`),ud=!0,dd=globalThis._VSCODE_NLS_LANGUAGE||sd,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var gd=ld;ud&&typeof pd.importScripts==`function`&&pd.origin;var _d=fd,vd=dd,yd;(e=>{function t(){return vd}e.value=t;function n(){return vd.length===2?vd===`en`:vd.length>=3&&vd[0]===`e`&&vd[1]===`n`&&vd[2]===`-`}e.isDefaultVariant=n;function r(){return vd===`en`}e.isDefault=r})(yd||={});var bd=typeof pd.postMessage==`function`&&!pd.importScripts;(()=>{if(bd){let e=[];pd.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),pd.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var xd=!!(_d&&_d.indexOf(`Chrome`)>=0);_d&&_d.indexOf(`Firefox`),!xd&&_d&&_d.indexOf(`Safari`),_d&&_d.indexOf(`Edg/`),_d&&_d.indexOf(`Android`);var Sd=typeof navigator==`object`?navigator:{};gd||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||Sd&&Sd.clipboard&&Sd.clipboard.writeText,gd||Sd&&Sd.clipboard&&Sd.clipboard.readText,gd||od()||Sd.keyboard,`ontouchstart`in $u||Sd.maxTouchPoints,$u.PointerEvent&&(`ontouchstart`in $u||navigator.maxTouchPoints);var Cd=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}},wd=new Cd,Td=new Cd,Ed=new Cd;Array(230);var Dd;(e=>{function t(e){return wd.keyCodeToStr(e)}e.toString=t;function n(e){return wd.strToKeyCode(e)}e.fromString=n;function r(e){return Td.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Ed.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Td.strToKeyCode(e)||Ed.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return wd.keyCodeToStr(e)}e.toElectronAccelerator=o})(Dd||={});var Od=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),kd;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof Ad?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ll.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Od})})(kd||={});var Ad=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?Od:(this._emitter||=new Z,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var jd;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(jd||={});var Md=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Z,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Ll.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Md.EMPTY=Md.fromArray([]);function Nd(e){return 55296<=e&&e<=56319}function Pd(e){return 56320<=e&&e<=57343}function Fd(e,t){return(e-55296<<10)+(t-56320)+65536}function Id(e){return Ld(e,0)}function Ld(e,t){switch(typeof e){case`object`:return e===null?Rd(349,t):Array.isArray(e)?Vd(e,t):Hd(e,t);case`string`:return Bd(e,t);case`boolean`:return zd(e,t);case`number`:return Rd(e,t);case`undefined`:return Rd(937,t);default:return Rd(617,t)}}function Rd(e,t){return(t<<5)-t+e|0}function zd(e,t){return Rd(e?433:863,t)}function Bd(e,t){t=Rd(149417,t);for(let n=0,r=e.length;n<r;n++)t=Rd(e.charCodeAt(n),t);return t}function Vd(e,t){return t=Rd(104579,t),e.reduce((e,t)=>Ld(t,e),t)}function Hd(e,t){return t=Rd(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Bd(n,t),Ld(e[n],t)),t)}function Ud(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function Wd(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function Gd(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function Kd(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):Gd((e>>>0).toString(16),t/4)}var qd=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(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(Nd(a))if(o+1<t){let t=e.charCodeAt(o+1);Pd(t)?(o++,s=Fd(a,t)):s=65533}else{i=a;break}else Pd(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}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()),Kd(this._h0)+Kd(this._h1)+Kd(this._h2)+Kd(this._h3)+Kd(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Wd(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Wd(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,Ud(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=Ud(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=Ud(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};qd._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:Jd,getWindow:Yd,getDocument:Xd,getWindows:Zd,getWindowsCount:Qd,getWindowId:$d,getWindowById:ef,hasWindow:tf,onDidRegisterWindow:nf,onWillUnregisterWindow:rf,onDidUnregisterWindow:af}=function(){let e=new Map,t={window:$u,disposables:new Tc};e.set($u.vscodeWindowId,t);let n=new Z,r=new Z,i=new Z;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return Ec.None;let a=new Tc,o={window:t,disposables:a.add(new Tc)};return e.set(t.vscodeWindowId,o),a.add(Cc(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(sf(t,lf.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:$u},getDocument(e){return Yd(e).document}}}(),of=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!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,null)}};function sf(e,t,n,r){return new of(e,t,n,r)}var cf=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};cf.None=new cf(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Id(n),a=r.get(i);if(a)a.users+=1;else{let o=new Z,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(Cc(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var lf={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:id?`webkitAnimationStart`:`animationstart`,ANIMATION_END:id?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:id?`webkitAnimationIteration`:`animationiteration`},uf=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function df(e,t,n,...r){let i=uf.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function ff(e,t,...n){return df(`http://www.w3.org/1999/xhtml`,e,t,...n)}ff.SVG=function(e,t,...n){return df(`http://www.w3.org/2000/svg`,e,t,...n)};var pf=class extends Ec{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new Dc,this._charAtlasDisposable=this._register(new Dc),this._observerDisposable=this._register(new Dc),this._model=new Iu,this._workCell=new hu,this._workCell2=new hu,this._rectangleRenderer=this._register(new Dc),this._glyphRenderer=this._register(new Dc),this._onChangeTextureAtlas=this._register(new Z),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Z),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Z),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Z),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Z),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};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 ul(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Qu(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=el(),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(sf(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(sf(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,uu(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=pu(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=pu(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Cc(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),uu(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 e of this._renderLayers)e.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,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),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 Xu(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Ou(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=lu(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=Sc(Ll.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ll.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 n of this._renderLayers)n.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 fu(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=hf(e,n.rows-1,0),t=hf(t,n.rows-1,0);let ee=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,te=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,ne=te-n.buffer.ydisp,x=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),re=-1,ie=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let S=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=te===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y<n.cols;y++){if(i=this._cellColorResolver.result.bg,s.loadCell(y,r),y===0&&(i=this._cellColorResolver.result.bg),l=!1,d=y>=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)d&&=e===this._model.selection.isCellSelected(this._terminal,v,o);d&&=!m||x<p[0]||x>=p[1],d?(l=!0,r=new mf(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*ju,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),ie&&o===te&&(y===x&&(this._model.cursor={x,y:ne,width:r.getWidth(),style:this._coreBrowserService.isFocused?ee:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},re=x+r.getWidth()-1),y>=x&&y<=re&&(this._coreBrowserService.isFocused&&ee===`block`||this._coreBrowserService.isFocused===!1&&n.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)),g!==0&&(this._model.lineLengths[a]=y+1),!(this._model.cells[v]===g&&this._model.cells[v+Mu]===this._cellColorResolver.result.bg&&this._model.cells[v+Nu]===this._cellColorResolver.result.fg&&this._model.cells[v+Pu]===this._cellColorResolver.result.ext)&&(S=!0,h.length>1&&(g|=Fu),this._model.cells[v]=g,this._model.cells[v+Mu]=this._cellColorResolver.result.bg,this._model.cells[v+Nu]=this._cellColorResolver.result.fg,this._model.cells[v+Pu]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*ju,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,Fc,0,0),this._model.cells[b]=0,this._model.cells[b+Mu]=this._cellColorResolver.result.bg,this._model.cells[b+Nu]=this._cellColorResolver.result.fg,this._model.cells[b+Pu]=this._cellColorResolver.result.ext;y--}}S&&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})}},mf=class extends Ml{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}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 hf(e,t,n=0){return Math.max(Math.min(e,t),n)}var gf=`di$target`,_f=`di$dependencies`,vf=new Map;function yf(e){if(vf.has(e))return vf.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);bf(t,e,r)};return t._id=e,vf.set(e,t),t}function bf(e,t,n){t[gf]===t?t[_f].push({id:e,index:n}):(t[_f]=[{id:e,index:n}],t[gf]=t)}yf(`BufferService`),yf(`CoreMouseService`),yf(`CoreService`),yf(`CharsetService`),yf(`InstantiationService`),yf(`LogService`);var xf=yf(`OptionsService`);yf(`OscLinkService`),yf(`UnicodeService`),yf(`DecorationService`);var Sf={trace:0,debug:1,info:2,warn:3,error:4,off:5},Cf=`xterm.js: `,wf=class extends Ec{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),Tf=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Sf[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,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:Cf)+t,...n)}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)}};wf=Qs([$s(0,xf)],wf);var Tf,Ef=class extends Ec{constructor(e){if(Nc&&Pc()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new Z),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Z),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Z),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Z),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 n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new pf(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(Ll.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ll.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ll.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ll.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(Cc(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};function Df(e){return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)}function Of(){return(0,m.useSyncExternalStore)(Df,()=>document.visibilityState===`visible`)}function kf(e){let t=/^#?([0-9a-fA-F]{6})(?:[0-9a-fA-F]{2})?$/.exec(e.trim());if(!t)return null;let n=t[1].toLowerCase(),r=e=>n.slice(e,e+2).repeat(2);return`rgb:${r(0)}/${r(2)}/${r(4)}`}function Af(e,t){let n=kf(t);return n?`\x1b]${e};${n}\x1b\\`:null}function jf(e,t){return e.type===`keydown`?t?e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&e.key===`c`:e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`c`:!1}function Mf(e,t,n){if(t.startsWith(`login-`)||t===`home`)return!1;let i=Array.from(e.clipboardData?.items??[]);if(i.some(e=>e.type===`text/plain`))return!1;let o=i.find(e=>e.kind===`file`&&e.type.startsWith(`image/`));if(!o)return!1;let s=o.getAsFile();if(!s)return!1;let c=a.safeParse(o.type);return c.success?(Nf(s,c.data,t,n),!0):(r.error(`Cannot paste ${o.type} — png, jpeg, gif, and webp are supported`),!0)}async function Nf(e,t,n,a){try{let r=await Pf(e),o=await i(`POST`,`/api/worktrees/${n}/paste`,{mime:t,data:r});d.write(n,a,`${o.path} `)}catch(e){r.error(e instanceof Error?`Image paste failed: ${e.message}`:`Image paste failed`)}}function Pf(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).replace(/^data:[^,]*,/,``)),r.onerror=()=>n(r.error??Error(`could not read the clipboard image`)),r.readAsDataURL(e)})}var Ff=new Set([`localhost`,`127.0.0.1`,`::1`,`[::1]`]);function If(e,t,n,r){if(!n)return e;let i;try{i=new URL(e)}catch{return e}if(i.protocol!==`http:`&&i.protocol!==`https:`||!Ff.has(i.hostname))return e;let a=i.port===``?i.protocol===`https:`?`443`:`80`:i.port,o=r?`puddle_token=${r}`:``,s=i.search?`${i.search}${o?`&${o}`:``}`:o?`?${o}`:``;return`/proxy/${t}/${a}${i.pathname}${s}${i.hash}`}var Lf=/(?:^|[\s"'`([<])((?:(?:\/|\.{1,2}\/|~\/)(?:[\w.+@~-]+\/)*[\w.+@~-]+|(?:[\w.+@~-]+\/)+[\w.+@~-]*|[\w.+@~-]+\.[A-Za-z]\w{0,11}))(?::(\d{1,6})(?::(\d{1,6}))?)?/dg,Rf=new Set([`.`,`,`,`;`,`:`,`)`,`]`,`'`,`"`]);function zf(e){let t=[],n=new RegExp(Lf.source,Lf.flags),r;for(;r=n.exec(e);){let e=r.indices,n=r[1];if(!e?.[1]||n===void 0)continue;let i=e[1][0],a=e[1][1],o=n;for(o.startsWith(`@`)&&(o=o.slice(1),i++);o.length>0&&Rf.has(o[o.length-1]);)o=o.slice(0,-1),a--;if(o.length===0)continue;let s=r[2]===void 0?void 0:Number.parseInt(r[2],10),c=r[3]===void 0?void 0:Number.parseInt(r[3],10),l=c!==void 0&&e[3]?e[3][1]:s!==void 0&&e[2]?e[2][1]:a;t.push({path:o,line:s,column:c,start:i,end:l})}return t}var Bf=class{fetcher;now;positiveTtlMs;negativeTtlMs;maxEntries;maxConcurrent;entries=new Map;inflight=new Map;inUse=0;waiters=[];constructor(e){this.fetcher=e.fetcher,this.now=e.now??Date.now,this.positiveTtlMs=e.positiveTtlMs??15e3,this.negativeTtlMs=e.negativeTtlMs??5e3,this.maxEntries=e.maxEntries??500,this.maxConcurrent=e.maxConcurrent??4}resolve(e,t,n){let r=`${e}\0${t}`,i=this.entries.get(r);if(i){if(this.now()<i.expiresAt)return Promise.resolve(i.value);this.entries.delete(r)}let a=this.inflight.get(r);if(a)return a;let o=this.withSlot(()=>this.fetcher(e,t,n)).then(e=>(this.store(r,e),e)).finally(()=>{this.inflight.delete(r)});return this.inflight.set(r,o),o}store(e,t){let n=t?this.positiveTtlMs:this.negativeTtlMs;for(this.entries.set(e,{value:t,expiresAt:this.now()+n});this.entries.size>this.maxEntries;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e)}}async withSlot(e){this.inUse>=this.maxConcurrent&&await new Promise(e=>this.waiters.push(e)),this.inUse++;try{return await e()}finally{this.inUse--,this.waiters.shift()?.()}}};function Vf(e,t){let n=t;for(;n>0&&e.getLine(n)?.isWrapped;)n--;let r=``;for(let t=n;;t++){let i=e.getLine(t);if(!i||t!==n&&!i.isWrapped||(r+=i.translateToString(!0),r.length>2048))break}return{text:r,startRow:n}}function Hf(e,t,n,r){let i=e.getNullCell(),a=t,o=n,s=r;for(;s>=0;){let t=e.getLine(a);if(!t)return null;for(;o<t.length;o++){if(t.getCell(o,i),i.getWidth()&&(s-=i.getChars().length||1,o===t.length-1&&i.getChars()===``)){let t=e.getLine(a+1);t?.isWrapped&&(t.getCell(0,i),i.getWidth()===2&&(s+=1))}if(s<0)return{row:a,col:o}}a++,o=0}return{row:a,col:o}}async function Uf(e,t,n){let r=new URLSearchParams({path:t});n!==void 0&&r.set(`line`,String(n));try{return await i(`GET`,`/api/worktrees/${e}/resolve?${r}`)}catch{return null}}function Wf(e,t,n){let r=new Bf({fetcher:Uf});return e.registerLinkProvider({provideLinks(i,a){let o=e.buffer.active,{text:s,startRow:c}=Vf(o,i-1),l=zf(s);if(l.length===0){a(void 0);return}Promise.all(l.map(async e=>{let i=await r.resolve(t,e.path,e.line);if(!i)return null;let a=Hf(o,c,0,e.start),l=Hf(o,a?.row??c,a?.col??0,e.end-e.start);return!a||!l?null:{range:{start:{x:a.col+1,y:a.row+1},end:{x:l.col,y:l.row+1}},text:s.slice(e.start,e.end),decorations:{underline:!0,pointerCursor:!0},activate:t=>{!t.metaKey&&!t.ctrlKey||n(i.path,e.line===void 0?void 0:Math.max(1,e.line),e.column)}}})).then(e=>{let t=e.filter(e=>e!==null);a(t.length>0?t:void 0)})}})}var Gf=n(),Kf=/Mac|iPhone|iPad/.test(navigator.platform),qf=[`starting`,`running`,`waiting_input`],Jf={ArrowLeft:``,ArrowRight:``,Backspace:``,Delete:`\v`};function Yf(e,t){let[n,r]=(0,m.useState)(e);return(0,m.useEffect)(()=>{if(e){r(!0);return}let n=setTimeout(()=>r(!1),t);return()=>clearTimeout(n)},[e,t]),n}var Xf=1500;function Zf({stream:e,term:t=`agent`,className:n,onExit:r,onOpenFile:i,paused:a=!1}){let h=(0,m.useRef)(null),g=(0,m.useRef)(null),_=(0,m.useRef)(null),v=(0,m.useRef)(!1),y=f(),b=(0,m.useRef)(r);b.current=r;let ee=(0,m.useRef)(i);ee.current=i;let te=Of(),ne=Yf(!a&&te,Xf),x=(0,m.useCallback)(()=>{let n=g.current,r=h.current;!n||!r||r.clientWidth===0||(_.current?.fit(),n.resize(n.cols,n.rows),n.refresh(0,n.rows-1),d.resize(e,t,n.cols,n.rows))},[e,t]);return(0,m.useEffect)(()=>{let n=h.current;if(!n)return;let r=new Bs({theme:c(),fontFamily:`'Ubuntu Sans Mono', ui-monospace, monospace`,fontSize:y.terminalFontSize,scrollback:y.terminalScrollback,cursorBlink:!0,macOptionClickForcesSelection:Kf});g.current=r;let i=new Us;r.loadAddon(i);let a=e.startsWith(`login-`)||e===`home`;r.loadAddon(new Ys((t,n)=>{let r=a?n:If(n,e,p()!==null,o.get());window.open(r,`_blank`,`noopener,noreferrer`)})),r.open(n),i.fit(),_.current=i;let s=ee.current&&!a?Wf(r,e,(e,t,n)=>ee.current?.(e,t,n)):null,f={stash:null},m=r.onData(n=>{n.startsWith(`\x1B[<`)||(f.stash=null),d.write(e,t,n)}),b=(n,r)=>i=>{if(i!==`?`)return!1;if(v.current)return!0;let a=Af(n,l()(r));return a&&d.write(e,t,a),!0},te=r.parser.registerOscHandler(10,b(10,`--text-primary`)),ne=r.parser.registerOscHandler(11,b(11,`--bg-base`)),re=r.parser.registerOscHandler(52,e=>{if(v.current)return!0;let t=e.indexOf(`;`),n=t===-1?``:e.slice(t+1);if(!n||n===`?`)return!0;try{let e=Uint8Array.from(atob(n),e=>e.charCodeAt(0));f.stash=new TextDecoder().decode(e)}catch{}return!0});r.attachCustomKeyEventHandler(n=>{if(jf(n,Kf)){let e=r.getSelection()||f.stash;return e?(navigator.clipboard?.writeText(e),n.preventDefault(),!1):!0}if(!Kf||n.type!==`keydown`||!n.metaKey||n.ctrlKey||n.altKey||n.shiftKey)return!0;let i=Jf[n.key];return i?(n.preventDefault(),d.write(e,t,i),!1):!0});let ie=n=>{Mf(n,e,t)&&(n.preventDefault(),n.stopPropagation())};n.addEventListener(`paste`,ie,!0);let S=new ResizeObserver(()=>x());S.observe(n);let ae=u(()=>{r.options.theme=c()});return()=>{n.removeEventListener(`paste`,ie,!0),S.disconnect(),ae(),te.dispose(),ne.dispose(),re.dispose(),s?.dispose(),m.dispose(),r.dispose(),g.current=null,_.current=null}},[e,t,x]),(0,m.useEffect)(()=>{let n=g.current;if(!n||!ne)return;let r=h.current;r&&r.clientWidth>0&&(_.current?.fit(),n.resize(n.cols,n.rows));let i=null;try{i=new Ef,i.onContextLoss(()=>{i?.dispose(),i=null,n.refresh(0,n.rows-1)}),n.loadAddon(i)}catch{i=null}n.refresh(0,n.rows-1);let a=d.attach(e,t,n.cols,n.rows,{onData:(e,t)=>{if(t===`replay`){v.current=!0,n.reset(),n.write(e,()=>{v.current=!1});return}n.write(e)},onExit:e=>b.current?.(e)});return()=>{i?.dispose(),i=null,a()}},[e,t,ne]),(0,m.useEffect)(()=>{let e=g.current;e&&(e.options.fontSize=y.terminalFontSize,e.options.scrollback=y.terminalScrollback,x())},[y.terminalFontSize,y.terminalScrollback,x]),(0,m.useEffect)(()=>{let t=!1;return d.onStatus(n=>{if(n.session!==e)return;let r=qf.includes(n.status);r&&!t&&x(),t=r})},[e,x]),(0,Gf.jsx)(`div`,{ref:h,className:s(`size-full`,n)})}export{Zf as Terminal};