@xterm/addon-webgl 0.19.0-beta.43 → 0.19.0-beta.44

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.
@@ -14,7 +14,7 @@
14
14
  * Copyright (c) Microsoft Corporation. All rights reserved.
15
15
  * Licensed under the MIT License. See License.txt in the project root for license information.
16
16
  *--------------------------------------------------------------------------------------------*/
17
- var Mi=Object.defineProperty;var Ei=Object.getOwnPropertyDescriptor;var Bt=(i,e,t,r)=>{for(var s=r>1?void 0:r?Ei(e,t):e,o=i.length-1,n;o>=0;o--)(n=i[o])&&(s=(r?n(e,t,s):n(s))||s);return r&&s&&Mi(e,t,s),s},Pt=(i,e)=>(t,r)=>e(t,r,i);var k=class{constructor(){this._listeners=new Set;this._disposed=!1}get event(){return this._event||(this._event=e=>(this._listeners.add(e),{dispose:()=>{this._disposed||this._listeners.delete(e)}})),this._event}fire(e,t){let r=[];for(let s of this._listeners.values())r.push(s);for(let s=0;s<r.length;s++)r[s].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&this._listeners.clear()}};function ne(i,e){return i(t=>e.fire(t))}var H=class{constructor(){this._disposables=[];this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},se=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}};function y(i){return{dispose:i}}function Oi(i){for(let e of i)e.dispose();i.length=0}function Nt(i){return{dispose:()=>Oi(i)}}var $e=typeof process<"u"&&"title"in process,xe=$e?"node":navigator.userAgent,pt=$e?"node":navigator.platform,kt=xe.includes("Firefox"),Gt=xe.includes("Edge"),vt=/^((?!chrome|android).)*safari/i.test(xe);function $t(){if(!vt)return 0;let i=xe.match(/Version\/(\d+)/);return i===null||i.length<2?0:parseInt(i[1])}var sr=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(pt);var or=["Windows","Win16","Win32","WinCE"].includes(pt),ar=pt.indexOf("Linux")>=0,lr=/\bCrOS\b/.test(xe);function ft(i,e,t,r){i.addEventListener(e,t,r);let s=!1;return{dispose:()=>{s||(s=!0,i.removeEventListener(e,t,r))}}}var Ht="";var w=0,F=0,B=0,I=0,j={css:"#00000000",rgba:0},G;(r=>{function i(s,o,n,l){return l!==void 0?`#${ce(s)}${ce(o)}${ce(n)}${ce(l)}`:`#${ce(s)}${ce(o)}${ce(n)}`}r.toCss=i;function e(s,o,n,l=255){return(s<<24|o<<16|n<<8|l)>>>0}r.toRgba=e;function t(s,o,n,l){return{css:r.toCss(s,o,n,l),rgba:r.toRgba(s,o,n,l)}}r.toColor=t})(G||={});var Le;(l=>{function i(c,a){if(I=(a.rgba&255)/255,I===1)return{css:a.css,rgba:a.rgba};let h=a.rgba>>24&255,d=a.rgba>>16&255,u=a.rgba>>8&255,_=c.rgba>>24&255,p=c.rgba>>16&255,v=c.rgba>>8&255;w=_+Math.round((h-_)*I),F=p+Math.round((d-p)*I),B=v+Math.round((u-v)*I);let M=G.toCss(w,F,B),E=G.toRgba(w,F,B);return{css:M,rgba:E}}l.blend=i;function e(c){return(c.rgba&255)===255}l.isOpaque=e;function t(c,a,h){let d=J.ensureContrastRatio(c.rgba,a.rgba,h);if(d)return G.toColor(d>>24&255,d>>16&255,d>>8&255)}l.ensureContrastRatio=t;function r(c){let a=(c.rgba|255)>>>0;return[w,F,B]=J.toChannels(a),{css:G.toCss(w,F,B),rgba:a}}l.opaque=r;function s(c,a){return I=Math.round(a*255),[w,F,B]=J.toChannels(c.rgba),{css:G.toCss(w,F,B,I),rgba:G.toRgba(w,F,B,I)}}l.opacity=s;function o(c,a){return I=c.rgba&255,s(c,I*a/255)}l.multiplyOpacity=o;function n(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}l.toColorRGB=n})(Le||={});var Ai;(r=>{let i,e;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(i=o,i.globalCompositeOperation="copy",e=i.createLinearGradient(0,0,1,1))}catch{}function t(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return w=parseInt(s.slice(1,2).repeat(2),16),F=parseInt(s.slice(2,3).repeat(2),16),B=parseInt(s.slice(3,4).repeat(2),16),G.toColor(w,F,B);case 5:return w=parseInt(s.slice(1,2).repeat(2),16),F=parseInt(s.slice(2,3).repeat(2),16),B=parseInt(s.slice(3,4).repeat(2),16),I=parseInt(s.slice(4,5).repeat(2),16),G.toColor(w,F,B,I);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return w=parseInt(o[1]),F=parseInt(o[2]),B=parseInt(o[3]),I=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),G.toColor(w,F,B,I);if(!i||!e)throw new Error("css.toColor: Unsupported css format");if(i.fillStyle=e,i.fillStyle=s,typeof i.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(i.fillRect(0,0,1,1),[w,F,B,I]=i.getImageData(0,0,1,1).data,I!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:G.toRgba(w,F,B,I),css:s}}r.toColor=t})(Ai||={});var $;(t=>{function i(r){return e(r>>16&255,r>>8&255,r&255)}t.relativeLuminance=i;function e(r,s,o){let n=r/255,l=s/255,c=o/255,a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),h=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),d=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return a*.2126+h*.7152+d*.0722}t.relativeLuminance2=e})($||={});var J;(o=>{function i(n,l){if(I=(l&255)/255,I===1)return l;let c=l>>24&255,a=l>>16&255,h=l>>8&255,d=n>>24&255,u=n>>16&255,_=n>>8&255;return w=d+Math.round((c-d)*I),F=u+Math.round((a-u)*I),B=_+Math.round((h-_)*I),G.toRgba(w,F,B)}o.blend=i;function e(n,l,c){let a=$.relativeLuminance(n>>8),h=$.relativeLuminance(l>>8);if(Q(a,h)<c){if(h<a){let p=t(n,l,c),v=Q(a,$.relativeLuminance(p>>8));if(v<c){let M=r(n,l,c),E=Q(a,$.relativeLuminance(M>>8));return v>E?p:M}return p}let u=r(n,l,c),_=Q(a,$.relativeLuminance(u>>8));if(_<c){let p=t(n,l,c),v=Q(a,$.relativeLuminance(p>>8));return _>v?u:p}return u}}o.ensureContrastRatio=e;function t(n,l,c){let a=n>>24&255,h=n>>16&255,d=n>>8&255,u=l>>24&255,_=l>>16&255,p=l>>8&255,v=Q($.relativeLuminance2(u,_,p),$.relativeLuminance2(a,h,d));for(;v<c&&(u>0||_>0||p>0);)u-=Math.max(0,Math.ceil(u*.1)),_-=Math.max(0,Math.ceil(_*.1)),p-=Math.max(0,Math.ceil(p*.1)),v=Q($.relativeLuminance2(u,_,p),$.relativeLuminance2(a,h,d));return(u<<24|_<<16|p<<8|255)>>>0}o.reduceLuminance=t;function r(n,l,c){let a=n>>24&255,h=n>>16&255,d=n>>8&255,u=l>>24&255,_=l>>16&255,p=l>>8&255,v=Q($.relativeLuminance2(u,_,p),$.relativeLuminance2(a,h,d));for(;v<c&&(u<255||_<255||p<255);)u=Math.min(255,u+Math.ceil((255-u)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),v=Q($.relativeLuminance2(u,_,p),$.relativeLuminance2(a,h,d));return(u<<24|_<<16|p<<8|255)>>>0}o.increaseLuminance=r;function s(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}o.toChannels=s})(J||={});function ce(i){let e=i.toString(16);return e.length<2?"0"+e:e}function Q(i,e){return i<e?(e+.05)/(i+.05):(i+.05)/(e+.05)}function T(i){if(!i)throw new Error("value must not be falsy");return i}function Ue(i){return 57508<=i&&i<=57558}function Ut(i){return 57520<=i&&i<=57527}function yi(i){return 57344<=i&&i<=63743}function Di(i){return 9472<=i&&i<=9631}function wi(i){return i>=128512&&i<=128591||i>=127744&&i<=128511||i>=128640&&i<=128767||i>=9728&&i<=9983||i>=9984&&i<=10175||i>=65024&&i<=65039||i>=129280&&i<=129535||i>=127462&&i<=127487}function Wt(i,e,t,r){return e===1&&t>Math.ceil(r*1.5)&&i!==void 0&&i>255&&!wi(i)&&!Ue(i)&&!yi(i)}function We(i){return Ue(i)||Di(i)}function Vt(){return{css:{canvas:He(),cell:He()},device:{canvas:He(),cell:He(),char:{width:0,height:0,left:0,top:0}}}}function He(){return{width:0,height:0}}function zt(i,e,t=0){return(i-(Math.round(e)*2-t))%(Math.round(e)*2)}var N=0,P=0,Z=!1,ee=!1,Ve=!1,U,bt=0,ze=class{constructor(e,t,r,s,o,n){this._terminal=e;this._optionService=t;this._selectionRenderModel=r;this._decorationService=s;this._coreBrowserService=o;this._themeService=n;this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,s){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,P=0,N=0,ee=!1,Z=!1,Ve=!1,U=this._themeService.colors,bt=0,e.getCode()!==0&&e.extended.underlineStyle===4){let n=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));bt=t*s%(Math.round(n)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",n=>{n.backgroundColorRGB&&(P=n.backgroundColorRGB.rgba>>8&16777215,ee=!0),n.foregroundColorRGB&&(N=n.foregroundColorRGB.rgba>>8&16777215,Z=!0)}),Ve=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Ve){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:P=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:P=(this.result.fg&16777215)<<8|255;break;case 0:default:P=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:P=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:P=(this.result.bg&16777215)<<8|255;break}P=J.blend(P,(this._coreBrowserService.isFocused?U.selectionBackgroundOpaque:U.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else P=(this._coreBrowserService.isFocused?U.selectionBackgroundOpaque:U.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(ee=!0,U.selectionForeground&&(N=U.selectionForeground.rgba>>8&16777215,Z=!0),We(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)N=(this._coreBrowserService.isFocused?U.selectionBackgroundOpaque:U.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:N=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:N=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:N=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:N=(this.result.fg&16777215)<<8|255;break;case 0:default:N=this._themeService.colors.foreground.rgba}N=J.blend(N,(this._coreBrowserService.isFocused?U.selectionBackgroundOpaque:U.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Z=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",n=>{n.backgroundColorRGB&&(P=n.backgroundColorRGB.rgba>>8&16777215,ee=!0),n.foregroundColorRGB&&(N=n.foregroundColorRGB.rgba>>8&16777215,Z=!0)}),ee&&(Ve?P=e.bg&-16777216&-134217729|P|50331648:P=e.bg&-16777216|P|50331648),Z&&(N=e.fg&-16777216&-67108865|N|50331648),this.result.fg&67108864&&(ee&&!Z&&((this.result.bg&50331648)===0?N=this.result.fg&-134217728|U.background.rgba>>8&16777215&16777215|50331648:N=this.result.fg&-134217728|this.result.bg&67108863,Z=!0),!ee&&Z&&((this.result.fg&50331648)===0?P=this.result.bg&-67108864|U.foreground.rgba>>8&16777215&16777215|50331648:P=this.result.bg&-67108864|this.result.fg&67108863,ee=!0)),U=void 0,this.result.bg=ee?P:this.result.bg,this.result.fg=Z?N:this.result.fg,this.result.ext&=536870911,this.result.ext|=bt<<29&3758096384}};var Xt=257,Yt=.5,Ke=kt||Gt?"bottom":"ideographic";var Pi={"\u2580":[{x:0,y:0,w:8,h:4}],"\u2581":[{x:0,y:7,w:8,h:1}],"\u2582":[{x:0,y:6,w:8,h:2}],"\u2583":[{x:0,y:5,w:8,h:3}],"\u2584":[{x:0,y:4,w:8,h:4}],"\u2585":[{x:0,y:3,w:8,h:5}],"\u2586":[{x:0,y:2,w:8,h:6}],"\u2587":[{x:0,y:1,w:8,h:7}],"\u2588":[{x:0,y:0,w:8,h:8}],"\u2589":[{x:0,y:0,w:7,h:8}],"\u258A":[{x:0,y:0,w:6,h:8}],"\u258B":[{x:0,y:0,w:5,h:8}],"\u258C":[{x:0,y:0,w:4,h:8}],"\u258D":[{x:0,y:0,w:3,h:8}],"\u258E":[{x:0,y:0,w:2,h:8}],"\u258F":[{x:0,y:0,w:1,h:8}],"\u2590":[{x:4,y:0,w:4,h:8}],"\u2594":[{x:0,y:0,w:8,h:1}],"\u2595":[{x:7,y:0,w:1,h:8}],"\u2596":[{x:0,y:4,w:4,h:4}],"\u2597":[{x:4,y:4,w:4,h:4}],"\u2598":[{x:0,y:0,w:4,h:4}],"\u2599":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u259A":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"\u259B":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"\u259C":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"\u259D":[{x:4,y:0,w:4,h:4}],"\u259E":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"\u259F":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u{1FB70}":[{x:1,y:0,w:1,h:8}],"\u{1FB71}":[{x:2,y:0,w:1,h:8}],"\u{1FB72}":[{x:3,y:0,w:1,h:8}],"\u{1FB73}":[{x:4,y:0,w:1,h:8}],"\u{1FB74}":[{x:5,y:0,w:1,h:8}],"\u{1FB75}":[{x:6,y:0,w:1,h:8}],"\u{1FB76}":[{x:0,y:1,w:8,h:1}],"\u{1FB77}":[{x:0,y:2,w:8,h:1}],"\u{1FB78}":[{x:0,y:3,w:8,h:1}],"\u{1FB79}":[{x:0,y:4,w:8,h:1}],"\u{1FB7A}":[{x:0,y:5,w:8,h:1}],"\u{1FB7B}":[{x:0,y:6,w:8,h:1}],"\u{1FB7C}":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB7D}":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7E}":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7F}":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB80}":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB81}":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB82}":[{x:0,y:0,w:8,h:2}],"\u{1FB83}":[{x:0,y:0,w:8,h:3}],"\u{1FB84}":[{x:0,y:0,w:8,h:5}],"\u{1FB85}":[{x:0,y:0,w:8,h:6}],"\u{1FB86}":[{x:0,y:0,w:8,h:7}],"\u{1FB87}":[{x:6,y:0,w:2,h:8}],"\u{1FB88}":[{x:5,y:0,w:3,h:8}],"\u{1FB89}":[{x:3,y:0,w:5,h:8}],"\u{1FB8A}":[{x:2,y:0,w:6,h:8}],"\u{1FB8B}":[{x:1,y:0,w:7,h:8}],"\u{1FB95}":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"\u{1FB96}":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"\u{1FB97}":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Ni={"\u2591":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"\u2592":[[1,0],[0,0],[0,1],[0,0]],"\u2593":[[0,1],[1,1],[1,0],[1,1]]};var ki={"\u2500":{1:"M0,.5 L1,.5"},"\u2501":{3:"M0,.5 L1,.5"},"\u2502":{1:"M.5,0 L.5,1"},"\u2503":{3:"M.5,0 L.5,1"},"\u250C":{1:"M0.5,1 L.5,.5 L1,.5"},"\u250F":{3:"M0.5,1 L.5,.5 L1,.5"},"\u2510":{1:"M0,.5 L.5,.5 L.5,1"},"\u2513":{3:"M0,.5 L.5,.5 L.5,1"},"\u2514":{1:"M.5,0 L.5,.5 L1,.5"},"\u2517":{3:"M.5,0 L.5,.5 L1,.5"},"\u2518":{1:"M.5,0 L.5,.5 L0,.5"},"\u251B":{3:"M.5,0 L.5,.5 L0,.5"},"\u251C":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2523":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2524":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252B":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252C":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2533":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2534":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253B":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253C":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u254B":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u2574":{1:"M.5,.5 L0,.5"},"\u2578":{3:"M.5,.5 L0,.5"},"\u2575":{1:"M.5,.5 L.5,0"},"\u2579":{3:"M.5,.5 L.5,0"},"\u2576":{1:"M.5,.5 L1,.5"},"\u257A":{3:"M.5,.5 L1,.5"},"\u2577":{1:"M.5,.5 L.5,1"},"\u257B":{3:"M.5,.5 L.5,1"},"\u2550":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"\u2551":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"\u2552":{1:(i,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"\u2553":{1:(i,e)=>`M${.5-i},1 L${.5-i},.5 L1,.5 M${.5+i},.5 L${.5+i},1`},"\u2554":{1:(i,e)=>`M1,${.5-e} L${.5-i},${.5-e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"\u2555":{1:(i,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"\u2556":{1:(i,e)=>`M${.5+i},1 L${.5+i},.5 L0,.5 M${.5-i},.5 L${.5-i},1`},"\u2557":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5+i},${.5-e} L${.5+i},1`},"\u2558":{1:(i,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"\u2559":{1:(i,e)=>`M1,.5 L${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"\u255A":{1:(i,e)=>`M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0 M1,${.5+e} L${.5-i},${.5+e} L${.5-i},0`},"\u255B":{1:(i,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"\u255C":{1:(i,e)=>`M0,.5 L${.5+i},.5 L${.5+i},0 M${.5-i},.5 L${.5-i},0`},"\u255D":{1:(i,e)=>`M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M0,${.5+e} L${.5+i},${.5+e} L${.5+i},0`},"\u255E":{1:(i,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"\u255F":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1 M${.5+i},.5 L1,.5`},"\u2560":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"\u2561":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"\u2562":{1:(i,e)=>`M0,.5 L${.5-i},.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"\u2563":{1:(i,e)=>`M${.5+i},0 L${.5+i},1 M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0`},"\u2564":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"\u2565":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},1 M${.5+i},.5 L${.5+i},1`},"\u2566":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"\u2567":{1:(i,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"\u2568":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"\u2569":{1:(i,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"\u256A":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"\u256B":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"\u256C":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"\u2571":{1:"M1,0 L0,1"},"\u2572":{1:"M0,0 L1,1"},"\u2573":{1:"M1,0 L0,1 M0,0 L1,1"},"\u257C":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u257D":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"\u257E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u257F":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u250D":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u250E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2511":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"\u2512":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2515":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"\u2516":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2519":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"\u251A":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"\u251D":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"\u251E":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u251F":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2520":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2521":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2522":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"\u2525":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"\u2526":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2527":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2528":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"\u2529":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"\u252A":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"\u252D":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u252E":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u252F":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"\u2530":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2531":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2532":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2535":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u2536":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u2537":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"\u2538":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2539":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u253A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"\u253D":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u253E":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u253F":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"\u2540":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2541":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2542":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2543":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u2544":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2545":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2546":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2547":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"\u2548":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2549":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u254A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u254C":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u254D":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u2504":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2505":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2508":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u2509":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u254E":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u254F":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u2506":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u2507":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u250A":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u250B":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u256D":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"\u256E":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"\u256F":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"\u2570":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}};var Re={"\uE0A0":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"\uE0A1":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"\uE0A2":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"\uE0B0":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"\uE0B1":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B2":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"\uE0B3":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B4":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"\uE0B5":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"\uE0B6":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"\uE0B7":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"\uE0B8":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"\uE0B9":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BA":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"\uE0BC":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"\uE0BD":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BE":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Re["\uE0BB"]=Re["\uE0BD"];Re["\uE0BF"]=Re["\uE0B9"];function Qt(i,e,t,r,s,o,n,l){let c=Pi[e];if(c)return Gi(i,c,t,r,s,o),!0;let a=Ni[e];if(a)return $i(i,a,t,r,s,o),!0;let h=ki[e];if(h)return Hi(i,h,t,r,s,o,l),!0;let d=Re[e];return d?(Ui(i,d,t,r,s,o,n,l),!0):!1}function Gi(i,e,t,r,s,o){for(let n=0;n<e.length;n++){let l=e[n],c=s/8,a=o/8;i.fillRect(t+l.x*c,r+l.y*a,l.w*c,l.h*a)}}var jt=new Map;function $i(i,e,t,r,s,o){let n=jt.get(e);n||(n=new Map,jt.set(e,n));let l=i.fillStyle;if(typeof l!="string")throw new Error(`Unexpected fillStyle type "${l}"`);let c=n.get(l);if(!c){let a=e[0].length,h=e.length,d=i.canvas.ownerDocument.createElement("canvas");d.width=a,d.height=h;let u=T(d.getContext("2d")),_=new ImageData(a,h),p,v,M,E;if(l.startsWith("#"))p=parseInt(l.slice(1,3),16),v=parseInt(l.slice(3,5),16),M=parseInt(l.slice(5,7),16),E=l.length>7&&parseInt(l.slice(7,9),16)||1;else if(l.startsWith("rgba"))[p,v,M,E]=l.substring(5,l.length-1).split(",").map(f=>parseFloat(f));else throw new Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);for(let f=0;f<h;f++)for(let D=0;D<a;D++)_.data[(f*a+D)*4]=p,_.data[(f*a+D)*4+1]=v,_.data[(f*a+D)*4+2]=M,_.data[(f*a+D)*4+3]=e[f][D]*(E*255);u.putImageData(_,0,0),c=T(i.createPattern(d,null)),n.set(l,c)}i.fillStyle=c,i.fillRect(t,r,s,o)}function Hi(i,e,t,r,s,o,n){i.strokeStyle=i.fillStyle;for(let[l,c]of Object.entries(e)){i.beginPath(),i.lineWidth=n*Number.parseInt(l);let a;if(typeof c=="function"){let d=.15/o*s;a=c(.15,d)}else a=c;for(let h of a.split(" ")){let d=h[0],u=Jt[d];if(!u){console.error(`Could not find drawing instructions for "${d}"`);continue}let _=h.substring(1).split(",");!_[0]||!_[1]||u(i,ei(_,s,o,t,r,!0,n))}i.stroke(),i.closePath()}}function Ui(i,e,t,r,s,o,n,l){let c=new Path2D;c.rect(t,r,s,o),i.clip(c),i.beginPath();let a=n/12;i.lineWidth=l*a;for(let h of e.d.split(" ")){let d=h[0],u=Jt[d];if(!u){console.error(`Could not find drawing instructions for "${d}"`);continue}let _=h.substring(1).split(",");!_[0]||!_[1]||u(i,ei(_,s,o,t,r,!1,l,(e.leftPadding??0)*(a/2),(e.rightPadding??0)*(a/2)))}e.type===1?(i.strokeStyle=i.fillStyle,i.stroke()):i.fill(),i.closePath()}function Zt(i,e,t=0){return Math.max(Math.min(i,e),t)}var Jt={C:(i,e)=>i.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(i,e)=>i.lineTo(e[0],e[1]),M:(i,e)=>i.moveTo(e[0],e[1])};function ei(i,e,t,r,s,o,n,l=0,c=0){let a=i.map(h=>parseFloat(h)||parseInt(h));if(a.length<2)throw new Error("Too few arguments for instruction");for(let h=0;h<a.length;h+=2)a[h]*=e-l*n-c*n,o&&a[h]!==0&&(a[h]=Zt(Math.round(a[h]+.5)-.5,e,0)),a[h]+=r+l*n;for(let h=1;h<a.length;h+=2)a[h]*=t,o&&a[h]!==0&&(a[h]=Zt(Math.round(a[h]+.5)-.5,t,0)),a[h]+=s;return a}var qe=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Me=class{constructor(){this._data=new qe}set(e,t,r,s,o){this._data.get(e,t)||this._data.set(e,t,new qe),this._data.get(e,t).set(r,s,o)}get(e,t,r,s){return this._data.get(e,t)?.get(r,s)}clear(){this._data.clear()}};var Xe=class{constructor(){this._tasks=[];this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,r=0,s=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),r=Math.max(t,r),o=e.timeRemaining(),r*1.5>o){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=o}this.clear()}},gt=class extends Xe{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}},Ct=class extends Xe{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ti=!$e&&"requestIdleCallback"in window?Ct:gt;var X=class i{constructor(){this.fg=0;this.bg=0;this.extended=new Ee}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 e=new i;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},Ee=class i{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 i(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}};var ii={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},Oe=2;var Ae,V=class i{constructor(e,t,r){this._document=e;this._config=t;this._unicodeService=r;this._didWarmUp=!1;this._cacheMap=new Me;this._cacheMapCombined=new Me;this._pages=[];this._activePages=[];this._workBoundingBox={top:0,left:0,bottom:0,right:0};this._workAttributeData=new X;this._textureSize=512;this._onAddTextureAtlasCanvas=new k;this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=new k;this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._requestClearModel=!1;this._createNewPage(),this._tmpCanvas=ri(e,this._config.deviceCellWidth*4+Oe*2,this._config.deviceCellHeight+Oe*2),this._tmpCtx=T(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new ti;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let r=this._drawToCache(t,0,0,0);this._cacheMap.set(t,0,0,0,r)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(i.maxAtlasPages&&this._pages.length>=Math.max(4,i.maxAtlasPages)){let t=this._pages.filter(a=>a.canvas.width*2<=(i.maxTextureSize||4096)).sort((a,h)=>h.canvas.width!==a.canvas.width?h.canvas.width-a.canvas.width:h.percentageUsed-a.percentageUsed),r=-1,s=0;for(let a=0;a<t.length;a++)if(t[a].canvas.width!==s)r=a,s=t[a].canvas.width;else if(a-r===3)break;let o=t.slice(r,r+4),n=o.map(a=>a.glyphs[0].texturePage).sort((a,h)=>a>h?1:-1),l=this.pages.length-o.length,c=this._mergePages(o,l);c.version++;for(let a=n.length-1;a>=0;a--)this._deletePage(n[a]);this.pages.push(c),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(c.canvas)}let e=new Ye(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let r=e[0].canvas.width*2,s=new Ye(this._document,r,e);for(let[o,n]of e.entries()){let l=o*n.canvas.width%r,c=Math.floor(o/2)*n.canvas.height;s.ctx.drawImage(n.canvas,l,c);for(let h of n.glyphs)h.texturePage=t,h.sizeClipSpace.x=h.size.x/r,h.sizeClipSpace.y=h.size.y/r,h.texturePosition.x+=l,h.texturePosition.y+=c,h.texturePositionClipSpace.x=h.texturePosition.x/r,h.texturePositionClipSpace.y=h.texturePosition.y/r;this._onRemoveTextureAtlasCanvas.fire(n.canvas);let a=this._activePages.indexOf(n);a!==-1&&this._activePages.splice(a,1)}return s}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let r=this._pages[t];for(let s of r.glyphs)s.texturePage--;r.version++}}getRasterizedGlyphCombinedChar(e,t,r,s,o){return this._getFromCacheMap(this._cacheMapCombined,e,t,r,s,o)}getRasterizedGlyph(e,t,r,s,o){return this._getFromCacheMap(this._cacheMap,e,t,r,s,o)}_getFromCacheMap(e,t,r,s,o,n=!1){return Ae=e.get(t,r,s,o),Ae||(Ae=this._drawToCache(t,r,s,o,n),e.set(t,r,s,o,Ae)),Ae}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,r,s){if(this._config.allowTransparency)return j;let o;switch(e){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(t);break;case 50331648:let n=X.toColorRGB(t);o=G.toColor(n[0],n[1],n[2]);break;case 0:default:r?o=Le.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return o}_getForegroundColor(e,t,r,s,o,n,l,c,a,h){let d=this._getMinimumContrastColor(e,t,r,s,o,n,l,a,c,h);if(d)return d;let u;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&a&&n<8&&(n+=8),u=this._getColorFromAnsiIndex(n);break;case 50331648:let _=X.toColorRGB(n);u=G.toColor(_[0],_[1],_[2]);break;case 0:default:l?u=this._config.colors.background:u=this._config.colors.foreground}return this._config.allowTransparency&&(u=Le.opaque(u)),c&&(u=Le.multiplyOpacity(u,Yt)),u}_resolveBackgroundRgba(e,t,r){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return r?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,r,s){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return r?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,r,s,o,n,l,c,a,h){if(this._config.minimumContrastRatio===1||h)return;let d=this._getContrastCache(a),u=d.getColor(e,s);if(u!==void 0)return u||void 0;let _=this._resolveBackgroundRgba(t,r,l),p=this._resolveForegroundRgba(o,n,l,c),v=J.ensureContrastRatio(_,p,this._config.minimumContrastRatio/(a?2:1));if(!v){d.setColor(e,s,null);return}let M=G.toColor(v>>24&255,v>>16&255,v>>8&255);return d.setColor(e,s,M),M}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,r,s,o=!1){let n=typeof e=="number"?String.fromCharCode(e):e,l=Math.min(this._config.deviceCellWidth*Math.max(n.length,2)+Oe*2,this._textureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let c=Math.min(this._config.deviceCellHeight+Oe*4,this._textureSize);if(this._tmpCanvas.height<c&&(this._tmpCanvas.height=c),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=s,!!this._workAttributeData.isInvisible())return ii;let h=!!this._workAttributeData.isBold(),d=!!this._workAttributeData.isInverse(),u=!!this._workAttributeData.isDim(),_=!!this._workAttributeData.isItalic(),p=!!this._workAttributeData.isUnderline(),v=!!this._workAttributeData.isStrikethrough(),M=!!this._workAttributeData.isOverline(),E=this._workAttributeData.getFgColor(),f=this._workAttributeData.getFgColorMode(),D=this._workAttributeData.getBgColor(),ae=this._workAttributeData.getBgColorMode();if(d){let m=E;E=D,D=m;let L=f;f=ae,ae=L}let re=this._getBackgroundColor(ae,D,d,u);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=re.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let ue=h?this._config.fontWeightBold:this._config.fontWeight,we=_?"italic":"";this._tmpCtx.font=`${we} ${ue} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Ke;let ut=n.length===1&&Ue(n.charCodeAt(0)),ge=n.length===1&&Ut(n.charCodeAt(0)),Fe=this._getForegroundColor(t,ae,D,r,f,E,d,u,h,We(n.charCodeAt(0)));this._tmpCtx.fillStyle=Fe.css;let S=ge?0:Oe*2,Be=!1;this._config.customGlyphs!==!1&&(Be=Qt(this._tmpCtx,n,S,S,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let Ce=!ut,de;if(typeof e=="number"?de=this._unicodeService.wcwidth(e):de=this._unicodeService.getStringCellWidth(e),p){this._tmpCtx.save();let m=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),L=m%2===1?.5:0;if(this._tmpCtx.lineWidth=m,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Ce=!1,this._tmpCtx.strokeStyle=`rgb(${X.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Ce=!1;let q=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&q<8&&(q+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(q).css}this._tmpCtx.beginPath();let K=S,A=Math.ceil(S+this._config.deviceCharHeight)-L-(o?m*2:0),Te=A+m,Se=A+m*2,le=this._workAttributeData.getUnderlineVariantOffset();for(let q=0;q<de;q++){this._tmpCtx.save();let O=K+q*this._config.deviceCellWidth,W=K+(q+1)*this._config.deviceCellWidth,_t=O+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(O,A),this._tmpCtx.lineTo(W,A),this._tmpCtx.moveTo(O,Se),this._tmpCtx.lineTo(W,Se);break;case 3:let Ne=m<=1?Se:Math.ceil(S+this._config.deviceCharHeight-m/2)-L,ke=m<=1?A:Math.ceil(S+this._config.deviceCharHeight+m/2)-L,Dt=new Path2D;Dt.rect(O,A,this._config.deviceCellWidth,Se-A),this._tmpCtx.clip(Dt),this._tmpCtx.moveTo(O-this._config.deviceCellWidth/2,Te),this._tmpCtx.bezierCurveTo(O-this._config.deviceCellWidth/2,ke,O,ke,O,Te),this._tmpCtx.bezierCurveTo(O,Ne,_t,Ne,_t,Te),this._tmpCtx.bezierCurveTo(_t,ke,W,ke,W,Te),this._tmpCtx.bezierCurveTo(W,Ne,W+this._config.deviceCellWidth/2,Ne,W+this._config.deviceCellWidth/2,Te);break;case 4:let Ge=le===0?0:le>=m?m*2-le:m-le;!(le>=m)===!1||Ge===0?(this._tmpCtx.setLineDash([Math.round(m),Math.round(m)]),this._tmpCtx.moveTo(O+Ge,A),this._tmpCtx.lineTo(W,A)):(this._tmpCtx.setLineDash([Math.round(m),Math.round(m)]),this._tmpCtx.moveTo(O,A),this._tmpCtx.lineTo(O+Ge,A),this._tmpCtx.moveTo(O+Ge+m,A),this._tmpCtx.lineTo(W,A)),le=zt(W-O,m,le);break;case 5:let Li=.6,Ii=.3,mt=W-O,wt=Math.floor(Li*mt),Ft=Math.floor(Ii*mt),Ri=mt-wt-Ft;this._tmpCtx.setLineDash([wt,Ft,Ri]),this._tmpCtx.moveTo(O,A),this._tmpCtx.lineTo(W,A);break;case 1:default:this._tmpCtx.moveTo(O,A),this._tmpCtx.lineTo(W,A);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Be&&this._config.fontSize>=12&&!this._config.allowTransparency&&n!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let q=this._tmpCtx.measureText(n);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in q&&q.actualBoundingBoxDescent>0){this._tmpCtx.save();let O=new Path2D;O.rect(K,A-Math.ceil(m/2),this._config.deviceCellWidth*de,Se-A+Math.ceil(m/2)),this._tmpCtx.clip(O),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=re.css,this._tmpCtx.strokeText(n,S,S+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(M){let m=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),L=m%2===1?.5:0;this._tmpCtx.lineWidth=m,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(S,S+L),this._tmpCtx.lineTo(S+this._config.deviceCharWidth*de,S+L),this._tmpCtx.stroke()}if(Be||this._tmpCtx.fillText(n,S,S+this._config.deviceCharHeight),n==="_"&&!this._config.allowTransparency){let m=St(this._tmpCtx.getImageData(S,S,this._config.deviceCellWidth,this._config.deviceCellHeight),re,Fe,Ce);if(m)for(let L=1;L<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=re.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(n,S,S+this._config.deviceCharHeight-L),m=St(this._tmpCtx.getImageData(S,S,this._config.deviceCellWidth,this._config.deviceCellHeight),re,Fe,Ce),!!m);L++);}if(v){let m=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),L=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=m,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(S,S+Math.floor(this._config.deviceCharHeight/2)-L),this._tmpCtx.lineTo(S+this._config.deviceCharWidth*de,S+Math.floor(this._config.deviceCharHeight/2)-L),this._tmpCtx.stroke()}this._tmpCtx.restore();let Pe=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),dt;if(this._config.allowTransparency?dt=Wi(Pe):dt=St(Pe,re,Fe,Ce),dt)return ii;let C=this._findGlyphBoundingBox(Pe,this._workBoundingBox,l,ge,Be,S),b,g;for(;;){if(this._activePages.length===0){let m=this._createNewPage();b=m,g=m.currentRow,g.height=C.size.y;break}b=this._activePages[this._activePages.length-1],g=b.currentRow;for(let m of this._activePages)C.size.y<=m.currentRow.height&&(b=m,g=m.currentRow);for(let m=this._activePages.length-1;m>=0;m--)for(let L of this._activePages[m].fixedRows)L.height<=g.height&&C.size.y<=L.height&&(b=this._activePages[m],g=L);if(g.y+C.size.y>=b.canvas.height||g.height>C.size.y+2){let m=!1;if(b.currentRow.y+b.currentRow.height+C.size.y>=b.canvas.height){let L;for(let K of this._activePages)if(K.currentRow.y+K.currentRow.height+C.size.y<K.canvas.height){L=K;break}if(L)b=L;else if(i.maxAtlasPages&&this._pages.length>=i.maxAtlasPages&&g.y+C.size.y<=b.canvas.height&&g.height>=C.size.y&&g.x+C.size.x<=b.canvas.width)m=!0;else{let K=this._createNewPage();b=K,g=K.currentRow,g.height=C.size.y,m=!0}}m||(b.currentRow.height>0&&b.fixedRows.push(b.currentRow),g={x:0,y:b.currentRow.y+b.currentRow.height,height:C.size.y},b.fixedRows.push(g),b.currentRow={x:0,y:g.y+g.height,height:0})}if(g.x+C.size.x<=b.canvas.width)break;g===b.currentRow?(g.x=0,g.y+=g.height,g.height=0):b.fixedRows.splice(b.fixedRows.indexOf(g),1)}return C.texturePage=this._pages.indexOf(b),C.texturePosition.x=g.x,C.texturePosition.y=g.y,C.texturePositionClipSpace.x=g.x/b.canvas.width,C.texturePositionClipSpace.y=g.y/b.canvas.height,C.sizeClipSpace.x/=b.canvas.width,C.sizeClipSpace.y/=b.canvas.height,g.height=Math.max(g.height,C.size.y),g.x+=C.size.x,b.ctx.putImageData(Pe,C.texturePosition.x-this._workBoundingBox.left,C.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,C.size.x,C.size.y),b.addGlyph(C),b.version++,C}_findGlyphBoundingBox(e,t,r,s,o,n){t.top=0;let l=s?this._config.deviceCellHeight:this._tmpCanvas.height,c=s?this._config.deviceCellWidth:r,a=!1;for(let h=0;h<l;h++){for(let d=0;d<c;d++){let u=h*this._tmpCanvas.width*4+d*4+3;if(e.data[u]!==0){t.top=h,a=!0;break}}if(a)break}t.left=0,a=!1;for(let h=0;h<n+c;h++){for(let d=0;d<l;d++){let u=d*this._tmpCanvas.width*4+h*4+3;if(e.data[u]!==0){t.left=h,a=!0;break}}if(a)break}t.right=c,a=!1;for(let h=n+c-1;h>=n;h--){for(let d=0;d<l;d++){let u=d*this._tmpCanvas.width*4+h*4+3;if(e.data[u]!==0){t.right=h,a=!0;break}}if(a)break}t.bottom=l,a=!1;for(let h=l-1;h>=0;h--){for(let d=0;d<c;d++){let u=h*this._tmpCanvas.width*4+d*4+3;if(e.data[u]!==0){t.bottom=h,a=!0;break}}if(a)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+n+(s||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+n+(s||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Ye=class{constructor(e,t,r){this._usedPixels=0;this._glyphs=[];this.version=0;this.currentRow={x:0,y:0,height:0};this.fixedRows=[];if(r)for(let s of r)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=ri(e,t,t),this.ctx=T(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function St(i,e,t,r){let s=e.rgba>>>24,o=e.rgba>>>16&255,n=e.rgba>>>8&255,l=t.rgba>>>24,c=t.rgba>>>16&255,a=t.rgba>>>8&255,h=Math.floor((Math.abs(s-l)+Math.abs(o-c)+Math.abs(n-a))/12),d=!0;for(let u=0;u<i.data.length;u+=4)i.data[u]===s&&i.data[u+1]===o&&i.data[u+2]===n||r&&Math.abs(i.data[u]-s)+Math.abs(i.data[u+1]-o)+Math.abs(i.data[u+2]-n)<h?i.data[u+3]=0:d=!1;return d}function Wi(i){for(let e=0;e<i.data.length;e+=4)if(i.data[e+3]>0)return!1;return!0}function ri(i,e,t){let r=i.createElement("canvas");return r.width=e,r.height=t,r}function ni(i,e,t,r,s,o,n){let l={foreground:o.foreground,background:o.background,cursor:j,cursorAccent:j,selectionForeground:j,selectionBackgroundTransparent:j,selectionBackgroundOpaque:j,selectionInactiveBackgroundTransparent:j,selectionInactiveBackgroundOpaque:j,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:n,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:i,deviceCellHeight:e,deviceCharWidth:t,deviceCharHeight:r,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:l}}function xt(i,e){for(let t=0;t<i.colors.ansi.length;t++)if(i.colors.ansi[t].rgba!==e.colors.ansi[t].rgba)return!1;return i.devicePixelRatio===e.devicePixelRatio&&i.customGlyphs===e.customGlyphs&&i.lineHeight===e.lineHeight&&i.letterSpacing===e.letterSpacing&&i.fontFamily===e.fontFamily&&i.fontSize===e.fontSize&&i.fontWeight===e.fontWeight&&i.fontWeightBold===e.fontWeightBold&&i.allowTransparency===e.allowTransparency&&i.deviceCharWidth===e.deviceCharWidth&&i.deviceCharHeight===e.deviceCharHeight&&i.drawBoldTextInBrightColors===e.drawBoldTextInBrightColors&&i.minimumContrastRatio===e.minimumContrastRatio&&i.colors.foreground.rgba===e.colors.foreground.rgba&&i.colors.background.rgba===e.colors.background.rgba}function si(i){return(i&50331648)===16777216||(i&50331648)===33554432}var z=[];function je(i,e,t,r,s,o,n,l){let c=ni(r,s,o,n,e,t,l);for(let d=0;d<z.length;d++){let u=z[d],_=u.ownedBy.indexOf(i);if(_>=0){if(xt(u.config,c))return u.atlas;u.ownedBy.length===1?(u.atlas.dispose(),z.splice(d,1)):u.ownedBy.splice(_,1);break}}for(let d=0;d<z.length;d++){let u=z[d];if(xt(u.config,c))return u.ownedBy.push(i),u.atlas}let a=i._core,h={atlas:new V(document,c,a.unicodeService),config:c,ownedBy:[i]};return z.push(h),h.atlas}function Lt(i){for(let e=0;e<z.length;e++){let t=z[e].ownedBy.indexOf(i);if(t!==-1){z[e].ownedBy.length===1?(z[e].atlas.dispose(),z.splice(e,1)):z[e].ownedBy.splice(t,1);break}}}var Ze=600,Qe=class{constructor(e,t){this._renderCallback=e;this._coreBrowserService=t;this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=Ze){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Ze-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=Ze-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Ze)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function It(i,e,t){let r=new e.ResizeObserver(s=>{let o=s.find(c=>c.target===i);if(!o)return;if(!("devicePixelContentBoxSize"in o)){r?.disconnect(),r=void 0;return}let n=o.devicePixelContentBoxSize[0].inlineSize,l=o.devicePixelContentBoxSize[0].blockSize;n>0&&l>0&&t(n,l)});try{r.observe(i,{box:["device-pixel-content-box"]})}catch{r.disconnect(),r=void 0}return y(()=>r?.disconnect())}function oi(i){return i>65535?(i-=65536,String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):String.fromCharCode(i)}var ye=class i extends X{constructor(){super(...arguments);this.content=0;this.fg=0;this.bg=0;this.extended=new Ee;this.combinedData=""}static fromCharData(t){let r=new i;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?oi(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(s-55296)*1024+o-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};var et=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function tt(i,e,t){let r=T(i.createProgram());if(i.attachShader(r,T(ai(i,i.VERTEX_SHADER,e))),i.attachShader(r,T(ai(i,i.FRAGMENT_SHADER,t))),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS))return r;console.error(i.getProgramInfoLog(r)),i.deleteProgram(r)}function ai(i,e,t){let r=T(i.createShader(e));if(i.shaderSource(r,t),i.compileShader(r),i.getShaderParameter(r,i.COMPILE_STATUS))return r;console.error(i.getShaderInfoLog(r)),i.deleteShader(r)}function li(i,e){let t=Math.min(i.length*2,e),r=new Float32Array(t);for(let s=0;s<i.length;s++)r[s]=i[s];return r}var Je=class{constructor(e){this.texture=e,this.version=-1}};var Ki=`#version 300 es
17
+ var Mi=Object.defineProperty;var Ei=Object.getOwnPropertyDescriptor;var Bt=(i,e,t,r)=>{for(var s=r>1?void 0:r?Ei(e,t):e,o=i.length-1,n;o>=0;o--)(n=i[o])&&(s=(r?n(e,t,s):n(s))||s);return r&&s&&Mi(e,t,s),s},Pt=(i,e)=>(t,r)=>e(t,r,i);var k=class{constructor(){this._listeners=new Set;this._disposed=!1}get event(){return this._event||(this._event=e=>(this._listeners.add(e),{dispose:()=>{this._disposed||this._listeners.delete(e)}})),this._event}fire(e,t){let r=[];for(let s of this._listeners.values())r.push(s);for(let s=0;s<r.length;s++)r[s].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&this._listeners.clear()}};function ne(i,e){return i(t=>e.fire(t))}var H=class{constructor(){this._disposables=[];this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1)}},se=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}};function y(i){return{dispose:i}}function Oi(i){for(let e of i)e.dispose();i.length=0}function Nt(i){return{dispose:()=>Oi(i)}}var $e=typeof process<"u"&&"title"in process,xe=$e?"node":navigator.userAgent,pt=$e?"node":navigator.platform,kt=xe.includes("Firefox"),Gt=xe.includes("Edge"),vt=/^((?!chrome|android).)*safari/i.test(xe);function $t(){if(!vt)return 0;let i=xe.match(/Version\/(\d+)/);return i===null||i.length<2?0:parseInt(i[1])}var sr=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(pt);var or=["Windows","Win16","Win32","WinCE"].includes(pt),ar=pt.indexOf("Linux")>=0,lr=/\bCrOS\b/.test(xe);function ft(i,e,t,r){i.addEventListener(e,t,r);let s=!1;return{dispose:()=>{s||(s=!0,i.removeEventListener(e,t,r))}}}var Ht="";var w=0,F=0,B=0,I=0,U={css:"#00000000",rgba:0},G;(r=>{function i(s,o,n,l){return l!==void 0?`#${ce(s)}${ce(o)}${ce(n)}${ce(l)}`:`#${ce(s)}${ce(o)}${ce(n)}`}r.toCss=i;function e(s,o,n,l=255){return(s<<24|o<<16|n<<8|l)>>>0}r.toRgba=e;function t(s,o,n,l){return{css:r.toCss(s,o,n,l),rgba:r.toRgba(s,o,n,l)}}r.toColor=t})(G||={});var Le;(l=>{function i(c,a){if(I=(a.rgba&255)/255,I===1)return{css:a.css,rgba:a.rgba};let h=a.rgba>>24&255,d=a.rgba>>16&255,u=a.rgba>>8&255,_=c.rgba>>24&255,p=c.rgba>>16&255,v=c.rgba>>8&255;w=_+Math.round((h-_)*I),F=p+Math.round((d-p)*I),B=v+Math.round((u-v)*I);let M=G.toCss(w,F,B),E=G.toRgba(w,F,B);return{css:M,rgba:E}}l.blend=i;function e(c){return(c.rgba&255)===255}l.isOpaque=e;function t(c,a,h){let d=J.ensureContrastRatio(c.rgba,a.rgba,h);if(d)return G.toColor(d>>24&255,d>>16&255,d>>8&255)}l.ensureContrastRatio=t;function r(c){let a=(c.rgba|255)>>>0;return[w,F,B]=J.toChannels(a),{css:G.toCss(w,F,B),rgba:a}}l.opaque=r;function s(c,a){return I=Math.round(a*255),[w,F,B]=J.toChannels(c.rgba),{css:G.toCss(w,F,B,I),rgba:G.toRgba(w,F,B,I)}}l.opacity=s;function o(c,a){return I=c.rgba&255,s(c,I*a/255)}l.multiplyOpacity=o;function n(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}l.toColorRGB=n})(Le||={});var Ai;(r=>{let i,e;try{let s=document.createElement("canvas");s.width=1,s.height=1;let o=s.getContext("2d",{willReadFrequently:!0});o&&(i=o,i.globalCompositeOperation="copy",e=i.createLinearGradient(0,0,1,1))}catch{}function t(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return w=parseInt(s.slice(1,2).repeat(2),16),F=parseInt(s.slice(2,3).repeat(2),16),B=parseInt(s.slice(3,4).repeat(2),16),G.toColor(w,F,B);case 5:return w=parseInt(s.slice(1,2).repeat(2),16),F=parseInt(s.slice(2,3).repeat(2),16),B=parseInt(s.slice(3,4).repeat(2),16),I=parseInt(s.slice(4,5).repeat(2),16),G.toColor(w,F,B,I);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let o=s.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(o)return w=parseInt(o[1]),F=parseInt(o[2]),B=parseInt(o[3]),I=Math.round((o[5]===void 0?1:parseFloat(o[5]))*255),G.toColor(w,F,B,I);if(!i||!e)throw new Error("css.toColor: Unsupported css format");if(i.fillStyle=e,i.fillStyle=s,typeof i.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(i.fillRect(0,0,1,1),[w,F,B,I]=i.getImageData(0,0,1,1).data,I!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:G.toRgba(w,F,B,I),css:s}}r.toColor=t})(Ai||={});var $;(t=>{function i(r){return e(r>>16&255,r>>8&255,r&255)}t.relativeLuminance=i;function e(r,s,o){let n=r/255,l=s/255,c=o/255,a=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),h=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),d=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return a*.2126+h*.7152+d*.0722}t.relativeLuminance2=e})($||={});var J;(o=>{function i(n,l){if(I=(l&255)/255,I===1)return l;let c=l>>24&255,a=l>>16&255,h=l>>8&255,d=n>>24&255,u=n>>16&255,_=n>>8&255;return w=d+Math.round((c-d)*I),F=u+Math.round((a-u)*I),B=_+Math.round((h-_)*I),G.toRgba(w,F,B)}o.blend=i;function e(n,l,c){let a=$.relativeLuminance(n>>8),h=$.relativeLuminance(l>>8);if(Q(a,h)<c){if(h<a){let p=t(n,l,c),v=Q(a,$.relativeLuminance(p>>8));if(v<c){let M=r(n,l,c),E=Q(a,$.relativeLuminance(M>>8));return v>E?p:M}return p}let u=r(n,l,c),_=Q(a,$.relativeLuminance(u>>8));if(_<c){let p=t(n,l,c),v=Q(a,$.relativeLuminance(p>>8));return _>v?u:p}return u}}o.ensureContrastRatio=e;function t(n,l,c){let a=n>>24&255,h=n>>16&255,d=n>>8&255,u=l>>24&255,_=l>>16&255,p=l>>8&255,v=Q($.relativeLuminance2(u,_,p),$.relativeLuminance2(a,h,d));for(;v<c&&(u>0||_>0||p>0);)u-=Math.max(0,Math.ceil(u*.1)),_-=Math.max(0,Math.ceil(_*.1)),p-=Math.max(0,Math.ceil(p*.1)),v=Q($.relativeLuminance2(u,_,p),$.relativeLuminance2(a,h,d));return(u<<24|_<<16|p<<8|255)>>>0}o.reduceLuminance=t;function r(n,l,c){let a=n>>24&255,h=n>>16&255,d=n>>8&255,u=l>>24&255,_=l>>16&255,p=l>>8&255,v=Q($.relativeLuminance2(u,_,p),$.relativeLuminance2(a,h,d));for(;v<c&&(u<255||_<255||p<255);)u=Math.min(255,u+Math.ceil((255-u)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),p=Math.min(255,p+Math.ceil((255-p)*.1)),v=Q($.relativeLuminance2(u,_,p),$.relativeLuminance2(a,h,d));return(u<<24|_<<16|p<<8|255)>>>0}o.increaseLuminance=r;function s(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]}o.toChannels=s})(J||={});function ce(i){let e=i.toString(16);return e.length<2?"0"+e:e}function Q(i,e){return i<e?(e+.05)/(i+.05):(i+.05)/(e+.05)}function T(i){if(!i)throw new Error("value must not be falsy");return i}function Ue(i){return 57508<=i&&i<=57558}function Ut(i){return 57520<=i&&i<=57527}function yi(i){return 57344<=i&&i<=63743}function Di(i){return 9472<=i&&i<=9631}function wi(i){return i>=128512&&i<=128591||i>=127744&&i<=128511||i>=128640&&i<=128767||i>=9728&&i<=9983||i>=9984&&i<=10175||i>=65024&&i<=65039||i>=129280&&i<=129535||i>=127462&&i<=127487}function Wt(i,e,t,r){return e===1&&t>Math.ceil(r*1.5)&&i!==void 0&&i>255&&!wi(i)&&!Ue(i)&&!yi(i)}function We(i){return Ue(i)||Di(i)}function Vt(){return{css:{canvas:He(),cell:He()},device:{canvas:He(),cell:He(),char:{width:0,height:0,left:0,top:0}}}}function He(){return{width:0,height:0}}function zt(i,e,t=0){return(i-(Math.round(e)*2-t))%(Math.round(e)*2)}var N=0,P=0,Z=!1,ee=!1,Ve=!1,W,bt=0,ze=class{constructor(e,t,r,s,o,n){this._terminal=e;this._optionService=t;this._selectionRenderModel=r;this._decorationService=s;this._coreBrowserService=o;this._themeService=n;this.result={fg:0,bg:0,ext:0}}resolve(e,t,r,s){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,P=0,N=0,ee=!1,Z=!1,Ve=!1,W=this._themeService.colors,bt=0,e.getCode()!==0&&e.extended.underlineStyle===4){let n=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));bt=t*s%(Math.round(n)*2)}if(this._decorationService.forEachDecorationAtCell(t,r,"bottom",n=>{n.backgroundColorRGB&&(P=n.backgroundColorRGB.rgba>>8&16777215,ee=!0),n.foregroundColorRGB&&(N=n.foregroundColorRGB.rgba>>8&16777215,Z=!0)}),Ve=this._selectionRenderModel.isCellSelected(this._terminal,t,r),Ve){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:P=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:P=(this.result.fg&16777215)<<8|255;break;case 0:default:P=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:P=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:P=(this.result.bg&16777215)<<8|255;break}P=J.blend(P,(this._coreBrowserService.isFocused?W.selectionBackgroundOpaque:W.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else P=(this._coreBrowserService.isFocused?W.selectionBackgroundOpaque:W.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(ee=!0,W.selectionForeground&&(N=W.selectionForeground.rgba>>8&16777215,Z=!0),We(e.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)N=(this._coreBrowserService.isFocused?W.selectionBackgroundOpaque:W.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:N=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:N=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:N=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:N=(this.result.fg&16777215)<<8|255;break;case 0:default:N=this._themeService.colors.foreground.rgba}N=J.blend(N,(this._coreBrowserService.isFocused?W.selectionBackgroundOpaque:W.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Z=!0}}this._decorationService.forEachDecorationAtCell(t,r,"top",n=>{n.backgroundColorRGB&&(P=n.backgroundColorRGB.rgba>>8&16777215,ee=!0),n.foregroundColorRGB&&(N=n.foregroundColorRGB.rgba>>8&16777215,Z=!0)}),ee&&(Ve?P=e.bg&-16777216&-134217729|P|50331648:P=e.bg&-16777216|P|50331648),Z&&(N=e.fg&-16777216&-67108865|N|50331648),this.result.fg&67108864&&(ee&&!Z&&((this.result.bg&50331648)===0?N=this.result.fg&-134217728|W.background.rgba>>8&16777215&16777215|50331648:N=this.result.fg&-134217728|this.result.bg&67108863,Z=!0),!ee&&Z&&((this.result.fg&50331648)===0?P=this.result.bg&-67108864|W.foreground.rgba>>8&16777215&16777215|50331648:P=this.result.bg&-67108864|this.result.fg&67108863,ee=!0)),W=void 0,this.result.bg=ee?P:this.result.bg,this.result.fg=Z?N:this.result.fg,this.result.ext&=536870911,this.result.ext|=bt<<29&3758096384}};var Xt=257,Yt=.5,Ke=kt||Gt?"bottom":"ideographic";var Pi={"\u2580":[{x:0,y:0,w:8,h:4}],"\u2581":[{x:0,y:7,w:8,h:1}],"\u2582":[{x:0,y:6,w:8,h:2}],"\u2583":[{x:0,y:5,w:8,h:3}],"\u2584":[{x:0,y:4,w:8,h:4}],"\u2585":[{x:0,y:3,w:8,h:5}],"\u2586":[{x:0,y:2,w:8,h:6}],"\u2587":[{x:0,y:1,w:8,h:7}],"\u2588":[{x:0,y:0,w:8,h:8}],"\u2589":[{x:0,y:0,w:7,h:8}],"\u258A":[{x:0,y:0,w:6,h:8}],"\u258B":[{x:0,y:0,w:5,h:8}],"\u258C":[{x:0,y:0,w:4,h:8}],"\u258D":[{x:0,y:0,w:3,h:8}],"\u258E":[{x:0,y:0,w:2,h:8}],"\u258F":[{x:0,y:0,w:1,h:8}],"\u2590":[{x:4,y:0,w:4,h:8}],"\u2594":[{x:0,y:0,w:8,h:1}],"\u2595":[{x:7,y:0,w:1,h:8}],"\u2596":[{x:0,y:4,w:4,h:4}],"\u2597":[{x:4,y:4,w:4,h:4}],"\u2598":[{x:0,y:0,w:4,h:4}],"\u2599":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u259A":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"\u259B":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"\u259C":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"\u259D":[{x:4,y:0,w:4,h:4}],"\u259E":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"\u259F":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u{1FB70}":[{x:1,y:0,w:1,h:8}],"\u{1FB71}":[{x:2,y:0,w:1,h:8}],"\u{1FB72}":[{x:3,y:0,w:1,h:8}],"\u{1FB73}":[{x:4,y:0,w:1,h:8}],"\u{1FB74}":[{x:5,y:0,w:1,h:8}],"\u{1FB75}":[{x:6,y:0,w:1,h:8}],"\u{1FB76}":[{x:0,y:1,w:8,h:1}],"\u{1FB77}":[{x:0,y:2,w:8,h:1}],"\u{1FB78}":[{x:0,y:3,w:8,h:1}],"\u{1FB79}":[{x:0,y:4,w:8,h:1}],"\u{1FB7A}":[{x:0,y:5,w:8,h:1}],"\u{1FB7B}":[{x:0,y:6,w:8,h:1}],"\u{1FB7C}":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB7D}":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7E}":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7F}":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB80}":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB81}":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB82}":[{x:0,y:0,w:8,h:2}],"\u{1FB83}":[{x:0,y:0,w:8,h:3}],"\u{1FB84}":[{x:0,y:0,w:8,h:5}],"\u{1FB85}":[{x:0,y:0,w:8,h:6}],"\u{1FB86}":[{x:0,y:0,w:8,h:7}],"\u{1FB87}":[{x:6,y:0,w:2,h:8}],"\u{1FB88}":[{x:5,y:0,w:3,h:8}],"\u{1FB89}":[{x:3,y:0,w:5,h:8}],"\u{1FB8A}":[{x:2,y:0,w:6,h:8}],"\u{1FB8B}":[{x:1,y:0,w:7,h:8}],"\u{1FB95}":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"\u{1FB96}":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"\u{1FB97}":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Ni={"\u2591":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"\u2592":[[1,0],[0,0],[0,1],[0,0]],"\u2593":[[0,1],[1,1],[1,0],[1,1]]};var ki={"\u2500":{1:"M0,.5 L1,.5"},"\u2501":{3:"M0,.5 L1,.5"},"\u2502":{1:"M.5,0 L.5,1"},"\u2503":{3:"M.5,0 L.5,1"},"\u250C":{1:"M0.5,1 L.5,.5 L1,.5"},"\u250F":{3:"M0.5,1 L.5,.5 L1,.5"},"\u2510":{1:"M0,.5 L.5,.5 L.5,1"},"\u2513":{3:"M0,.5 L.5,.5 L.5,1"},"\u2514":{1:"M.5,0 L.5,.5 L1,.5"},"\u2517":{3:"M.5,0 L.5,.5 L1,.5"},"\u2518":{1:"M.5,0 L.5,.5 L0,.5"},"\u251B":{3:"M.5,0 L.5,.5 L0,.5"},"\u251C":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2523":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2524":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252B":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252C":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2533":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2534":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253B":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253C":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u254B":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u2574":{1:"M.5,.5 L0,.5"},"\u2578":{3:"M.5,.5 L0,.5"},"\u2575":{1:"M.5,.5 L.5,0"},"\u2579":{3:"M.5,.5 L.5,0"},"\u2576":{1:"M.5,.5 L1,.5"},"\u257A":{3:"M.5,.5 L1,.5"},"\u2577":{1:"M.5,.5 L.5,1"},"\u257B":{3:"M.5,.5 L.5,1"},"\u2550":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"\u2551":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"\u2552":{1:(i,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"\u2553":{1:(i,e)=>`M${.5-i},1 L${.5-i},.5 L1,.5 M${.5+i},.5 L${.5+i},1`},"\u2554":{1:(i,e)=>`M1,${.5-e} L${.5-i},${.5-e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"\u2555":{1:(i,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"\u2556":{1:(i,e)=>`M${.5+i},1 L${.5+i},.5 L0,.5 M${.5-i},.5 L${.5-i},1`},"\u2557":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5+i},${.5-e} L${.5+i},1`},"\u2558":{1:(i,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"\u2559":{1:(i,e)=>`M1,.5 L${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"\u255A":{1:(i,e)=>`M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0 M1,${.5+e} L${.5-i},${.5+e} L${.5-i},0`},"\u255B":{1:(i,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"\u255C":{1:(i,e)=>`M0,.5 L${.5+i},.5 L${.5+i},0 M${.5-i},.5 L${.5-i},0`},"\u255D":{1:(i,e)=>`M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M0,${.5+e} L${.5+i},${.5+e} L${.5+i},0`},"\u255E":{1:(i,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"\u255F":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1 M${.5+i},.5 L1,.5`},"\u2560":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"\u2561":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"\u2562":{1:(i,e)=>`M0,.5 L${.5-i},.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"\u2563":{1:(i,e)=>`M${.5+i},0 L${.5+i},1 M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0`},"\u2564":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"\u2565":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},1 M${.5+i},.5 L${.5+i},1`},"\u2566":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"\u2567":{1:(i,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"\u2568":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"\u2569":{1:(i,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"\u256A":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"\u256B":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"\u256C":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"\u2571":{1:"M1,0 L0,1"},"\u2572":{1:"M0,0 L1,1"},"\u2573":{1:"M1,0 L0,1 M0,0 L1,1"},"\u257C":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u257D":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"\u257E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u257F":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u250D":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u250E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2511":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"\u2512":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2515":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"\u2516":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2519":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"\u251A":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"\u251D":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"\u251E":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u251F":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2520":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2521":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2522":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"\u2525":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"\u2526":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2527":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2528":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"\u2529":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"\u252A":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"\u252D":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u252E":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u252F":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"\u2530":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2531":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2532":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2535":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u2536":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u2537":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"\u2538":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2539":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u253A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"\u253D":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u253E":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u253F":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"\u2540":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2541":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2542":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2543":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u2544":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2545":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2546":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2547":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"\u2548":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2549":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u254A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u254C":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u254D":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u2504":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2505":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2508":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u2509":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u254E":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u254F":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u2506":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u2507":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u250A":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u250B":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u256D":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"\u256E":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"\u256F":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"\u2570":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}};var Re={"\uE0A0":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"\uE0A1":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"\uE0A2":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"\uE0B0":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"\uE0B1":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B2":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"\uE0B3":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B4":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"\uE0B5":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"\uE0B6":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"\uE0B7":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"\uE0B8":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"\uE0B9":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BA":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"\uE0BC":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"\uE0BD":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0BE":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Re["\uE0BB"]=Re["\uE0BD"];Re["\uE0BF"]=Re["\uE0B9"];function Qt(i,e,t,r,s,o,n,l){let c=Pi[e];if(c)return Gi(i,c,t,r,s,o),!0;let a=Ni[e];if(a)return $i(i,a,t,r,s,o),!0;let h=ki[e];if(h)return Hi(i,h,t,r,s,o,l),!0;let d=Re[e];return d?(Ui(i,d,t,r,s,o,n,l),!0):!1}function Gi(i,e,t,r,s,o){for(let n=0;n<e.length;n++){let l=e[n],c=s/8,a=o/8;i.fillRect(t+l.x*c,r+l.y*a,l.w*c,l.h*a)}}var jt=new Map;function $i(i,e,t,r,s,o){let n=jt.get(e);n||(n=new Map,jt.set(e,n));let l=i.fillStyle;if(typeof l!="string")throw new Error(`Unexpected fillStyle type "${l}"`);let c=n.get(l);if(!c){let a=e[0].length,h=e.length,d=i.canvas.ownerDocument.createElement("canvas");d.width=a,d.height=h;let u=T(d.getContext("2d")),_=new ImageData(a,h),p,v,M,E;if(l.startsWith("#"))p=parseInt(l.slice(1,3),16),v=parseInt(l.slice(3,5),16),M=parseInt(l.slice(5,7),16),E=l.length>7&&parseInt(l.slice(7,9),16)||1;else if(l.startsWith("rgba"))[p,v,M,E]=l.substring(5,l.length-1).split(",").map(f=>parseFloat(f));else throw new Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);for(let f=0;f<h;f++)for(let D=0;D<a;D++)_.data[(f*a+D)*4]=p,_.data[(f*a+D)*4+1]=v,_.data[(f*a+D)*4+2]=M,_.data[(f*a+D)*4+3]=e[f][D]*(E*255);u.putImageData(_,0,0),c=T(i.createPattern(d,null)),n.set(l,c)}i.fillStyle=c,i.fillRect(t,r,s,o)}function Hi(i,e,t,r,s,o,n){i.strokeStyle=i.fillStyle;for(let[l,c]of Object.entries(e)){i.beginPath(),i.lineWidth=n*Number.parseInt(l);let a;if(typeof c=="function"){let d=.15/o*s;a=c(.15,d)}else a=c;for(let h of a.split(" ")){let d=h[0],u=Jt[d];if(!u){console.error(`Could not find drawing instructions for "${d}"`);continue}let _=h.substring(1).split(",");!_[0]||!_[1]||u(i,ei(_,s,o,t,r,!0,n))}i.stroke(),i.closePath()}}function Ui(i,e,t,r,s,o,n,l){let c=new Path2D;c.rect(t,r,s,o),i.clip(c),i.beginPath();let a=n/12;i.lineWidth=l*a;for(let h of e.d.split(" ")){let d=h[0],u=Jt[d];if(!u){console.error(`Could not find drawing instructions for "${d}"`);continue}let _=h.substring(1).split(",");!_[0]||!_[1]||u(i,ei(_,s,o,t,r,!1,l,(e.leftPadding??0)*(a/2),(e.rightPadding??0)*(a/2)))}e.type===1?(i.strokeStyle=i.fillStyle,i.stroke()):i.fill(),i.closePath()}function Zt(i,e,t=0){return Math.max(Math.min(i,e),t)}var Jt={C:(i,e)=>i.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(i,e)=>i.lineTo(e[0],e[1]),M:(i,e)=>i.moveTo(e[0],e[1])};function ei(i,e,t,r,s,o,n,l=0,c=0){let a=i.map(h=>parseFloat(h)||parseInt(h));if(a.length<2)throw new Error("Too few arguments for instruction");for(let h=0;h<a.length;h+=2)a[h]*=e-l*n-c*n,o&&a[h]!==0&&(a[h]=Zt(Math.round(a[h]+.5)-.5,e,0)),a[h]+=r+l*n;for(let h=1;h<a.length;h+=2)a[h]*=t,o&&a[h]!==0&&(a[h]=Zt(Math.round(a[h]+.5)-.5,t,0)),a[h]+=s;return a}var qe=class{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Me=class{constructor(){this._data=new qe}set(e,t,r,s,o){this._data.get(e,t)||this._data.set(e,t,new qe),this._data.get(e,t).set(r,s,o)}get(e,t,r,s){return this._data.get(e,t)?.get(r,s)}clear(){this._data.clear()}};var Xe=class{constructor(){this._tasks=[];this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,r=0,s=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),r=Math.max(t,r),o=e.timeRemaining(),r*1.5>o){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=o}this.clear()}},gt=class extends Xe{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}},Ct=class extends Xe{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ti=!$e&&"requestIdleCallback"in window?Ct:gt;var Y=class i{constructor(){this.fg=0;this.bg=0;this.extended=new Ee}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 e=new i;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},Ee=class i{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 i(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}};var ii={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},Oe=2;var Ae,z=class i{constructor(e,t,r){this._document=e;this._config=t;this._unicodeService=r;this._didWarmUp=!1;this._cacheMap=new Me;this._cacheMapCombined=new Me;this._pages=[];this._activePages=[];this._workBoundingBox={top:0,left:0,bottom:0,right:0};this._workAttributeData=new Y;this._textureSize=512;this._onAddTextureAtlasCanvas=new k;this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=new k;this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._requestClearModel=!1;this._createNewPage(),this._tmpCanvas=ri(e,this._config.deviceCellWidth*4+Oe*2,this._config.deviceCellHeight+Oe*2),this._tmpCtx=T(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new ti;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let r=this._drawToCache(t,0,0,0);this._cacheMap.set(t,0,0,0,r)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(i.maxAtlasPages&&this._pages.length>=Math.max(4,i.maxAtlasPages)){let t=this._pages.filter(a=>a.canvas.width*2<=(i.maxTextureSize||4096)).sort((a,h)=>h.canvas.width!==a.canvas.width?h.canvas.width-a.canvas.width:h.percentageUsed-a.percentageUsed),r=-1,s=0;for(let a=0;a<t.length;a++)if(t[a].canvas.width!==s)r=a,s=t[a].canvas.width;else if(a-r===3)break;let o=t.slice(r,r+4),n=o.map(a=>a.glyphs[0].texturePage).sort((a,h)=>a>h?1:-1),l=this.pages.length-o.length,c=this._mergePages(o,l);c.version++;for(let a=n.length-1;a>=0;a--)this._deletePage(n[a]);this.pages.push(c),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(c.canvas)}let e=new Ye(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let r=e[0].canvas.width*2,s=new Ye(this._document,r,e);for(let[o,n]of e.entries()){let l=o*n.canvas.width%r,c=Math.floor(o/2)*n.canvas.height;s.ctx.drawImage(n.canvas,l,c);for(let h of n.glyphs)h.texturePage=t,h.sizeClipSpace.x=h.size.x/r,h.sizeClipSpace.y=h.size.y/r,h.texturePosition.x+=l,h.texturePosition.y+=c,h.texturePositionClipSpace.x=h.texturePosition.x/r,h.texturePositionClipSpace.y=h.texturePosition.y/r;this._onRemoveTextureAtlasCanvas.fire(n.canvas);let a=this._activePages.indexOf(n);a!==-1&&this._activePages.splice(a,1)}return s}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let r=this._pages[t];for(let s of r.glyphs)s.texturePage--;r.version++}}getRasterizedGlyphCombinedChar(e,t,r,s,o){return this._getFromCacheMap(this._cacheMapCombined,e,t,r,s,o)}getRasterizedGlyph(e,t,r,s,o){return this._getFromCacheMap(this._cacheMap,e,t,r,s,o)}_getFromCacheMap(e,t,r,s,o,n=!1){return Ae=e.get(t,r,s,o),Ae||(Ae=this._drawToCache(t,r,s,o,n),e.set(t,r,s,o,Ae)),Ae}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,r,s){if(this._config.allowTransparency)return U;let o;switch(e){case 16777216:case 33554432:o=this._getColorFromAnsiIndex(t);break;case 50331648:let n=Y.toColorRGB(t);o=G.toColor(n[0],n[1],n[2]);break;case 0:default:r?o=Le.opaque(this._config.colors.foreground):o=this._config.colors.background;break}return o}_getForegroundColor(e,t,r,s,o,n,l,c,a,h){let d=this._getMinimumContrastColor(e,t,r,s,o,n,l,a,c,h);if(d)return d;let u;switch(o){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&a&&n<8&&(n+=8),u=this._getColorFromAnsiIndex(n);break;case 50331648:let _=Y.toColorRGB(n);u=G.toColor(_[0],_[1],_[2]);break;case 0:default:l?u=this._config.colors.background:u=this._config.colors.foreground}return this._config.allowTransparency&&(u=Le.opaque(u)),c&&(u=Le.multiplyOpacity(u,Yt)),u}_resolveBackgroundRgba(e,t,r){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return r?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,r,s){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&s&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return r?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,r,s,o,n,l,c,a,h){if(this._config.minimumContrastRatio===1||h)return;let d=this._getContrastCache(a),u=d.getColor(e,s);if(u!==void 0)return u||void 0;let _=this._resolveBackgroundRgba(t,r,l),p=this._resolveForegroundRgba(o,n,l,c),v=J.ensureContrastRatio(_,p,this._config.minimumContrastRatio/(a?2:1));if(!v){d.setColor(e,s,null);return}let M=G.toColor(v>>24&255,v>>16&255,v>>8&255);return d.setColor(e,s,M),M}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,r,s,o=!1){let n=typeof e=="number"?String.fromCharCode(e):e,l=Math.min(this._config.deviceCellWidth*Math.max(n.length,2)+Oe*2,this._textureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let c=Math.min(this._config.deviceCellHeight+Oe*4,this._textureSize);if(this._tmpCanvas.height<c&&(this._tmpCanvas.height=c),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=s,!!this._workAttributeData.isInvisible())return ii;let h=!!this._workAttributeData.isBold(),d=!!this._workAttributeData.isInverse(),u=!!this._workAttributeData.isDim(),_=!!this._workAttributeData.isItalic(),p=!!this._workAttributeData.isUnderline(),v=!!this._workAttributeData.isStrikethrough(),M=!!this._workAttributeData.isOverline(),E=this._workAttributeData.getFgColor(),f=this._workAttributeData.getFgColorMode(),D=this._workAttributeData.getBgColor(),ae=this._workAttributeData.getBgColorMode();if(d){let m=E;E=D,D=m;let L=f;f=ae,ae=L}let re=this._getBackgroundColor(ae,D,d,u);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=re.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let ue=h?this._config.fontWeightBold:this._config.fontWeight,we=_?"italic":"";this._tmpCtx.font=`${we} ${ue} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=Ke;let ut=n.length===1&&Ue(n.charCodeAt(0)),ge=n.length===1&&Ut(n.charCodeAt(0)),Fe=this._getForegroundColor(t,ae,D,r,f,E,d,u,h,We(n.charCodeAt(0)));this._tmpCtx.fillStyle=Fe.css;let S=ge?0:Oe*2,Be=!1;this._config.customGlyphs!==!1&&(Be=Qt(this._tmpCtx,n,S,S,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let Ce=!ut,de;if(typeof e=="number"?de=this._unicodeService.wcwidth(e):de=this._unicodeService.getStringCellWidth(e),p){this._tmpCtx.save();let m=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),L=m%2===1?.5:0;if(this._tmpCtx.lineWidth=m,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())Ce=!1,this._tmpCtx.strokeStyle=`rgb(${Y.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{Ce=!1;let X=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&X<8&&(X+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(X).css}this._tmpCtx.beginPath();let q=S,A=Math.ceil(S+this._config.deviceCharHeight)-L-(o?m*2:0),Te=A+m,Se=A+m*2,le=this._workAttributeData.getUnderlineVariantOffset();for(let X=0;X<de;X++){this._tmpCtx.save();let O=q+X*this._config.deviceCellWidth,V=q+(X+1)*this._config.deviceCellWidth,_t=O+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(O,A),this._tmpCtx.lineTo(V,A),this._tmpCtx.moveTo(O,Se),this._tmpCtx.lineTo(V,Se);break;case 3:let Ne=m<=1?Se:Math.ceil(S+this._config.deviceCharHeight-m/2)-L,ke=m<=1?A:Math.ceil(S+this._config.deviceCharHeight+m/2)-L,Dt=new Path2D;Dt.rect(O,A,this._config.deviceCellWidth,Se-A),this._tmpCtx.clip(Dt),this._tmpCtx.moveTo(O-this._config.deviceCellWidth/2,Te),this._tmpCtx.bezierCurveTo(O-this._config.deviceCellWidth/2,ke,O,ke,O,Te),this._tmpCtx.bezierCurveTo(O,Ne,_t,Ne,_t,Te),this._tmpCtx.bezierCurveTo(_t,ke,V,ke,V,Te),this._tmpCtx.bezierCurveTo(V,Ne,V+this._config.deviceCellWidth/2,Ne,V+this._config.deviceCellWidth/2,Te);break;case 4:let Ge=le===0?0:le>=m?m*2-le:m-le;!(le>=m)===!1||Ge===0?(this._tmpCtx.setLineDash([Math.round(m),Math.round(m)]),this._tmpCtx.moveTo(O+Ge,A),this._tmpCtx.lineTo(V,A)):(this._tmpCtx.setLineDash([Math.round(m),Math.round(m)]),this._tmpCtx.moveTo(O,A),this._tmpCtx.lineTo(O+Ge,A),this._tmpCtx.moveTo(O+Ge+m,A),this._tmpCtx.lineTo(V,A)),le=zt(V-O,m,le);break;case 5:let Li=.6,Ii=.3,mt=V-O,wt=Math.floor(Li*mt),Ft=Math.floor(Ii*mt),Ri=mt-wt-Ft;this._tmpCtx.setLineDash([wt,Ft,Ri]),this._tmpCtx.moveTo(O,A),this._tmpCtx.lineTo(V,A);break;case 1:default:this._tmpCtx.moveTo(O,A),this._tmpCtx.lineTo(V,A);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!Be&&this._config.fontSize>=12&&!this._config.allowTransparency&&n!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let X=this._tmpCtx.measureText(n);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in X&&X.actualBoundingBoxDescent>0){this._tmpCtx.save();let O=new Path2D;O.rect(q,A-Math.ceil(m/2),this._config.deviceCellWidth*de,Se-A+Math.ceil(m/2)),this._tmpCtx.clip(O),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=re.css,this._tmpCtx.strokeText(n,S,S+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(M){let m=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),L=m%2===1?.5:0;this._tmpCtx.lineWidth=m,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(S,S+L),this._tmpCtx.lineTo(S+this._config.deviceCharWidth*de,S+L),this._tmpCtx.stroke()}if(Be||this._tmpCtx.fillText(n,S,S+this._config.deviceCharHeight),n==="_"&&!this._config.allowTransparency){let m=St(this._tmpCtx.getImageData(S,S,this._config.deviceCellWidth,this._config.deviceCellHeight),re,Fe,Ce);if(m)for(let L=1;L<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=re.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(n,S,S+this._config.deviceCharHeight-L),m=St(this._tmpCtx.getImageData(S,S,this._config.deviceCellWidth,this._config.deviceCellHeight),re,Fe,Ce),!!m);L++);}if(v){let m=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),L=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=m,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(S,S+Math.floor(this._config.deviceCharHeight/2)-L),this._tmpCtx.lineTo(S+this._config.deviceCharWidth*de,S+Math.floor(this._config.deviceCharHeight/2)-L),this._tmpCtx.stroke()}this._tmpCtx.restore();let Pe=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),dt;if(this._config.allowTransparency?dt=Wi(Pe):dt=St(Pe,re,Fe,Ce),dt)return ii;let C=this._findGlyphBoundingBox(Pe,this._workBoundingBox,l,ge,Be,S),b,g;for(;;){if(this._activePages.length===0){let m=this._createNewPage();b=m,g=m.currentRow,g.height=C.size.y;break}b=this._activePages[this._activePages.length-1],g=b.currentRow;for(let m of this._activePages)C.size.y<=m.currentRow.height&&(b=m,g=m.currentRow);for(let m=this._activePages.length-1;m>=0;m--)for(let L of this._activePages[m].fixedRows)L.height<=g.height&&C.size.y<=L.height&&(b=this._activePages[m],g=L);if(g.y+C.size.y>=b.canvas.height||g.height>C.size.y+2){let m=!1;if(b.currentRow.y+b.currentRow.height+C.size.y>=b.canvas.height){let L;for(let q of this._activePages)if(q.currentRow.y+q.currentRow.height+C.size.y<q.canvas.height){L=q;break}if(L)b=L;else if(i.maxAtlasPages&&this._pages.length>=i.maxAtlasPages&&g.y+C.size.y<=b.canvas.height&&g.height>=C.size.y&&g.x+C.size.x<=b.canvas.width)m=!0;else{let q=this._createNewPage();b=q,g=q.currentRow,g.height=C.size.y,m=!0}}m||(b.currentRow.height>0&&b.fixedRows.push(b.currentRow),g={x:0,y:b.currentRow.y+b.currentRow.height,height:C.size.y},b.fixedRows.push(g),b.currentRow={x:0,y:g.y+g.height,height:0})}if(g.x+C.size.x<=b.canvas.width)break;g===b.currentRow?(g.x=0,g.y+=g.height,g.height=0):b.fixedRows.splice(b.fixedRows.indexOf(g),1)}return C.texturePage=this._pages.indexOf(b),C.texturePosition.x=g.x,C.texturePosition.y=g.y,C.texturePositionClipSpace.x=g.x/b.canvas.width,C.texturePositionClipSpace.y=g.y/b.canvas.height,C.sizeClipSpace.x/=b.canvas.width,C.sizeClipSpace.y/=b.canvas.height,g.height=Math.max(g.height,C.size.y),g.x+=C.size.x,b.ctx.putImageData(Pe,C.texturePosition.x-this._workBoundingBox.left,C.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,C.size.x,C.size.y),b.addGlyph(C),b.version++,C}_findGlyphBoundingBox(e,t,r,s,o,n){t.top=0;let l=s?this._config.deviceCellHeight:this._tmpCanvas.height,c=s?this._config.deviceCellWidth:r,a=!1;for(let h=0;h<l;h++){for(let d=0;d<c;d++){let u=h*this._tmpCanvas.width*4+d*4+3;if(e.data[u]!==0){t.top=h,a=!0;break}}if(a)break}t.left=0,a=!1;for(let h=0;h<n+c;h++){for(let d=0;d<l;d++){let u=d*this._tmpCanvas.width*4+h*4+3;if(e.data[u]!==0){t.left=h,a=!0;break}}if(a)break}t.right=c,a=!1;for(let h=n+c-1;h>=n;h--){for(let d=0;d<l;d++){let u=d*this._tmpCanvas.width*4+h*4+3;if(e.data[u]!==0){t.right=h,a=!0;break}}if(a)break}t.bottom=l,a=!1;for(let h=l-1;h>=0;h--){for(let d=0;d<c;d++){let u=h*this._tmpCanvas.width*4+d*4+3;if(e.data[u]!==0){t.bottom=h,a=!0;break}}if(a)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+n+(s||o?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+n+(s||o?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Ye=class{constructor(e,t,r){this._usedPixels=0;this._glyphs=[];this.version=0;this.currentRow={x:0,y:0,height:0};this.fixedRows=[];if(r)for(let s of r)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=ri(e,t,t),this.ctx=T(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function St(i,e,t,r){let s=e.rgba>>>24,o=e.rgba>>>16&255,n=e.rgba>>>8&255,l=t.rgba>>>24,c=t.rgba>>>16&255,a=t.rgba>>>8&255,h=Math.floor((Math.abs(s-l)+Math.abs(o-c)+Math.abs(n-a))/12),d=!0;for(let u=0;u<i.data.length;u+=4)i.data[u]===s&&i.data[u+1]===o&&i.data[u+2]===n||r&&Math.abs(i.data[u]-s)+Math.abs(i.data[u+1]-o)+Math.abs(i.data[u+2]-n)<h?i.data[u+3]=0:d=!1;return d}function Wi(i){for(let e=0;e<i.data.length;e+=4)if(i.data[e+3]>0)return!1;return!0}function ri(i,e,t){let r=i.createElement("canvas");return r.width=e,r.height=t,r}function ni(i,e,t,r,s,o,n){let l={foreground:o.foreground,background:o.background,cursor:U,cursorAccent:U,selectionForeground:U,selectionBackgroundTransparent:U,selectionBackgroundOpaque:U,selectionInactiveBackgroundTransparent:U,selectionInactiveBackgroundOpaque:U,overviewRulerBorder:U,scrollbarSliderBackground:U,scrollbarSliderHoverBackground:U,scrollbarSliderActiveBackground:U,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:s.customGlyphs,devicePixelRatio:n,letterSpacing:s.letterSpacing,lineHeight:s.lineHeight,deviceCellWidth:i,deviceCellHeight:e,deviceCharWidth:t,deviceCharHeight:r,fontFamily:s.fontFamily,fontSize:s.fontSize,fontWeight:s.fontWeight,fontWeightBold:s.fontWeightBold,allowTransparency:s.allowTransparency,drawBoldTextInBrightColors:s.drawBoldTextInBrightColors,minimumContrastRatio:s.minimumContrastRatio,colors:l}}function xt(i,e){for(let t=0;t<i.colors.ansi.length;t++)if(i.colors.ansi[t].rgba!==e.colors.ansi[t].rgba)return!1;return i.devicePixelRatio===e.devicePixelRatio&&i.customGlyphs===e.customGlyphs&&i.lineHeight===e.lineHeight&&i.letterSpacing===e.letterSpacing&&i.fontFamily===e.fontFamily&&i.fontSize===e.fontSize&&i.fontWeight===e.fontWeight&&i.fontWeightBold===e.fontWeightBold&&i.allowTransparency===e.allowTransparency&&i.deviceCharWidth===e.deviceCharWidth&&i.deviceCharHeight===e.deviceCharHeight&&i.drawBoldTextInBrightColors===e.drawBoldTextInBrightColors&&i.minimumContrastRatio===e.minimumContrastRatio&&i.colors.foreground.rgba===e.colors.foreground.rgba&&i.colors.background.rgba===e.colors.background.rgba}function si(i){return(i&50331648)===16777216||(i&50331648)===33554432}var K=[];function je(i,e,t,r,s,o,n,l){let c=ni(r,s,o,n,e,t,l);for(let d=0;d<K.length;d++){let u=K[d],_=u.ownedBy.indexOf(i);if(_>=0){if(xt(u.config,c))return u.atlas;u.ownedBy.length===1?(u.atlas.dispose(),K.splice(d,1)):u.ownedBy.splice(_,1);break}}for(let d=0;d<K.length;d++){let u=K[d];if(xt(u.config,c))return u.ownedBy.push(i),u.atlas}let a=i._core,h={atlas:new z(document,c,a.unicodeService),config:c,ownedBy:[i]};return K.push(h),h.atlas}function Lt(i){for(let e=0;e<K.length;e++){let t=K[e].ownedBy.indexOf(i);if(t!==-1){K[e].ownedBy.length===1?(K[e].atlas.dispose(),K.splice(e,1)):K[e].ownedBy.splice(t,1);break}}}var Ze=600,Qe=class{constructor(e,t){this._renderCallback=e;this._coreBrowserService=t;this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=Ze){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let t=Ze-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,t>0){this._restartInterval(t);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let t=Ze-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(t);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Ze)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function It(i,e,t){let r=new e.ResizeObserver(s=>{let o=s.find(c=>c.target===i);if(!o)return;if(!("devicePixelContentBoxSize"in o)){r?.disconnect(),r=void 0;return}let n=o.devicePixelContentBoxSize[0].inlineSize,l=o.devicePixelContentBoxSize[0].blockSize;n>0&&l>0&&t(n,l)});try{r.observe(i,{box:["device-pixel-content-box"]})}catch{r.disconnect(),r=void 0}return y(()=>r?.disconnect())}function oi(i){return i>65535?(i-=65536,String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):String.fromCharCode(i)}var ye=class i extends Y{constructor(){super(...arguments);this.content=0;this.fg=0;this.bg=0;this.extended=new Ee;this.combinedData=""}static fromCharData(t){let r=new i;return r.setFromCharData(t),r}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?oi(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let r=!1;if(t[1].length>2)r=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let o=t[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(s-55296)*1024+o-56320+65536|t[2]<<22:r=!0}else r=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;r&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};var et=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function tt(i,e,t){let r=T(i.createProgram());if(i.attachShader(r,T(ai(i,i.VERTEX_SHADER,e))),i.attachShader(r,T(ai(i,i.FRAGMENT_SHADER,t))),i.linkProgram(r),i.getProgramParameter(r,i.LINK_STATUS))return r;console.error(i.getProgramInfoLog(r)),i.deleteProgram(r)}function ai(i,e,t){let r=T(i.createShader(e));if(i.shaderSource(r,t),i.compileShader(r),i.getShaderParameter(r,i.COMPILE_STATUS))return r;console.error(i.getShaderInfoLog(r)),i.deleteShader(r)}function li(i,e){let t=Math.min(i.length*2,e),r=new Float32Array(t);for(let s=0;s<i.length;s++)r[s]=i[s];return r}var Je=class{constructor(e){this.texture=e,this.version=-1}};var Ki=`#version 300 es
18
18
  layout (location = 0) in vec2 a_unitquad;
19
19
  layout (location = 1) in vec2 a_cellpos;
20
20
  layout (location = 2) in vec2 a_offset;
@@ -48,7 +48,7 @@ void main() {
48
48
  if (v_texpage == 0) {
49
49
  outColor = texture(u_texture[0], v_texcoord);
50
50
  } ${e}
51
- }`}var oe=11,pe=oe*Float32Array.BYTES_PER_ELEMENT,Xi=2,R=0,x,Mt=0,De=0,it=class extends H{constructor(t,r,s,o){super();this._terminal=t;this._gl=r;this._dimensions=s;this._optionsService=o;this._activeBuffer=0;this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let n=this._gl;V.maxAtlasPages===void 0&&(V.maxAtlasPages=Math.min(32,T(n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS))),V.maxTextureSize=T(n.getParameter(n.MAX_TEXTURE_SIZE))),this._program=T(tt(n,Ki,qi(V.maxAtlasPages))),this.register(y(()=>n.deleteProgram(this._program))),this._projectionLocation=T(n.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=T(n.getUniformLocation(this._program,"u_resolution")),this._textureLocation=T(n.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let l=new Float32Array([0,0,1,0,0,1,1,1]),c=n.createBuffer();this.register(y(()=>n.deleteBuffer(c))),n.bindBuffer(n.ARRAY_BUFFER,c),n.bufferData(n.ARRAY_BUFFER,l,n.STATIC_DRAW),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),h=n.createBuffer();this.register(y(()=>n.deleteBuffer(h))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,h),n.bufferData(n.ELEMENT_ARRAY_BUFFER,a,n.STATIC_DRAW),this._attributesBuffer=T(n.createBuffer()),this.register(y(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,2,n.FLOAT,!1,pe,0),n.vertexAttribDivisor(2,1),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,n.FLOAT,!1,pe,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(3,1),n.enableVertexAttribArray(4),n.vertexAttribPointer(4,1,n.FLOAT,!1,pe,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(4,1),n.enableVertexAttribArray(5),n.vertexAttribPointer(5,2,n.FLOAT,!1,pe,5*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(5,1),n.enableVertexAttribArray(6),n.vertexAttribPointer(6,2,n.FLOAT,!1,pe,7*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(6,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,pe,9*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.useProgram(this._program);let d=new Int32Array(V.maxAtlasPages);for(let u=0;u<V.maxAtlasPages;u++)d[u]=u;n.uniform1iv(this._textureLocation,d),n.uniformMatrix4fv(this._projectionLocation,!1,et),this._atlasTextures=[];for(let u=0;u<V.maxAtlasPages;u++){let _=new Je(T(n.createTexture()));this.register(y(()=>n.deleteTexture(_.texture))),n.activeTexture(n.TEXTURE0+u),n.bindTexture(n.TEXTURE_2D,_.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[u]=_}n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,s,o,n,l,c,a,h){this._updateCell(this._vertices.attributes,t,r,s,o,n,l,c,a,h)}_updateCell(t,r,s,o,n,l,c,a,h,d){if(R=(s*this._terminal.cols+r)*oe,o===0||o===void 0){t.fill(0,R,R+oe-1-Xi);return}this._atlas&&(a&&a.length>1?x=this._atlas.getRasterizedGlyphCombinedChar(a,n,l,c,!1):x=this._atlas.getRasterizedGlyph(o,n,l,c,!1),Mt=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),n!==d&&x.offset.x>Mt?(De=x.offset.x-Mt,t[R]=-(x.offset.x-De)+this._dimensions.device.char.left,t[R+1]=-x.offset.y+this._dimensions.device.char.top,t[R+2]=(x.size.x-De)/this._dimensions.device.canvas.width,t[R+3]=x.size.y/this._dimensions.device.canvas.height,t[R+4]=x.texturePage,t[R+5]=x.texturePositionClipSpace.x+De/this._atlas.pages[x.texturePage].canvas.width,t[R+6]=x.texturePositionClipSpace.y,t[R+7]=x.sizeClipSpace.x-De/this._atlas.pages[x.texturePage].canvas.width,t[R+8]=x.sizeClipSpace.y):(t[R]=-x.offset.x+this._dimensions.device.char.left,t[R+1]=-x.offset.y+this._dimensions.device.char.top,t[R+2]=x.size.x/this._dimensions.device.canvas.width,t[R+3]=x.size.y/this._dimensions.device.canvas.height,t[R+4]=x.texturePage,t[R+5]=x.texturePositionClipSpace.x,t[R+6]=x.texturePositionClipSpace.y,t[R+7]=x.sizeClipSpace.x,t[R+8]=x.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Wt(o,h,x.size.x,this._dimensions.device.cell.width)&&(t[R+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*oe;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let s=0;for(;s<this._vertices.attributesBuffers.length;s++)this._vertices.count!==r?this._vertices.attributesBuffers[s]=new Float32Array(r):this._vertices.attributesBuffers[s].fill(0);this._vertices.count=r,s=0;for(let o=0;o<t.rows;o++)for(let n=0;n<t.cols;n++)this._vertices.attributes[s+9]=n/t.cols,this._vertices.attributes[s+10]=o/t.rows,s+=oe}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let s=this._vertices.attributesBuffers[this._activeBuffer],o=0;for(let n=0;n<t.lineLengths.length;n++){let l=n*this._terminal.cols*oe,c=this._vertices.attributes.subarray(l,l+t.lineLengths[n]*oe);s.set(c,o),o+=c.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,s.subarray(0,o),r.STREAM_DRAW);for(let n=0;n<this._atlas.pages.length;n++)this._atlas.pages[n].version!==this._atlasTextures[n].version&&this._bindAtlasPageTexture(r,this._atlas,n);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,o/oe)}setAtlas(t){this._atlas=t;for(let r of this._atlasTextures)r.version=-1}_bindAtlasPageTexture(t,r,s){t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[s].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[s].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[s].version=r.pages[s].version}setDimensions(t){this._dimensions=t}};var Et=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,r,s=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let o=e.buffers.active.ydisp,n=t[1]-o,l=r[1]-o,c=Math.max(n,0),a=Math.min(l,e.rows-1);if(c>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=l,this.viewportCappedStartRow=c,this.viewportCappedEndRow=a,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function ci(){return new Et}var ve=4,fe=1,be=2,nt=3,hi=2147483648,rt=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=ci()}resize(e,t){let r=e*t*ve;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}};var Yi=`#version 300 es
51
+ }`}var oe=11,pe=oe*Float32Array.BYTES_PER_ELEMENT,Xi=2,R=0,x,Mt=0,De=0,it=class extends H{constructor(t,r,s,o){super();this._terminal=t;this._gl=r;this._dimensions=s;this._optionsService=o;this._activeBuffer=0;this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let n=this._gl;z.maxAtlasPages===void 0&&(z.maxAtlasPages=Math.min(32,T(n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS))),z.maxTextureSize=T(n.getParameter(n.MAX_TEXTURE_SIZE))),this._program=T(tt(n,Ki,qi(z.maxAtlasPages))),this.register(y(()=>n.deleteProgram(this._program))),this._projectionLocation=T(n.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=T(n.getUniformLocation(this._program,"u_resolution")),this._textureLocation=T(n.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let l=new Float32Array([0,0,1,0,0,1,1,1]),c=n.createBuffer();this.register(y(()=>n.deleteBuffer(c))),n.bindBuffer(n.ARRAY_BUFFER,c),n.bufferData(n.ARRAY_BUFFER,l,n.STATIC_DRAW),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),h=n.createBuffer();this.register(y(()=>n.deleteBuffer(h))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,h),n.bufferData(n.ELEMENT_ARRAY_BUFFER,a,n.STATIC_DRAW),this._attributesBuffer=T(n.createBuffer()),this.register(y(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,2,n.FLOAT,!1,pe,0),n.vertexAttribDivisor(2,1),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,n.FLOAT,!1,pe,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(3,1),n.enableVertexAttribArray(4),n.vertexAttribPointer(4,1,n.FLOAT,!1,pe,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(4,1),n.enableVertexAttribArray(5),n.vertexAttribPointer(5,2,n.FLOAT,!1,pe,5*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(5,1),n.enableVertexAttribArray(6),n.vertexAttribPointer(6,2,n.FLOAT,!1,pe,7*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(6,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,pe,9*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.useProgram(this._program);let d=new Int32Array(z.maxAtlasPages);for(let u=0;u<z.maxAtlasPages;u++)d[u]=u;n.uniform1iv(this._textureLocation,d),n.uniformMatrix4fv(this._projectionLocation,!1,et),this._atlasTextures=[];for(let u=0;u<z.maxAtlasPages;u++){let _=new Je(T(n.createTexture()));this.register(y(()=>n.deleteTexture(_.texture))),n.activeTexture(n.TEXTURE0+u),n.bindTexture(n.TEXTURE_2D,_.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[u]=_}n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,r,s,o,n,l,c,a,h){this._updateCell(this._vertices.attributes,t,r,s,o,n,l,c,a,h)}_updateCell(t,r,s,o,n,l,c,a,h,d){if(R=(s*this._terminal.cols+r)*oe,o===0||o===void 0){t.fill(0,R,R+oe-1-Xi);return}this._atlas&&(a&&a.length>1?x=this._atlas.getRasterizedGlyphCombinedChar(a,n,l,c,!1):x=this._atlas.getRasterizedGlyph(o,n,l,c,!1),Mt=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),n!==d&&x.offset.x>Mt?(De=x.offset.x-Mt,t[R]=-(x.offset.x-De)+this._dimensions.device.char.left,t[R+1]=-x.offset.y+this._dimensions.device.char.top,t[R+2]=(x.size.x-De)/this._dimensions.device.canvas.width,t[R+3]=x.size.y/this._dimensions.device.canvas.height,t[R+4]=x.texturePage,t[R+5]=x.texturePositionClipSpace.x+De/this._atlas.pages[x.texturePage].canvas.width,t[R+6]=x.texturePositionClipSpace.y,t[R+7]=x.sizeClipSpace.x-De/this._atlas.pages[x.texturePage].canvas.width,t[R+8]=x.sizeClipSpace.y):(t[R]=-x.offset.x+this._dimensions.device.char.left,t[R+1]=-x.offset.y+this._dimensions.device.char.top,t[R+2]=x.size.x/this._dimensions.device.canvas.width,t[R+3]=x.size.y/this._dimensions.device.canvas.height,t[R+4]=x.texturePage,t[R+5]=x.texturePositionClipSpace.x,t[R+6]=x.texturePositionClipSpace.y,t[R+7]=x.sizeClipSpace.x,t[R+8]=x.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Wt(o,h,x.size.x,this._dimensions.device.cell.width)&&(t[R+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,r=t.cols*t.rows*oe;this._vertices.count!==r?this._vertices.attributes=new Float32Array(r):this._vertices.attributes.fill(0);let s=0;for(;s<this._vertices.attributesBuffers.length;s++)this._vertices.count!==r?this._vertices.attributesBuffers[s]=new Float32Array(r):this._vertices.attributesBuffers[s].fill(0);this._vertices.count=r,s=0;for(let o=0;o<t.rows;o++)for(let n=0;n<t.cols;n++)this._vertices.attributes[s+9]=n/t.cols,this._vertices.attributes[s+10]=o/t.rows,s+=oe}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let s=this._vertices.attributesBuffers[this._activeBuffer],o=0;for(let n=0;n<t.lineLengths.length;n++){let l=n*this._terminal.cols*oe,c=this._vertices.attributes.subarray(l,l+t.lineLengths[n]*oe);s.set(c,o),o+=c.length}r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,s.subarray(0,o),r.STREAM_DRAW);for(let n=0;n<this._atlas.pages.length;n++)this._atlas.pages[n].version!==this._atlasTextures[n].version&&this._bindAtlasPageTexture(r,this._atlas,n);r.drawElementsInstanced(r.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,o/oe)}setAtlas(t){this._atlas=t;for(let r of this._atlasTextures)r.version=-1}_bindAtlasPageTexture(t,r,s){t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[s].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r.pages[s].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[s].version=r.pages[s].version}setDimensions(t){this._dimensions=t}};var Et=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,r,s=!1){if(this.selectionStart=t,this.selectionEnd=r,!t||!r||t[0]===r[0]&&t[1]===r[1]){this.clear();return}let o=e.buffers.active.ydisp,n=t[1]-o,l=r[1]-o,c=Math.max(n,0),a=Math.min(l,e.rows-1);if(c>=e.rows||a<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=l,this.viewportCappedStartRow=c,this.viewportCappedEndRow=a,this.startCol=t[0],this.endCol=r[0]}isCellSelected(e,t,r){return this.hasSelection?(r-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&r>=this.viewportCappedStartRow&&t<this.endCol&&r<=this.viewportCappedEndRow:t<this.startCol&&r>=this.viewportCappedStartRow&&t>=this.endCol&&r<=this.viewportCappedEndRow:r>this.viewportStartRow&&r<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&r===this.viewportStartRow&&t>=this.startCol):!1}};function ci(){return new Et}var ve=4,fe=1,be=2,nt=3,hi=2147483648,rt=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=ci()}resize(e,t){let r=e*t*ve;r!==this.cells.length&&(this.cells=new Uint32Array(r),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}};var Yi=`#version 300 es
52
52
  layout (location = 0) in vec2 a_position;
53
53
  layout (location = 1) in vec2 a_size;
54
54
  layout (location = 2) in vec4 a_color;
@@ -71,5 +71,5 @@ out vec4 outColor;
71
71
 
72
72
  void main() {
73
73
  outColor = v_color;
74
- }`,ie=8,Ot=ie*Float32Array.BYTES_PER_ELEMENT,Zi=20*ie,st=class{constructor(){this.attributes=new Float32Array(Zi),this.count=0}},te=0,ui=0,di=0,_i=0,mi=0,pi=0,vi=0,ot=class extends H{constructor(t,r,s,o){super();this._terminal=t;this._gl=r;this._dimensions=s;this._themeService=o;this._vertices=new st;this._verticesCursor=new st;let n=this._gl;this._program=T(tt(n,Yi,ji)),this.register(y(()=>n.deleteProgram(this._program))),this._projectionLocation=T(n.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let l=new Float32Array([0,0,1,0,0,1,1,1]),c=n.createBuffer();this.register(y(()=>n.deleteBuffer(c))),n.bindBuffer(n.ARRAY_BUFFER,c),n.bufferData(n.ARRAY_BUFFER,l,n.STATIC_DRAW),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),h=n.createBuffer();this.register(y(()=>n.deleteBuffer(h))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,h),n.bufferData(n.ELEMENT_ARRAY_BUFFER,a,n.STATIC_DRAW),this._attributesBuffer=T(n.createBuffer()),this.register(y(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,n.FLOAT,!1,Ot,0),n.vertexAttribDivisor(0,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,Ot,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,4,n.FLOAT,!1,Ot,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(2,1),this._updateCachedColors(o.colors),this.register(this._themeService.onChangeColors(d=>{this._updateCachedColors(d),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),r.uniformMatrix4fv(this._projectionLocation,!1,et),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,t.attributes,r.DYNAMIC_DRAW),r.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.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(t){let r=this._terminal,s=this._vertices,o=1,n,l,c,a,h,d,u,_,p,v,M;for(n=0;n<r.rows;n++){for(c=-1,a=0,h=0,d=!1,l=0;l<r.cols;l++)u=(n*r.cols+l)*ve,_=t.cells[u+fe],p=t.cells[u+be],v=!!(p&67108864),(_!==a||p!==h&&(d||v))&&((a!==0||d&&h!==0)&&(M=o++*ie,this._updateRectangle(s,M,h,a,c,l,n)),c=l,a=_,h=p,d=v);(a!==0||d&&h!==0)&&(M=o++*ie,this._updateRectangle(s,M,h,a,c,r.cols,n))}s.count=o}updateCursor(t){let r=this._verticesCursor,s=t.cursor;if(!s||s.style==="block"){r.count=0;return}let o,n=0;(s.style==="bar"||s.style==="outline")&&(o=n++*ie,this._addRectangleFloat(r.attributes,o,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.style==="bar"?s.dpr*s.cursorWidth:s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(s.style==="underline"||s.style==="outline")&&(o=n++*ie,this._addRectangleFloat(r.attributes,o,s.x*this._dimensions.device.cell.width,(s.y+1)*this._dimensions.device.cell.height-s.dpr,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat)),s.style==="outline"&&(o=n++*ie,this._addRectangleFloat(r.attributes,o,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat),o=n++*ie,this._addRectangleFloat(r.attributes,o,(s.x+s.width)*this._dimensions.device.cell.width-s.dpr,s.y*this._dimensions.device.cell.height,s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),r.count=n}_updateRectangle(t,r,s,o,n,l,c){if(s&67108864)switch(s&50331648){case 16777216:case 33554432:te=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:te=(s&16777215)<<8;break;case 0:default:te=this._themeService.colors.foreground.rgba}else switch(o&50331648){case 16777216:case 33554432:te=this._themeService.colors.ansi[o&255].rgba;break;case 50331648:te=(o&16777215)<<8;break;case 0:default:te=this._themeService.colors.background.rgba}t.attributes.length<r+4&&(t.attributes=li(t.attributes,this._terminal.rows*this._terminal.cols*ie)),ui=n*this._dimensions.device.cell.width,di=c*this._dimensions.device.cell.height,_i=(te>>24&255)/255,mi=(te>>16&255)/255,pi=(te>>8&255)/255,vi=1,this._addRectangle(t.attributes,r,ui,di,(l-n)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,_i,mi,pi,vi)}_addRectangle(t,r,s,o,n,l,c,a,h,d){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=o/this._dimensions.device.canvas.height,t[r+2]=n/this._dimensions.device.canvas.width,t[r+3]=l/this._dimensions.device.canvas.height,t[r+4]=c,t[r+5]=a,t[r+6]=h,t[r+7]=d}_addRectangleFloat(t,r,s,o,n,l,c){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=o/this._dimensions.device.canvas.height,t[r+2]=n/this._dimensions.device.canvas.width,t[r+3]=l/this._dimensions.device.canvas.height,t[r+4]=c[0],t[r+5]=c[1],t[r+6]=c[2],t[r+7]=c[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}};var at=class extends H{constructor(t,r,s,o,n,l,c,a){super();this._container=r;this._alpha=n;this._coreBrowserService=l;this._optionsService=c;this._themeService=a;this._deviceCharWidth=0;this._deviceCharHeight=0;this._deviceCellWidth=0;this._deviceCellHeight=0;this._deviceCharLeft=0;this._deviceCharTop=0;this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${s}-layer`),this._canvas.style.zIndex=o.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(t,h),this.reset(t)})),this.register(y(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=T(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,r,s){}handleSelectionChanged(t,r,s,o=!1){}_setTransparency(t,r){if(r===this._alpha)return;let s=this._canvas;this._alpha=r,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,r){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=je(t,this._optionsService.rawOptions,r,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(t,r){this._deviceCellWidth=r.device.cell.width,this._deviceCellHeight=r.device.cell.height,this._deviceCharWidth=r.device.char.width,this._deviceCharHeight=r.device.char.height,this._deviceCharLeft=r.device.char.left,this._deviceCharTop=r.device.char.top,this._canvas.width=r.device.canvas.width,this._canvas.height=r.device.canvas.height,this._canvas.style.width=`${r.css.canvas.width}px`,this._canvas.style.height=`${r.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,r,s=1){this._ctx.fillRect(t*this._deviceCellWidth,(r+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*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(t,r,s,o){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,o*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,o*this._deviceCellHeight))}_fillCharTrueColor(t,r,s,o){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=Ke,this._clipCell(s,o,r.getWidth()),this._ctx.fillText(r.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,o*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,r,s){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,r,s){let o=r?t.options.fontWeightBold:t.options.fontWeight;return`${s?"italic":""} ${o} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}};var lt=class extends at{constructor(e,t,r,s,o,n,l){super(r,e,"link",t,!0,o,n,l),this.register(s.onShowLinkUnderline(c=>this._handleShowLinkUnderline(c))),this.register(s.onHideLinkUnderline(c=>this._handleHideLinkUnderline(c)))}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===Xt?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&si(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()}};var ct=class extends H{constructor(t,r,s,o,n,l,c,a,h){super();this._terminal=t;this._characterJoinerService=r;this._charSizeService=s;this._coreBrowserService=o;this._coreService=n;this._decorationService=l;this._optionsService=c;this._themeService=a;this._cursorBlinkStateManager=new se;this._charAtlasDisposable=this.register(new se);this._observerDisposable=this.register(new se);this._model=new rt;this._workCell=new ye;this._workCell2=new ye;this._rectangleRenderer=this.register(new se);this._glyphRenderer=this.register(new se);this._onChangeTextureAtlas=this.register(new k);this.onChangeTextureAtlas=this._onChangeTextureAtlas.event;this._onAddTextureAtlasCanvas=this.register(new k);this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=this.register(new k);this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._onRequestRedraw=this.register(new k);this.onRequestRedraw=this._onRequestRedraw.event;this._onContextLoss=this.register(new k);this.onContextLoss=this._onContextLoss.event;this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new ze(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new lt(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,c,this._themeService)],this.dimensions=Vt(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(c.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let d={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",d),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register(ft(this._canvas,"webglcontextlost",u=>{console.log("webglcontextlost event received"),u.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(u)},3e3)})),this.register(ft(this._canvas,"webglcontextrestored",u=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Lt(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=It(this._canvas,this._coreBrowserService.window,(u,_)=>this._setCanvasDevicePixelDimensions(u,_)),this.register(this._coreBrowserService.onWindowChange(u=>{this._observerDisposable.value=It(this._canvas,u,(_,p)=>this._setCanvasDevicePixelDimensions(_,p))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register(y(()=>{for(let u of this._renderLayers)u.dispose();this._canvas.parentElement?.removeChild(this._canvas),Lt(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(t,r){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let s of this._renderLayers)s.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 t of this._renderLayers)t.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let t of this._renderLayers)t.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,r,s){for(let o of this._renderLayers)o.handleSelectionChanged(this._terminal,t,r,s);this._model.selection.update(this._core,t,r,s),this._requestRedrawViewport()}handleCursorMove(){for(let t of this._renderLayers)t.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new ot(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new it(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 t=je(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._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=Nt([ne(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),ne(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=t,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(t){this._model.clear(),t&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(t){return-1}deregisterCharacterJoiner(t){return!1}renderRows(t,r){if(!this._isAttached)if(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,t,r);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,r),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new Qe(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,r){let s=this._core,o=this._workCell,n,l,c,a,h,d,u,_,p,v,M,E,f,D;t=fi(t,s.rows-1,0),r=fi(r,s.rows-1,0);let ae=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,re=ae-s.buffer.ydisp,ue=Math.min(this._terminal.buffer.active.cursorX,s.cols-1),we=-1,ut=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ge=!1;for(l=t;l<=r;l++)for(c=l+s.buffer.ydisp,a=s.buffer.lines.get(c),this._model.lineLengths[l]=0,h=this._characterJoinerService.getJoinedCharacters(c),f=0;f<s.cols;f++)if(n=this._cellColorResolver.result.bg,a.loadCell(f,o),f===0&&(n=this._cellColorResolver.result.bg),d=!1,u=f,h.length>0&&f===h[0][0]&&(d=!0,_=h.shift(),o=new At(o,a.translateToString(!0,_[0],_[1]),_[1]-_[0]),u=_[1]-1),p=o.getChars(),v=o.getCode(),E=(l*s.cols+f)*ve,this._cellColorResolver.resolve(o,f,c,this.dimensions.device.cell.width),ut&&c===ae&&(f===ue&&(this._model.cursor={x:ue,y:re,width:o.getWidth(),style:this._coreBrowserService.isFocused?s.options.cursorStyle||"block":s.options.cursorInactiveStyle,cursorWidth:s.options.cursorWidth,dpr:this._devicePixelRatio},we=ue+o.getWidth()-1),f>=ue&&f<=we&&(this._coreBrowserService.isFocused&&(s.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&s.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)),v!==0&&(this._model.lineLengths[l]=f+1),!(this._model.cells[E]===v&&this._model.cells[E+fe]===this._cellColorResolver.result.bg&&this._model.cells[E+be]===this._cellColorResolver.result.fg&&this._model.cells[E+nt]===this._cellColorResolver.result.ext)&&(ge=!0,p.length>1&&(v|=hi),this._model.cells[E]=v,this._model.cells[E+fe]=this._cellColorResolver.result.bg,this._model.cells[E+be]=this._cellColorResolver.result.fg,this._model.cells[E+nt]=this._cellColorResolver.result.ext,M=o.getWidth(),this._glyphRenderer.value.updateCell(f,l,v,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,p,M,n),d))for(o=this._workCell,f++;f<u;f++)D=(l*s.cols+f)*ve,this._glyphRenderer.value.updateCell(f,l,0,0,0,0,Ht,0,0),this._model.cells[D]=0,this._model.cells[D+fe]=this._cellColorResolver.result.bg,this._model.cells[D+be]=this._cellColorResolver.result.fg,this._model.cells[D+nt]=this._cellColorResolver.result.ext;ge&&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(t,r){this._canvas.width===t&&this._canvas.height===r||(this._canvas.width=t,this._canvas.height=r,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},At=class extends X{constructor(t,r,s){super();this.content=0;this.combinedData="";this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function fi(i,e,t=0){return Math.max(Math.min(i,e),t)}var bi="di$target",gi="di$dependencies",yt=new Map;function Y(i){if(yt.has(i))return yt.get(i);let e=function(t,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Qi(e,t,s)};return e.toString=()=>i,yt.set(i,e),e}function Qi(i,e,t){e[bi]===e?e[gi].push({id:i,index:t}):(e[gi]=[{id:i,index:t}],e[bi]=e)}var Un=Y("BufferService"),Wn=Y("CoreMouseService"),Vn=Y("CoreService"),zn=Y("CharsetService"),Kn=Y("InstantiationService");var qn=Y("LogService"),Ci=Y("OptionsService"),Xn=Y("OscLinkService"),Yn=Y("UnicodeService"),jn=Y("DecorationService");var Ji={trace:0,debug:1,info:2,warn:3,error:4,off:5},er="xterm.js: ",ht=class extends H{constructor(t){super();this._optionsService=t;this._logLevel=5;this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Ti=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Ji[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let r=0;r<t.length;r++)typeof t[r]=="function"&&(t[r]=t[r]())}_log(t,r,s){this._evalLazyOptionalParams(s),t.call(console,(this._optionsService.options.logger?"":er)+r,...s)}trace(t,...r){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,r)}debug(t,...r){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,r)}info(t,...r){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,r)}warn(t,...r){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,r)}error(t,...r){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,r)}};ht=Bt([Pt(0,Ci)],ht);var Ti;function Si(i){Ti=i}var xi=class extends H{constructor(t){if(vt&&$t()<16){let r={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",r))throw new Error("Webgl2 is only supported on Safari 16 and above")}super();this._preserveDrawingBuffer=t;this._onChangeTextureAtlas=this.register(new k);this.onChangeTextureAtlas=this._onChangeTextureAtlas.event;this._onAddTextureAtlasCanvas=this.register(new k);this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=this.register(new k);this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._onContextLoss=this.register(new k);this.onContextLoss=this._onContextLoss.event}activate(t){let r=t._core;if(!t.element){this.register(r.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let s=r.coreService,o=r.optionsService,n=r,l=n._renderService,c=n._characterJoinerService,a=n._charSizeService,h=n._coreBrowserService,d=n._decorationService,u=n._logService,_=n._themeService;Si(u),this._renderer=this.register(new ct(t,c,a,h,s,d,o,_,this._preserveDrawingBuffer)),this.register(ne(this._renderer.onContextLoss,this._onContextLoss)),this.register(ne(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register(ne(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register(ne(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this.register(y(()=>{let p=this._terminal._core._renderService;p.setRenderer(this._terminal._core._createRenderer()),p.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};export{xi as WebglAddon};
74
+ }`,ie=8,Ot=ie*Float32Array.BYTES_PER_ELEMENT,Zi=20*ie,st=class{constructor(){this.attributes=new Float32Array(Zi),this.count=0}},te=0,ui=0,di=0,_i=0,mi=0,pi=0,vi=0,ot=class extends H{constructor(t,r,s,o){super();this._terminal=t;this._gl=r;this._dimensions=s;this._themeService=o;this._vertices=new st;this._verticesCursor=new st;let n=this._gl;this._program=T(tt(n,Yi,ji)),this.register(y(()=>n.deleteProgram(this._program))),this._projectionLocation=T(n.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let l=new Float32Array([0,0,1,0,0,1,1,1]),c=n.createBuffer();this.register(y(()=>n.deleteBuffer(c))),n.bindBuffer(n.ARRAY_BUFFER,c),n.bufferData(n.ARRAY_BUFFER,l,n.STATIC_DRAW),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),h=n.createBuffer();this.register(y(()=>n.deleteBuffer(h))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,h),n.bufferData(n.ELEMENT_ARRAY_BUFFER,a,n.STATIC_DRAW),this._attributesBuffer=T(n.createBuffer()),this.register(y(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,n.FLOAT,!1,Ot,0),n.vertexAttribDivisor(0,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,Ot,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,4,n.FLOAT,!1,Ot,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(2,1),this._updateCachedColors(o.colors),this.register(this._themeService.onChangeColors(d=>{this._updateCachedColors(d),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let r=this._gl;r.useProgram(this._program),r.bindVertexArray(this._vertexArrayObject),r.uniformMatrix4fv(this._projectionLocation,!1,et),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.bufferData(r.ARRAY_BUFFER,t.attributes,r.DYNAMIC_DRAW),r.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,r.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.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(t){let r=this._terminal,s=this._vertices,o=1,n,l,c,a,h,d,u,_,p,v,M;for(n=0;n<r.rows;n++){for(c=-1,a=0,h=0,d=!1,l=0;l<r.cols;l++)u=(n*r.cols+l)*ve,_=t.cells[u+fe],p=t.cells[u+be],v=!!(p&67108864),(_!==a||p!==h&&(d||v))&&((a!==0||d&&h!==0)&&(M=o++*ie,this._updateRectangle(s,M,h,a,c,l,n)),c=l,a=_,h=p,d=v);(a!==0||d&&h!==0)&&(M=o++*ie,this._updateRectangle(s,M,h,a,c,r.cols,n))}s.count=o}updateCursor(t){let r=this._verticesCursor,s=t.cursor;if(!s||s.style==="block"){r.count=0;return}let o,n=0;(s.style==="bar"||s.style==="outline")&&(o=n++*ie,this._addRectangleFloat(r.attributes,o,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.style==="bar"?s.dpr*s.cursorWidth:s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(s.style==="underline"||s.style==="outline")&&(o=n++*ie,this._addRectangleFloat(r.attributes,o,s.x*this._dimensions.device.cell.width,(s.y+1)*this._dimensions.device.cell.height-s.dpr,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat)),s.style==="outline"&&(o=n++*ie,this._addRectangleFloat(r.attributes,o,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat),o=n++*ie,this._addRectangleFloat(r.attributes,o,(s.x+s.width)*this._dimensions.device.cell.width-s.dpr,s.y*this._dimensions.device.cell.height,s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),r.count=n}_updateRectangle(t,r,s,o,n,l,c){if(s&67108864)switch(s&50331648){case 16777216:case 33554432:te=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:te=(s&16777215)<<8;break;case 0:default:te=this._themeService.colors.foreground.rgba}else switch(o&50331648){case 16777216:case 33554432:te=this._themeService.colors.ansi[o&255].rgba;break;case 50331648:te=(o&16777215)<<8;break;case 0:default:te=this._themeService.colors.background.rgba}t.attributes.length<r+4&&(t.attributes=li(t.attributes,this._terminal.rows*this._terminal.cols*ie)),ui=n*this._dimensions.device.cell.width,di=c*this._dimensions.device.cell.height,_i=(te>>24&255)/255,mi=(te>>16&255)/255,pi=(te>>8&255)/255,vi=1,this._addRectangle(t.attributes,r,ui,di,(l-n)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,_i,mi,pi,vi)}_addRectangle(t,r,s,o,n,l,c,a,h,d){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=o/this._dimensions.device.canvas.height,t[r+2]=n/this._dimensions.device.canvas.width,t[r+3]=l/this._dimensions.device.canvas.height,t[r+4]=c,t[r+5]=a,t[r+6]=h,t[r+7]=d}_addRectangleFloat(t,r,s,o,n,l,c){t[r]=s/this._dimensions.device.canvas.width,t[r+1]=o/this._dimensions.device.canvas.height,t[r+2]=n/this._dimensions.device.canvas.width,t[r+3]=l/this._dimensions.device.canvas.height,t[r+4]=c[0],t[r+5]=c[1],t[r+6]=c[2],t[r+7]=c[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}};var at=class extends H{constructor(t,r,s,o,n,l,c,a){super();this._container=r;this._alpha=n;this._coreBrowserService=l;this._optionsService=c;this._themeService=a;this._deviceCharWidth=0;this._deviceCharHeight=0;this._deviceCellWidth=0;this._deviceCellHeight=0;this._deviceCharLeft=0;this._deviceCharTop=0;this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${s}-layer`),this._canvas.style.zIndex=o.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(h=>{this._refreshCharAtlas(t,h),this.reset(t)})),this.register(y(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=T(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,r,s){}handleSelectionChanged(t,r,s,o=!1){}_setTransparency(t,r){if(r===this._alpha)return;let s=this._canvas;this._alpha=r,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,r){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=je(t,this._optionsService.rawOptions,r,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(t,r){this._deviceCellWidth=r.device.cell.width,this._deviceCellHeight=r.device.cell.height,this._deviceCharWidth=r.device.char.width,this._deviceCharHeight=r.device.char.height,this._deviceCharLeft=r.device.char.left,this._deviceCharTop=r.device.char.top,this._canvas.width=r.device.canvas.width,this._canvas.height=r.device.canvas.height,this._canvas.style.width=`${r.css.canvas.width}px`,this._canvas.style.height=`${r.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,r,s=1){this._ctx.fillRect(t*this._deviceCellWidth,(r+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*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(t,r,s,o){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,o*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,o*this._deviceCellHeight))}_fillCharTrueColor(t,r,s,o){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=Ke,this._clipCell(s,o,r.getWidth()),this._ctx.fillText(r.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,o*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,r,s){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,r*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,r,s){let o=r?t.options.fontWeightBold:t.options.fontWeight;return`${s?"italic":""} ${o} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}};var lt=class extends at{constructor(e,t,r,s,o,n,l){super(r,e,"link",t,!0,o,n,l),this.register(s.onShowLinkUnderline(c=>this._handleShowLinkUnderline(c))),this.register(s.onHideLinkUnderline(c=>this._handleHideLinkUnderline(c)))}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===Xt?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&si(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()}};var ct=class extends H{constructor(t,r,s,o,n,l,c,a,h){super();this._terminal=t;this._characterJoinerService=r;this._charSizeService=s;this._coreBrowserService=o;this._coreService=n;this._decorationService=l;this._optionsService=c;this._themeService=a;this._cursorBlinkStateManager=new se;this._charAtlasDisposable=this.register(new se);this._observerDisposable=this.register(new se);this._model=new rt;this._workCell=new ye;this._workCell2=new ye;this._rectangleRenderer=this.register(new se);this._glyphRenderer=this.register(new se);this._onChangeTextureAtlas=this.register(new k);this.onChangeTextureAtlas=this._onChangeTextureAtlas.event;this._onAddTextureAtlasCanvas=this.register(new k);this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=this.register(new k);this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._onRequestRedraw=this.register(new k);this.onRequestRedraw=this._onRequestRedraw.event;this._onContextLoss=this.register(new k);this.onContextLoss=this._onContextLoss.event;this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new ze(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new lt(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,c,this._themeService)],this.dimensions=Vt(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(c.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let d={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",d),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register(ft(this._canvas,"webglcontextlost",u=>{console.log("webglcontextlost event received"),u.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(u)},3e3)})),this.register(ft(this._canvas,"webglcontextrestored",u=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Lt(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=It(this._canvas,this._coreBrowserService.window,(u,_)=>this._setCanvasDevicePixelDimensions(u,_)),this.register(this._coreBrowserService.onWindowChange(u=>{this._observerDisposable.value=It(this._canvas,u,(_,p)=>this._setCanvasDevicePixelDimensions(_,p))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register(y(()=>{for(let u of this._renderLayers)u.dispose();this._canvas.parentElement?.removeChild(this._canvas),Lt(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(t,r){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let s of this._renderLayers)s.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 t of this._renderLayers)t.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let t of this._renderLayers)t.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,r,s){for(let o of this._renderLayers)o.handleSelectionChanged(this._terminal,t,r,s);this._model.selection.update(this._core,t,r,s),this._requestRedrawViewport()}handleCursorMove(){for(let t of this._renderLayers)t.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new ot(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new it(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 t=je(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._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=Nt([ne(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),ne(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=t,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(t){this._model.clear(),t&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(t){return-1}deregisterCharacterJoiner(t){return!1}renderRows(t,r){if(!this._isAttached)if(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,t,r);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,r),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new Qe(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,r){let s=this._core,o=this._workCell,n,l,c,a,h,d,u,_,p,v,M,E,f,D;t=fi(t,s.rows-1,0),r=fi(r,s.rows-1,0);let ae=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,re=ae-s.buffer.ydisp,ue=Math.min(this._terminal.buffer.active.cursorX,s.cols-1),we=-1,ut=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ge=!1;for(l=t;l<=r;l++)for(c=l+s.buffer.ydisp,a=s.buffer.lines.get(c),this._model.lineLengths[l]=0,h=this._characterJoinerService.getJoinedCharacters(c),f=0;f<s.cols;f++)if(n=this._cellColorResolver.result.bg,a.loadCell(f,o),f===0&&(n=this._cellColorResolver.result.bg),d=!1,u=f,h.length>0&&f===h[0][0]&&(d=!0,_=h.shift(),o=new At(o,a.translateToString(!0,_[0],_[1]),_[1]-_[0]),u=_[1]-1),p=o.getChars(),v=o.getCode(),E=(l*s.cols+f)*ve,this._cellColorResolver.resolve(o,f,c,this.dimensions.device.cell.width),ut&&c===ae&&(f===ue&&(this._model.cursor={x:ue,y:re,width:o.getWidth(),style:this._coreBrowserService.isFocused?s.options.cursorStyle||"block":s.options.cursorInactiveStyle,cursorWidth:s.options.cursorWidth,dpr:this._devicePixelRatio},we=ue+o.getWidth()-1),f>=ue&&f<=we&&(this._coreBrowserService.isFocused&&(s.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&s.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)),v!==0&&(this._model.lineLengths[l]=f+1),!(this._model.cells[E]===v&&this._model.cells[E+fe]===this._cellColorResolver.result.bg&&this._model.cells[E+be]===this._cellColorResolver.result.fg&&this._model.cells[E+nt]===this._cellColorResolver.result.ext)&&(ge=!0,p.length>1&&(v|=hi),this._model.cells[E]=v,this._model.cells[E+fe]=this._cellColorResolver.result.bg,this._model.cells[E+be]=this._cellColorResolver.result.fg,this._model.cells[E+nt]=this._cellColorResolver.result.ext,M=o.getWidth(),this._glyphRenderer.value.updateCell(f,l,v,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,p,M,n),d))for(o=this._workCell,f++;f<u;f++)D=(l*s.cols+f)*ve,this._glyphRenderer.value.updateCell(f,l,0,0,0,0,Ht,0,0),this._model.cells[D]=0,this._model.cells[D+fe]=this._cellColorResolver.result.bg,this._model.cells[D+be]=this._cellColorResolver.result.fg,this._model.cells[D+nt]=this._cellColorResolver.result.ext;ge&&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(t,r){this._canvas.width===t&&this._canvas.height===r||(this._canvas.width=t,this._canvas.height=r,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},At=class extends Y{constructor(t,r,s){super();this.content=0;this.combinedData="";this.fg=t.fg,this.bg=t.bg,this.combinedData=r,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function fi(i,e,t=0){return Math.max(Math.min(i,e),t)}var bi="di$target",gi="di$dependencies",yt=new Map;function j(i){if(yt.has(i))return yt.get(i);let e=function(t,r,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Qi(e,t,s)};return e.toString=()=>i,yt.set(i,e),e}function Qi(i,e,t){e[bi]===e?e[gi].push({id:i,index:t}):(e[gi]=[{id:i,index:t}],e[bi]=e)}var Un=j("BufferService"),Wn=j("CoreMouseService"),Vn=j("CoreService"),zn=j("CharsetService"),Kn=j("InstantiationService");var qn=j("LogService"),Ci=j("OptionsService"),Xn=j("OscLinkService"),Yn=j("UnicodeService"),jn=j("DecorationService");var Ji={trace:0,debug:1,info:2,warn:3,error:4,off:5},er="xterm.js: ",ht=class extends H{constructor(t){super();this._optionsService=t;this._logLevel=5;this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),Ti=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Ji[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let r=0;r<t.length;r++)typeof t[r]=="function"&&(t[r]=t[r]())}_log(t,r,s){this._evalLazyOptionalParams(s),t.call(console,(this._optionsService.options.logger?"":er)+r,...s)}trace(t,...r){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,r)}debug(t,...r){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,r)}info(t,...r){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,r)}warn(t,...r){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,r)}error(t,...r){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,r)}};ht=Bt([Pt(0,Ci)],ht);var Ti;function Si(i){Ti=i}var xi=class extends H{constructor(t){if(vt&&$t()<16){let r={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",r))throw new Error("Webgl2 is only supported on Safari 16 and above")}super();this._preserveDrawingBuffer=t;this._onChangeTextureAtlas=this.register(new k);this.onChangeTextureAtlas=this._onChangeTextureAtlas.event;this._onAddTextureAtlasCanvas=this.register(new k);this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event;this._onRemoveTextureAtlasCanvas=this.register(new k);this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event;this._onContextLoss=this.register(new k);this.onContextLoss=this._onContextLoss.event}activate(t){let r=t._core;if(!t.element){this.register(r.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let s=r.coreService,o=r.optionsService,n=r,l=n._renderService,c=n._characterJoinerService,a=n._charSizeService,h=n._coreBrowserService,d=n._decorationService,u=n._logService,_=n._themeService;Si(u),this._renderer=this.register(new ct(t,c,a,h,s,d,o,_,this._preserveDrawingBuffer)),this.register(ne(this._renderer.onContextLoss,this._onContextLoss)),this.register(ne(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register(ne(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register(ne(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this.register(y(()=>{let p=this._terminal._core._renderService;p.setRenderer(this._terminal._core._createRenderer()),p.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};export{xi as WebglAddon};
75
75
  //# sourceMappingURL=xterm-addon-webgl.mjs.map