/**
 * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
 * @license MIT
 *
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * @license MIT
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 */
var e=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?a.isErrorNoTelemetry(e)?new a(e.message+"\n\n"+e.stack):new Error(e.message+"\n\n"+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function t(t){(function(e){return e instanceof o||e instanceof Error&&e.name===i&&e.message===i})(t)||e.onUnexpectedError(t)}var i="Canceled";var s,r,n,o=class extends Error{constructor(){super(i),this.name=this.message}},a=class e extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e)return t;let i=new e;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}};function h(e,t){let i,s=this,r=!1;return function(){return r||(r=!0,t||(i=e.apply(s,arguments))),i}}function l(e){if(n.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(b){t.push(b)}if(1===t.length)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function c(...e){return d(()=>l(e))}function d(e){return{dispose:h(()=>{e()})}}(r=s||={}).isLessThan=function(e){return e<0},r.isLessThanOrEqual=function(e){return e<=0},r.isGreaterThan=function(e){return e>0},r.isNeitherLessOrGreaterThan=function(e){return 0===e},r.greaterThan=1,r.lessThan=-1,r.neitherLessOrGreaterThan=0,(e=>{function t(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=t;let i=Object.freeze([]);function*s(e){yield e}e.empty=function(){return i},e.single=s,e.wrap=function(e){return t(e)?e:s(e)},e.from=function(e){return e||i},e.reverse=function*(e){for(let t=e.length-1;t>=0;t--)yield e[t]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){let i=0;for(let s of e)if(t(s,i++))return!0;return!1},e.find=function(e,t){for(let i of e)if(t(i))return i},e.filter=function*(e,t){for(let i of e)t(i)&&(yield i)},e.map=function*(e,t){let i=0;for(let s of e)yield t(s,i++)},e.flatMap=function*(e,t){let i=0;for(let s of e)yield*t(s,i++)},e.concat=function*(...e){for(let t of e)yield*t},e.reduce=function(e,t,i){let s=i;for(let r of e)s=t(s,r);return s},e.slice=function*(e,t,i=e.length){for(t<0&&(t+=e.length),i<0?i+=e.length:i>e.length&&(i=e.length);t<i;t++)yield e[t]},e.consume=function(t,i=Number.POSITIVE_INFINITY){let s=[];if(0===i)return[s,t];let r=t[Symbol.iterator]();for(let n=0;n<i;n++){let t=r.next();if(t.done)return[s,e.empty()];s.push(t.value)}return[s,{[Symbol.iterator]:()=>r}]},e.asyncToArray=async function(e){let t=[];for await(let i of e)t.push(i);return Promise.resolve(t)}})(n||={});var _=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{l(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&this._toDispose.delete(e)}};_.DISABLE_DISPOSED_WARNING=!1;var u=_,g=class{constructor(){this._store=new u,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};g.None=Object.freeze({dispose(){}});var v=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}clearAndLeak(){let e=this._value;return this._value=void 0,e}},f=typeof process<"u"&&"title"in process,p=f?"node":navigator.userAgent,m=f?"node":navigator.platform,w=p.includes("Firefox"),C=p.includes("Edge"),x=/^((?!chrome|android).)*safari/i.test(p);m.indexOf("Linux");var L,b,y,M,S,A,R=0,T=0,k=0,E=0,B={css:"#00000000",rgba:0};function P(e){let t=e.toString(16);return t.length<2?"0"+t:t}function $(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function D(e){if(!e)throw new Error("value must not be falsy");return e}function F(e){return 57508<=e&&e<=57558}function I(e){return F(e)||function(e){return 9472<=e&&e<=9631}(e)}function W(e,t,i=0){return(e-(2*Math.round(t)-i))%(2*Math.round(t))}(b=L||={}).toCss=function(e,t,i,s){return void 0!==s?`#${P(e)}${P(t)}${P(i)}${P(s)}`:`#${P(e)}${P(t)}${P(i)}`},b.toRgba=function(e,t,i,s=255){return(e<<24|t<<16|i<<8|s)>>>0},b.toColor=function(e,t,i,s){return{css:b.toCss(e,t,i,s),rgba:b.toRgba(e,t,i,s)}},(e=>{function t(e,t){return E=Math.round(255*t),[R,T,k]=A.toChannels(e.rgba),{css:L.toCss(R,T,k,E),rgba:L.toRgba(R,T,k,E)}}e.blend=function(e,t){if(1===(E=(255&t.rgba)/255))return{css:t.css,rgba:t.rgba};let i=t.rgba>>24&255,s=t.rgba>>16&255,r=t.rgba>>8&255,n=e.rgba>>24&255,o=e.rgba>>16&255,a=e.rgba>>8&255;return R=n+Math.round((i-n)*E),T=o+Math.round((s-o)*E),k=a+Math.round((r-a)*E),{css:L.toCss(R,T,k),rgba:L.toRgba(R,T,k)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,i){let s=A.ensureContrastRatio(e.rgba,t.rgba,i);if(s)return L.toColor(s>>24&255,s>>16&255,s>>8&255)},e.opaque=function(e){let t=(255|e.rgba)>>>0;return[R,T,k]=A.toChannels(t),{css:L.toCss(R,T,k),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,i){return t(e,(E=255&e.rgba)*i/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}})(y||={}),(e=>{let t,i;try{let e=document.createElement("canvas");e.width=1,e.height=1;let s=e.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return R=parseInt(e.slice(1,2).repeat(2),16),T=parseInt(e.slice(2,3).repeat(2),16),k=parseInt(e.slice(3,4).repeat(2),16),L.toColor(R,T,k);case 5:return R=parseInt(e.slice(1,2).repeat(2),16),T=parseInt(e.slice(2,3).repeat(2),16),k=parseInt(e.slice(3,4).repeat(2),16),E=parseInt(e.slice(4,5).repeat(2),16),L.toColor(R,T,k,E);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let s=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return R=parseInt(s[1]),T=parseInt(s[2]),k=parseInt(s[3]),E=Math.round(255*(void 0===s[5]?1:parseFloat(s[5]))),L.toColor(R,T,k,E);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[R,T,k,E]=t.getImageData(0,0,1,1).data,255!==E)throw new Error("css.toColor: Unsupported css format");return{rgba:L.toRgba(R,T,k,E),css:e}}})(M||={}),(e=>{function t(e,t,i){let s=e/255,r=t/255,n=i/255;return.2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t})(S||={}),(e=>{function t(e,t,i){let s=e>>24&255,r=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,h=t>>8&255,l=$(S.relativeLuminance2(o,a,h),S.relativeLuminance2(s,r,n));for(;l<i&&(o>0||a>0||h>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),h-=Math.max(0,Math.ceil(.1*h)),l=$(S.relativeLuminance2(o,a,h),S.relativeLuminance2(s,r,n));return(o<<24|a<<16|h<<8|255)>>>0}function i(e,t,i){let s=e>>24&255,r=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,h=t>>8&255,l=$(S.relativeLuminance2(o,a,h),S.relativeLuminance2(s,r,n));for(;l<i&&(o<255||a<255||h<255);)o=Math.min(255,o+Math.ceil(.1*(255-o))),a=Math.min(255,a+Math.ceil(.1*(255-a))),h=Math.min(255,h+Math.ceil(.1*(255-h))),l=$(S.relativeLuminance2(o,a,h),S.relativeLuminance2(s,r,n));return(o<<24|a<<16|h<<8|255)>>>0}e.blend=function(e,t){if(1===(E=(255&t)/255))return t;let i=t>>24&255,s=t>>16&255,r=t>>8&255,n=e>>24&255,o=e>>16&255,a=e>>8&255;return R=n+Math.round((i-n)*E),T=o+Math.round((s-o)*E),k=a+Math.round((r-a)*E),L.toRgba(R,T,k)},e.ensureContrastRatio=function(e,s,r){let n=S.relativeLuminance(e>>8),o=S.relativeLuminance(s>>8);if($(n,o)<r){if(o<n){let o=t(e,s,r),a=$(n,S.relativeLuminance(o>>8));if(a<r){let t=i(e,s,r);return a>$(n,S.relativeLuminance(t>>8))?o:t}return o}let a=i(e,s,r),h=$(n,S.relativeLuminance(a>>8));if(h<r){let i=t(e,s,r);return h>$(n,S.relativeLuminance(i>>8))?a:i}return a}},e.reduceLuminance=t,e.increaseLuminance=i,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]}})(A||={});var z,O=0,U=0,N=!1,q=!1,G=!1,H=0,V=class{constructor(e,t,i,s,r,n){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=s,this._coreBrowserService=r,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,s){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=268435456&e.bg?e.extended.ext:0,U=0,O=0,q=!1,N=!1,G=!1,z=this._themeService.colors,H=0,0!==e.getCode()&&4===e.extended.underlineStyle){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));H=t*s%(2*Math.round(e))}if(this._decorationService.forEachDecorationAtCell(t,i,"bottom",e=>{e.backgroundColorRGB&&(U=e.backgroundColorRGB.rgba>>8&16777215,q=!0),e.foregroundColorRGB&&(O=e.foregroundColorRGB.rgba>>8&16777215,N=!0)}),G=this._selectionRenderModel.isCellSelected(this._terminal,t,i)){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:U=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:U=(16777215&this.result.fg)<<8|255;break;default:U=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:U=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:U=(16777215&this.result.bg)<<8|255}U=A.blend(U,4294967040&(this._coreBrowserService.isFocused?z.selectionBackgroundOpaque:z.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else U=(this._coreBrowserService.isFocused?z.selectionBackgroundOpaque:z.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(q=!0,z.selectionForeground&&(O=z.selectionForeground.rgba>>8&16777215,N=!0),I(e.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))O=(this._coreBrowserService.isFocused?z.selectionBackgroundOpaque:z.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:O=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:O=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:O=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:O=(16777215&this.result.fg)<<8|255;break;default:O=this._themeService.colors.foreground.rgba}O=A.blend(O,4294967040&(this._coreBrowserService.isFocused?z.selectionBackgroundOpaque:z.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}N=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",e=>{e.backgroundColorRGB&&(U=e.backgroundColorRGB.rgba>>8&16777215,q=!0),e.foregroundColorRGB&&(O=e.foregroundColorRGB.rgba>>8&16777215,N=!0)}),q&&(U=G?-16777216&e.bg&-134217729|U|50331648:-16777216&e.bg|U|50331648),N&&(O=-16777216&e.fg&-67108865|O|50331648),67108864&this.result.fg&&(q&&!N&&(O=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&z.background.rgba>>8|50331648,N=!0),!q&&N&&(U=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&z.foreground.rgba>>8|50331648,q=!0)),z=void 0,this.result.bg=q?U:this.result.bg,this.result.fg=N?O:this.result.fg,this.result.ext&=536870911,this.result.ext|=H<<29&3758096384}},j=w||C?"bottom":"ideographic",Y={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{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}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{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}],"🮖":[{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}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},X={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},Z={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},Q={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};function K(e,t,i,s,r,n,o,a){let h=Y[t];if(h)return function(e,t,i,s,r,n){for(let o=0;o<t.length;o++){let a=t[o],h=r/8,l=n/8;e.fillRect(i+a.x*h,s+a.y*l,a.w*h,a.h*l)}}(e,h,i,s,r,n),!0;let l=X[t];if(l)return function(e,t,i,s,r,n){let o=J.get(t);o||(o=new Map,J.set(t,o));let a=e.fillStyle;if("string"!=typeof a)throw new Error(`Unexpected fillStyle type "${a}"`);let h=o.get(a);if(!h){let i=t[0].length,s=t.length,r=e.canvas.ownerDocument.createElement("canvas");r.width=i,r.height=s;let n,l,c,d,_=D(r.getContext("2d")),u=new ImageData(i,s);if(a.startsWith("#"))n=parseInt(a.slice(1,3),16),l=parseInt(a.slice(3,5),16),c=parseInt(a.slice(5,7),16),d=a.length>7&&parseInt(a.slice(7,9),16)||1;else{if(!a.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);[n,l,c,d]=a.substring(5,a.length-1).split(",").map(e=>parseFloat(e))}for(let e=0;e<s;e++)for(let s=0;s<i;s++)u.data[4*(e*i+s)]=n,u.data[4*(e*i+s)+1]=l,u.data[4*(e*i+s)+2]=c,u.data[4*(e*i+s)+3]=t[e][s]*(255*d);_.putImageData(u,0,0),h=D(e.createPattern(r,null)),o.set(a,h)}e.fillStyle=h,e.fillRect(i,s,r,n)}(e,l,i,s,r,n),!0;let c=Z[t];if(c)return function(e,t,i,s,r,n,o){e.strokeStyle=e.fillStyle;for(let[a,h]of Object.entries(t)){let t;if(e.beginPath(),e.lineWidth=o*Number.parseInt(a),"function"==typeof h){t=h(.15,.15/n*r)}else t=h;for(let a of t.split(" ")){let t=a[0],h=te[t];if(!h){console.error(`Could not find drawing instructions for "${t}"`);continue}let l=a.substring(1).split(",");!l[0]||!l[1]||h(e,ie(l,r,n,i,s,!0,o))}e.stroke(),e.closePath()}}(e,c,i,s,r,n,a),!0;let d=Q[t];return!!d&&(function(e,t,i,s,r,n,o,a){let h=new Path2D;h.rect(i,s,r,n),e.clip(h),e.beginPath();let l=o/12;e.lineWidth=a*l;for(let c of t.d.split(" ")){let o=c[0],h=te[o];if(!h){console.error(`Could not find drawing instructions for "${o}"`);continue}let d=c.substring(1).split(",");!d[0]||!d[1]||h(e,ie(d,r,n,i,s,!1,a,(t.leftPadding??0)*(l/2),(t.rightPadding??0)*(l/2)))}1===t.type?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}(e,d,i,s,r,n,o,a),!0)}Q[""]=Q[""],Q[""]=Q[""];var J=new Map;function ee(e,t,i=0){return Math.max(Math.min(e,t),i)}var te={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function ie(e,t,i,s,r,n,o,a=0,h=0){let l=e.map(e=>parseFloat(e)||parseInt(e));if(l.length<2)throw new Error("Too few arguments for instruction");for(let c=0;c<l.length;c+=2)l[c]*=t-a*o-h*o,n&&0!==l[c]&&(l[c]=ee(Math.round(l[c]+.5)-.5,t,0)),l[c]+=s+a*o;for(let c=1;c<l.length;c+=2)l[c]*=i,n&&0!==l[c]&&(l[c]=ee(Math.round(l[c]+.5)-.5,i,0)),l[c]+=r;return l}var se,re=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},ne=class{constructor(){this._data=new re}set(e,t,i,s,r){this._data.get(e,t)||this._data.set(e,t,new re),this._data.get(e,t).set(i,s,r)}get(e,t,i,s){return this._data.get(e,t)?.get(i,s)}clear(){this._data.clear()}},oe=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),r=e.timeRemaining(),1.5*i>r)return s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),void this._start();s=r}this.clear()}},ae=!f&&"requestIdleCallback"in window?class extends oe{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:class extends oe{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},he=class e{constructor(){this.fg=0,this.bg=0,this.extended=new le}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return!(50331648&~this.fg)}isBgRGB(){return!(50331648&~this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&~this.extended.underlineColor):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},le=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(3758096384&this._ext)>>29;return e<0?4294967288^e:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},ce=globalThis.performance&&"function"==typeof globalThis.performance.now,de=class e{static create(t){return new e(t)}constructor(e){this._now=ce&&!1===e?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return-1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}};(e=>{function t(e){return(t,i=null,s)=>{let r,n=!1;return r=e(e=>{if(!n)return r?r.dispose():n=!0,t.call(i,e)},null,s),n&&r.dispose(),r}}function i(e,t,i){return r((i,s=null,r)=>e(e=>i.call(s,t(e)),null,r),i)}function s(e,t,i){return r((i,s=null,r)=>e(e=>t(e)&&i.call(s,e),null,r),i)}function r(e,t){let i,s=new Le({onWillAddFirstListener(){i=e(s.fire,s)},onDidRemoveLastListener(){i?.dispose()}});return t?.add(s),s.event}function n(e,t,i=100,s=!1,r=!1,n,o){let a,h,l,c,d=0,_=new Le({leakWarningThreshold:n,onWillAddFirstListener(){a=e(e=>{d++,h=t(h,e),s&&!l&&(_.fire(h),h=void 0),c=()=>{let e=h;h=void 0,l=void 0,(!s||d>1)&&_.fire(e),d=0},"number"==typeof i?(clearTimeout(l),l=setTimeout(c,i)):void 0===l&&(l=0,queueMicrotask(c))})},onWillRemoveListener(){r&&d>0&&c?.()},onDidRemoveLastListener(){c=void 0,a.dispose()}});return o?.add(_),_.event}e.None=()=>g.None,e.defer=function(e,t){return n(e,()=>{},0,void 0,!0,void 0,t)},e.once=t,e.map=i,e.forEach=function(e,t,i){return r((i,s=null,r)=>e(e=>{t(e),i.call(s,e)},null,r),i)},e.filter=s,e.signal=function(e){return e},e.any=function(...e){return(t,i=null,s)=>function(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}(c(...e.map(e=>e(e=>t.call(i,e)))),s)},e.reduce=function(e,t,s,r){let n=s;return i(e,e=>(n=t(n,e),n),r)},e.debounce=n,e.accumulate=function(t,i=0,s){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],i,void 0,!0,void 0,s)},e.latch=function(e,t=(e,t)=>e===t,i){let r,n=!0;return s(e,e=>{let i=n||!t(e,r);return n=!1,r=e,i},i)},e.split=function(t,i,s){return[e.filter(t,i,s),e.filter(t,e=>!i(e),s)]},e.buffer=function(e,t=!1,i=[],s){let r=i.slice(),n=e(e=>{r?r.push(e):a.fire(e)});s&&s.add(n);let o=()=>{r?.forEach(e=>a.fire(e)),r=null},a=new Le({onWillAddFirstListener(){n||(n=e(e=>a.fire(e)),s&&s.add(n))},onDidAddFirstListener(){r&&(t?setTimeout(o):o())},onDidRemoveLastListener(){n&&n.dispose(),n=null}});return s&&s.add(a),a.event},e.chain=function(e,t){return(i,s,r)=>{let n=t(new a);return e(function(e){let t=n.evaluate(e);t!==o&&i.call(s,t)},void 0,r)}};let o=Symbol("HaltChainable");class a{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:o),this}reduce(e,t){let i=t;return this.steps.push(t=>(i=e(i,t),i)),this}latch(e=(e,t)=>e===t){let t,i=!0;return this.steps.push(s=>{let r=i||!e(s,t);return i=!1,t=s,r?s:o}),this}evaluate(e){for(let t of this.steps)if((e=t(e))===o)break;return e}}e.fromNodeEventEmitter=function(e,t,i=e=>e){let s=(...e)=>r.fire(i(...e)),r=new Le({onWillAddFirstListener:()=>e.on(t,s),onDidRemoveLastListener:()=>e.removeListener(t,s)});return r.event},e.fromDOMEventEmitter=function(e,t,i=e=>e){let s=(...e)=>r.fire(i(...e)),r=new Le({onWillAddFirstListener:()=>e.addEventListener(t,s),onDidRemoveLastListener:()=>e.removeEventListener(t,s)});return r.event},e.toPromise=function(e){return new Promise(i=>t(e)(i))},e.fromPromise=function(e){let t=new Le;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event},e.forward=function(e,t){return e(e=>t.fire(e))},e.runAndSubscribe=function(e,t,i){return t(i),e(e=>t(e))};class h{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let i={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new Le(i),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,t){return new h(e,t).emitter.event},e.fromObservableLight=function(e){return(t,i,s)=>{let r=0,n=!1,o={beginUpdate(){r++},endUpdate(){r--,0===r&&(e.reportChanges(),n&&(n=!1,t.call(i)))},handlePossibleChange(){},handleChange(){n=!0}};e.addObserver(o),e.reportChanges();let a={dispose(){e.removeObserver(o)}};return s instanceof u?s.add(a):Array.isArray(s)&&s.push(a),a}}})(se||={});var _e=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new de,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};_e.all=new Set,_e._idPool=0;var ue=_e,ge=class e{constructor(t,i,s=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let i=this.threshold;if(i<=0||t<i)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*i;let[e,s]=this.getMostFrequentStack(),r=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${s}):`;console.warn(r),console.warn(e);let n=new me(r,e);this._errorHandler(n)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[i,s]of this._stacks)(!e||t<s)&&(e=[i,s],t=s);return e}};ge._idPool=1;var ve,fe=ge,pe=class e{constructor(e){this.value=e}static create(){let t=new Error;return new e(t.stack??"")}print(){console.warn(this.value.split("\n").slice(2).join("\n"))}},me=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},we=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Ce=0,xe=class{constructor(e){this.value=e,this.id=Ce++}},Le=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new fe(e?.onListenerError??t,this._options?.leakWarningThreshold??-1):void 0,this._perfMon=this._options?._profName?new ue(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,i,s)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let i=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],s=new we(`${e}. HINT: Stack shows most frequent listener (${i[1]}-times)`,i[0]);return(this._options?.onListenerError||t)(s),g.None}if(this._disposed)return g.None;i&&(e=e.bind(i));let r,n=new xe(e);this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(n.stack=pe.create(),r=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof xe?(this._deliveryQueue??=new be,this._listeners=[this._listeners,n]):this._listeners.push(n):(this._options?.onWillAddFirstListener?.(this),this._listeners=n,this._options?.onDidAddFirstListener?.(this)),this._size++;let o=d(()=>{r?.(),this._removeListener(n)});return s instanceof u?s.add(o):Array.isArray(s)&&s.push(o),o},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(1===this._size)return this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),void(this._size=0);let t=this._listeners,i=t.indexOf(e);if(-1===i)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let s=this._deliveryQueue.current===this;if(2*this._size<=t.length){let e=0;for(let i=0;i<t.length;i++)t[i]?t[e++]=t[i]:s&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,i){if(!e)return;let s=this._options?.onListenerError||t;if(s)try{e.value(i)}catch(r){s(r)}else e.value(i)}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof xe)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},be=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},ye={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}},Me=class e{constructor(e,t,i){this._document=e,this._config=t,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new ne,this._cacheMapCombined=new ne,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new he,this._textureSize=512,this._onAddTextureAtlasCanvas=new Le,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Le,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=Re(e,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=D(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new ae;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let e=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,e)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(0!==this._pages[0].currentRow.x||0!==this._pages[0].currentRow.y){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let t=this._pages.filter(t=>2*t.canvas.width<=(e.maxTextureSize||4096)).sort((e,t)=>t.canvas.width!==e.canvas.width?t.canvas.width-e.canvas.width:t.percentageUsed-e.percentageUsed),i=-1,s=0;for(let e=0;e<t.length;e++)if(t[e].canvas.width!==s)i=e,s=t[e].canvas.width;else if(e-i===3)break;let r=t.slice(i,i+4),n=r.map(e=>e.glyphs[0].texturePage).sort((e,t)=>e>t?1:-1),o=this.pages.length-r.length,a=this._mergePages(r,o);a.version++;for(let e=n.length-1;e>=0;e--)this._deletePage(n[e]);this.pages.push(a),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(a.canvas)}let t=new Se(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(e,t){let i=2*e[0].canvas.width,s=new Se(this._document,i,e);for(let[r,n]of e.entries()){let e=r*n.canvas.width%i,o=Math.floor(r/2)*n.canvas.height;s.ctx.drawImage(n.canvas,e,o);for(let s of n.glyphs)s.texturePage=t,s.sizeClipSpace.x=s.size.x/i,s.sizeClipSpace.y=s.size.y/i,s.texturePosition.x+=e,s.texturePosition.y+=o,s.texturePositionClipSpace.x=s.texturePosition.x/i,s.texturePositionClipSpace.y=s.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(n.canvas);let a=this._activePages.indexOf(n);-1!==a&&this._activePages.splice(a,1)}return s}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,i,s,r,n){return this._getFromCacheMap(this._cacheMapCombined,e,t,i,s,r,n)}getRasterizedGlyph(e,t,i,s,r,n){return this._getFromCacheMap(this._cacheMap,e,t,i,s,r,n)}_getFromCacheMap(e,t,i,s,r,n,o){return(ve=e.get(t,i,s,r))||(ve=this._drawToCache(t,i,s,r,n,o),e.set(t,i,s,r,ve)),ve}_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,i,s){if(this._config.allowTransparency)return B;let r;switch(e){case 16777216:case 33554432:r=this._getColorFromAnsiIndex(t);break;case 50331648:let e=he.toColorRGB(t);r=L.toColor(e[0],e[1],e[2]);break;default:r=i?y.opaque(this._config.colors.foreground):this._config.colors.background}return this._config.allowTransparency||(r=y.opaque(r)),r}_getForegroundColor(e,t,i,s,r,n,o,a,h,l){let c,d=this._getMinimumContrastColor(e,t,i,s,r,n,o,h,a,l);if(d)return d;switch(r){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&h&&n<8&&(n+=8),c=this._getColorFromAnsiIndex(n);break;case 50331648:let e=he.toColorRGB(n);c=L.toColor(e[0],e[1],e[2]);break;default:c=o?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(c=y.opaque(c)),a&&(c=y.multiplyOpacity(c,.5)),c}_resolveBackgroundRgba(e,t,i){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,i,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;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,i,s,r,n,o,a,h,l){if(1===this._config.minimumContrastRatio||l)return;let c=this._getContrastCache(h),d=c.getColor(e,s);if(void 0!==d)return d||void 0;let _=this._resolveBackgroundRgba(t,i,o),u=this._resolveForegroundRgba(r,n,o,a),g=A.ensureContrastRatio(_,u,this._config.minimumContrastRatio/(h?2:1));if(!g)return void c.setColor(e,s,null);let v=L.toColor(g>>24&255,g>>16&255,g>>8&255);return c.setColor(e,s,v),v}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,s,r,n,o){let a="number"==typeof t?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let h=Math.min(this._config.deviceCellWidth*Math.max(a.length,2)+4,this._config.deviceMaxTextureSize);this._tmpCanvas.width<h&&(this._tmpCanvas.width=h);let l=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=r,this._workAttributeData.isInvisible())return ye;let c=!!this._workAttributeData.isBold(),d=!!this._workAttributeData.isInverse(),_=!!this._workAttributeData.isDim(),u=!!this._workAttributeData.isItalic(),g=!!this._workAttributeData.isUnderline(),v=!!this._workAttributeData.isStrikethrough(),f=!!this._workAttributeData.isOverline(),p=this._workAttributeData.getFgColor(),m=this._workAttributeData.getFgColorMode(),w=this._workAttributeData.getBgColor(),C=this._workAttributeData.getBgColorMode();if(d){let e=p;p=w,w=e;let t=m;m=C,C=t}let x=this._getBackgroundColor(C,w,d,_);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let L=c?this._config.fontWeightBold:this._config.fontWeight,b=u?"italic":"";this._tmpCtx.font=`${b} ${L} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=j;let y=1===a.length&&F(a.charCodeAt(0)),M=1===a.length&&(57520<=(A=a.charCodeAt(0))&&A<=57527),S=this._getForegroundColor(i,C,w,s,m,p,d,_,c,I(a.charCodeAt(0)));var A;this._tmpCtx.fillStyle=S.css;let R=M?0:4,T=!1;!1!==this._config.customGlyphs&&(T=K(this._tmpCtx,a,R,R,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let k,E=!y;if(k="number"==typeof t?this._unicodeService.wcwidth(t):this._unicodeService.getStringCellWidth(t),g){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())E=!1,this._tmpCtx.strokeStyle=`rgb(${he.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{E=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let i=R,s=Math.ceil(R+this._config.deviceCharHeight)-t-(n?2*e:0),r=s+e,o=s+2*e,h=this._workAttributeData.getUnderlineVariantOffset();for(let n=0;n<k;n++){this._tmpCtx.save();let a=i+n*this._config.deviceCellWidth,l=i+(n+1)*this._config.deviceCellWidth,c=a+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(a,s),this._tmpCtx.lineTo(l,s),this._tmpCtx.moveTo(a,o),this._tmpCtx.lineTo(l,o);break;case 3:let i=e<=1?o:Math.ceil(R+this._config.deviceCharHeight-e/2)-t,n=e<=1?s:Math.ceil(R+this._config.deviceCharHeight+e/2)-t,d=new Path2D;d.rect(a,s,this._config.deviceCellWidth,o-s),this._tmpCtx.clip(d),this._tmpCtx.moveTo(a-this._config.deviceCellWidth/2,r),this._tmpCtx.bezierCurveTo(a-this._config.deviceCellWidth/2,n,a,n,a,r),this._tmpCtx.bezierCurveTo(a,i,c,i,c,r),this._tmpCtx.bezierCurveTo(c,n,l,n,l,r),this._tmpCtx.bezierCurveTo(l,i,l+this._config.deviceCellWidth/2,i,l+this._config.deviceCellWidth/2,r);break;case 4:let _=0===h?0:h>=e?2*e-h:e-h;!1==!(h>=e)||0===_?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(a+_,s),this._tmpCtx.lineTo(l,s)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(a,s),this._tmpCtx.lineTo(a+_,s),this._tmpCtx.moveTo(a+_+e,s),this._tmpCtx.lineTo(l,s)),h=W(l-a,e,h);break;case 5:let u=.6,g=.3,v=l-a,f=Math.floor(u*v),p=Math.floor(g*v),m=v-f-p;this._tmpCtx.setLineDash([f,p,m]),this._tmpCtx.moveTo(a,s),this._tmpCtx.lineTo(l,s);break;default:this._tmpCtx.moveTo(a,s),this._tmpCtx.lineTo(l,s)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!T&&this._config.fontSize>=12&&!this._config.allowTransparency&&" "!==a){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let t=this._tmpCtx.measureText(a);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(i,s-Math.ceil(e/2),this._config.deviceCellWidth*k,o-s+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(a,R,R+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(f){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=e%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(R,R+t),this._tmpCtx.lineTo(R+this._config.deviceCharWidth*k,R+t),this._tmpCtx.stroke()}if(T||this._tmpCtx.fillText(a,R,R+this._config.deviceCharHeight),"_"===a&&!this._config.allowTransparency){let e=Ae(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),x,S,E);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(a,R,R+this._config.deviceCharHeight-t),e=Ae(this._tmpCtx.getImageData(R,R,this._config.deviceCellWidth,this._config.deviceCellHeight),x,S,E),e);t++);}if(v){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(R,R+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(R+this._config.deviceCharWidth*k,R+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let B,P=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);if(B=this._config.allowTransparency?function(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}(P):Ae(P,x,S,E),B)return ye;let $,D,z=this._findGlyphBoundingBox(P,this._workBoundingBox,h,M,T,R);for(;;){if(0===this._activePages.length){let e=this._createNewPage();$=e,D=e.currentRow,D.height=z.size.y;break}$=this._activePages[this._activePages.length-1],D=$.currentRow;for(let e of this._activePages)z.size.y<=e.currentRow.height&&($=e,D=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=D.height&&z.size.y<=t.height&&($=this._activePages[e],D=t);if(z.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Se(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),$=this._overflowSizePage,D=this._overflowSizePage.currentRow,D.x+z.size.x>=$.canvas.width&&(D.x=0,D.y+=D.height,D.height=0);break}if(D.y+z.size.y>=$.canvas.height||D.height>z.size.y+2){let t=!1;if($.currentRow.y+$.currentRow.height+z.size.y>=$.canvas.height){let i;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+z.size.y<e.canvas.height){i=e;break}if(i)$=i;else if(e.maxAtlasPages&&this._pages.length>=e.maxAtlasPages&&D.y+z.size.y<=$.canvas.height&&D.height>=z.size.y&&D.x+z.size.x<=$.canvas.width)t=!0;else{let e=this._createNewPage();$=e,D=e.currentRow,D.height=z.size.y,t=!0}}t||($.currentRow.height>0&&$.fixedRows.push($.currentRow),D={x:0,y:$.currentRow.y+$.currentRow.height,height:z.size.y},$.fixedRows.push(D),$.currentRow={x:0,y:D.y+D.height,height:0})}if(D.x+z.size.x<=$.canvas.width)break;D===$.currentRow?(D.x=0,D.y+=D.height,D.height=0):$.fixedRows.splice($.fixedRows.indexOf(D),1)}return z.texturePage=this._pages.indexOf($),z.texturePosition.x=D.x,z.texturePosition.y=D.y,z.texturePositionClipSpace.x=D.x/$.canvas.width,z.texturePositionClipSpace.y=D.y/$.canvas.height,z.sizeClipSpace.x/=$.canvas.width,z.sizeClipSpace.y/=$.canvas.height,D.height=Math.max(D.height,z.size.y),D.x+=z.size.x,$.ctx.putImageData(P,z.texturePosition.x-this._workBoundingBox.left,z.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,z.size.x,z.size.y),$.addGlyph(z),$.version++,z}_findGlyphBoundingBox(e,t,i,s,r,n){t.top=0;let o=s?this._config.deviceCellHeight:this._tmpCanvas.height,a=s?this._config.deviceCellWidth:i,h=!1;for(let l=0;l<o;l++){for(let i=0;i<a;i++){let s=l*this._tmpCanvas.width*4+4*i+3;if(0!==e.data[s]){t.top=l,h=!0;break}}if(h)break}t.left=0,h=!1;for(let l=0;l<n+a;l++){for(let i=0;i<o;i++){let s=i*this._tmpCanvas.width*4+4*l+3;if(0!==e.data[s]){t.left=l,h=!0;break}}if(h)break}t.right=a,h=!1;for(let l=n+a-1;l>=n;l--){for(let i=0;i<o;i++){let s=i*this._tmpCanvas.width*4+4*l+3;if(0!==e.data[s]){t.right=l,h=!0;break}}if(h)break}t.bottom=o,h=!1;for(let l=o-1;l>=0;l--){for(let i=0;i<a;i++){let s=l*this._tmpCanvas.width*4+4*i+3;if(0!==e.data[s]){t.bottom=l,h=!0;break}}if(h)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||r?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+n+(s||r?1===this._config.lineHeight?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Se=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let s of i)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=Re(e,t,t),this.ctx=D(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 Ae(e,t,i,s){let r=t.rgba>>>24,n=t.rgba>>>16&255,o=t.rgba>>>8&255,a=i.rgba>>>24,h=i.rgba>>>16&255,l=i.rgba>>>8&255,c=Math.floor((Math.abs(r-a)+Math.abs(n-h)+Math.abs(o-l))/12),d=!0;for(let _=0;_<e.data.length;_+=4)e.data[_]===r&&e.data[_+1]===n&&e.data[_+2]===o||s&&Math.abs(e.data[_]-r)+Math.abs(e.data[_+1]-n)+Math.abs(e.data[_+2]-o)<c?e.data[_+3]=0:d=!1;return d}function Re(e,t,i){let s=e.createElement("canvas");return s.width=t,s.height=i,s}function Te(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}var ke=[];function Ee(e,t,i,s,r,n,o,a,h){let l=function(e,t,i,s,r,n,o,a){let h={foreground:n.foreground,background:n.background,cursor:B,cursorAccent:B,selectionForeground:B,selectionBackgroundTransparent:B,selectionBackgroundOpaque:B,selectionInactiveBackgroundTransparent:B,selectionInactiveBackgroundOpaque:B,overviewRulerBorder:B,scrollbarSliderBackground:B,scrollbarSliderHoverBackground:B,scrollbarSliderActiveBackground:B,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:a,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:i,deviceCharHeight:s,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:h}}(s,r,n,o,t,i,a,h);for(let _=0;_<ke.length;_++){let t=ke[_],i=t.ownedBy.indexOf(e);if(i>=0){if(Te(t.config,l))return t.atlas;1===t.ownedBy.length?(t.atlas.dispose(),ke.splice(_,1)):t.ownedBy.splice(i,1);break}}for(let _=0;_<ke.length;_++){let t=ke[_];if(Te(t.config,l))return t.ownedBy.push(e),t.atlas}let c=e._core,d={atlas:new Me(document,l,c.unicodeService),config:l,ownedBy:[e]};return ke.push(d),d.atlas}function Be(e){for(let t=0;t<ke.length;t++){let i=ke[t].ownedBy.indexOf(e);if(-1!==i){1===ke[t].ownedBy.length?(ke[t].atlas.dispose(),ke.splice(t,1)):ke[t].ownedBy.splice(i,1);break}}}var Pe=600,$e=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=Pe){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=Pe-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0)return void this._restartInterval(e)}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 e=Pe-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(e)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Pe)},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 De(e,t,i){let s=new t.ResizeObserver(t=>{let r=t.find(t=>t.target===e);if(!r)return;if(!("devicePixelContentBoxSize"in r))return s?.disconnect(),void(s=void 0);let n=r.devicePixelContentBoxSize[0].inlineSize,o=r.devicePixelContentBoxSize[0].blockSize;n>0&&o>0&&i(n,o)});try{s.observe(e,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return d(()=>s?.disconnect())}var Fe=class e extends he{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new le,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(e=2097151&this.content)>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e):"";var e}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(2===e[1].length){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=1024*(i-55296)+s-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ie=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function We(e,t,i){let s=D(e.createProgram());if(e.attachShader(s,D(ze(e,e.VERTEX_SHADER,t))),e.attachShader(s,D(ze(e,e.FRAGMENT_SHADER,i))),e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS))return s;console.error(e.getProgramInfoLog(s)),e.deleteProgram(s)}function ze(e,t,i){let s=D(e.createShader(t));if(e.shaderSource(s,i),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS))return s;console.error(e.getShaderInfoLog(s)),e.deleteShader(s)}var Oe=class{constructor(e){this.texture=e,this.version=-1}};var Ue,Ne=11,qe=Ne*Float32Array.BYTES_PER_ELEMENT,Ge=0,He=0,Ve=0,je=class extends g{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let r=this._gl;void 0===Me.maxAtlasPages&&(Me.maxAtlasPages=Math.min(32,D(r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS))),Me.maxTextureSize=D(r.getParameter(r.MAX_TEXTURE_SIZE))),this._program=D(We(r,"#version 300 es\nlayout (location = 0) in vec2 a_unitquad;\nlayout (location = 1) in vec2 a_cellpos;\nlayout (location = 2) in vec2 a_offset;\nlayout (location = 3) in vec2 a_size;\nlayout (location = 4) in float a_texpage;\nlayout (location = 5) in vec2 a_texcoord;\nlayout (location = 6) in vec2 a_texsize;\n\nuniform mat4 u_projection;\nuniform vec2 u_resolution;\n\nout vec2 v_texcoord;\nflat out int v_texpage;\n\nvoid main() {\n  vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);\n  gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);\n  v_texpage = int(a_texpage);\n  v_texcoord = a_texcoord + a_unitquad * a_texsize;\n}",function(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es\nprecision lowp float;\n\nin vec2 v_texcoord;\nflat in int v_texpage;\n\nuniform sampler2D u_texture[${e}];\n\nout vec4 outColor;\n\nvoid main() {\n  if (v_texpage == 0) {\n    outColor = texture(u_texture[0], v_texcoord);\n  } ${t}\n}`}(Me.maxAtlasPages))),this._register(d(()=>r.deleteProgram(this._program))),this._projectionLocation=D(r.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=D(r.getUniformLocation(this._program,"u_resolution")),this._textureLocation=D(r.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(d(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),h=r.createBuffer();this._register(d(()=>r.deleteBuffer(h))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h),r.bufferData(r.ELEMENT_ARRAY_BUFFER,a,r.STATIC_DRAW),this._attributesBuffer=D(r.createBuffer()),this._register(d(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,2,r.FLOAT,!1,qe,0),r.vertexAttribDivisor(2,1),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,r.FLOAT,!1,qe,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(3,1),r.enableVertexAttribArray(4),r.vertexAttribPointer(4,1,r.FLOAT,!1,qe,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(4,1),r.enableVertexAttribArray(5),r.vertexAttribPointer(5,2,r.FLOAT,!1,qe,5*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(5,1),r.enableVertexAttribArray(6),r.vertexAttribPointer(6,2,r.FLOAT,!1,qe,7*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(6,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,qe,9*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.useProgram(this._program);let l=new Int32Array(Me.maxAtlasPages);for(let c=0;c<Me.maxAtlasPages;c++)l[c]=c;r.uniform1iv(this._textureLocation,l),r.uniformMatrix4fv(this._projectionLocation,!1,Ie),this._atlasTextures=[];for(let c=0;c<Me.maxAtlasPages;c++){let e=new Oe(D(r.createTexture()));this._register(d(()=>r.deleteTexture(e.texture))),r.activeTexture(r.TEXTURE0+c),r.bindTexture(r.TEXTURE_2D,e.texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[c]=e}r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(e,t,i,s,r,n,o,a,h){this._updateCell(this._vertices.attributes,e,t,i,s,r,n,o,a,h)}_updateCell(e,t,i,s,r,n,o,a,h,l){Ge=(i*this._terminal.cols+t)*Ne,0!==s&&void 0!==s?this._atlas&&(Ue=a&&a.length>1?this._atlas.getRasterizedGlyphCombinedChar(a,r,n,o,!1,this._terminal.element):this._atlas.getRasterizedGlyph(s,r,n,o,!1,this._terminal.element),He=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),r!==l&&Ue.offset.x>He?(Ve=Ue.offset.x-He,e[Ge]=-(Ue.offset.x-Ve)+this._dimensions.device.char.left,e[Ge+1]=-Ue.offset.y+this._dimensions.device.char.top,e[Ge+2]=(Ue.size.x-Ve)/this._dimensions.device.canvas.width,e[Ge+3]=Ue.size.y/this._dimensions.device.canvas.height,e[Ge+4]=Ue.texturePage,e[Ge+5]=Ue.texturePositionClipSpace.x+Ve/this._atlas.pages[Ue.texturePage].canvas.width,e[Ge+6]=Ue.texturePositionClipSpace.y,e[Ge+7]=Ue.sizeClipSpace.x-Ve/this._atlas.pages[Ue.texturePage].canvas.width,e[Ge+8]=Ue.sizeClipSpace.y):(e[Ge]=-Ue.offset.x+this._dimensions.device.char.left,e[Ge+1]=-Ue.offset.y+this._dimensions.device.char.top,e[Ge+2]=Ue.size.x/this._dimensions.device.canvas.width,e[Ge+3]=Ue.size.y/this._dimensions.device.canvas.height,e[Ge+4]=Ue.texturePage,e[Ge+5]=Ue.texturePositionClipSpace.x,e[Ge+6]=Ue.texturePositionClipSpace.y,e[Ge+7]=Ue.sizeClipSpace.x,e[Ge+8]=Ue.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&function(e,t,i,s){return 1===t&&i>Math.ceil(1.5*s)&&void 0!==e&&e>255&&!function(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}(e)&&!F(e)&&!function(e){return 57344<=e&&e<=63743}(e)}(s,h,Ue.size.x,this._dimensions.device.cell.width)&&(e[Ge+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width)):e.fill(0,Ge,Ge+Ne-1-2)}clear(){let e=this._terminal,t=e.cols*e.rows*Ne;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==t?this._vertices.attributesBuffers[i]=new Float32Array(t):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=t,i=0;for(let s=0;s<e.rows;s++)for(let t=0;t<e.cols;t++)this._vertices.attributes[i+9]=t/e.cols,this._vertices.attributes[i+10]=s/e.rows,i+=Ne}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],s=0;for(let r=0;r<e.lineLengths.length;r++){let t=r*this._terminal.cols*Ne,n=this._vertices.attributes.subarray(t,t+e.lineLengths[r]*Ne);i.set(n,s),s+=n.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,s),t.STREAM_DRAW);for(let r=0;r<this._atlas.pages.length;r++)this._atlas.pages[r].version!==this._atlasTextures[r].version&&this._bindAtlasPageTexture(t,this._atlas,r);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,s/Ne)}setAtlas(e){this._atlas=e;for(let t of this._atlasTextures)t.version=-1}_bindAtlasPageTexture(e,t,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[i].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[i].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[i].version=t.pages[i].version}setDimensions(e){this._dimensions=e}},Ye=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1])return void this.clear();let r=e.buffers.active.ydisp,n=t[1]-r,o=i[1]-r,a=Math.max(n,0),h=Math.min(o,e.rows-1);a>=e.rows||h<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=i[0])}isCellSelected(e,t,i){return!!this.hasSelection&&(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol)}};var Xe=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=new Ye}resize(e,t){let i=e*t*4;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},Ze=8*Float32Array.BYTES_PER_ELEMENT,Qe=class{constructor(){this.attributes=new Float32Array(160),this.count=0}},Ke=0,Je=0,et=0,tt=0,it=0,st=0,rt=0,nt=class extends g{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=s,this._vertices=new Qe,this._verticesCursor=new Qe;let r=this._gl;this._program=D(We(r,"#version 300 es\nlayout (location = 0) in vec2 a_position;\nlayout (location = 1) in vec2 a_size;\nlayout (location = 2) in vec4 a_color;\nlayout (location = 3) in vec2 a_unitquad;\n\nuniform mat4 u_projection;\n\nout vec4 v_color;\n\nvoid main() {\n  vec2 zeroToOne = a_position + (a_unitquad * a_size);\n  gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);\n  v_color = a_color;\n}","#version 300 es\nprecision lowp float;\n\nin vec4 v_color;\n\nout vec4 outColor;\n\nvoid main() {\n  outColor = v_color;\n}")),this._register(d(()=>r.deleteProgram(this._program))),this._projectionLocation=D(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(d(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),h=r.createBuffer();this._register(d(()=>r.deleteBuffer(h))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h),r.bufferData(r.ELEMENT_ARRAY_BUFFER,a,r.STATIC_DRAW),this._attributesBuffer=D(r.createBuffer()),this._register(d(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,Ze,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,Ze,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,Ze,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,Ie),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t,i,s,r,n,o,a,h,l,c,d,_=this._terminal,u=this._vertices,g=1;for(t=0;t<_.rows;t++){for(s=-1,r=0,n=0,o=!1,i=0;i<_.cols;i++)a=4*(t*_.cols+i),h=e.cells[a+1],l=e.cells[a+2],c=!!(67108864&l),(h!==r||l!==n&&(o||c))&&((0!==r||o&&0!==n)&&(d=8*g++,this._updateRectangle(u,d,n,r,s,i,t)),s=i,r=h,n=l,o=c);(0!==r||o&&0!==n)&&(d=8*g++,this._updateRectangle(u,d,n,r,s,_.cols,t))}u.count=g}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||"block"===i.style)return void(t.count=0);let s,r=0;("bar"===i.style||"outline"===i.style)&&(s=8*r++,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,"bar"===i.style?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),("underline"===i.style||"outline"===i.style)&&(s=8*r++,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),"outline"===i.style&&(s=8*r++,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),s=8*r++,this._addRectangleFloat(t.attributes,s,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=r}_updateRectangle(e,t,i,s,r,n,o){if(67108864&i)switch(50331648&i){case 16777216:case 33554432:Ke=this._themeService.colors.ansi[255&i].rgba;break;case 50331648:Ke=(16777215&i)<<8;break;default:Ke=this._themeService.colors.foreground.rgba}else switch(50331648&s){case 16777216:case 33554432:Ke=this._themeService.colors.ansi[255&s].rgba;break;case 50331648:Ke=(16777215&s)<<8;break;default:Ke=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=function(e,t){let i=Math.min(2*e.length,t),s=new Float32Array(i);for(let r=0;r<e.length;r++)s[r]=e[r];return s}(e.attributes,this._terminal.rows*this._terminal.cols*8)),Je=r*this._dimensions.device.cell.width,et=o*this._dimensions.device.cell.height,tt=(Ke>>24&255)/255,it=(Ke>>16&255)/255,st=(Ke>>8&255)/255,rt=1,this._addRectangle(e.attributes,t,Je,et,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,tt,it,st,rt)}_addRectangle(e,t,i,s,r,n,o,a,h,l){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=a,e[t+6]=h,e[t+7]=l}_addRectangleFloat(e,t,i,s,r,n,o){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}},ot=class extends g{constructor(e,t,i,s,r,n,o,a){super(),this._container=t,this._alpha=r,this._coreBrowserService=n,this._optionsService=o,this._themeService=a,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(d(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=D(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,s=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=Ee(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,i,s){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,s){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=j,this._clipCell(i,s,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){return`${i?"italic":""} ${t?e.options.fontWeightBold:e.options.fontWeight} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},at=class extends ot{constructor(e,t,i,s,r,n,o){super(i,e,"link",t,!0,r,n,o),this._register(s.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(s.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(257===e.fg?this._ctx.fillStyle=this._themeService.colors.background.css:void 0!==e.fg&&(16777216==(50331648&(t=e.fg))||33554432==(50331648&t))?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)}var t;this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},ht="object"==typeof window?window:globalThis,lt=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Le,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Le,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let i=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(i,e),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let i=this.getWindowId(t);this.mapWindowIdToFullScreen.set(i,e),this._onDidChangeFullscreen.fire(i)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};lt.INSTANCE=new lt;var ct=lt;ct.INSTANCE.onDidChangeZoomLevel,ct.INSTANCE.onDidChangeFullscreen;var dt="object"==typeof navigator?navigator.userAgent:"";dt.indexOf("Firefox"),dt.indexOf("AppleWebKit"),!(dt.indexOf("Chrome")>=0)&&dt.indexOf("Safari"),dt.indexOf("Electron/"),dt.indexOf("Android");var _t=!1;if("function"==typeof ht.matchMedia){let e=ht.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=ht.matchMedia("(display-mode: fullscreen)");_t=e.matches,function(e,t,i){"string"==typeof t&&(t=e.matchMedia(t)),t.addEventListener("change",i)}(ht,e,({matches:e})=>{_t&&t.matches||(_t=e)})}var ut,gt,vt="en",ft=!1,pt=vt,mt=globalThis;typeof mt.vscode<"u"&&typeof mt.vscode.process<"u"&&(gt=mt.vscode.process);var wt="string"==typeof gt?.versions?.electron&&"renderer"===gt?.type;if("object"==typeof gt){gt.platform,gt.platform,"linux"===gt.platform&&!!gt.env.SNAP&&gt.env.SNAP_REVISION,!!gt.env.CI||gt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,pt=vt;let e=gt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,pt=t.resolvedLanguage||vt,t.languagePack?.translationsConfigFile}catch{}ft=!0}else"object"!=typeof navigator||wt?console.error("Unable to resolve platform."):((ut=navigator.userAgent).indexOf("Windows"),ut.indexOf("Macintosh"),(ut.indexOf("Macintosh")>=0||ut.indexOf("iPad")>=0||ut.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints,ut.indexOf("Linux")>=0,ut?.indexOf("Mobi"),pt=globalThis._VSCODE_NLS_LANGUAGE||vt,navigator.language.toLowerCase());var Ct,xt=ft,Lt=ut,bt=pt;(e=>{e.value=function(){return bt},e.isDefaultVariant=function(){return 2===bt.length?"en"===bt:bt.length>=3&&("e"===bt[0]&&"n"===bt[1]&&"-"===bt[2])},e.isDefault=function(){return"en"===bt}})(Ct||={});var yt="function"==typeof mt.postMessage&&!mt.importScripts;(()=>{if(yt){let e=[];mt.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;i++){let s=e[i];if(s.id===t.data.vscodeScheduleAsyncWork)return e.splice(i,1),void s.callback()}});let t=0;return i=>{let s=++t;e.push({id:s,callback:i}),mt.postMessage({vscodeScheduleAsyncWork:s},"*")}}})();var Mt=!!(Lt&&Lt.indexOf("Chrome")>=0);Lt&&Lt.indexOf("Firefox"),!Mt&&Lt&&Lt.indexOf("Safari"),Lt&&Lt.indexOf("Edg/"),Lt&&Lt.indexOf("Android");var St="object"==typeof navigator?navigator:{};xt||document.queryCommandSupported&&document.queryCommandSupported("copy")||St&&St.clipboard&&St.clipboard.writeText,xt||St&&St.clipboard&&St.clipboard.readText;var At,Rt,Tt=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},kt=new Tt,Et=new Tt,Bt=new Tt;new Array(230),(Rt=At||={}).toString=function(e){return kt.keyCodeToStr(e)},Rt.fromString=function(e){return kt.strToKeyCode(e)},Rt.toUserSettingsUS=function(e){return Et.keyCodeToStr(e)},Rt.toUserSettingsGeneral=function(e){return Bt.keyCodeToStr(e)},Rt.fromUserSettings=function(e){return Et.strToKeyCode(e)||Bt.strToKeyCode(e)},Rt.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return kt.keyCodeToStr(e)};var Pt,$t=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}});(e=>{e.isCancellationToken=function(t){return t===e.None||t===e.Cancelled||t instanceof It||!(!t||"object"!=typeof t)&&("boolean"==typeof t.isCancellationRequested&&"function"==typeof t.onCancellationRequested)},e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:se.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:$t})})(Pt||={});var Dt,Ft,It=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?$t:(this._emitter||(this._emitter=new Le),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};(Ft=Dt||={}).settled=async function(e){let t,i=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||(t=e)})));if(typeof t<"u")throw t;return i},Ft.withAsyncBody=function(e){return new Promise(async(t,i)=>{try{await e(t,i)}catch(Rt){i(Rt)}})};var Wt=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let i of t)e.emitOne(i)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Le,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(i){this.reject(i)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await se.toPromise(this._onStateChanged.event)}},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new e(async e=>{for await(let s of t)e.emitOne(i(s))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async e=>{for await(let s of t)i(s)&&e.emitOne(s)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let i of e)t.push(i);return t}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Wt.EMPTY=Wt.fromArray([]);var{getWindow:zt}=function(){let e=new Map,t={window:ht,disposables:new u};e.set(ht.vscodeWindowId,t);let i=new Le,s=new Le,r=new Le;return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(t){if(e.has(t.vscodeWindowId))return g.None;let n=new u,o={window:t,disposables:n.add(new u)};return e.set(t.vscodeWindowId,o),n.add(d(()=>{e.delete(t.vscodeWindowId),s.fire(t)})),n.add(Ut(t,Nt.BEFORE_UNLOAD,()=>{r.fire(t)})),i.fire(o),n},getWindows:()=>e.values(),getWindowsCount:()=>e.size,getWindowId:e=>e.vscodeWindowId,hasWindow:t=>e.has(t),getWindowById:function(i,s){return("number"==typeof i?e.get(i):void 0)??(s?t:void 0)},getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let i=e;return i?.view?i.view.window:ht},getDocument:e=>zt(e).document}}(),Ot=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ut(e,t,i,s){return new Ot(e,t,i,s)}var Nt={BEFORE_UNLOAD:"beforeunload"},qt=class extends g{constructor(e,t,i,s,r,n,o,a,h){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._optionsService=o,this._themeService=a,this._cursorBlinkStateManager=new v,this._charAtlasDisposable=this._register(new v),this._observerDisposable=this._register(new v),this._model=new Xe,this._workCell=new Fe,this._workCell2=new Fe,this._rectangleRenderer=this._register(new v),this._glyphRenderer=this._register(new v),this._onChangeTextureAtlas=this._register(new Le),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Le),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Le),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Le),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Le),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let l={antialias:!1,depth:!1,preserveDrawingBuffer:h};if(this._gl=this._canvas.getContext("webgl2",l),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new V(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new at(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions={css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}},this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(Ut(this._canvas,"webglcontextlost",e=>{console.log("webglcontextlost event received"),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(e)},3e3)})),this._register(Ut(this._canvas,"webglcontextrestored",e=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,Be(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=De(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=De(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(d(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),Be(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new nt(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new je(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)return void(this._isAttached=!1);let e=Ee(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=c(se.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),se.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached){if(!(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new $e(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i,s,r,n,o,a,h,l,c,d,_,u,g,v,f,p=this._core,m=this._workCell,w=0,C=!0;e=Ht(e,p.rows-1,0),t=Ht(t,p.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??p.options.cursorStyle??"block",L=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,b=L-p.buffer.ydisp,y=Math.min(this._terminal.buffer.active.cursorX,p.cols-1),M=-1,S=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let A=!1;for(s=e;s<=t;s++)for(r=s+p.buffer.ydisp,n=p.buffer.lines.get(r),this._model.lineLengths[s]=0,c=L===r,w=0,o=this._characterJoinerService.getJoinedCharacters(r),v=0;v<p.cols;v++){if(i=this._cellColorResolver.result.bg,n.loadCell(v,m),0===v&&(i=this._cellColorResolver.result.bg),a=!1,C=v>=w,h=v,o.length>0&&v===o[0][0]&&C){l=o.shift();let e=this._model.selection.isCellSelected(this._terminal,l[0],r);for(g=l[0]+1;g<l[1];g++)C&&=e===this._model.selection.isCellSelected(this._terminal,g,r);C&&=!c||y<l[0]||y>=l[1],C?(a=!0,m=new Gt(m,n.translateToString(!0,l[0],l[1]),l[1]-l[0]),h=l[1]-1):w=l[1]}if(d=m.getChars(),_=m.getCode(),g=4*(s*p.cols+v),this._cellColorResolver.resolve(m,v,r,this.dimensions.device.cell.width),S&&r===L&&(v===y&&(this._model.cursor={x:y,y:b,width:m.getWidth(),style:this._coreBrowserService.isFocused?x:p.options.cursorInactiveStyle,cursorWidth:p.options.cursorWidth,dpr:this._devicePixelRatio},M=y+m.getWidth()-1),v>=y&&v<=M&&(this._coreBrowserService.isFocused&&"block"===x||!1===this._coreBrowserService.isFocused&&"block"===p.options.cursorInactiveStyle)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),0!==_&&(this._model.lineLengths[s]=v+1),(this._model.cells[g]!==_||this._model.cells[g+1]!==this._cellColorResolver.result.bg||this._model.cells[g+2]!==this._cellColorResolver.result.fg||this._model.cells[g+3]!==this._cellColorResolver.result.ext)&&(A=!0,d.length>1&&(_|=2147483648),this._model.cells[g]=_,this._model.cells[g+1]=this._cellColorResolver.result.bg,this._model.cells[g+2]=this._cellColorResolver.result.fg,this._model.cells[g+3]=this._cellColorResolver.result.ext,u=m.getWidth(),this._glyphRenderer.value.updateCell(v,s,_,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,d,u,i),a)){for(m=this._workCell,v++;v<=h;v++)f=4*(s*p.cols+v),this._glyphRenderer.value.updateCell(v,s,0,0,0,0,"",0,0),this._model.cells[f]=0,this._model.cells[f+1]=this._cellColorResolver.result.bg,this._model.cells[f+2]=this._cellColorResolver.result.fg,this._model.cells[f+3]=this._cellColorResolver.result.ext;v--}}A&&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=1===this._optionsService.rawOptions.lineHeight?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},Gt=class extends he{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function Ht(e,t,i=0){return Math.max(Math.min(e,t),i)}var Vt="di$target",jt="di$dependencies",Yt=new Map;function Xt(e){if(Yt.has(e))return Yt.get(e);let t=function(e,i,s){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");!function(e,t,i){t[Vt]===t?t[jt].push({id:e,index:i}):(t[jt]=[{id:e,index:i}],t[Vt]=t)}(t,e,s)};return t._id=e,Yt.set(e,t),t}Xt("BufferService"),Xt("CoreMouseService"),Xt("CoreService"),Xt("CharsetService"),Xt("InstantiationService"),Xt("LogService");var Zt=Xt("OptionsService");Xt("OscLinkService"),Xt("UnicodeService"),Xt("DecorationService");var Qt,Kt,Jt={trace:0,debug:1,info:2,warn:3,error:4,off:5},ei=class extends g{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Jt[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};ei=((e,t)=>{for(var i,s=t,r=e.length-1;r>=0;r--)(i=e[r])&&(s=i(s)||s);return s})([(Qt=0,Kt=Zt,(e,t)=>Kt(e,t,Qt))],ei);var ti=class extends g{constructor(e){if(x&&function(){if(!x)return 0;let e=p.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}()<16){let e={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",e))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new Le),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Le),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Le),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Le),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element)return void this._register(t.onWillOpen(()=>this.activate(e)));this._terminal=e;let i=t.coreService,s=t.optionsService,r=t,n=r._renderService,o=r._characterJoinerService,a=r._charSizeService,h=r._coreBrowserService,l=r._decorationService;r._logService;let c=r._themeService;this._renderer=this._register(new qt(e,o,a,h,i,l,s,c,this._preserveDrawingBuffer)),this._register(se.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(se.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(se.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(se.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(d(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};export{ti as WebglAddon};
