loopat 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +194 -0
- package/bin/loopat.mjs +65 -0
- package/package.json +52 -0
- package/server/package.json +22 -0
- package/server/src/api-tokens.ts +161 -0
- package/server/src/api-v1-openapi.ts +363 -0
- package/server/src/api-v1.ts +681 -0
- package/server/src/auth.ts +309 -0
- package/server/src/bootstrap.ts +113 -0
- package/server/src/chat.ts +390 -0
- package/server/src/claude-binary.ts +68 -0
- package/server/src/compose.ts +474 -0
- package/server/src/config.ts +783 -0
- package/server/src/files.ts +173 -0
- package/server/src/git-crypt-key.ts +36 -0
- package/server/src/git-host.ts +104 -0
- package/server/src/github.ts +161 -0
- package/server/src/index.ts +3204 -0
- package/server/src/kanban.ts +810 -0
- package/server/src/loop-stats.ts +225 -0
- package/server/src/loop-status.ts +67 -0
- package/server/src/loops.ts +1832 -0
- package/server/src/mcp-oauth.ts +516 -0
- package/server/src/onboarding.ts +105 -0
- package/server/src/paths.ts +190 -0
- package/server/src/personal-keys.ts +60 -0
- package/server/src/plugin-installer.ts +287 -0
- package/server/src/podman.ts +1216 -0
- package/server/src/presets.ts +30 -0
- package/server/src/profiles.ts +177 -0
- package/server/src/providers.ts +45 -0
- package/server/src/serve.ts +275 -0
- package/server/src/session.ts +1496 -0
- package/server/src/system-prompt.ts +90 -0
- package/server/src/term.ts +211 -0
- package/server/src/tiers.ts +762 -0
- package/server/src/vaults.ts +189 -0
- package/server/src/workspace.ts +501 -0
- package/server/templates/.claude-plugin/marketplace.json +13 -0
- package/server/templates/CLAUDE.md +78 -0
- package/server/templates/loop-kinds/distill/CLAUDE.md +46 -0
- package/server/templates/plugins/loopat/.claude-plugin/plugin.json +5 -0
- package/server/templates/plugins/loopat/skills/onboarding/SKILL.md +266 -0
- package/server/templates/plugins/loopat/skills/promote/SKILL.md +53 -0
- package/server/templates/sandbox/Containerfile +113 -0
- package/web/dist/assets/CodeEditor-BGODueTo.js +49 -0
- package/web/dist/assets/Editor-DMS25Vve.js +1 -0
- package/web/dist/assets/Markdown-CnHbW7WK.js +5 -0
- package/web/dist/assets/MilkdownEditor-nqo9_0v5.js +123 -0
- package/web/dist/assets/Terminal-BrP-ENHg.css +1 -0
- package/web/dist/assets/Terminal-CYWvxYam.js +174 -0
- package/web/dist/assets/index-DM5eO-Tv.js +163 -0
- package/web/dist/assets/index-DxIFezwv.css +1 -0
- package/web/dist/assets/w3c-keyname-BOAvb0qz.js +1 -0
- package/web/dist/favicon.svg +1 -0
- package/web/dist/index.html +14 -0
- package/web/dist/logo.png +0 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import{C as e,S as t,x as n,y as r}from"./index-DM5eO-Tv.js";var i=e(n(),1),a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,r)=>{for(var i=r>1?void 0:r?o(t,n):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(i=(r?c(t,n,i):c(i))||i);return r&&i&&a(t,n,i),i},l=(e,t)=>(n,r)=>t(n,r,e),u=`Terminal input`,d={get:()=>u,set:e=>u=e},f=`Too much output to announce, navigate to rows manually to read`,p={get:()=>f,set:e=>f=e};function m(e){return e.replace(/\r?\n/g,`\r`)}function h(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function g(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function _(e,t,n,r){e.stopPropagation(),e.clipboardData&&v(e.clipboardData.getData(`text/plain`),t,n,r)}function v(e,t,n,r){e=m(e),e=h(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function y(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function b(e,t,n,r,i){y(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function x(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function S(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var ee=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},C=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}else this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},w=``,T=` `,E=class e{constructor(){this.fg=0,this.bg=0,this.extended=new D}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},D=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},O=class e extends E{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new D,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?x(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},k=`di$target`,A=`di$dependencies`,j=new Map;function M(e){return e[A]||[]}function N(e){if(j.has(e))return j.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);P(t,e,r)};return t._id=e,j.set(e,t),t}function P(e,t,n){t[k]===t?t[A].push({id:e,index:n}):(t[A]=[{id:e,index:n}],t[k]=t)}var F=N(`BufferService`),te=N(`CoreMouseService`),ne=N(`CoreService`),re=N(`CharsetService`),ie=N(`InstantiationService`),ae=N(`LogService`),I=N(`OptionsService`),oe=N(`OscLinkService`),se=N(`UnicodeService`),ce=N(`DecorationService`),le=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new O,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId)if(c===-1){c=t,s=a.extended.urlId;continue}else l=a.extended.urlId!==s;else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):ue(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};le=c([l(0,F),l(1,I),l(2,oe)],le);function ue(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
2
|
+
|
|
3
|
+
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var de=N(`CharSizeService`),fe=N(`CoreBrowserService`),pe=N(`MouseService`),me=N(`RenderService`),he=N(`SelectionService`),ge=N(`CharacterJoinerService`),_e=N(`ThemeService`),L=N(`LinkProviderService`),ve=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?we.isErrorNoTelemetry(e)?new we(e.message+`
|
|
4
|
+
|
|
5
|
+
`+e.stack):Error(e.message+`
|
|
6
|
+
|
|
7
|
+
`+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 ye(e){xe(e)||ve.onUnexpectedError(e)}var be=`Canceled`;function xe(e){return e instanceof Se?!0:e instanceof Error&&e.name===be&&e.message===be}var Se=class extends Error{constructor(){super(be),this.name=this.message}};function Ce(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var we=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},Te=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function Ee(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}var De=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=Ee(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};De.assertInvariants=!1;function R(e,t=0){return e[e.length-(1+t)]}var Oe;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Oe||={});function z(e,t){return(n,r)=>t(e(n),e(r))}var ke=(e,t)=>e-t,Ae=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Oe.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Ae.empty=new Ae(e=>{});function je(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var Me=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function Ne(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var Pe;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(Pe||={});var Fe=!1,Ie=null,Le=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
|
|
8
|
+
`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new Me;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
|
|
9
|
+
`),e)}n.sort(z(e=>e.idx,ke));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
|
|
10
|
+
`)).size}/${n.length} leaks) at ${a}`;let o=je([...i.get(e.slice(0,t).join(`
|
|
11
|
+
`))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
|
|
15
|
+
${s.join(`
|
|
16
|
+
`)}
|
|
17
|
+
============================================================
|
|
18
|
+
|
|
19
|
+
`}return n.length>e&&(a+=`
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
... and ${n.length-e} more leaking disposables
|
|
23
|
+
|
|
24
|
+
`),{leaks:n,details:a}}};Le.idx=0;function Re(e){Ie=e}if(Fe){let e=`__is_disposable_tracked__`;Re(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==V.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==V.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function ze(e){return Ie?.trackDisposable(e),e}function Be(e){Ie?.markAsDisposed(e)}function Ve(e,t){Ie?.setParent(e,t)}function He(e,t){if(Ie)for(let n of e)Ie.setParent(n,t)}function Ue(e){return Ie?.markAsSingleton(e),e}function We(e){if(Pe.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Ge(...e){let t=B(()=>We(e));return He(e,t),t}function B(e){let t=ze({dispose:Ne(()=>{Be(t),e()})});return t}var Ke=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,ze(this)}dispose(){this._isDisposed||(Be(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{We(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return Ve(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),Ve(e,null))}};Ke.DISABLE_DISPOSED_WARNING=!1;var qe=Ke,V=class{constructor(){this._store=new qe,ze(this),Ve(this._store,this)}dispose(){Be(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};V.None=Object.freeze({dispose(){}});var Je=class{constructor(){this._isDisposed=!1,ze(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Ve(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Be(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Ve(e,null),e}},Ye=typeof window==`object`?window:globalThis,Xe=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Xe.Undefined=new Xe(void 0);var Ze=Xe,Qe=class{constructor(){this._first=Ze.Undefined,this._last=Ze.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ze.Undefined}clear(){let e=this._first;for(;e!==Ze.Undefined;){let t=e.next;e.prev=Ze.Undefined,e.next=Ze.Undefined,e=t}this._first=Ze.Undefined,this._last=Ze.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Ze(e);if(this._first===Ze.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Ze.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ze.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ze.Undefined&&e.next!==Ze.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ze.Undefined&&e.next===Ze.Undefined?(this._first=Ze.Undefined,this._last=Ze.Undefined):e.next===Ze.Undefined?(this._last=this._last.prev,this._last.next=Ze.Undefined):e.prev===Ze.Undefined&&(this._first=this._first.next,this._first.prev=Ze.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==Ze.Undefined;)yield e.element,e=e.next}},$e=globalThis.performance&&typeof globalThis.performance.now==`function`,et=class e{static create(t){return new e(t)}constructor(e){this._now=$e&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},tt=!1,nt=!1,rt=!1,it;(e=>{e.None=()=>V.None;function t(e){if(rt){let{onDidAddListener:t}=e,n=ut.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(Ge(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new H(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new H(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new H({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{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:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new H({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new H({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function S(e){return new Promise(t=>r(e)(t))}e.toPromise=S;function ee(e){let t=new H;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=ee;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new H(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof qe?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(it||={});var at=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 et,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}}};at.all=new Set,at._idPool=0;var ot=at,st=-1,ct=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new dt(i,e);this._errorHandler(a)}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[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};ct._idPool=1;var lt=ct,ut=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
25
|
+
`).slice(2).join(`
|
|
26
|
+
`))}},dt=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},ft=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},pt=0,mt=class{constructor(e){this.value=e,this.id=pt++}},ht=2,gt=(e,t)=>{if(e instanceof mt)t(e);else for(let n=0;n<e.length;n++){let r=e[n];r&&t(r)}},_t;if(tt){let e=[];setInterval(()=>{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(`
|
|
27
|
+
`)),e.length=0)},3e3),_t=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var H=class{constructor(e){this._size=0,this._options=e,this._leakageMon=st>0||this._options?.leakWarningThreshold?new lt(e?.onListenerError??ye,this._options?.leakWarningThreshold??st):void 0,this._perfMon=this._options?._profName?new ot(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(nt){let e=this._listeners;queueMicrotask(()=>{gt(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{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 t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new ft(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||ye)(n),V.None}if(this._disposed)return V.None;t&&(e=e.bind(t));let r=new mt(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=ut.create(),i=this._leakageMon.check(r.stack,this._size+1)),nt&&(r.stack=ut.create()),this._listeners?this._listeners instanceof mt?(this._deliveryQueue??=new vt,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=B(()=>{_t?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof qe?n.add(a):Array.isArray(n)&&n.push(a),_t){let e=Error().stack.split(`
|
|
28
|
+
`).slice(2,3).join(`
|
|
29
|
+
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);_t.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*ht<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||ye;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_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 mt)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}},vt=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},yt=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new H,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new H,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};yt.INSTANCE=new yt;var bt=yt;function xt(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}bt.INSTANCE.onDidChangeZoomLevel;function St(e){return bt.INSTANCE.getZoomFactor(e)}bt.INSTANCE.onDidChangeFullscreen;var Ct=typeof navigator==`object`?navigator.userAgent:``,wt=Ct.indexOf(`Firefox`)>=0,Tt=Ct.indexOf(`AppleWebKit`)>=0,Et=Ct.indexOf(`Chrome`)>=0,Dt=!Et&&Ct.indexOf(`Safari`)>=0;Ct.indexOf(`Electron/`),Ct.indexOf(`Android`);var Ot=!1;if(typeof Ye.matchMedia==`function`){let e=Ye.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=Ye.matchMedia(`(display-mode: fullscreen)`);Ot=e.matches,xt(Ye,e,({matches:e})=>{Ot&&t.matches||(Ot=e)})}function kt(){return Ot}var At=`en`,jt=!1,Mt=!1,Nt=!1,Pt=!1,Ft=!1,It=At,Lt,Rt=globalThis,zt;typeof Rt.vscode<`u`&&typeof Rt.vscode.process<`u`?zt=Rt.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(zt=process);var Bt=typeof zt?.versions?.electron==`string`&&zt?.type===`renderer`;if(typeof zt==`object`){jt=zt.platform===`win32`,Mt=zt.platform===`darwin`,Nt=zt.platform===`linux`,Nt&&zt.env.SNAP&&zt.env.SNAP_REVISION,zt.env.CI||zt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,It=At;let e=zt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,It=t.resolvedLanguage||At,t.languagePack?.translationsConfigFile}catch{}Pt=!0}else typeof navigator==`object`&&!Bt?(Lt=navigator.userAgent,jt=Lt.indexOf(`Windows`)>=0,Mt=Lt.indexOf(`Macintosh`)>=0,(Lt.indexOf(`Macintosh`)>=0||Lt.indexOf(`iPad`)>=0||Lt.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,Nt=Lt.indexOf(`Linux`)>=0,Lt?.indexOf(`Mobi`),Ft=!0,It=globalThis._VSCODE_NLS_LANGUAGE||At,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var Vt=jt,Ht=Mt,Ut=Nt,Wt=Pt;Ft&&typeof Rt.importScripts==`function`&&Rt.origin;var Gt=Lt,Kt=It,qt;(e=>{function t(){return Kt}e.value=t;function n(){return Kt.length===2?Kt===`en`:Kt.length>=3?Kt[0]===`e`&&Kt[1]===`n`&&Kt[2]===`-`:!1}e.isDefaultVariant=n;function r(){return Kt===`en`}e.isDefault=r})(qt||={});var Jt=typeof Rt.postMessage==`function`&&!Rt.importScripts;(()=>{if(Jt){let e=[];Rt.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Rt.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var Yt=!!(Gt&&Gt.indexOf(`Chrome`)>=0);Gt&&Gt.indexOf(`Firefox`),!Yt&&Gt&&Gt.indexOf(`Safari`),Gt&&Gt.indexOf(`Edg/`),Gt&&Gt.indexOf(`Android`);var Xt=typeof navigator==`object`?navigator:{};Wt||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||Xt&&Xt.clipboard&&Xt.clipboard.writeText,Wt||Xt&&Xt.clipboard&&Xt.clipboard.readText,Wt||kt()||Xt.keyboard,`ontouchstart`in Ye||Xt.maxTouchPoints,Ye.PointerEvent&&(`ontouchstart`in Ye||navigator.maxTouchPoints);var Zt=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}},Qt=new Zt,$t=new Zt,en=new Zt,tn=Array(230),nn;(e=>{function t(e){return Qt.keyCodeToStr(e)}e.toString=t;function n(e){return Qt.strToKeyCode(e)}e.fromString=n;function r(e){return $t.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return en.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return $t.strToKeyCode(e)||en.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return Qt.keyCodeToStr(e)}e.toElectronAccelerator=o})(nn||={});var rn=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new an([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},an=class{constructor(e){if(e.length===0)throw Ce(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function on(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return nn.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(wt)switch(t){case 59:return 85;case 60:if(Ut)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Ht)return 57;break}else if(Tt&&(Ht&&t===93||!Ht&&t===92))return 57;return tn[t]||0}var sn=Ht?256:2048,cn=512,ln=1024,un=Ht?2048:256,dn=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=on(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=sn),this.altKey&&(t|=cn),this.shiftKey&&(t|=ln),this.metaKey&&(t|=un),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new rn(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},fn=new WeakMap;function pn(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var mn=class{static getSameOriginWindowChain(e){let t=fn.get(e);if(!t){t=[],fn.set(e,t);let n=e,r;do r=pn(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},hn=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=mn.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},gn=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(Et){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)r?this.deltaY=t.wheelDeltaY/(120*i):this.deltaY=t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?wt&&!Ht?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)Dt&&Vt?this.deltaX=-(t.wheelDeltaX/120):r?this.deltaX=t.wheelDeltaX/(120*i):this.deltaX=t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;t.deltaMode===t.DOM_DELTA_LINE?wt&&!Ht?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},_n=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),vn;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof yn?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:it.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:_n})})(vn||={});var yn=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?_n:(this._emitter||=new H,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},bn=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Te(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Te(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},xn=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new Te(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=B(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Sn;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Sn||={});var Cn=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new H,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await it.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Cn.EMPTY=Cn.fromArray([]);function wn(e){return 55296<=e&&e<=56319}function Tn(e){return 56320<=e&&e<=57343}function En(e,t){return(e-55296<<10)+(t-56320)+65536}function Dn(e){return On(e,0)}function On(e,t){switch(typeof e){case`object`:return e===null?kn(349,t):Array.isArray(e)?Mn(e,t):Nn(e,t);case`string`:return jn(e,t);case`boolean`:return An(e,t);case`number`:return kn(e,t);case`undefined`:return kn(937,t);default:return kn(617,t)}}function kn(e,t){return(t<<5)-t+e|0}function An(e,t){return kn(e?433:863,t)}function jn(e,t){t=kn(149417,t);for(let n=0,r=e.length;n<r;n++)t=kn(e.charCodeAt(n),t);return t}function Mn(e,t){return t=kn(104579,t),e.reduce((e,t)=>On(t,e),t)}function Nn(e,t){return t=kn(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=jn(n,t),On(e[n],t)),t)}function Pn(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function Fn(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function In(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function Ln(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):In((e>>>0).toString(16),t/4)}var Rn=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(wn(a))if(o+1<t){let t=e.charCodeAt(o+1);Tn(t)?(o++,s=En(a,t)):s=65533}else{i=a;break}else Tn(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Ln(this._h0)+Ln(this._h1)+Ln(this._h2)+Ln(this._h3)+Ln(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Fn(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Fn(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,Pn(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=Pn(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=Pn(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};Rn._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:zn,getWindow:Bn,getDocument:Vn,getWindows:Hn,getWindowsCount:Un,getWindowId:Wn,getWindowById:Gn,hasWindow:Kn,onDidRegisterWindow:qn,onWillUnregisterWindow:Jn,onDidUnregisterWindow:Yn}=function(){let e=new Map,t={window:Ye,disposables:new qe};e.set(Ye.vscodeWindowId,t);let n=new H,r=new H,i=new H;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return V.None;let a=new qe,o={window:t,disposables:a.add(new qe)};return e.set(t.vscodeWindowId,o),a.add(B(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(U(t,ar.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:Ye},getDocument(e){return Bn(e).document}}}(),Xn=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function U(e,t,n,r){return new Xn(e,t,n,r)}function Zn(e,t){return function(n){return t(new hn(e,n))}}function Qn(e){return function(t){return e(new dn(t))}}var $n=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=Zn(Bn(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=Qn(n)),U(e,t,i,r)},er,tr=class extends xn{constructor(e){super(),this.defaultTarget=e&&Bn(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},nr=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){ye(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(nr.sort),a.shift().execute();r.set(i,!1)};er=(t,r,a=0)=>{let o=Wn(t),s=new nr(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var rr=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};rr.None=new rr(0,0);function ir(e){let t=e.getBoundingClientRect(),n=Bn(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Dn(n),a=r.get(i);if(a)a.users+=1;else{let o=new H,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(B(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var ar={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:Tt?`webkitAnimationStart`:`animationstart`,ANIMATION_END:Tt?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:Tt?`webkitAnimationIteration`:`animationiteration`},or=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function sr(e,t,n,...r){let i=or.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function cr(e,t,...n){return sr(`http://www.w3.org/1999/xhtml`,e,t,...n)}cr.SVG=function(e,t,...n){return sr(`http://www.w3.org/2000/svg`,e,t,...n)};var lr=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=ur(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=ur(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=ur(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=ur(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=ur(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=ur(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=ur(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=ur(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=ur(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=ur(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=ur(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=ur(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=ur(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=ur(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function ur(e){return typeof e==`number`?`${e}px`:e}function dr(e){return new lr(e)}var fr=class{constructor(){this._hooks=new qe,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(B(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=Bn(e)}this._hooks.add(U(a,ar.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(U(a,ar.POINTER_UP,e=>this.stopMonitoring(!0)))}};function pr(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var mr;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(mr||={});var hr=class e extends V{constructor(){super(),this.dispatched=!1,this.targets=new Qe,this.ignoreTargets=new Qe,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(it.runAndSubscribe(qn,({window:e,disposables:t})=>{t.add(U(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(U(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(U(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:Ye,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=Ue(new e),B(e.INSTANCE.targets.push(t))):V.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=Ue(new e),B(e.INSTANCE.ignoreTargets.push(t))):V.None}static isTouchDevice(){return`ontouchstart`in Ye||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(mr.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-R(s.rollingPageX))<30&&Math.abs(s.initialPageY-R(s.rollingPageY))<30){let e=this.newGestureEvent(mr.Tap,s.initialTarget);e.pageX=R(s.rollingPageX),e.pageY=R(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-R(s.rollingPageX))<30&&Math.abs(s.initialPageY-R(s.rollingPageY))<30){let e=this.newGestureEvent(mr.Contextmenu,s.initialTarget);e.pageX=R(s.rollingPageX),e.pageY=R(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=R(s.rollingPageX),n=R(s.rollingPageY),i=R(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(mr.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===mr.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else (t.type===mr.Change||t.type===mr.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=er(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(mr.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(mr.Change,i.initialTarget);a.translationX=r.pageX-R(i.rollingPageX),a.translationY=r.pageY-R(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};hr.SCROLL_FRICTION=-.005,hr.HOLD_DELAY=700,hr.CLEAR_TAP_COUNT_TIME=400,c([pr],hr,`isTouchDevice`,1);var gr=hr,_r=class extends V{onclick(e,t){this._register(U(e,ar.CLICK,n=>t(new hn(Bn(e),n))))}onmousedown(e,t){this._register(U(e,ar.MOUSE_DOWN,n=>t(new hn(Bn(e),n))))}onmouseover(e,t){this._register(U(e,ar.MOUSE_OVER,n=>t(new hn(Bn(e),n))))}onmouseleave(e,t){this._register(U(e,ar.MOUSE_LEAVE,n=>t(new hn(Bn(e),n))))}onkeydown(e,t){this._register(U(e,ar.KEY_DOWN,e=>t(new dn(e))))}onkeyup(e,t){this._register(U(e,ar.KEY_UP,e=>t(new dn(e))))}oninput(e,t){this._register(U(e,ar.INPUT,t))}onblur(e,t){this._register(U(e,ar.BLUR,t))}onfocus(e,t){this._register(U(e,ar.FOCUS,t))}onchange(e,t){this._register(U(e,ar.CHANGE,t))}ignoreGesture(e){return gr.ignoreTarget(e)}},vr=11,yr=class extends _r{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=vr+`px`,this.domNode.style.height=vr+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new fr),this._register($n(this.bgDomNode,ar.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register($n(this.domNode,ar.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new tr),this._pointerdownScheduleRepeatTimer=this._register(new bn)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Bn(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},br=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},xr=class extends V{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new H),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new br(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new Tr(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Tr.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Sr=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Cr(e,t){let n=t-e;return function(t){return e+n*Dr(t)}}function wr(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var Tr=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),wr(Cr(e,r),Cr(i,t),.33)}return Cr(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new Sr(this.scrollLeft(t),this.scrollTop(t),!1):new Sr(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){return r+=10,new e(t,n,Date.now()-10,r)}};function Er(e){return e**3}function Dr(e){return 1-Er(1-e)}var Or=class extends V{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new bn)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},kr=140,Ar=class extends _r{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Or(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new fr),this._shouldRender=!0,this.domNode=dr(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(U(this.domNode.domNode,ar.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new yr(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=dr(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(U(this.slider.domNode,ar.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=ir(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(Vt&&a>kr){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},jr=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize===t?!1:(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize===t?!1:(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition===t?!1:(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},Mr=class extends Ar{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new jr(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Nr=class extends Ar{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new jr(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Pr=500,Fr=50,Ir=!0,Lr=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Rr=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(Et){let t=St(Bn(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new Lr(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Rr.INSTANCE=new Rr;var zr=Rr,Br=class extends _r{constructor(e,t,n){super(),this._onScroll=this._register(new H),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new H),this.onWillScroll=this._onWillScroll.event,this._options=Hr(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Nr(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Mr(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=dr(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=dr(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=dr(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new bn),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=We(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Ht&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new gn(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=We(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(U(this._listenOnDomNode,ar.MOUSE_WHEEL,e=>{this._onMouseWheel(new gn(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=zr.INSTANCE;Ir&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!Ht&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=Fr*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=Fr*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(Ir&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Pr)}},Vr=class extends Br{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Hr(e){let t={lazyRender:typeof e.lazyRender<`u`?e.lazyRender:!1,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<`u`?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`?e.horizontalHasArrows:!1,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,Ht&&(t.className+=` mac`),t}var Ur=class extends V{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new H),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new xr({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>er(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Vr(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(it.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(B(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(B(()=>this._styleElement.remove())),this._register(it.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
30
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Ur=c([l(2,F),l(3,fe),l(4,te),l(5,_e),l(6,I),l(7,me)],Ur);var Wr=class extends V{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(B(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Wr=c([l(1,F),l(2,fe),l(3,ce),l(4,me)],Wr);var Gr=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Kr={full:0,left:0,center:0,right:0},qr={full:0,left:0,center:0,right:0},Jr={full:0,left:0,center:0,right:0},Yr=class extends V{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new Gr,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(B(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);qr.full=this._canvas.width,qr.left=e,qr.center=t,qr.right=e,this._refreshDrawHeightConstants(),Jr.full=1,Jr.left=1,Jr.center=1+qr.left,Jr.right=1+qr.left+qr.center}_refreshDrawHeightConstants(){Kr.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Kr.left=t,Kr.center=t,Kr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Kr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Kr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Kr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Kr.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Jr[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Kr[e.position||`full`]/2),qr[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Kr[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Yr=c([l(2,F),l(3,ce),l(4,me),l(5,I),l(6,_e),l(7,fe)],Yr);var W;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
31
|
+
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(W||={});var Xr;(e=>(e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``))(Xr||={});var Zr;(e=>e.ST=`${W.ESC}\\`)(Zr||={});var Qr=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${W.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Qr=c([l(2,F),l(3,I),l(4,ne),l(5,me)],Qr);var $r=0,ei=0,ti=0,G=0,ni={css:`#00000000`,rgba:0},ri;(e=>{function t(e,t,n,r){return r===void 0?`#${oi(e)}${oi(t)}${oi(n)}`:`#${oi(e)}${oi(t)}${oi(n)}${oi(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(ri||={});var K;(e=>{function t(e,t){if(G=(t.rgba&255)/255,G===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return $r=a+Math.round((n-a)*G),ei=o+Math.round((r-o)*G),ti=s+Math.round((i-s)*G),{css:ri.toCss($r,ei,ti),rgba:ri.toRgba($r,ei,ti)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=ai.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return ri.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[$r,ei,ti]=ai.toChannels(t),{css:ri.toCss($r,ei,ti),rgba:t}}e.opaque=i;function a(e,t){return G=Math.round(t*255),[$r,ei,ti]=ai.toChannels(e.rgba),{css:ri.toCss($r,ei,ti,G),rgba:ri.toRgba($r,ei,ti,G)}}e.opacity=a;function o(e,t){return G=e.rgba&255,a(e,G*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(K||={});var q;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return $r=parseInt(e.slice(1,2).repeat(2),16),ei=parseInt(e.slice(2,3).repeat(2),16),ti=parseInt(e.slice(3,4).repeat(2),16),ri.toColor($r,ei,ti);case 5:return $r=parseInt(e.slice(1,2).repeat(2),16),ei=parseInt(e.slice(2,3).repeat(2),16),ti=parseInt(e.slice(3,4).repeat(2),16),G=parseInt(e.slice(4,5).repeat(2),16),ri.toColor($r,ei,ti,G);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 r=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(r)return $r=parseInt(r[1]),ei=parseInt(r[2]),ti=parseInt(r[3]),G=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),ri.toColor($r,ei,ti,G);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[$r,ei,ti,G]=t.getImageData(0,0,1,1).data,G!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:ri.toRgba($r,ei,ti,G),css:e}}e.toColor=r})(q||={});var ii;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(ii||={});var ai;(e=>{function t(e,t){if(G=(t&255)/255,G===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return $r=a+Math.round((n-a)*G),ei=o+Math.round((r-o)*G),ti=s+Math.round((i-s)*G),ri.toRgba($r,ei,ti)}e.blend=t;function n(e,t,n){let a=ii.relativeLuminance(e>>8),o=ii.relativeLuminance(t>>8);if(si(a,o)<n){if(o<a){let o=r(e,t,n),s=si(a,ii.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>si(a,ii.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=si(a,ii.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>si(a,ii.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=si(ii.relativeLuminance2(o,s,c),ii.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=si(ii.relativeLuminance2(o,s,c),ii.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=si(ii.relativeLuminance2(o,s,c),ii.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=si(ii.relativeLuminance2(o,s,c),ii.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(ai||={});function oi(e){let t=e.toString(16);return t.length<2?`0`+t:t}function si(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var ci=class extends E{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},li=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new O}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||T.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)li._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||T.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};li=c([l(0,F)],li);function ui(e){return 57508<=e&&e<=57558}function di(e){return 9472<=e&&e<=9631}function fi(e){return ui(e)||di(e)}function pi(){return{css:{canvas:mi(),cell:mi()},device:{canvas:mi(),cell:mi(),char:{width:0,height:0,left:0,top:0}}}}function mi(){return{width:0,height:0}}var hi=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new O,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,ee=0,C=!1,w=0,D=0,O=[],k=l!==-1&&u!==-1;for(let A=0;A<m;A++){e.loadCell(A,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let j=!1,M=A>=D,N=A,P=this._workCell;if(f.length>0&&A===f[0][0]&&M){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)M&&=i===this._isCellInSelection(v,t);M&&=!n||a<r[0]||a>=r[1],M?(j=!0,P=new ci(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),N=r[1]-1,m=P.getWidth()):D=r[1]}let F=this._isCellInSelection(A,t),te=n&&A===a,ne=k&&A>=l&&A<=u,re=!1;this._decorationService.forEachDecorationAtCell(A,t,void 0,e=>{re=!0});let ie=P.getChars()||T;if(ie===` `&&(P.isUnderline()||P.isOverline())&&(ie=`\xA0`),w=m*s-c.get(ie,P.isBold(),P.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(F&&C||!F&&!C&&P.bg===y)&&(F&&C&&p.selectionForeground||P.fg===b)&&P.extended.ext===x&&ne===S&&w===ee&&!te&&!j&&!re&&M){P.isInvisible()?_+=T:_+=ie,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=P.bg,b=P.fg,x=P.extended.ext,S=ne,ee=w,C=F,j&&a>=A&&a<=N&&(a=A),!this._coreService.isCursorHidden&&te&&this._coreService.isCursorInitialized){if(O.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&O.push(`xterm-cursor-blink`),O.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:O.push(`xterm-cursor-outline`);break;case`block`:O.push(`xterm-cursor-block`);break;case`bar`:O.push(`xterm-cursor-bar`);break;case`underline`:O.push(`xterm-cursor-underline`);break;default:break}}if(P.isBold()&&O.push(`xterm-bold`),P.isItalic()&&O.push(`xterm-italic`),P.isDim()&&O.push(`xterm-dim`),_=P.isInvisible()?T:P.getChars()||T,P.isUnderline()&&(O.push(`xterm-underline-${P.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!P.isUnderlineColorDefault()))if(P.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${E.toColorRGB(P.getUnderlineColor()).join(`,`)})`;else{let e=P.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&P.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}P.isOverline()&&(O.push(`xterm-overline`),_===` `&&(_=`\xA0`)),P.isStrikethrough()&&O.push(`xterm-strikethrough`),ne&&(h.style.textDecoration=`underline`);let ae=P.getFgColor(),I=P.getFgColorMode(),oe=P.getBgColor(),se=P.getBgColorMode(),ce=!!P.isInverse();if(ce){let e=ae;ae=oe,oe=e;let t=I;I=se,se=t}let le,ue,de=!1;this._decorationService.forEachDecorationAtCell(A,t,void 0,e=>{e.options.layer!==`top`&&de||(e.backgroundColorRGB&&(se=50331648,oe=e.backgroundColorRGB.rgba>>8&16777215,le=e.backgroundColorRGB),e.foregroundColorRGB&&(I=50331648,ae=e.foregroundColorRGB.rgba>>8&16777215,ue=e.foregroundColorRGB),de=e.options.layer===`top`)}),!de&&F&&(le=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,oe=le.rgba>>8&16777215,se=50331648,de=!0,p.selectionForeground&&(I=50331648,ae=p.selectionForeground.rgba>>8&16777215,ue=p.selectionForeground)),de&&O.push(`xterm-decoration-top`);let fe;switch(se){case 16777216:case 33554432:fe=p.ansi[oe],O.push(`xterm-bg-${oe}`);break;case 50331648:fe=ri.toColor(oe>>16,oe>>8&255,oe&255),this._addStyle(h,`background-color:#${gi((oe>>>0).toString(16),`0`,6)}`);break;default:ce?(fe=p.foreground,O.push(`xterm-bg-257`)):fe=p.background}switch(le||P.isDim()&&(le=K.multiplyOpacity(fe,.5)),I){case 16777216:case 33554432:P.isBold()&&ae<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ae+=8),this._applyMinimumContrast(h,fe,p.ansi[ae],P,le,void 0)||O.push(`xterm-fg-${ae}`);break;case 50331648:let e=ri.toColor(ae>>16&255,ae>>8&255,ae&255);this._applyMinimumContrast(h,fe,e,P,le,ue)||this._addStyle(h,`color:#${gi(ae.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,fe,p.foreground,P,le,ue)||ce&&O.push(`xterm-fg-257`)}O.length&&=(h.className=O.join(` `),0),!te&&!j&&!re&&M?g++:h.textContent=_,w!==this.defaultSpacing&&(h.style.letterSpacing=`${w}px`),d.push(h),A=N}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||fi(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=K.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};hi=c([l(1,ge),l(2,I),l(3,fe),l(4,ne),l(5,ce),l(6,_e)],hi);function gi(e,t,n){for(;e.length<n;)e=t+e;return e}var _i=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},vi=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,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function yi(){return new vi}var bi=`xterm-dom-renderer-owner-`,xi=`xterm-rows`,Si=`xterm-fg-`,Ci=`xterm-bg-`,wi=`xterm-focus`,Ti=`xterm-selection`,Ei=1,Di=class extends V{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=Ei++,this._rowElements=[],this._selectionRenderModel=yi(),this.onRequestRedraw=this._register(new H).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(xi),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(Ti),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=pi(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(hi,document),this._element.classList.add(bi+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(B(()=>{this._element.classList.remove(bi+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new _i(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${xi} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${xi} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${xi} .xterm-dim { color: ${K.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${xi}.${wi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${xi}.${wi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${xi}.${wi} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${xi} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${xi} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${xi} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${xi} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${xi} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Ti} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ti} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ti} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${Si}${n} { color: ${r.css}; }${this._terminalSelector} .${Si}${n}.xterm-dim { color: ${K.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${Ci}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${Si}257 { color: ${K.opaque(e.background).css}; }${this._terminalSelector} .${Si}257.xterm-dim { color: ${K.multiplyOpacity(K.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ci}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(wi),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(wi),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${bi}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};Di=c([l(7,ie),l(8,de),l(9,I),l(10,F),l(11,ne),l(12,fe),l(13,_e)],Di);var Oi=class extends V{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new H),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new ji(this._optionsService))}catch{this._measureStrategy=this._register(new Ai(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Oi=c([l(2,I)],Oi);var ki=class extends V{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},Ai=class extends ki{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},ji=class extends ki{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},Mi=class extends V{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Ni(this._window)),this._onDprChange=this._register(new H),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new H),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(it.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(U(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(U(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},Ni=class extends V{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Je),this._onDprChange=this._register(new H),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(B(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=U(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},Pi=class extends V{constructor(){super(),this.linkProviders=[],this._register(B(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function Fi(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function Ii(e,t,n,r,i,a,o,s,c){if(!a)return;let l=Fi(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var Li=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return Ii(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=Fi(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Li=c([l(0,me),l(1,de)],Li);var Ri=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},zi={};s(zi,{getSafariVersion:()=>Ki,isChromeOS:()=>Qi,isFirefox:()=>Ui,isIpad:()=>Ji,isIphone:()=>Yi,isLegacyEdge:()=>Wi,isLinux:()=>Zi,isMac:()=>qi,isNode:()=>Bi,isSafari:()=>Gi,isWindows:()=>Xi});var Bi=typeof process<`u`&&`title`in process,Vi=Bi?`node`:navigator.userAgent,Hi=Bi?`node`:navigator.platform,Ui=Vi.includes(`Firefox`),Wi=Vi.includes(`Edge`),Gi=/^((?!chrome|android).)*safari/i.test(Vi);function Ki(){if(!Gi)return 0;let e=Vi.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var qi=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(Hi),Ji=Hi===`iPad`,Yi=Hi===`iPhone`,Xi=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(Hi),Zi=Hi.indexOf(`Linux`)>=0,Qi=/\bCrOS\b/.test(Vi),$i=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),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},ea=class extends $i{_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())}}},ta=class extends $i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},na=!Bi&&`requestIdleCallback`in window?ta:ea,ra=class{constructor(){this._queue=new na}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},ia=class extends V{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new Je),this._pausedResizeTask=new ra,this._observerDisposable=this._register(new Je),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new H),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new H),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new H),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new H),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Ri((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new aa(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(B(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=B(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};ia=c([l(2,I),l(3,de),l(4,ne),l(5,ce),l(6,F),l(7,fe),l(8,_e)],ia);var aa=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function oa(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return Y(i,a,e,t,n,r)+ca(a,t,n,r)+la(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,ga(Math.abs(i-e),ha(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return ga(J(a>t?e:i,n)+(s-1)*n.cols+1+sa(a>t?i:e,n),ha(o,r))}function sa(e,t){return e-1}function J(e,t){return t.cols-e}function Y(e,t,n,r,i,a){return ca(t,r,i,a).length===0?``:ga(ma(e,t,e,t-da(t,i),!1,i).length,ha(`D`,a))}function ca(e,t,n,r){let i=e-da(e,n),a=t-da(t,n);return ga(Math.abs(i-a)-ua(e,t,n),ha(pa(e,t),r))}function la(e,t,n,r,i,a){let o;o=ca(t,r,i,a).length>0?r-da(r,i):t;let s=r,c=fa(e,t,n,r,i,a);return ga(ma(e,o,n,s,c===`C`,i).length,ha(c,a))}function ua(e,t,n){let r=0,i=e-da(e,n),a=t-da(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=pa(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function da(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function fa(e,t,n,r,i,a){let o;return o=ca(n,r,i,a).length>0?r-da(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function pa(e,t){return e>t?`A`:`B`}function ma(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function ha(e,t){let n=t?`O`:`[`;return W.ESC+n+e}function ga(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var _a=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function va(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var ya=50,ba=15,xa=50,Sa=500,Ca=RegExp(`\xA0`,`g`),wa=class extends V{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new O,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new H),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new H),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new H),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new H),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new _a(this._bufferService),this._activeSelectionMode=0,this._register(B(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(Ca,` `)).join(Xi?`\r
|
|
32
|
+
`:`
|
|
33
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),Zi&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=va(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=Fi(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-ya),ya),t/=ya,t/Math.abs(t)+Math.round(t*(ba-1)))}shouldForceSelection(e){return qi?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),xa)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(qi&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<Sa&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=oa(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=va(n,this._bufferService.cols)}};wa=c([l(3,F),l(4,ne),l(5,pe),l(6,I),l(7,me),l(8,fe)],wa);var Ta=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Ea=class{constructor(){this._color=new Ta,this._css=new Ta}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Da=Object.freeze((()=>{let e=[q.toColor(`#2e3436`),q.toColor(`#cc0000`),q.toColor(`#4e9a06`),q.toColor(`#c4a000`),q.toColor(`#3465a4`),q.toColor(`#75507b`),q.toColor(`#06989a`),q.toColor(`#d3d7cf`),q.toColor(`#555753`),q.toColor(`#ef2929`),q.toColor(`#8ae234`),q.toColor(`#fce94f`),q.toColor(`#729fcf`),q.toColor(`#ad7fa8`),q.toColor(`#34e2e2`),q.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:ri.toCss(r,i,a),rgba:ri.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:ri.toCss(n,n,n),rgba:ri.toRgba(n,n,n)})}return e})()),Oa=q.toColor(`#ffffff`),ka=q.toColor(`#000000`),Aa=q.toColor(`#ffffff`),ja=ka,Ma={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},Na=Oa,Pa=class extends V{constructor(e){super(),this._optionsService=e,this._contrastCache=new Ea,this._halfContrastCache=new Ea,this._onChangeColors=this._register(new H),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Oa,background:ka,cursor:Aa,cursorAccent:ja,selectionForeground:void 0,selectionBackgroundTransparent:Ma,selectionBackgroundOpaque:K.blend(ka,Ma),selectionInactiveBackgroundTransparent:Ma,selectionInactiveBackgroundOpaque:K.blend(ka,Ma),scrollbarSliderBackground:K.opacity(Oa,.2),scrollbarSliderHoverBackground:K.opacity(Oa,.4),scrollbarSliderActiveBackground:K.opacity(Oa,.5),overviewRulerBorder:Oa,ansi:Da.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=X(e.foreground,Oa),t.background=X(e.background,ka),t.cursor=K.blend(t.background,X(e.cursor,Aa)),t.cursorAccent=K.blend(t.background,X(e.cursorAccent,ja)),t.selectionBackgroundTransparent=X(e.selectionBackground,Ma),t.selectionBackgroundOpaque=K.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=X(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=K.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?X(e.selectionForeground,ni):void 0,t.selectionForeground===ni&&(t.selectionForeground=void 0),K.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=K.opacity(t.selectionBackgroundTransparent,.3)),K.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=K.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=X(e.scrollbarSliderBackground,K.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=X(e.scrollbarSliderHoverBackground,K.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=X(e.scrollbarSliderActiveBackground,K.opacity(t.foreground,.5)),t.overviewRulerBorder=X(e.overviewRulerBorder,Na),t.ansi=Da.slice(),t.ansi[0]=X(e.black,Da[0]),t.ansi[1]=X(e.red,Da[1]),t.ansi[2]=X(e.green,Da[2]),t.ansi[3]=X(e.yellow,Da[3]),t.ansi[4]=X(e.blue,Da[4]),t.ansi[5]=X(e.magenta,Da[5]),t.ansi[6]=X(e.cyan,Da[6]),t.ansi[7]=X(e.white,Da[7]),t.ansi[8]=X(e.brightBlack,Da[8]),t.ansi[9]=X(e.brightRed,Da[9]),t.ansi[10]=X(e.brightGreen,Da[10]),t.ansi[11]=X(e.brightYellow,Da[11]),t.ansi[12]=X(e.brightBlue,Da[12]),t.ansi[13]=X(e.brightMagenta,Da[13]),t.ansi[14]=X(e.brightCyan,Da[14]),t.ansi[15]=X(e.brightWhite,Da[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=X(e.extendedAnsi[r],Da[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Pa=c([l(0,I)],Pa);function X(e,t){if(e!==void 0)try{return q.toColor(e)}catch{}return t}var Fa=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Ia=class{constructor(){this._services=new Fa,this._services.set(ie,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=M(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},La={trace:0,debug:1,info:2,warn:3,error:4,off:5},Ra=`xterm.js: `,za=class extends V{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),Ba=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=La[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:Ra)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};za=c([l(0,I)],za);var Ba,Va=class extends V{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new H),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new H),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new H),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Z=3,Ha=Object.freeze(new E),Ua=0,Wa=2,Ga=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*Z);let r=t||O.fromCharData([0,w,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*Z+0],n=t&2097151;return[this._data[e*Z+1],t&2097152?this._combined[e]:n?x(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*Z+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*Z+0]=e|2097152|t[2]<<22):this._data[e*Z+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*Z+0]>>22}hasWidth(e){return this._data[e*Z+0]&12582912}getFg(e){return this._data[e*Z+1]}getBg(e){return this._data[e*Z+2]}hasContent(e){return this._data[e*Z+0]&4194303}getCodePoint(e){let t=this._data[e*Z+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*Z+0]&2097152}getString(e){let t=this._data[e*Z+0];return t&2097152?this._combined[e]:t&2097151?x(t&2097151):``}isProtected(e){return this._data[e*Z+2]&536870912}loadCell(e,t){return Ua=e*Z,t.content=this._data[Ua+0],t.fg=this._data[Ua+1],t.bg=this._data[Ua+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*Z+0]=t.content,this._data[e*Z+1]=t.fg,this._data[e*Z+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*Z+0]=t|n<<22,this._data[e*Z+1]=r.fg,this._data[e*Z+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*Z+0];r&2097152?this._combined[e]+=x(t):r&2097151?(this._combined[e]=x(r&2097151)+x(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*Z+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new O;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new O;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*Wa<this._data.buffer.byteLength;let n=e*Z;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*Wa<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Wa<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);return}this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Z+0]&4194303)return e+(this._data[e*Z+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Z+0]&4194303||this._data[e*Z+2]&50331648)return e+(this._data[e*Z+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<Z;e++)this._data[(n+i)*Z+e]=a[(t+i)*Z+e];a[(t+i)*Z+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<Z;e++)this._data[(n+i)*Z+e]=a[(t+i)*Z+e];a[(t+i)*Z+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*Z+0],n=e&2097151,a=e&2097152?this._combined[t]:n?x(n):T;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function Ka(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=Xa(u,d,t),p=1,m=0;for(;p<u.length;){let e=Xa(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function qa(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function Ja(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function Ya(e,t,n){let r=[],i=e.map((n,r)=>Xa(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=Xa(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function Xa(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var Za=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new H),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),We(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Za._nextId=1;var Qa=Za,$a={},eo=$a.B;$a[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:``,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},$a.A={"#":`£`},$a.B=void 0,$a[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},$a.C=$a[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},$a.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},$a.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},$a.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},$a.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},$a.E=$a[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},$a.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},$a.H=$a[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},$a[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var to=4294967295,no=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=Ha.clone(),this.savedCharset=eo,this.markers=[],this._nullCell=O.fromCharData([0,w,1,0]),this._whitespaceCell=O.fromCharData([0,T,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new na,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Va(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new D),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new D),this._whitespaceCell}getBlankLine(e,t){return new Ga(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>to?to:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Ha);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Va(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Ha),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Ga(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new Ga(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=Ka(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Ha),n);if(r.length>0){let n=qa(this.lines,r);Ja(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Ha),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Ga(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Ha),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=Ya(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(Ha,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=Xa(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new Qa(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},ro=class extends V{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new H),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new no(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new no(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},io=2,ao=1,oo=class extends V{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new H),this.onResize=this._onResize.event,this._onScroll=this._register(new H),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,io),this.rows=Math.max(e.rawOptions.rows||0,ao),this.buffers=this._register(new ro(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};oo=c([l(0,I)],oo);var so={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:qi,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},co=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],lo=class extends V{constructor(e){super(),this._onOptionChange=this._register(new H),this.onOptionChange=this._onOptionChange.event;let t={...so};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(B(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in so))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in so))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=so[e],!uo(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=so[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=co.includes(t)?t:so[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={};break}return t}};function uo(e){return e===`block`||e===`underline`||e===`bar`}function fo(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&fo(e[r],t-1);return n}var po=Object.freeze({insertMode:!1}),mo=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),ho=class extends V{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new H),this.onData=this._onData.event,this._onUserInput=this._register(new H),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new H),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new H),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=fo(po),this.decPrivateModes=fo(mo)}reset(){this.modes=fo(po),this.decPrivateModes=fo(mo)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};ho=c([l(0,F),l(1,ae),l(2,I)],ho);var go={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function _o(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var vo=String.fromCharCode,yo={DEFAULT:e=>{let t=[_o(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${vo(t[0])}${vo(t[1])}${vo(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${_o(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${_o(e,!0)};${e.x};${e.y}${t}`}},bo=class extends V{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new H),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(go))this.addProtocol(e,go[e]);for(let e of Object.keys(yo))this.addEncoding(e,yo[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};bo=c([l(0,F),l(1,ne),l(2,I)],bo);var xo=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],So=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],Co;function wo(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var To=class{constructor(){if(this.version=`6`,!Co){Co=new Uint8Array(65536),Co.fill(1),Co[0]=0,Co.fill(0,1,32),Co.fill(0,127,160),Co.fill(2,4352,4448),Co[9001]=2,Co[9002]=2,Co.fill(2,11904,42192),Co[12351]=1,Co.fill(2,44032,55204),Co.fill(2,63744,64256),Co.fill(2,65040,65050),Co.fill(2,65072,65136),Co.fill(2,65280,65377),Co.fill(2,65504,65511);for(let e=0;e<xo.length;++e)Co.fill(0,xo[e][0],xo[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Co[e]:wo(e,So)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Eo.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Eo.createPropertyValue(0,n,r)}},Eo=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new H,this.onChange=this._onChange.event;let e=new To;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Do=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Oo(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var ko=2147483647,Ao=256,jo=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>Ao)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>ko?ko:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>ko?ko:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,ko):e}},Mo=[],No=class{constructor(){this._state=0,this._active=Mo,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Mo}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=Mo,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Mo,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,S(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Mo,this._id=-1,this._state=0}}},Po=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=S(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},Fo=[],Io=class{constructor(){this._handlers=Object.create(null),this._active=Fo,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Fo}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Fo,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Fo,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,S(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Fo,this._ident=0}},Lo=new jo;Lo.addParam(0);var Ro=class{constructor(e){this._handler=e,this._data=``,this._params=Lo,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Lo,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=S(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=Lo,this._data=``,this._hitLimit=!1,e));return this._params=Lo,this._data=``,this._hitLimit=!1,t}},zo=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},Bo=160,Vo=function(){let e=new zo(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Bo,0,2,0),e.add(Bo,8,5,8),e.add(Bo,6,0,6),e.add(Bo,11,0,11),e.add(Bo,13,13,13),e}(),Ho=class extends V{constructor(e=Vo){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new jo,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(B(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new No),this._dcsParser=this._register(new Io),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:Bo)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<Bo){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Bo){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Bo){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<Bo){this._printHandler(e,n,i),n=i-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<Bo){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<Bo){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},Uo=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,Wo=/^[\da-f]+$/;function Go(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=Uo.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),Wo.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function Ko(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function qo(e,t=16){let[n,r,i]=e;return`rgb:${Ko(n,t)}/${Ko(r,t)}/${Ko(i,t)}`}var Jo={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Yo=131072,Xo=10;function Zo(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var Qo=5e3,$o=0,es=class extends V{constructor(e,t,n,r,i,a,o,s,c=new Ho){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new ee,this._utf8Decoder=new C,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Ha.clone(),this._eraseAttrDataInternal=Ha.clone(),this._onRequestBell=this._register(new H),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new H),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new H),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new H),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new H),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new H),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new H),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new H),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new H),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new H),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new H),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new H),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new H),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new ts(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(W.BEL,()=>this.bell()),this._parser.setExecuteHandler(W.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(W.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(W.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(W.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(W.BS,()=>this.backspace()),this._parser.setExecuteHandler(W.HT,()=>this.tab()),this._parser.setExecuteHandler(W.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(W.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Xr.IND,()=>this.index()),this._parser.setExecuteHandler(Xr.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Xr.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Po(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new Po(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new Po(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new Po(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new Po(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new Po(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new Po(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new Po(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new Po(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new Po(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new Po(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new Po(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in $a)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new Ro((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),Qo))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${Qo} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Yo&&(a=this._parseStack.position+Yo)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Yo&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Yo))),o||this._dirtyRowTracker.clearRange(),e.length>Yo)for(let t=a;t<e.length;t+=Yo){let a=t+Yo<e.length?t+Yo:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=Eo.extractWidth(t);let n=Eo.extractShouldJoin(t),m=n?Eo.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(x(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof Ga&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>Zo(e.params[0],this._optionsService.rawOptions.windowOptions)?t(e):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Ro(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Po(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Ha));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=Eo.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(W.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(W.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(W.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(W.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(W.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,eo),this._charsetService.setgCharset(1,eo),this._charsetService.setgCharset(2,eo),this._charsetService.setgCharset(3,eo);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${W.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=E.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Ha.fg,e.bg=Ha.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=Ha.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Ha.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=Ha.fg&16777215,r.bg&=-67108864,r.bg|=Ha.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${W.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${W.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${W.ESC}[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Ha.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`;break}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Zo(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${W.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Xo&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Xo&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(ns(n))if(r===`?`)t.push({type:0,index:n});else{let e=Go(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=Go(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);ns(r)&&t.push({type:2,index:r})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,eo),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(Jo[e[0]],$a[e[1]]||eo),!0):(this.selectDefaultCharset(),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Ha.clone(),this._eraseAttrDataInternal=Ha.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new O;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${W.ESC}${e}${W.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},ts=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&($o=e,e=t,t=$o),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ts=c([l(0,F)],ts);function ns(e){return 0<=e&&e<256}var rs=5e7,is=12,as=50,os=class extends V{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new H),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>rs)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=is?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=is)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>as&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},ss=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};ss=c([l(0,F)],ss);var cs=!1,ls=class extends V{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Je),this._onBinary=this._register(new H),this.onBinary=this._onBinary.event,this._onData=this._register(new H),this.onData=this._onData.event,this._onLineFeed=this._register(new H),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new H),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new H),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new H),this._instantiationService=new Ia,this.optionsService=this._register(new lo(e)),this._instantiationService.setService(I,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(oo)),this._instantiationService.setService(F,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(za)),this._instantiationService.setService(ae,this._logService),this.coreService=this._register(this._instantiationService.createInstance(ho)),this._instantiationService.setService(ne,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(bo)),this._instantiationService.setService(te,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Eo)),this._instantiationService.setService(se,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Do),this._instantiationService.setService(re,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(ss),this._instantiationService.setService(oe,this._oscLinkService),this._inputHandler=this._register(new es(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(it.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(it.forward(this._bufferService.onResize,this._onResize)),this._register(it.forward(this.coreService.onData,this._onData)),this._register(it.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new os((e,t)=>this._inputHandler.parse(e,t))),this._register(it.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new H),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!cs&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),cs=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,io),t=Math.max(t,ao),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Oo.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(Oo(this._bufferService),!1))),this._windowsWrappingHeuristics.value=B(()=>{for(let t of e)t.dispose()})}}},us={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function ds(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?t?i.key=W.ESC+`OA`:i.key=W.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?t?i.key=W.ESC+`OD`:i.key=W.ESC+`[D`:e.key===`UIKeyInputRightArrow`?t?i.key=W.ESC+`OC`:i.key=W.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(t?i.key=W.ESC+`OB`:i.key=W.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:W.DEL,e.altKey&&(i.key=W.ESC+i.key);break;case 9:if(e.shiftKey){i.key=W.ESC+`[Z`;break}i.key=W.HT,i.cancel=!0;break;case 13:i.key=e.altKey?W.ESC+W.CR:W.CR,i.cancel=!0;break;case 27:i.key=W.ESC,e.altKey&&(i.key=W.ESC+W.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=W.ESC+`[1;`+(a+1)+`D`:t?i.key=W.ESC+`OD`:i.key=W.ESC+`[D`;break;case 39:if(e.metaKey)break;a?i.key=W.ESC+`[1;`+(a+1)+`C`:t?i.key=W.ESC+`OC`:i.key=W.ESC+`[C`;break;case 38:if(e.metaKey)break;a?i.key=W.ESC+`[1;`+(a+1)+`A`:t?i.key=W.ESC+`OA`:i.key=W.ESC+`[A`;break;case 40:if(e.metaKey)break;a?i.key=W.ESC+`[1;`+(a+1)+`B`:t?i.key=W.ESC+`OB`:i.key=W.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=W.ESC+`[2~`);break;case 46:a?i.key=W.ESC+`[3;`+(a+1)+`~`:i.key=W.ESC+`[3~`;break;case 36:a?i.key=W.ESC+`[1;`+(a+1)+`H`:t?i.key=W.ESC+`OH`:i.key=W.ESC+`[H`;break;case 35:a?i.key=W.ESC+`[1;`+(a+1)+`F`:t?i.key=W.ESC+`OF`:i.key=W.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=W.ESC+`[5;`+(a+1)+`~`:i.key=W.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=W.ESC+`[6;`+(a+1)+`~`:i.key=W.ESC+`[6~`;break;case 112:a?i.key=W.ESC+`[1;`+(a+1)+`P`:i.key=W.ESC+`OP`;break;case 113:a?i.key=W.ESC+`[1;`+(a+1)+`Q`:i.key=W.ESC+`OQ`;break;case 114:a?i.key=W.ESC+`[1;`+(a+1)+`R`:i.key=W.ESC+`OR`;break;case 115:a?i.key=W.ESC+`[1;`+(a+1)+`S`:i.key=W.ESC+`OS`;break;case 116:a?i.key=W.ESC+`[15;`+(a+1)+`~`:i.key=W.ESC+`[15~`;break;case 117:a?i.key=W.ESC+`[17;`+(a+1)+`~`:i.key=W.ESC+`[17~`;break;case 118:a?i.key=W.ESC+`[18;`+(a+1)+`~`:i.key=W.ESC+`[18~`;break;case 119:a?i.key=W.ESC+`[19;`+(a+1)+`~`:i.key=W.ESC+`[19~`;break;case 120:a?i.key=W.ESC+`[20;`+(a+1)+`~`:i.key=W.ESC+`[20~`;break;case 121:a?i.key=W.ESC+`[21;`+(a+1)+`~`:i.key=W.ESC+`[21~`;break;case 122:a?i.key=W.ESC+`[23;`+(a+1)+`~`:i.key=W.ESC+`[23~`;break;case 123:a?i.key=W.ESC+`[24;`+(a+1)+`~`:i.key=W.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=W.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=W.DEL:e.keyCode===219?i.key=W.ESC:e.keyCode===220?i.key=W.FS:e.keyCode===221&&(i.key=W.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=us[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=W.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=W.ESC+n}else if(e.keyCode===32)i.key=W.ESC+(e.ctrlKey?W.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=W.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=W.US),e.key===`@`&&(i.key=W.NUL));break}return i}var fs=0,ps=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new na,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new na,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(fs=this._search(t),fs===-1)||this._getKey(this._array[fs])!==t)return!1;do if(this._array[fs]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(fs),!0;while(++fs<this._array.length&&this._getKey(this._array[fs])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(fs=this._search(e),!(fs<0||fs>=this._array.length)&&this._getKey(this._array[fs])===e))do yield this._array[fs];while(++fs<this._array.length&&this._getKey(this._array[fs])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(fs=this._search(e),!(fs<0||fs>=this._array.length)&&this._getKey(this._array[fs])===e))do t(this._array[fs]);while(++fs<this._array.length&&this._getKey(this._array[fs])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},ms=0,hs=0,gs=class extends V{constructor(){super(),this._decorations=new ps(e=>e?.marker.line),this._onDecorationRegistered=this._register(new H),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new H),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(B(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new _s(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{ms=t.options.x??0,hs=ms+(t.options.width??1),e>=ms&&e<hs&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},_s=class extends qe{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new H),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new H),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=q.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=q.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},vs=1e3,ys=class{constructor(e,t=vs){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},bs=20,xs=!1,Ss=class extends V{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new ys(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);xs?(this._accessibilityContainer.classList.add(`debug`),this._rowContainer.classList.add(`debug`),this._debugRootContainer=i.createElement(`div`),this._debugRootContainer.classList.add(`xterm`),this._debugRootContainer.appendChild(i.createTextNode(`------start a11y------`)),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(i.createTextNode(`------end a11y------`)),this._terminal.element.insertAdjacentElement(`afterend`,this._debugRootContainer)):this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
34
|
+
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(U(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(B(()=>{xs?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<bs+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
35
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===bs+1&&(this._liveRegion.textContent+=p.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Ss=c([l(1,ie),l(2,fe),l(3,me)],Ss);var Cs=class extends V{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new H),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new H),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(B(()=>{We(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(U(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(U(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(U(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(U(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&ws(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,We(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};Cs=c([l(1,pe),l(2,me),l(3,F),l(4,L)],Cs);function ws(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Ts=class extends ls{constructor(e={}){super(e),this._linkifier=this._register(new Je),this.browser=zi,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Je),this._onCursorMove=this._register(new H),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new H),this.onKey=this._onKey.event,this._onRender=this._register(new H),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new H),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new H),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new H),this.onBell=this._onBell.event,this._onFocus=this._register(new H),this._onBlur=this._register(new H),this._onA11yCharEmitter=this._register(new H),this._onA11yTabEmitter=this._register(new H),this._onWillOpen=this._register(new H),this._setup(),this._decorationService=this._instantiationService.createInstance(gs),this._instantiationService.setService(ce,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Pi),this._instantiationService.setService(L,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(le)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(it.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(it.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(it.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(it.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(B(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=K.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${W.ESC}]${n};${qo(r)}${Zr.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=ri.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=ri.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ss,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(W.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(U(this.element,`copy`,e=>{this.hasSelection()&&g(e,this._selectionService)}));let e=e=>_(e,this.textarea,this.coreService,this.optionsService);this._register(U(this.textarea,`paste`,e)),this._register(U(this.element,`paste`,e)),Ui?this._register(U(this.element,`mousedown`,e=>{e.button===2&&b(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(U(this.element,`contextmenu`,e=>{b(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Zi&&this._register(U(this.element,`auxclick`,e=>{e.button===1&&y(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(U(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(U(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(U(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(U(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(U(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(U(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(U(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(U(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,d.get()),Qi||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Mi,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(fe,this._coreBrowserService),this._register(U(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(U(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Oi,this._document,this._helperContainer),this._instantiationService.setService(de,this._charSizeService),this._themeService=this._instantiationService.createInstance(Pa),this._instantiationService.setService(_e,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(li),this._instantiationService.setService(ge,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(ia,this.rows,this.screenElement)),this._instantiationService.setService(me,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(Qr,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Li),this._instantiationService.setService(pe,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Cs,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(Ur,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(wa,this.element,this.screenElement,r)),this._instantiationService.setService(he,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(it.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Wr,this.screenElement)),this._register(U(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ss,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Yr,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Yr,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Di,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(U(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(U(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=W.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){v(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=ds(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===W.ETX||n.key===W.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Es(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(Ha));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(W.ESC+`[I`):this.coreService.triggerDataEvent(W.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${W.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${W.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Es(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Ds=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Os=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new O)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},ks=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new Os(t)}getNullCell(){return new O}},As=class extends V{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new H),this.onBufferChange=this._onBufferChange.event,this._normal=new ks(this._core.buffers.normal,`normal`),this._alternate=new ks(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},js=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},Ms=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Ns=[`cols`,`rows`],Ps=0,Fs=class extends V{constructor(e){super(),this._core=this._register(new Ts(e)),this._addonManager=this._register(new Ds),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(Ns.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new js(this._core),this._parser}get unicode(){return this._checkProposedApi(),new Ms(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new As(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`;break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
36
|
+
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return d.get()},set promptLabel(e){d.set(e)},get tooMuchOutput(){return p.get()},set tooMuchOutput(e){p.set(e)}}}_verifyIntegers(...e){for(Ps of e)if(Ps===1/0||isNaN(Ps)||Ps%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Ps of e)if(Ps&&(Ps===1/0||isNaN(Ps)||Ps%1!=0||Ps<0))throw Error(`This API only accepts positive integers`)}},Is=2,Ls=1,Rs=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Is,Math.floor(u/e.css.cell.width)),rows:Math.max(Ls,Math.floor(l/e.css.cell.height))}}},zs=Object.defineProperty,Bs=Object.getOwnPropertyDescriptor,Vs=(e,t,n,r)=>{for(var i=r>1?void 0:r?Bs(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&zs(t,n,i),i},Hs=(e,t)=>(n,r)=>t(n,r,e),Us=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Js.isErrorNoTelemetry(e)?new Js(e.message+`
|
|
37
|
+
|
|
38
|
+
`+e.stack):Error(e.message+`
|
|
39
|
+
|
|
40
|
+
`+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 Ws(e){Ks(e)||Us.onUnexpectedError(e)}var Gs=`Canceled`;function Ks(e){return e instanceof qs?!0:e instanceof Error&&e.name===Gs&&e.message===Gs}var qs=class extends Error{constructor(){super(Gs),this.name=this.message}},Js=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}};function Ys(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}var Xs=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=Ys(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};Xs.assertInvariants=!1;var Zs;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Zs||={});function Qs(e,t){return(n,r)=>t(e(n),e(r))}var $s=(e,t)=>e-t,ec=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Zs.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};ec.empty=new ec(e=>{});function tc(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var nc=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function rc(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var ic;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(ic||={});var ac=!1,oc=null,sc=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
|
|
41
|
+
`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new nc;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
|
|
42
|
+
`),e)}n.sort(Qs(e=>e.idx,$s));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
|
|
43
|
+
`)).size}/${n.length} leaks) at ${a}`;let o=tc([...i.get(e.slice(0,t).join(`
|
|
44
|
+
`))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
|
|
48
|
+
${s.join(`
|
|
49
|
+
`)}
|
|
50
|
+
============================================================
|
|
51
|
+
|
|
52
|
+
`}return n.length>e&&(a+=`
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
... and ${n.length-e} more leaking disposables
|
|
56
|
+
|
|
57
|
+
`),{leaks:n,details:a}}};sc.idx=0;function cc(e){oc=e}if(ac){let e=`__is_disposable_tracked__`;cc(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==vc.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==vc.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function lc(e){return oc?.trackDisposable(e),e}function uc(e){oc?.markAsDisposed(e)}function dc(e,t){oc?.setParent(e,t)}function fc(e,t){if(oc)for(let n of e)oc.setParent(n,t)}function pc(e){if(ic.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function mc(...e){let t=hc(()=>pc(e));return fc(e,t),t}function hc(e){let t=lc({dispose:rc(()=>{uc(t),e()})});return t}var gc=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,lc(this)}dispose(){this._isDisposed||(uc(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{pc(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return dc(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),dc(e,null))}};gc.DISABLE_DISPOSED_WARNING=!1;var _c=gc,vc=class{constructor(){this._store=new _c,lc(this),dc(this._store,this)}dispose(){uc(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};vc.None=Object.freeze({dispose(){}});var yc=class{constructor(){this._isDisposed=!1,lc(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&dc(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,uc(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&dc(e,null),e}},bc=typeof process<`u`&&`title`in process,xc=bc?`node`:navigator.userAgent,Sc=bc?`node`:navigator.platform,Cc=xc.includes(`Firefox`),wc=xc.includes(`Edge`),Tc=/^((?!chrome|android).)*safari/i.test(xc);function Ec(){if(!Tc)return 0;let e=xc.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(Sc),[`Windows`,`Win16`,`Win32`,`WinCE`].includes(Sc),Sc.indexOf(`Linux`),/\bCrOS\b/.test(xc);var Dc=``,Oc=0,kc=0,Ac=0,jc=0,Mc={css:`#00000000`,rgba:0},Nc;(e=>{function t(e,t,n,r){return r===void 0?`#${Rc(e)}${Rc(t)}${Rc(n)}`:`#${Rc(e)}${Rc(t)}${Rc(n)}${Rc(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(Nc||={});var Pc;(e=>{function t(e,t){if(jc=(t.rgba&255)/255,jc===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return Oc=a+Math.round((n-a)*jc),kc=o+Math.round((r-o)*jc),Ac=s+Math.round((i-s)*jc),{css:Nc.toCss(Oc,kc,Ac),rgba:Nc.toRgba(Oc,kc,Ac)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=Lc.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return Nc.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[Oc,kc,Ac]=Lc.toChannels(t),{css:Nc.toCss(Oc,kc,Ac),rgba:t}}e.opaque=i;function a(e,t){return jc=Math.round(t*255),[Oc,kc,Ac]=Lc.toChannels(e.rgba),{css:Nc.toCss(Oc,kc,Ac,jc),rgba:Nc.toRgba(Oc,kc,Ac,jc)}}e.opacity=a;function o(e,t){return jc=e.rgba&255,a(e,jc*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(Pc||={});var Fc;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Oc=parseInt(e.slice(1,2).repeat(2),16),kc=parseInt(e.slice(2,3).repeat(2),16),Ac=parseInt(e.slice(3,4).repeat(2),16),Nc.toColor(Oc,kc,Ac);case 5:return Oc=parseInt(e.slice(1,2).repeat(2),16),kc=parseInt(e.slice(2,3).repeat(2),16),Ac=parseInt(e.slice(3,4).repeat(2),16),jc=parseInt(e.slice(4,5).repeat(2),16),Nc.toColor(Oc,kc,Ac,jc);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 r=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(r)return Oc=parseInt(r[1]),kc=parseInt(r[2]),Ac=parseInt(r[3]),jc=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),Nc.toColor(Oc,kc,Ac,jc);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[Oc,kc,Ac,jc]=t.getImageData(0,0,1,1).data,jc!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:Nc.toRgba(Oc,kc,Ac,jc),css:e}}e.toColor=r})(Fc||={});var Ic;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(Ic||={});var Lc;(e=>{function t(e,t){if(jc=(t&255)/255,jc===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return Oc=a+Math.round((n-a)*jc),kc=o+Math.round((r-o)*jc),Ac=s+Math.round((i-s)*jc),Nc.toRgba(Oc,kc,Ac)}e.blend=t;function n(e,t,n){let a=Ic.relativeLuminance(e>>8),o=Ic.relativeLuminance(t>>8);if(zc(a,o)<n){if(o<a){let o=r(e,t,n),s=zc(a,Ic.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>zc(a,Ic.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=zc(a,Ic.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>zc(a,Ic.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=zc(Ic.relativeLuminance2(o,s,c),Ic.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=zc(Ic.relativeLuminance2(o,s,c),Ic.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=zc(Ic.relativeLuminance2(o,s,c),Ic.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=zc(Ic.relativeLuminance2(o,s,c),Ic.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(Lc||={});function Rc(e){let t=e.toString(16);return t.length<2?`0`+t:t}function zc(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Bc(e){if(!e)throw Error(`value must not be falsy`);return e}function Vc(e){return 57508<=e&&e<=57558}function Hc(e){return 57520<=e&&e<=57527}function Uc(e){return 57344<=e&&e<=63743}function Wc(e){return 9472<=e&&e<=9631}function Gc(e){return e>=128512&&e<=128591||e>=127744&&e<=128511||e>=128640&&e<=128767||e>=9728&&e<=9983||e>=9984&&e<=10175||e>=65024&&e<=65039||e>=129280&&e<=129535||e>=127462&&e<=127487}function Kc(e,t,n,r){return t===1&&n>Math.ceil(r*1.5)&&e!==void 0&&e>255&&!Gc(e)&&!Vc(e)&&!Uc(e)}function qc(e){return Vc(e)||Wc(e)}function Jc(){return{css:{canvas:Yc(),cell:Yc()},device:{canvas:Yc(),cell:Yc(),char:{width:0,height:0,left:0,top:0}}}}function Yc(){return{width:0,height:0}}function Xc(e,t,n=0){return(e-(Math.round(t)*2-n))%(Math.round(t)*2)}var Zc=0,Qc=0,$c=!1,el=!1,tl=!1,nl,rl=0,il=class{constructor(e,t,n,r,i,a){this._terminal=e,this._optionService=t,this._selectionRenderModel=n,this._decorationService=r,this._coreBrowserService=i,this._themeService=a,this.result={fg:0,bg:0,ext:0}}resolve(e,t,n,r){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=e.bg&268435456?e.extended.ext:0,Qc=0,Zc=0,el=!1,$c=!1,tl=!1,nl=this._themeService.colors,rl=0,e.getCode()!==0&&e.extended.underlineStyle===4){let e=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));rl=t*r%(Math.round(e)*2)}if(this._decorationService.forEachDecorationAtCell(t,n,`bottom`,e=>{e.backgroundColorRGB&&(Qc=e.backgroundColorRGB.rgba>>8&16777215,el=!0),e.foregroundColorRGB&&(Zc=e.foregroundColorRGB.rgba>>8&16777215,$c=!0)}),tl=this._selectionRenderModel.isCellSelected(this._terminal,t,n),tl){if(this.result.fg&67108864||this.result.bg&50331648){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Qc=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Qc=(this.result.fg&16777215)<<8|255;break;case 0:default:Qc=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Qc=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Qc=(this.result.bg&16777215)<<8|255;break}Qc=Lc.blend(Qc,(this._coreBrowserService.isFocused?nl.selectionBackgroundOpaque:nl.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Qc=(this._coreBrowserService.isFocused?nl.selectionBackgroundOpaque:nl.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(el=!0,nl.selectionForeground&&(Zc=nl.selectionForeground.rgba>>8&16777215,$c=!0),qc(e.getCode())){if(this.result.fg&67108864&&!(this.result.bg&50331648))Zc=(this._coreBrowserService.isFocused?nl.selectionBackgroundOpaque:nl.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Zc=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Zc=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Zc=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Zc=(this.result.fg&16777215)<<8|255;break;case 0:default:Zc=this._themeService.colors.foreground.rgba}Zc=Lc.blend(Zc,(this._coreBrowserService.isFocused?nl.selectionBackgroundOpaque:nl.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}$c=!0}}this._decorationService.forEachDecorationAtCell(t,n,`top`,e=>{e.backgroundColorRGB&&(Qc=e.backgroundColorRGB.rgba>>8&16777215,el=!0),e.foregroundColorRGB&&(Zc=e.foregroundColorRGB.rgba>>8&16777215,$c=!0)}),el&&(Qc=tl?e.bg&-150994944|Qc|50331648:e.bg&-16777216|Qc|50331648),$c&&(Zc=e.fg&-83886080|Zc|50331648),this.result.fg&67108864&&(el&&!$c&&(Zc=this.result.bg&50331648?this.result.fg&-134217728|this.result.bg&67108863:this.result.fg&-134217728|nl.background.rgba>>8&16777215|50331648,$c=!0),!el&&$c&&(Qc=this.result.fg&50331648?this.result.bg&-67108864|this.result.fg&67108863:this.result.bg&-67108864|nl.foreground.rgba>>8&16777215|50331648,el=!0)),nl=void 0,this.result.bg=el?Qc:this.result.bg,this.result.fg=$c?Zc:this.result.fg,this.result.ext&=536870911,this.result.ext|=rl<<29&3758096384}},al=.5,ol=Cc||wc?`bottom`:`ideographic`,sl={"▀":[{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}]},cl={"░":[[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]]},ll={"─":{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`}},ul={"":{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}};ul[``]=ul[``],ul[``]=ul[``];function dl(e,t,n,r,i,a,o,s){let c=sl[t];if(c)return fl(e,c,n,r,i,a),!0;let l=cl[t];if(l)return ml(e,l,n,r,i,a),!0;let u=ll[t];if(u)return hl(e,u,n,r,i,a,s),!0;let d=ul[t];return d?(gl(e,d,n,r,i,a,o,s),!0):!1}function fl(e,t,n,r,i,a){for(let o=0;o<t.length;o++){let s=t[o],c=i/8,l=a/8;e.fillRect(n+s.x*c,r+s.y*l,s.w*c,s.h*l)}}var pl=new Map;function ml(e,t,n,r,i,a){let o=pl.get(t);o||(o=new Map,pl.set(t,o));let s=e.fillStyle;if(typeof s!=`string`)throw Error(`Unexpected fillStyle type "${s}"`);let c=o.get(s);if(!c){let n=t[0].length,r=t.length,i=e.canvas.ownerDocument.createElement(`canvas`);i.width=n,i.height=r;let a=Bc(i.getContext(`2d`)),l=new ImageData(n,r),u,d,f,p;if(s.startsWith(`#`))u=parseInt(s.slice(1,3),16),d=parseInt(s.slice(3,5),16),f=parseInt(s.slice(5,7),16),p=s.length>7&&parseInt(s.slice(7,9),16)||1;else if(s.startsWith(`rgba`))[u,d,f,p]=s.substring(5,s.length-1).split(`,`).map(e=>parseFloat(e));else throw Error(`Unexpected fillStyle color format "${s}" when drawing pattern glyph`);for(let e=0;e<r;e++)for(let r=0;r<n;r++)l.data[(e*n+r)*4]=u,l.data[(e*n+r)*4+1]=d,l.data[(e*n+r)*4+2]=f,l.data[(e*n+r)*4+3]=t[e][r]*(p*255);a.putImageData(l,0,0),c=Bc(e.createPattern(i,null)),o.set(s,c)}e.fillStyle=c,e.fillRect(n,r,i,a)}function hl(e,t,n,r,i,a,o){e.strokeStyle=e.fillStyle;for(let[s,c]of Object.entries(t)){e.beginPath(),e.lineWidth=o*Number.parseInt(s);let t;t=typeof c==`function`?c(.15,.15/a*i):c;for(let s of t.split(` `)){let t=s[0],c=vl[t];if(!c){console.error(`Could not find drawing instructions for "${t}"`);continue}let l=s.substring(1).split(`,`);!l[0]||!l[1]||c(e,yl(l,i,a,n,r,!0,o))}e.stroke(),e.closePath()}}function gl(e,t,n,r,i,a,o,s){let c=new Path2D;c.rect(n,r,i,a),e.clip(c),e.beginPath();let l=o/12;e.lineWidth=s*l;for(let o of t.d.split(` `)){let c=o[0],u=vl[c];if(!u){console.error(`Could not find drawing instructions for "${c}"`);continue}let d=o.substring(1).split(`,`);!d[0]||!d[1]||u(e,yl(d,i,a,n,r,!1,s,(t.leftPadding??0)*(l/2),(t.rightPadding??0)*(l/2)))}t.type===1?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}function _l(e,t,n=0){return Math.max(Math.min(e,t),n)}var vl={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 yl(e,t,n,r,i,a,o,s=0,c=0){let l=e.map(e=>parseFloat(e)||parseInt(e));if(l.length<2)throw Error(`Too few arguments for instruction`);for(let e=0;e<l.length;e+=2)l[e]*=t-s*o-c*o,a&&l[e]!==0&&(l[e]=_l(Math.round(l[e]+.5)-.5,t,0)),l[e]+=r+s*o;for(let e=1;e<l.length;e+=2)l[e]*=n,a&&l[e]!==0&&(l[e]=_l(Math.round(l[e]+.5)-.5,n,0)),l[e]+=i;return l}var bl=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},xl=class{constructor(){this._data=new bl}set(e,t,n,r,i){this._data.get(e,t)||this._data.set(e,t,new bl),this._data.get(e,t).set(n,r,i)}get(e,t,n,r){return this._data.get(e,t)?.get(n,r)}clear(){this._data.clear()}},Sl=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),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},Cl=class extends Sl{_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())}}},wl=class extends Sl{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Tl=!bc&&`requestIdleCallback`in window?wl:Cl,El=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Dl}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return(this.fg&50331648)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Dl=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ol=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Ol.Undefined=new Ol(void 0);var kl=globalThis.performance&&typeof globalThis.performance.now==`function`,Al=class e{static create(t){return new e(t)}constructor(e){this._now=kl&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},jl=!1,Ml=!1,Nl=!1,Pl;(e=>{e.None=()=>vc.None;function t(e){if(Nl){let{onDidAddListener:t}=e,n=Bl.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(mc(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new Q(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new Q(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Q({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{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:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Q({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Q({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function S(e){return new Promise(t=>r(e)(t))}e.toPromise=S;function ee(e){let t=new Q;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=ee;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new Q(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof _c?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(Pl||={});var Fl=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 Al,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}}};Fl.all=new Set,Fl._idPool=0;var Il=Fl,Ll=-1,Rl=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new Vl(i,e);this._errorHandler(a)}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[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};Rl._idPool=1;var zl=Rl,Bl=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
58
|
+
`).slice(2).join(`
|
|
59
|
+
`))}},Vl=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},Hl=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},Ul=0,Wl=class{constructor(e){this.value=e,this.id=Ul++}},Gl=2,Kl=(e,t)=>{if(e instanceof Wl)t(e);else for(let n=0;n<e.length;n++){let r=e[n];r&&t(r)}},ql;if(jl){let e=[];setInterval(()=>{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(`
|
|
60
|
+
`)),e.length=0)},3e3),ql=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var Q=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Ll>0||this._options?.leakWarningThreshold?new zl(e?.onListenerError??Ws,this._options?.leakWarningThreshold??Ll):void 0,this._perfMon=this._options?._profName?new Il(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Ml){let e=this._listeners;queueMicrotask(()=>{Kl(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{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 t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Hl(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Ws)(n),vc.None}if(this._disposed)return vc.None;t&&(e=e.bind(t));let r=new Wl(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Bl.create(),i=this._leakageMon.check(r.stack,this._size+1)),Ml&&(r.stack=Bl.create()),this._listeners?this._listeners instanceof Wl?(this._deliveryQueue??=new Jl,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=hc(()=>{ql?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof _c?n.add(a):Array.isArray(n)&&n.push(a),ql){let e=Error().stack.split(`
|
|
61
|
+
`).slice(2,3).join(`
|
|
62
|
+
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);ql.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Gl<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Ws;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_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 Wl)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}},Jl=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Yl={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}},Xl=2,Zl,Ql=class e{constructor(e,t,n){this._document=e,this._config=t,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new xl,this._cacheMapCombined=new xl,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new El,this._textureSize=512,this._onAddTextureAtlasCanvas=new Q,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new Q,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=nu(e,this._config.deviceCellWidth*4+Xl*2,this._config.deviceCellHeight+Xl*2),this._tmpCtx=Bc(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(),!0)}_doWarmUp(){let e=new Tl;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(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let t=this._pages.filter(t=>t.canvas.width*2<=(e.maxTextureSize||4096)).sort((e,t)=>t.canvas.width===e.canvas.width?t.percentageUsed-e.percentageUsed:t.canvas.width-e.canvas.width),n=-1,r=0;for(let e=0;e<t.length;e++)if(t[e].canvas.width!==r)n=e,r=t[e].canvas.width;else if(e-n===3)break;let i=t.slice(n,n+4),a=i.map(e=>e.glyphs[0].texturePage).sort((e,t)=>e>t?1:-1),o=this.pages.length-i.length,s=this._mergePages(i,o);s.version++;for(let e=a.length-1;e>=0;e--)this._deletePage(a[e]);this.pages.push(s),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(s.canvas)}let t=new $l(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(e,t){let n=e[0].canvas.width*2,r=new $l(this._document,n,e);for(let[i,a]of e.entries()){let e=i*a.canvas.width%n,o=Math.floor(i/2)*a.canvas.height;r.ctx.drawImage(a.canvas,e,o);for(let r of a.glyphs)r.texturePage=t,r.sizeClipSpace.x=r.size.x/n,r.sizeClipSpace.y=r.size.y/n,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/n,r.texturePositionClipSpace.y=r.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(a.canvas);let s=this._activePages.indexOf(a);s!==-1&&this._activePages.splice(s,1)}return r}_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,n,r,i,a){return this._getFromCacheMap(this._cacheMapCombined,e,t,n,r,i,a)}getRasterizedGlyph(e,t,n,r,i,a){return this._getFromCacheMap(this._cacheMap,e,t,n,r,i,a)}_getFromCacheMap(e,t,n,r,i,a,o){return Zl=e.get(t,n,r,i),Zl||(Zl=this._drawToCache(t,n,r,i,a,o),e.set(t,n,r,i,Zl)),Zl}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw Error(`No color found for idx `+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,n,r){if(this._config.allowTransparency)return Mc;let i;switch(e){case 16777216:case 33554432:i=this._getColorFromAnsiIndex(t);break;case 50331648:let e=El.toColorRGB(t);i=Nc.toColor(e[0],e[1],e[2]);break;default:i=n?Pc.opaque(this._config.colors.foreground):this._config.colors.background;break}return this._config.allowTransparency||(i=Pc.opaque(i)),i}_getForegroundColor(e,t,n,r,i,a,o,s,c,l){let u=this._getMinimumContrastColor(e,t,n,r,i,a,o,c,s,l);if(u)return u;let d;switch(i){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&c&&a<8&&(a+=8),d=this._getColorFromAnsiIndex(a);break;case 50331648:let e=El.toColorRGB(a);d=Nc.toColor(e[0],e[1],e[2]);break;default:d=o?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(d=Pc.opaque(d)),s&&(d=Pc.multiplyOpacity(d,al)),d}_resolveBackgroundRgba(e,t,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,n,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,n,r,i,a,o,s,c,l){if(this._config.minimumContrastRatio===1||l)return;let u=this._getContrastCache(c),d=u.getColor(e,r);if(d!==void 0)return d||void 0;let f=this._resolveBackgroundRgba(t,n,o),p=this._resolveForegroundRgba(i,a,o,s),m=Lc.ensureContrastRatio(f,p,this._config.minimumContrastRatio/(c?2:1));if(!m){u.setColor(e,r,null);return}let h=Nc.toColor(m>>24&255,m>>16&255,m>>8&255);return u.setColor(e,r,h),h}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,n,r,i,a,o){let s=typeof t==`number`?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display=`none`,o.append(this._tmpCanvas));let c=Math.min(this._config.deviceCellWidth*Math.max(s.length,2)+Xl*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<c&&(this._tmpCanvas.width=c);let l=Math.min(this._config.deviceCellHeight+Xl*4,this._textureSize);if(this._tmpCanvas.height<l&&(this._tmpCanvas.height=l),this._tmpCtx.save(),this._workAttributeData.fg=r,this._workAttributeData.bg=n,this._workAttributeData.extended.ext=i,this._workAttributeData.isInvisible())return Yl;let u=!!this._workAttributeData.isBold(),d=!!this._workAttributeData.isInverse(),f=!!this._workAttributeData.isDim(),p=!!this._workAttributeData.isItalic(),m=!!this._workAttributeData.isUnderline(),h=!!this._workAttributeData.isStrikethrough(),g=!!this._workAttributeData.isOverline(),_=this._workAttributeData.getFgColor(),v=this._workAttributeData.getFgColorMode(),y=this._workAttributeData.getBgColor(),b=this._workAttributeData.getBgColorMode();if(d){let e=_;_=y,y=e;let t=v;v=b,b=t}let x=this._getBackgroundColor(b,y,d,f);this._tmpCtx.globalCompositeOperation=`copy`,this._tmpCtx.fillStyle=x.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation=`source-over`;let S=u?this._config.fontWeightBold:this._config.fontWeight,ee=p?`italic`:``;this._tmpCtx.font=`${ee} ${S} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=ol;let C=s.length===1&&Vc(s.charCodeAt(0)),w=s.length===1&&Hc(s.charCodeAt(0)),T=this._getForegroundColor(n,b,y,r,v,_,d,f,u,qc(s.charCodeAt(0)));this._tmpCtx.fillStyle=T.css;let E=w?0:Xl*2,D=!1;this._config.customGlyphs!==!1&&(D=dl(this._tmpCtx,s,E,E,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let O=!C,k;if(k=typeof t==`number`?this._unicodeService.wcwidth(t):this._unicodeService.getStringCellWidth(t),m){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())O=!1,this._tmpCtx.strokeStyle=`rgb(${El.toColorRGB(this._workAttributeData.getUnderlineColor()).join(`,`)})`;else{O=!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 n=E,r=Math.ceil(E+this._config.deviceCharHeight)-t-(a?e*2:0),i=r+e,o=r+e*2,c=this._workAttributeData.getUnderlineVariantOffset();for(let a=0;a<k;a++){this._tmpCtx.save();let s=n+a*this._config.deviceCellWidth,l=n+(a+1)*this._config.deviceCellWidth,u=s+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r),this._tmpCtx.moveTo(s,o),this._tmpCtx.lineTo(l,o);break;case 3:let n=e<=1?o:Math.ceil(E+this._config.deviceCharHeight-e/2)-t,a=e<=1?r:Math.ceil(E+this._config.deviceCharHeight+e/2)-t,d=new Path2D;d.rect(s,r,this._config.deviceCellWidth,o-r),this._tmpCtx.clip(d),this._tmpCtx.moveTo(s-this._config.deviceCellWidth/2,i),this._tmpCtx.bezierCurveTo(s-this._config.deviceCellWidth/2,a,s,a,s,i),this._tmpCtx.bezierCurveTo(s,n,u,n,u,i),this._tmpCtx.bezierCurveTo(u,a,l,a,l,i),this._tmpCtx.bezierCurveTo(l,n,l+this._config.deviceCellWidth/2,n,l+this._config.deviceCellWidth/2,i);break;case 4:let f=c===0?0:c>=e?e*2-c:e-c;c>=e||f===0?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s+f,r),this._tmpCtx.lineTo(l,r)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(s+f,r),this._tmpCtx.moveTo(s+f+e,r),this._tmpCtx.lineTo(l,r)),c=Xc(l-s,e,c);break;case 5:let p=l-s,m=Math.floor(.6*p),h=Math.floor(.3*p),g=p-m-h;this._tmpCtx.setLineDash([m,h,g]),this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r);break;default:this._tmpCtx.moveTo(s,r),this._tmpCtx.lineTo(l,r);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!D&&this._config.fontSize>=12&&!this._config.allowTransparency&&s!==` `){this._tmpCtx.save(),this._tmpCtx.textBaseline=`alphabetic`;let t=this._tmpCtx.measureText(s);if(this._tmpCtx.restore(),`actualBoundingBoxDescent`in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(n,r-Math.ceil(e/2),this._config.deviceCellWidth*k,o-r+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=x.css,this._tmpCtx.strokeText(s,E,E+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(g){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(E,E+t),this._tmpCtx.lineTo(E+this._config.deviceCharWidth*k,E+t),this._tmpCtx.stroke()}if(D||this._tmpCtx.fillText(s,E,E+this._config.deviceCharHeight),s===`_`&&!this._config.allowTransparency){let e=eu(this._tmpCtx.getImageData(E,E,this._config.deviceCellWidth,this._config.deviceCellHeight),x,T,O);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(s,E,E+this._config.deviceCharHeight-t),e=eu(this._tmpCtx.getImageData(E,E,this._config.deviceCellWidth,this._config.deviceCellHeight),x,T,O),e);t++);}if(h){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(E,E+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(E+this._config.deviceCharWidth*k,E+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let A=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),j;if(j=this._config.allowTransparency?tu(A):eu(A,x,T,O),j)return Yl;let M=this._findGlyphBoundingBox(A,this._workBoundingBox,c,w,D,E),N,P;for(;;){if(this._activePages.length===0){let e=this._createNewPage();N=e,P=e.currentRow,P.height=M.size.y;break}N=this._activePages[this._activePages.length-1],P=N.currentRow;for(let e of this._activePages)M.size.y<=e.currentRow.height&&(N=e,P=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=P.height&&M.size.y<=t.height&&(N=this._activePages[e],P=t);if(M.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new $l(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),N=this._overflowSizePage,P=this._overflowSizePage.currentRow,P.x+M.size.x>=N.canvas.width&&(P.x=0,P.y+=P.height,P.height=0);break}if(P.y+M.size.y>=N.canvas.height||P.height>M.size.y+2){let t=!1;if(N.currentRow.y+N.currentRow.height+M.size.y>=N.canvas.height){let n;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+M.size.y<e.canvas.height){n=e;break}if(n)N=n;else if(e.maxAtlasPages&&this._pages.length>=e.maxAtlasPages&&P.y+M.size.y<=N.canvas.height&&P.height>=M.size.y&&P.x+M.size.x<=N.canvas.width)t=!0;else{let e=this._createNewPage();N=e,P=e.currentRow,P.height=M.size.y,t=!0}}t||(N.currentRow.height>0&&N.fixedRows.push(N.currentRow),P={x:0,y:N.currentRow.y+N.currentRow.height,height:M.size.y},N.fixedRows.push(P),N.currentRow={x:0,y:P.y+P.height,height:0})}if(P.x+M.size.x<=N.canvas.width)break;P===N.currentRow?(P.x=0,P.y+=P.height,P.height=0):N.fixedRows.splice(N.fixedRows.indexOf(P),1)}return M.texturePage=this._pages.indexOf(N),M.texturePosition.x=P.x,M.texturePosition.y=P.y,M.texturePositionClipSpace.x=P.x/N.canvas.width,M.texturePositionClipSpace.y=P.y/N.canvas.height,M.sizeClipSpace.x/=N.canvas.width,M.sizeClipSpace.y/=N.canvas.height,P.height=Math.max(P.height,M.size.y),P.x+=M.size.x,N.ctx.putImageData(A,M.texturePosition.x-this._workBoundingBox.left,M.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,M.size.x,M.size.y),N.addGlyph(M),N.version++,M}_findGlyphBoundingBox(e,t,n,r,i,a){t.top=0;let o=r?this._config.deviceCellHeight:this._tmpCanvas.height,s=r?this._config.deviceCellWidth:n,c=!1;for(let n=0;n<o;n++){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+r*4+3;if(e.data[i]!==0){t.top=n,c=!0;break}}if(c)break}t.left=0,c=!1;for(let n=0;n<a+s;n++){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+n*4+3;if(e.data[i]!==0){t.left=n,c=!0;break}}if(c)break}t.right=s,c=!1;for(let n=a+s-1;n>=a;n--){for(let r=0;r<o;r++){let i=r*this._tmpCanvas.width*4+n*4+3;if(e.data[i]!==0){t.right=n,c=!0;break}}if(c)break}t.bottom=o,c=!1;for(let n=o-1;n>=0;n--){for(let r=0;r<s;r++){let i=n*this._tmpCanvas.width*4+r*4+3;if(e.data[i]!==0){t.bottom=n,c=!0;break}}if(c)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+a+(r||i?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+a+(r||i?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},$l=class{constructor(e,t,n){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],n)for(let e of n)this._glyphs.push(...e.glyphs),this._usedPixels+=e._usedPixels;this.canvas=nu(e,t,t),this.ctx=Bc(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 eu(e,t,n,r){let i=t.rgba>>>24,a=t.rgba>>>16&255,o=t.rgba>>>8&255,s=n.rgba>>>24,c=n.rgba>>>16&255,l=n.rgba>>>8&255,u=Math.floor((Math.abs(i-s)+Math.abs(a-c)+Math.abs(o-l))/12),d=!0;for(let t=0;t<e.data.length;t+=4)e.data[t]===i&&e.data[t+1]===a&&e.data[t+2]===o||r&&Math.abs(e.data[t]-i)+Math.abs(e.data[t+1]-a)+Math.abs(e.data[t+2]-o)<u?e.data[t+3]=0:d=!1;return d}function tu(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}function nu(e,t,n){let r=e.createElement(`canvas`);return r.width=t,r.height=n,r}function ru(e,t,n,r,i,a,o,s){let c={foreground:a.foreground,background:a.background,cursor:Mc,cursorAccent:Mc,selectionForeground:Mc,selectionBackgroundTransparent:Mc,selectionBackgroundOpaque:Mc,selectionInactiveBackgroundTransparent:Mc,selectionInactiveBackgroundOpaque:Mc,overviewRulerBorder:Mc,scrollbarSliderBackground:Mc,scrollbarSliderHoverBackground:Mc,scrollbarSliderActiveBackground:Mc,ansi:a.ansi.slice(),contrastCache:a.contrastCache,halfContrastCache:a.halfContrastCache};return{customGlyphs:i.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:s,letterSpacing:i.letterSpacing,lineHeight:i.lineHeight,deviceCellWidth:e,deviceCellHeight:t,deviceCharWidth:n,deviceCharHeight:r,fontFamily:i.fontFamily,fontSize:i.fontSize,fontWeight:i.fontWeight,fontWeightBold:i.fontWeightBold,allowTransparency:i.allowTransparency,drawBoldTextInBrightColors:i.drawBoldTextInBrightColors,minimumContrastRatio:i.minimumContrastRatio,colors:c}}function iu(e,t){for(let n=0;n<e.colors.ansi.length;n++)if(e.colors.ansi[n].rgba!==t.colors.ansi[n].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}function au(e){return(e&50331648)==16777216||(e&50331648)==33554432}var ou=[];function su(e,t,n,r,i,a,o,s,c){let l=ru(r,i,a,o,t,n,s,c);for(let t=0;t<ou.length;t++){let n=ou[t],r=n.ownedBy.indexOf(e);if(r>=0){if(iu(n.config,l))return n.atlas;n.ownedBy.length===1?(n.atlas.dispose(),ou.splice(t,1)):n.ownedBy.splice(r,1);break}}for(let t=0;t<ou.length;t++){let n=ou[t];if(iu(n.config,l))return n.ownedBy.push(e),n.atlas}let u=e._core,d={atlas:new Ql(document,l,u.unicodeService),config:l,ownedBy:[e]};return ou.push(d),d.atlas}function cu(e){for(let t=0;t<ou.length;t++){let n=ou[t].ownedBy.indexOf(e);if(n!==-1){ou[t].ownedBy.length===1?(ou[t].atlas.dispose(),ou.splice(t,1)):ou[t].ownedBy.splice(n,1);break}}}var lu=600,uu=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),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}))}_restartInterval(e=lu){this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=lu-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=lu-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},lu)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&=(this._coreBrowserService.window.clearInterval(this._blinkInterval),void 0),this._blinkStartTimeout&&=(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),void 0),this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function du(e,t,n){let r=new t.ResizeObserver(t=>{let i=t.find(t=>t.target===e);if(!i)return;if(!(`devicePixelContentBoxSize`in i)){r?.disconnect(),r=void 0;return}let a=i.devicePixelContentBoxSize[0].inlineSize,o=i.devicePixelContentBoxSize[0].blockSize;a>0&&o>0&&n(a,o)});try{r.observe(e,{box:[`device-pixel-content-box`]})}catch{r.disconnect(),r=void 0}return hc(()=>r?.disconnect())}function fu(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}var pu=class e extends El{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Dl,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?fu(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},mu=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function hu(e,t,n){let r=Bc(e.createProgram());if(e.attachShader(r,Bc(gu(e,e.VERTEX_SHADER,t))),e.attachShader(r,Bc(gu(e,e.FRAGMENT_SHADER,n))),e.linkProgram(r),e.getProgramParameter(r,e.LINK_STATUS))return r;console.error(e.getProgramInfoLog(r)),e.deleteProgram(r)}function gu(e,t,n){let r=Bc(e.createShader(t));if(e.shaderSource(r,n),e.compileShader(r),e.getShaderParameter(r,e.COMPILE_STATUS))return r;console.error(e.getShaderInfoLog(r)),e.deleteShader(r)}function _u(e,t){let n=Math.min(e.length*2,t),r=new Float32Array(n);for(let t=0;t<e.length;t++)r[t]=e[t];return r}var vu=class{constructor(e){this.texture=e,this.version=-1}},yu=`#version 300 es
|
|
63
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
64
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
65
|
+
layout (location = 2) in vec2 a_offset;
|
|
66
|
+
layout (location = 3) in vec2 a_size;
|
|
67
|
+
layout (location = 4) in float a_texpage;
|
|
68
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
69
|
+
layout (location = 6) in vec2 a_texsize;
|
|
70
|
+
|
|
71
|
+
uniform mat4 u_projection;
|
|
72
|
+
uniform vec2 u_resolution;
|
|
73
|
+
|
|
74
|
+
out vec2 v_texcoord;
|
|
75
|
+
flat out int v_texpage;
|
|
76
|
+
|
|
77
|
+
void main() {
|
|
78
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
79
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
80
|
+
v_texpage = int(a_texpage);
|
|
81
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
82
|
+
}`;function bu(e){let t=``;for(let n=1;n<e;n++)t+=` else if (v_texpage == ${n}) { outColor = texture(u_texture[${n}], v_texcoord); }`;return`#version 300 es
|
|
83
|
+
precision lowp float;
|
|
84
|
+
|
|
85
|
+
in vec2 v_texcoord;
|
|
86
|
+
flat in int v_texpage;
|
|
87
|
+
|
|
88
|
+
uniform sampler2D u_texture[${e}];
|
|
89
|
+
|
|
90
|
+
out vec4 outColor;
|
|
91
|
+
|
|
92
|
+
void main() {
|
|
93
|
+
if (v_texpage == 0) {
|
|
94
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
95
|
+
} ${t}
|
|
96
|
+
}`}var xu=11,Su=xu*Float32Array.BYTES_PER_ELEMENT,Cu=2,wu=0,Tu,Eu=0,Du=0,Ou=class extends vc{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._optionsService=r,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array,attributesBuffers:[new Float32Array,new Float32Array]};let i=this._gl;Ql.maxAtlasPages===void 0&&(Ql.maxAtlasPages=Math.min(32,Bc(i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS))),Ql.maxTextureSize=Bc(i.getParameter(i.MAX_TEXTURE_SIZE))),this._program=Bc(hu(i,yu,bu(Ql.maxAtlasPages))),this._register(hc(()=>i.deleteProgram(this._program))),this._projectionLocation=Bc(i.getUniformLocation(this._program,`u_projection`)),this._resolutionLocation=Bc(i.getUniformLocation(this._program,`u_resolution`)),this._textureLocation=Bc(i.getUniformLocation(this._program,`u_texture`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(hc(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(hc(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=Bc(i.createBuffer()),this._register(hc(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,2,i.FLOAT,!1,Su,0),i.vertexAttribDivisor(2,1),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,i.FLOAT,!1,Su,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(3,1),i.enableVertexAttribArray(4),i.vertexAttribPointer(4,1,i.FLOAT,!1,Su,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(4,1),i.enableVertexAttribArray(5),i.vertexAttribPointer(5,2,i.FLOAT,!1,Su,5*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(5,1),i.enableVertexAttribArray(6),i.vertexAttribPointer(6,2,i.FLOAT,!1,Su,7*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(6,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,Su,9*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.useProgram(this._program);let l=new Int32Array(Ql.maxAtlasPages);for(let e=0;e<Ql.maxAtlasPages;e++)l[e]=e;i.uniform1iv(this._textureLocation,l),i.uniformMatrix4fv(this._projectionLocation,!1,mu),this._atlasTextures=[];for(let e=0;e<Ql.maxAtlasPages;e++){let t=new vu(Bc(i.createTexture()));this._register(hc(()=>i.deleteTexture(t.texture))),i.activeTexture(i.TEXTURE0+e),i.bindTexture(i.TEXTURE_2D,t.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[e]=t}i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(e,t,n,r,i,a,o,s,c){this._updateCell(this._vertices.attributes,e,t,n,r,i,a,o,s,c)}_updateCell(e,t,n,r,i,a,o,s,c,l){if(wu=(n*this._terminal.cols+t)*xu,r===0||r===void 0){e.fill(0,wu,wu+xu-1-Cu);return}this._atlas&&(Tu=s&&s.length>1?this._atlas.getRasterizedGlyphCombinedChar(s,i,a,o,!1,this._terminal.element):this._atlas.getRasterizedGlyph(r,i,a,o,!1,this._terminal.element),Eu=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),i!==l&&Tu.offset.x>Eu?(Du=Tu.offset.x-Eu,e[wu]=-(Tu.offset.x-Du)+this._dimensions.device.char.left,e[wu+1]=-Tu.offset.y+this._dimensions.device.char.top,e[wu+2]=(Tu.size.x-Du)/this._dimensions.device.canvas.width,e[wu+3]=Tu.size.y/this._dimensions.device.canvas.height,e[wu+4]=Tu.texturePage,e[wu+5]=Tu.texturePositionClipSpace.x+Du/this._atlas.pages[Tu.texturePage].canvas.width,e[wu+6]=Tu.texturePositionClipSpace.y,e[wu+7]=Tu.sizeClipSpace.x-Du/this._atlas.pages[Tu.texturePage].canvas.width,e[wu+8]=Tu.sizeClipSpace.y):(e[wu]=-Tu.offset.x+this._dimensions.device.char.left,e[wu+1]=-Tu.offset.y+this._dimensions.device.char.top,e[wu+2]=Tu.size.x/this._dimensions.device.canvas.width,e[wu+3]=Tu.size.y/this._dimensions.device.canvas.height,e[wu+4]=Tu.texturePage,e[wu+5]=Tu.texturePositionClipSpace.x,e[wu+6]=Tu.texturePositionClipSpace.y,e[wu+7]=Tu.sizeClipSpace.x,e[wu+8]=Tu.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Kc(r,c,Tu.size.x,this._dimensions.device.cell.width)&&(e[wu+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*xu;this._vertices.count===t?this._vertices.attributes.fill(0):this._vertices.attributes=new Float32Array(t);let n=0;for(;n<this._vertices.attributesBuffers.length;n++)this._vertices.count===t?this._vertices.attributesBuffers[n].fill(0):this._vertices.attributesBuffers[n]=new Float32Array(t);this._vertices.count=t,n=0;for(let t=0;t<e.rows;t++)for(let r=0;r<e.cols;r++)this._vertices.attributes[n+9]=r/e.cols,this._vertices.attributes[n+10]=t/e.rows,n+=xu}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 n=this._vertices.attributesBuffers[this._activeBuffer],r=0;for(let t=0;t<e.lineLengths.length;t++){let i=t*this._terminal.cols*xu,a=this._vertices.attributes.subarray(i,i+e.lineLengths[t]*xu);n.set(a,r),r+=a.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,n.subarray(0,r),t.STREAM_DRAW);for(let e=0;e<this._atlas.pages.length;e++)this._atlas.pages[e].version!==this._atlasTextures[e].version&&this._bindAtlasPageTexture(t,this._atlas,e);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,r/xu)}setAtlas(e){this._atlas=e;for(let e of this._atlasTextures)e.version=-1}_bindAtlasPageTexture(e,t,n){e.activeTexture(e.TEXTURE0+n),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[n].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[n].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[n].version=t.pages[n].version}setDimensions(e){this._dimensions=e}},ku=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,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function Au(){return new ku}var ju=4,Mu=1,Nu=2,Pu=3,Fu=2147483648,Iu=class{constructor(){this.cells=new Uint32Array,this.lineLengths=new Uint32Array,this.selection=Au()}resize(e,t){let n=e*t*ju;n!==this.cells.length&&(this.cells=new Uint32Array(n),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},Lu=`#version 300 es
|
|
97
|
+
layout (location = 0) in vec2 a_position;
|
|
98
|
+
layout (location = 1) in vec2 a_size;
|
|
99
|
+
layout (location = 2) in vec4 a_color;
|
|
100
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
101
|
+
|
|
102
|
+
uniform mat4 u_projection;
|
|
103
|
+
|
|
104
|
+
out vec4 v_color;
|
|
105
|
+
|
|
106
|
+
void main() {
|
|
107
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
108
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
109
|
+
v_color = a_color;
|
|
110
|
+
}`,Ru=`#version 300 es
|
|
111
|
+
precision lowp float;
|
|
112
|
+
|
|
113
|
+
in vec4 v_color;
|
|
114
|
+
|
|
115
|
+
out vec4 outColor;
|
|
116
|
+
|
|
117
|
+
void main() {
|
|
118
|
+
outColor = v_color;
|
|
119
|
+
}`,zu=8,Bu=zu*Float32Array.BYTES_PER_ELEMENT,Vu=20*zu,Hu=class{constructor(){this.attributes=new Float32Array(Vu),this.count=0}},Uu=0,Wu=0,Gu=0,Ku=0,qu=0,Ju=0,Yu=0,Xu=class extends vc{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new Hu,this._verticesCursor=new Hu;let i=this._gl;this._program=Bc(hu(i,Lu,Ru)),this._register(hc(()=>i.deleteProgram(this._program))),this._projectionLocation=Bc(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(hc(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(hc(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=Bc(i.createBuffer()),this._register(hc(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,Bu,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,Bu,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,Bu,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,mu),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i<t.rows;i++){for(o=-1,s=0,c=0,l=!1,a=0;a<t.cols;a++)u=(i*t.cols+a)*ju,d=e.cells[u+Mu],f=e.cells[u+Nu],p=!!(f&67108864),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=r++*zu,this._updateRectangle(n,m,c,s,o,a,i)),o=a,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=r++*zu,this._updateRectangle(n,m,c,s,o,t.cols,i))}n.count=r}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`){t.count=0;return}let r,i=0;(n.style===`bar`||n.style===`outline`)&&(r=i++*zu,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style===`underline`||n.style===`outline`)&&(r=i++*zu,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=i++*zu,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=i++*zu,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,o){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:Uu=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Uu=(n&16777215)<<8;break;case 0:default:Uu=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:Uu=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:Uu=(r&16777215)<<8;break;case 0:default:Uu=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=_u(e.attributes,this._terminal.rows*this._terminal.cols*zu)),Wu=i*this._dimensions.device.cell.width,Gu=o*this._dimensions.device.cell.height,Ku=(Uu>>24&255)/255,qu=(Uu>>16&255)/255,Ju=(Uu>>8&255)/255,Yu=1,this._addRectangle(e.attributes,t,Wu,Gu,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,Ku,qu,Ju,Yu)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},Zu=class extends vc{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(hc(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Bc(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=su(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=ol,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},Qu=class extends Zu{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&au(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},$u=typeof window==`object`?window:globalThis,ed=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Q,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Q,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};ed.INSTANCE=new ed;var td=ed;function nd(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}td.INSTANCE.onDidChangeZoomLevel,td.INSTANCE.onDidChangeFullscreen;var rd=typeof navigator==`object`?navigator.userAgent:``;rd.indexOf(`Firefox`);var id=rd.indexOf(`AppleWebKit`)>=0;!(rd.indexOf(`Chrome`)>=0)&&rd.indexOf(`Safari`),rd.indexOf(`Electron/`),rd.indexOf(`Android`);var ad=!1;if(typeof $u.matchMedia==`function`){let e=$u.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=$u.matchMedia(`(display-mode: fullscreen)`);ad=e.matches,nd($u,e,({matches:e})=>{ad&&t.matches||(ad=e)})}function od(){return ad}var sd=`en`,cd=!1,ld=!1,ud=!1,dd=sd,fd,pd=globalThis,md;typeof pd.vscode<`u`&&typeof pd.vscode.process<`u`?md=pd.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(md=process);var hd=typeof md?.versions?.electron==`string`&&md?.type===`renderer`;if(typeof md==`object`){md.platform,md.platform,cd=md.platform===`linux`,cd&&md.env.SNAP&&md.env.SNAP_REVISION,md.env.CI||md.env.BUILD_ARTIFACTSTAGINGDIRECTORY,dd=sd;let e=md.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,dd=t.resolvedLanguage||sd,t.languagePack?.translationsConfigFile}catch{}ld=!0}else typeof navigator==`object`&&!hd?(fd=navigator.userAgent,fd.indexOf(`Windows`),fd.indexOf(`Macintosh`),(fd.indexOf(`Macintosh`)>=0||fd.indexOf(`iPad`)>=0||fd.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,cd=fd.indexOf(`Linux`)>=0,fd?.indexOf(`Mobi`),ud=!0,dd=globalThis._VSCODE_NLS_LANGUAGE||sd,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var gd=ld;ud&&typeof pd.importScripts==`function`&&pd.origin;var _d=fd,vd=dd,yd;(e=>{function t(){return vd}e.value=t;function n(){return vd.length===2?vd===`en`:vd.length>=3?vd[0]===`e`&&vd[1]===`n`&&vd[2]===`-`:!1}e.isDefaultVariant=n;function r(){return vd===`en`}e.isDefault=r})(yd||={});var bd=typeof pd.postMessage==`function`&&!pd.importScripts;(()=>{if(bd){let e=[];pd.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),pd.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var xd=!!(_d&&_d.indexOf(`Chrome`)>=0);_d&&_d.indexOf(`Firefox`),!xd&&_d&&_d.indexOf(`Safari`),_d&&_d.indexOf(`Edg/`),_d&&_d.indexOf(`Android`);var Sd=typeof navigator==`object`?navigator:{};gd||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||Sd&&Sd.clipboard&&Sd.clipboard.writeText,gd||Sd&&Sd.clipboard&&Sd.clipboard.readText,gd||od()||Sd.keyboard,`ontouchstart`in $u||Sd.maxTouchPoints,$u.PointerEvent&&(`ontouchstart`in $u||navigator.maxTouchPoints);var Cd=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},wd=new Cd,Td=new Cd,Ed=new Cd;Array(230);var Dd;(e=>{function t(e){return wd.keyCodeToStr(e)}e.toString=t;function n(e){return wd.strToKeyCode(e)}e.fromString=n;function r(e){return Td.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Ed.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Td.strToKeyCode(e)||Ed.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return wd.keyCodeToStr(e)}e.toElectronAccelerator=o})(Dd||={});var Od=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),kd;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof Ad?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Pl.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Od})})(kd||={});var Ad=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?Od:(this._emitter||=new Q,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var jd;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(jd||={});var Md=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Q,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Pl.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Md.EMPTY=Md.fromArray([]);function Nd(e){return 55296<=e&&e<=56319}function Pd(e){return 56320<=e&&e<=57343}function Fd(e,t){return(e-55296<<10)+(t-56320)+65536}function Id(e){return Ld(e,0)}function Ld(e,t){switch(typeof e){case`object`:return e===null?Rd(349,t):Array.isArray(e)?Vd(e,t):Hd(e,t);case`string`:return Bd(e,t);case`boolean`:return zd(e,t);case`number`:return Rd(e,t);case`undefined`:return Rd(937,t);default:return Rd(617,t)}}function Rd(e,t){return(t<<5)-t+e|0}function zd(e,t){return Rd(e?433:863,t)}function Bd(e,t){t=Rd(149417,t);for(let n=0,r=e.length;n<r;n++)t=Rd(e.charCodeAt(n),t);return t}function Vd(e,t){return t=Rd(104579,t),e.reduce((e,t)=>Ld(t,e),t)}function Hd(e,t){return t=Rd(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Bd(n,t),Ld(e[n],t)),t)}function Ud(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function Wd(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function Gd(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function Kd(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):Gd((e>>>0).toString(16),t/4)}var qd=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(Nd(a))if(o+1<t){let t=e.charCodeAt(o+1);Pd(t)?(o++,s=Fd(a,t)):s=65533}else{i=a;break}else Pd(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Kd(this._h0)+Kd(this._h1)+Kd(this._h2)+Kd(this._h3)+Kd(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Wd(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Wd(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,Ud(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=Ud(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=Ud(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};qd._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:Jd,getWindow:Yd,getDocument:Xd,getWindows:Zd,getWindowsCount:Qd,getWindowId:$d,getWindowById:ef,hasWindow:tf,onDidRegisterWindow:nf,onWillUnregisterWindow:rf,onDidUnregisterWindow:af}=function(){let e=new Map,t={window:$u,disposables:new _c};e.set($u.vscodeWindowId,t);let n=new Q,r=new Q,i=new Q;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return vc.None;let a=new _c,o={window:t,disposables:a.add(new _c)};return e.set(t.vscodeWindowId,o),a.add(hc(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(sf(t,lf.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:$u},getDocument(e){return Yd(e).document}}}(),of=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function sf(e,t,n,r){return new of(e,t,n,r)}var cf=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};cf.None=new cf(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Id(n),a=r.get(i);if(a)a.users+=1;else{let o=new Q,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(hc(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var lf={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:id?`webkitAnimationStart`:`animationstart`,ANIMATION_END:id?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:id?`webkitAnimationIteration`:`animationiteration`},uf=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function df(e,t,n,...r){let i=uf.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function ff(e,t,...n){return df(`http://www.w3.org/1999/xhtml`,e,t,...n)}ff.SVG=function(e,t,...n){return df(`http://www.w3.org/2000/svg`,e,t,...n)};var pf=class extends vc{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new yc,this._charAtlasDisposable=this._register(new yc),this._observerDisposable=this._register(new yc),this._model=new Iu,this._workCell=new pu,this._workCell2=new pu,this._rectangleRenderer=this._register(new yc),this._glyphRenderer=this._register(new yc),this._onChangeTextureAtlas=this._register(new Q),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Q),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Q),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new Q),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new Q),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new il(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Qu(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=Jc(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(sf(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(sf(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,cu(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=du(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=du(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(hc(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),cu(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new Xu(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Ou(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=su(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=mc(Pl.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Pl.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new uu(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=hf(e,n.rows-1,0),t=hf(t,n.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,ee=S-n.buffer.ydisp,C=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),w=-1,T=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let E=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=S===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y<n.cols;y++){if(i=this._cellColorResolver.result.bg,s.loadCell(y,r),y===0&&(i=this._cellColorResolver.result.bg),l=!1,d=y>=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)d&&=e===this._model.selection.isCellSelected(this._terminal,v,o);d&&=!m||C<p[0]||C>=p[1],d?(l=!0,r=new mf(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*ju,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),T&&o===S&&(y===C&&(this._model.cursor={x:C,y:ee,width:r.getWidth(),style:this._coreBrowserService.isFocused?x:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},w=C+r.getWidth()-1),y>=C&&y<=w&&(this._coreBrowserService.isFocused&&x===`block`||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),g!==0&&(this._model.lineLengths[a]=y+1),!(this._model.cells[v]===g&&this._model.cells[v+Mu]===this._cellColorResolver.result.bg&&this._model.cells[v+Nu]===this._cellColorResolver.result.fg&&this._model.cells[v+Pu]===this._cellColorResolver.result.ext)&&(E=!0,h.length>1&&(g|=Fu),this._model.cells[v]=g,this._model.cells[v+Mu]=this._cellColorResolver.result.bg,this._model.cells[v+Nu]=this._cellColorResolver.result.fg,this._model.cells[v+Pu]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*ju,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,Dc,0,0),this._model.cells[b]=0,this._model.cells[b+Mu]=this._cellColorResolver.result.bg,this._model.cells[b+Nu]=this._cellColorResolver.result.fg,this._model.cells[b+Pu]=this._cellColorResolver.result.ext;y--}}E&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},mf=class extends El{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function hf(e,t,n=0){return Math.max(Math.min(e,t),n)}var gf=`di$target`,_f=`di$dependencies`,vf=new Map;function yf(e){if(vf.has(e))return vf.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);bf(t,e,r)};return t._id=e,vf.set(e,t),t}function bf(e,t,n){t[gf]===t?t[_f].push({id:e,index:n}):(t[_f]=[{id:e,index:n}],t[gf]=t)}yf(`BufferService`),yf(`CoreMouseService`),yf(`CoreService`),yf(`CharsetService`),yf(`InstantiationService`),yf(`LogService`);var xf=yf(`OptionsService`);yf(`OscLinkService`),yf(`UnicodeService`),yf(`DecorationService`);var Sf={trace:0,debug:1,info:2,warn:3,error:4,off:5},Cf=`xterm.js: `,wf=class extends vc{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),Tf=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Sf[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:Cf)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};wf=Vs([Hs(0,xf)],wf);var Tf,Ef=class extends vc{constructor(e){if(Tc&&Ec()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new Q),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new Q),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new Q),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new Q),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new pf(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(Pl.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Pl.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Pl.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Pl.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(hc(()=>{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()}},Df=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Mf.isErrorNoTelemetry(e)?new Mf(e.message+`
|
|
120
|
+
|
|
121
|
+
`+e.stack):Error(e.message+`
|
|
122
|
+
|
|
123
|
+
`+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 Of(e){Af(e)||Df.onUnexpectedError(e)}var kf=`Canceled`;function Af(e){return e instanceof jf?!0:e instanceof Error&&e.name===kf&&e.message===kf}var jf=class extends Error{constructor(){super(kf),this.name=this.message}},Mf=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}};function Nf(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}var Pf=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=Nf(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};Pf.assertInvariants=!1;var Ff;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Ff||={});function If(e,t){return(n,r)=>t(e(n),e(r))}var Lf=(e,t)=>e-t,Rf=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Ff.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Rf.empty=new Rf(e=>{});function zf(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var Bf=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function Vf(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var Hf;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(Hf||={});var Uf=!1,Wf=null,Gf=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
|
|
124
|
+
`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new Bf;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
|
|
125
|
+
`),e)}n.sort(If(e=>e.idx,Lf));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
|
|
126
|
+
`)).size}/${n.length} leaks) at ${a}`;let o=zf([...i.get(e.slice(0,t).join(`
|
|
127
|
+
`))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
|
|
131
|
+
${s.join(`
|
|
132
|
+
`)}
|
|
133
|
+
============================================================
|
|
134
|
+
|
|
135
|
+
`}return n.length>e&&(a+=`
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
... and ${n.length-e} more leaking disposables
|
|
139
|
+
|
|
140
|
+
`),{leaks:n,details:a}}};Gf.idx=0;function Kf(e){Wf=e}if(Uf){let e=`__is_disposable_tracked__`;Kf(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==np.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==np.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function qf(e){return Wf?.trackDisposable(e),e}function Jf(e){Wf?.markAsDisposed(e)}function Yf(e,t){Wf?.setParent(e,t)}function Xf(e,t){if(Wf)for(let n of e)Wf.setParent(n,t)}function Zf(e){if(Hf.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Qf(...e){let t=$f(()=>Zf(e));return Xf(e,t),t}function $f(e){let t=qf({dispose:Vf(()=>{Jf(t),e()})});return t}var ep=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,qf(this)}dispose(){this._isDisposed||(Jf(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Zf(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return Yf(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),Yf(e,null))}};ep.DISABLE_DISPOSED_WARNING=!1;var tp=ep,np=class{constructor(){this._store=new tp,qf(this),Yf(this._store,this)}dispose(){Jf(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};np.None=Object.freeze({dispose(){}});var rp=class{constructor(){this._isDisposed=!1,qf(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Yf(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Jf(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Yf(e,null),e}},ip=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};ip.Undefined=new ip(void 0);var ap=globalThis.performance&&typeof globalThis.performance.now==`function`,op=class e{static create(t){return new e(t)}constructor(e){this._now=ap&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},sp=!1,cp=!1,lp=!1,up;(e=>{e.None=()=>np.None;function t(e){if(lp){let{onDidAddListener:t}=e,n=gp.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(Qf(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new wp(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new wp(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new wp({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{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:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new wp({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new wp({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function S(e){return new Promise(t=>r(e)(t))}e.toPromise=S;function ee(e){let t=new wp;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=ee;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new wp(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof tp?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(up||={});var dp=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 op,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}}};dp.all=new Set,dp._idPool=0;var fp=dp,pp=-1,mp=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new _p(i,e);this._errorHandler(a)}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[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};mp._idPool=1;var hp=mp,gp=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
141
|
+
`).slice(2).join(`
|
|
142
|
+
`))}},_p=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},vp=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},yp=0,bp=class{constructor(e){this.value=e,this.id=yp++}},xp=2,Sp=(e,t)=>{if(e instanceof bp)t(e);else for(let n=0;n<e.length;n++){let r=e[n];r&&t(r)}},Cp;if(sp){let e=[];setInterval(()=>{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(`
|
|
143
|
+
`)),e.length=0)},3e3),Cp=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var wp=class{constructor(e){this._size=0,this._options=e,this._leakageMon=pp>0||this._options?.leakWarningThreshold?new hp(e?.onListenerError??Of,this._options?.leakWarningThreshold??pp):void 0,this._perfMon=this._options?._profName?new fp(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(cp){let e=this._listeners;queueMicrotask(()=>{Sp(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{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 t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new vp(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Of)(n),np.None}if(this._disposed)return np.None;t&&(e=e.bind(t));let r=new bp(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=gp.create(),i=this._leakageMon.check(r.stack,this._size+1)),cp&&(r.stack=gp.create()),this._listeners?this._listeners instanceof bp?(this._deliveryQueue??=new Tp,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=$f(()=>{Cp?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof tp?n.add(a):Array.isArray(n)&&n.push(a),Cp){let e=Error().stack.split(`
|
|
144
|
+
`).slice(2,3).join(`
|
|
145
|
+
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);Cp.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*xp<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Of;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_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 bp)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}},Tp=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ep=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Dp;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof Op?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:up.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Ep})})(Dp||={});var Op=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?Ep:(this._emitter||=new wp,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},kp=`en`,Ap=!1,jp=!1,Mp=kp,Np,Pp=globalThis,Fp;typeof Pp.vscode<`u`&&typeof Pp.vscode.process<`u`?Fp=Pp.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(Fp=process);var Ip=typeof Fp?.versions?.electron==`string`&&Fp?.type===`renderer`;if(typeof Fp==`object`){Fp.platform,Fp.platform,Ap=Fp.platform===`linux`,Ap&&Fp.env.SNAP&&Fp.env.SNAP_REVISION,Fp.env.CI||Fp.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Mp=kp;let e=Fp.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,Mp=t.resolvedLanguage||kp,t.languagePack?.translationsConfigFile}catch{}}else typeof navigator==`object`&&!Ip?(Np=navigator.userAgent,Np.indexOf(`Windows`),Np.indexOf(`Macintosh`),(Np.indexOf(`Macintosh`)>=0||Np.indexOf(`iPad`)>=0||Np.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,Ap=Np.indexOf(`Linux`)>=0,Np?.indexOf(`Mobi`),jp=!0,Mp=globalThis._VSCODE_NLS_LANGUAGE||kp,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);jp&&typeof Pp.importScripts==`function`&&Pp.origin;var Lp=Np,Rp=Mp,zp;(e=>{function t(){return Rp}e.value=t;function n(){return Rp.length===2?Rp===`en`:Rp.length>=3?Rp[0]===`e`&&Rp[1]===`n`&&Rp[2]===`-`:!1}e.isDefaultVariant=n;function r(){return Rp===`en`}e.isDefault=r})(zp||={});var Bp=typeof Pp.postMessage==`function`&&!Pp.importScripts;(()=>{if(Bp){let e=[];Pp.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Pp.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var Vp=!!(Lp&&Lp.indexOf(`Chrome`)>=0);Lp&&Lp.indexOf(`Firefox`),!Vp&&Lp&&Lp.indexOf(`Safari`),Lp&&Lp.indexOf(`Edg/`),Lp&&Lp.indexOf(`Android`);function Hp(e,t=0,n){let r=setTimeout(()=>{e(),n&&i.dispose()},t),i=$f(()=>{clearTimeout(r),n?.deleteAndLeak(i)});return n?.add(i),i}(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Up;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Up||={});var Wp=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new wp,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await up.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};Wp.EMPTY=Wp.fromArray([]);var Gp=class extends np{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new rp),this._linesCacheDisposables=this._register(new rp),this._register($f(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=Qf(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=Hp(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let n=[],r=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let a=this._terminal.buffer.active.getLine(e+1),o=a?a.isWrapped:!1,s=i.translateToString(!o&&t);if(o&&a){let e=i.getCell(i.length-1);e&&e.getCode()===0&&e.getWidth()===1&&a.getCell(0)?.getWidth()===2&&(s=s.slice(0,-1))}if(n.push(s),o)r.push(r[r.length-1]+s.length);else break;e++,i=a}return[n.join(``),r]}},Kp=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},qp=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,n,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let i={startRow:t,startCol:n},a=this._findInLine(e,i,r);if(!a)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(i.startRow=n,i.startCol=0,a=this._findInLine(e,i,r),!a);n++);return a}findNextWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=0,a=0;r&&(n===e?(i=r.end.x,a=r.end.y):(i=r.start.x,a=r.start.y)),this._lineCache.initLinesCache();let o={startRow:a,startCol:i},s=this._findInLine(e,o,t);if(!s)for(let n=a+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);if(!s&&a!==0)for(let n=0;n<a&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);return!s&&r&&(o.startRow=r.start.y,o.startCol=0,s=this._findInLine(e,o,t)),s}findPreviousWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=this._terminal.buffer.active.baseY+this._terminal.rows-1,a=this._terminal.cols;this._lineCache.initLinesCache();let o={startRow:i,startCol:a},s;if(r&&(o.startRow=i=r.start.y,o.startCol=a=r.start.x,n!==e&&(s=this._findInLine(e,o,t,!1),s||(o.startRow=i=r.end.y,o.startCol=a=r.end.x))),s||=this._findInLine(e,o,t,!0),!s){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let n=i-1;n>=0&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);}if(!s&&i!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=i&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);return s}_isWholeWord(e,t,n){return(e===0||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e-1]))&&(e+n.length===t.length||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=t.startRow,a=t.startCol;if(this._terminal.buffer.active.getLine(i)?.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,n)}let o=this._lineCache.getLineFromCache(i);o||(o=this._lineCache.translateBufferLineToStringWithWrap(i,!0),this._lineCache.setLineInCache(i,o));let[s,c]=o,l=this._bufferColsToStringOffset(i,a),u=e,d=s;n.regex||(u=n.caseSensitive?e:e.toLowerCase(),d=n.caseSensitive?s:s.toLowerCase());let f=-1;if(n.regex){let t=RegExp(u,n.caseSensitive?`g`:`gi`),i;if(r)for(;i=t.exec(d.slice(0,l));)f=t.lastIndex-i[0].length,e=i[0],t.lastIndex-=e.length-1;else i=t.exec(d.slice(l)),i&&i[0].length>0&&(f=l+(t.lastIndex-i[0].length),e=i[0])}else r?l-u.length>=0&&(f=d.lastIndexOf(u,l-u.length)):f=d.indexOf(u,l);if(f>=0){if(n.wholeWord&&!this._isWholeWord(f,d,e))return;let t=0;for(;t<c.length-1&&f>=c[t+1];)t++;let r=t;for(;r<c.length-1&&f+e.length>=c[r+1];)r++;let a=f-c[t],o=f+e.length-c[r],s=this._stringLengthToBufferSize(i+t,a),l=this._stringLengthToBufferSize(i+r,o)-s+this._terminal.cols*(r-t);return{term:e,col:s,row:i+t,size:l}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e<t;e++){let r=n.getCell(e);if(!r)break;let i=r.getChars();i.length>1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=e,r=0,i=this._terminal.buffer.active.getLine(n);for(;t>0&&i;){for(let e=0;e<t&&e<this._terminal.cols;e++){let t=i.getCell(e);if(!t)break;t.getWidth()&&(r+=t.getCode()===0?1:t.getChars().length)}if(n++,i=this._terminal.buffer.active.getLine(n),i&&!i.isWrapped)break;t-=this._terminal.cols}return r}},Jp=class extends np{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register($f(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let n of e){let e=this._createResultDecorations(n,t,!1);if(e)for(let t of e)this._storeDecoration(t,n)}}createActiveDecoration(e,t){let n=this._createResultDecorations(e,t,!0);if(n)return{decorations:n,match:e,dispose(){Zf(n)}}}clearHighlightDecorations(){Zf(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecorations(e,t,n){let r=[],i=e.col,a=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;a>0;){let e=Math.min(this._terminal.cols-i,a);r.push([o,i,e]),i=0,a-=e,o++}let s=[];for(let e of r){let r=this._terminal.registerMarker(e[0]),i=this._terminal.registerDecoration({marker:r,x:e[1],width:e[2],backgroundColor:n?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:n?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:`center`}});if(i){let e=[];e.push(r),e.push(i.onRender(e=>this._applyStyles(e,n?t.activeMatchBorder:t.matchBorder,!1))),e.push(i.onDispose(()=>Zf(e))),s.push(i)}}return s.length===0?void 0:s}},Yp=class extends np{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new wp)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&=(this._selectedDecoration.dispose(),void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let n=this._searchResults[t];if(n.row===e.row&&n.col===e.col&&n.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},Xp=class extends np{constructor(e){super(),this._highlightTimeout=this._register(new rp),this._lineCache=this._register(new rp),this._state=new Kp,this._resultTracker=this._register(new Yp),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new Gp(e),this._engine=new qp(e,this._lineCache.value),this._decorationManager=new Jp(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register($f(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=Hp(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error(`Cannot use addon until it has been loaded`);if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],r,i=this._engine.find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(n,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(n,t.decorations)}_findNextAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}findPrevious(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}_selectResult(e,t,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!n&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let t=e.row-this._terminal.buffer.active.viewportY;t-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(t)}return!0}},Zp=`3.7.8`,Qp=Zp,$p=typeof Buffer==`function`,em=typeof TextDecoder==`function`?new TextDecoder:void 0,tm=typeof TextEncoder==`function`?new TextEncoder:void 0,nm=Array.prototype.slice.call(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`),rm=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(nm),im=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,am=String.fromCharCode.bind(String),om=typeof Uint8Array.from==`function`?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),sm=e=>e.replace(/=/g,``).replace(/[+\/]/g,e=>e==`+`?`-`:`_`),cm=e=>e.replace(/[^A-Za-z0-9\+\/]/g,``),lm=e=>{let t,n,r,i,a=``,o=e.length%3;for(let o=0;o<e.length;){if((n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw TypeError(`invalid character found`);t=n<<16|r<<8|i,a+=nm[t>>18&63]+nm[t>>12&63]+nm[t>>6&63]+nm[t&63]}return o?a.slice(0,o-3)+`===`.substring(o):a},um=typeof btoa==`function`?e=>btoa(e):$p?e=>Buffer.from(e,`binary`).toString(`base64`):lm,dm=$p?e=>Buffer.from(e).toString(`base64`):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(am.apply(null,e.subarray(n,n+4096)));return um(t.join(``))},fm=(e,t=!1)=>t?sm(dm(e)):dm(e),pm=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?am(192|t>>>6)+am(128|t&63):am(224|t>>>12&15)+am(128|t>>>6&63)+am(128|t&63)}else{var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return am(240|t>>>18&7)+am(128|t>>>12&63)+am(128|t>>>6&63)+am(128|t&63)}},mm=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,hm=e=>e.replace(mm,pm),gm=$p?e=>Buffer.from(e,`utf8`).toString(`base64`):tm?e=>dm(tm.encode(e)):e=>um(hm(e)),_m=(e,t=!1)=>t?sm(gm(e)):gm(e),vm=e=>_m(e,!0),ym=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,bm=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return am((t>>>10)+55296)+am((t&1023)+56320);case 3:return am((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return am((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},xm=e=>e.replace(ym,bm),Sm=e=>{if(e=e.replace(/\s+/g,``),!im.test(e))throw TypeError(`malformed base64.`);e+=`==`.slice(2-(e.length&3));let t,n,r,i=[];for(let a=0;a<e.length;)t=rm[e.charAt(a++)]<<18|rm[e.charAt(a++)]<<12|(n=rm[e.charAt(a++)])<<6|(r=rm[e.charAt(a++)]),n===64?i.push(am(t>>16&255)):r===64?i.push(am(t>>16&255,t>>8&255)):i.push(am(t>>16&255,t>>8&255,t&255));return i.join(``)},Cm=typeof atob==`function`?e=>atob(cm(e)):$p?e=>Buffer.from(e,`base64`).toString(`binary`):Sm,wm=$p?e=>om(Buffer.from(e,`base64`)):e=>om(Cm(e).split(``).map(e=>e.charCodeAt(0))),Tm=e=>wm(Dm(e)),Em=$p?e=>Buffer.from(e,`base64`).toString(`utf8`):em?e=>em.decode(wm(e)):e=>xm(Cm(e)),Dm=e=>cm(e.replace(/[-_]/g,e=>e==`-`?`+`:`/`)),Om=e=>Em(Dm(e)),km=e=>{if(typeof e!=`string`)return!1;let t=e.replace(/\s+/g,``).replace(/={0,2}$/,``);return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},Am=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),jm=function(){let e=(e,t)=>Object.defineProperty(String.prototype,e,Am(t));e(`fromBase64`,function(){return Om(this)}),e(`toBase64`,function(e){return _m(this,e)}),e(`toBase64URI`,function(){return _m(this,!0)}),e(`toBase64URL`,function(){return _m(this,!0)}),e(`toUint8Array`,function(){return Tm(this)})},Mm=function(){let e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Am(t));e(`toBase64`,function(e){return fm(this,e)}),e(`toBase64URI`,function(){return fm(this,!0)}),e(`toBase64URL`,function(){return fm(this,!0)})},Nm={version:Zp,VERSION:Qp,atob:Cm,atobPolyfill:Sm,btoa:um,btoaPolyfill:lm,fromBase64:Om,toBase64:_m,encode:_m,encodeURI:vm,encodeURL:vm,utob:hm,btou:xm,decode:Om,isValid:km,fromUint8Array:fm,toUint8Array:Tm,extendString:jm,extendUint8Array:Mm,extendBuiltins:()=>{jm(),Mm()}},Pm=class{constructor(e=new Im,t=new Fm){this._base64=e,this._provider=t}activate(e){this._terminal=e,this._disposable=e.parser.registerOscHandler(52,e=>this._setOrReportClipboard(e))}dispose(){return this._disposable?.dispose()}_readText(e,t){let n=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${e};${n}\x07`,!1)}_setOrReportClipboard(e){let t=e.split(`;`);if(t.length<2)return!0;let n=t[0],r=t[1];if(r===`?`){let e=this._provider.readText(n);return e instanceof Promise?e.then(e=>(this._readText(n,e),!0)):(this._readText(n,e),!0)}let i=``;try{i=this._base64.decodeText(r)}catch{}let a=this._provider.writeText(n,i);return a instanceof Promise?a.then(()=>!0):!0}},Fm=class{async readText(e){return e===`c`?navigator.clipboard.readText():Promise.resolve(``)}async writeText(e,t){return e===`c`?navigator.clipboard.writeText(t):Promise.resolve()}},Im=class{encodeText(e){return Nm.encode(e)}decodeText(e){let t=Nm.decode(e);return!Nm.isValid(e)||Nm.encode(t)!==e?``:t}},Lm=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],Rm=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],zm;function Bm(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var Vm=class{constructor(){if(this.version=`6`,!zm){zm=new Uint8Array(65536),zm.fill(1),zm[0]=0,zm.fill(0,1,32),zm.fill(0,127,160),zm.fill(2,4352,4448),zm[9001]=2,zm[9002]=2,zm.fill(2,11904,42192),zm[12351]=1,zm.fill(2,44032,55204),zm.fill(2,63744,64256),zm.fill(2,65040,65050),zm.fill(2,65072,65136),zm.fill(2,65280,65377),zm.fill(2,65504,65511);for(let e=0;e<Lm.length;++e)zm.fill(0,Lm[e][0],Lm[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?zm[e]:Bm(e,Rm)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Bh.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Bh.createPropertyValue(0,n,r)}},Hm=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?qm.isErrorNoTelemetry(e)?new qm(e.message+`
|
|
146
|
+
|
|
147
|
+
`+e.stack):Error(e.message+`
|
|
148
|
+
|
|
149
|
+
`+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 Um(e){Gm(e)||Hm.onUnexpectedError(e)}var Wm=`Canceled`;function Gm(e){return e instanceof Km?!0:e instanceof Error&&e.name===Wm&&e.message===Wm}var Km=class extends Error{constructor(){super(Wm),this.name=this.message}},qm=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}};function Jm(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}function Ym(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}var Xm=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=Ym(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};Xm.assertInvariants=!1;var Zm;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Zm||={});function Qm(e,t){return(n,r)=>t(e(n),e(r))}var $m=(e,t)=>e-t,eh=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>t(n)?e(n):!0))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||Zm.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};eh.empty=new eh(e=>{});function th(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var nh=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}},rh;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(rh||={});var ih=!1,ah=null,oh=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
|
|
150
|
+
`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new nh;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
|
|
151
|
+
`),e)}n.sort(Qm(e=>e.idx,$m));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
|
|
152
|
+
`)).size}/${n.length} leaks) at ${a}`;let o=th([...i.get(e.slice(0,t).join(`
|
|
153
|
+
`))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
|
|
157
|
+
${s.join(`
|
|
158
|
+
`)}
|
|
159
|
+
============================================================
|
|
160
|
+
|
|
161
|
+
`}return n.length>e&&(a+=`
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
... and ${n.length-e} more leaking disposables
|
|
165
|
+
|
|
166
|
+
`),{leaks:n,details:a}}};oh.idx=0;function sh(e){ah=e}if(ih){let e=`__is_disposable_tracked__`;sh(new class{trackDisposable(t){let n=Error(`Potentially leaked disposable`).stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==_h.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==_h.None)try{t[e]=!0}catch{}}markAsSingleton(e){}})}function ch(e){return ah?.trackDisposable(e),e}function lh(e){ah?.markAsDisposed(e)}function uh(e,t){ah?.setParent(e,t)}function dh(e,t){if(ah)for(let n of e)ah.setParent(n,t)}function fh(e){if(rh.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function ph(...e){let t=mh(()=>fh(e));return dh(e,t),t}function mh(e){let t=ch({dispose:Jm(()=>{lh(t),e()})});return t}var hh=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,ch(this)}dispose(){this._isDisposed||(lh(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{fh(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return uh(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),uh(e,null))}};hh.DISABLE_DISPOSED_WARNING=!1;var gh=hh,_h=class{constructor(){this._store=new gh,ch(this),uh(this._store,this)}dispose(){lh(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};_h.None=Object.freeze({dispose(){}});var vh=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};vh.Undefined=new vh(void 0);var yh=globalThis.performance&&typeof globalThis.performance.now==`function`,bh=class e{static create(t){return new e(t)}constructor(e){this._now=yh&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},xh=!1,Sh=!1,Ch=!1,wh;(e=>{e.None=()=>_h.None;function t(e){if(Ch){let{onDidAddListener:t}=e,n=Ah.create(),r=0;e.onDidAddListener=()=>{++r===2&&(console.warn(`snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here`),n.print()),t?.()}}}function n(e,t){return f(e,()=>{},0,void 0,!0,void 0,t)}e.defer=n;function r(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=r;function i(e,t,n){return u((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=i;function a(e,t,n){return u((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=a;function o(e,t,n){return u((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=o;function s(e){return e}e.signal=s;function c(...e){return(t,n=null,r)=>d(ph(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=c;function l(e,t,n,r){let a=n;return i(e,e=>(a=t(a,e),a),r)}e.reduce=l;function u(e,n){let r,i={onWillAddFirstListener(){r=e(a.fire,a)},onDidRemoveLastListener(){r?.dispose()}};n||t(i);let a=new Rh(i);return n?.add(a),a.event}function d(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function f(e,n,r=100,i=!1,a=!1,o,s){let c,l,u,d=0,f,p={leakWarningThreshold:o,onWillAddFirstListener(){c=e(e=>{d++,l=n(l,e),i&&!u&&(m.fire(l),l=void 0),f=()=>{let e=l;l=void 0,u=void 0,(!i||d>1)&&m.fire(e),d=0},typeof r==`number`?(clearTimeout(u),u=setTimeout(f,r)):u===void 0&&(u=0,queueMicrotask(f))})},onWillRemoveListener(){a&&d>0&&f?.()},onDidRemoveLastListener(){f=void 0,c.dispose()}};s||t(p);let m=new Rh(p);return s?.add(m),m.event}e.debounce=f;function p(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=p;function m(e,t=(e,t)=>e===t,n){let r=!0,i;return o(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=m;function h(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=h;function g(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Rh({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=g;function _(e,t){return(n,r,i)=>{let a=t(new y);return e(function(e){let t=a.evaluate(e);t!==v&&n.call(r,t)},void 0,i)}}e.chain=_;let v=Symbol(`HaltChainable`);class y{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:v),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:v}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===v)break;return e}}function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Rh({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=b;function x(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Rh({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=x;function S(e){return new Promise(t=>r(e)(t))}e.toPromise=S;function ee(e){let t=new Rh;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=ee;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,n){this._observable=e,this._counter=0,this._hasChanged=!1;let r={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};n||t(r),this.emitter=new Rh(r),n&&n.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof gh?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(wh||={});var Th=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 bh,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}}};Th.all=new Set,Th._idPool=0;var Eh=Th,Dh=-1,Oh=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new jh(i,e);this._errorHandler(a)}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[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};Oh._idPool=1;var kh=Oh,Ah=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
167
|
+
`).slice(2).join(`
|
|
168
|
+
`))}},jh=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},Mh=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},Nh=0,Ph=class{constructor(e){this.value=e,this.id=Nh++}},Fh=2,Ih=(e,t)=>{if(e instanceof Ph)t(e);else for(let n=0;n<e.length;n++){let r=e[n];r&&t(r)}},Lh;if(xh){let e=[];setInterval(()=>{e.length!==0&&(console.warn(`[LEAKING LISTENERS] GC'ed these listeners that were NOT yet disposed:`),console.warn(e.join(`
|
|
169
|
+
`)),e.length=0)},3e3),Lh=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var Rh=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Dh>0||this._options?.leakWarningThreshold?new kh(e?.onListenerError??Um,this._options?.leakWarningThreshold??Dh):void 0,this._perfMon=this._options?._profName?new Eh(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(Sh){let e=this._listeners;queueMicrotask(()=>{Ih(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{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 t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Mh(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Um)(n),_h.None}if(this._disposed)return _h.None;t&&(e=e.bind(t));let r=new Ph(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Ah.create(),i=this._leakageMon.check(r.stack,this._size+1)),Sh&&(r.stack=Ah.create()),this._listeners?this._listeners instanceof Ph?(this._deliveryQueue??=new zh,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=mh(()=>{Lh?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof gh?n.add(a):Array.isArray(n)&&n.push(a),Lh){let e=Error().stack.split(`
|
|
170
|
+
`).slice(2,3).join(`
|
|
171
|
+
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);Lh.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Fh<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||Um;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_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 Ph)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}},zh=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Bh=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Rh,this.onChange=this._onChange.event;let e=new Vm;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Vh=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1541],[1552,1562],[1564,1564],[1611,1631],[1648,1648],[1750,1757],[1759,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2045,2045],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2259,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2558,2558],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2810,2815],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3076,3076],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4448,4607],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6158],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7673],[7675,7679],[8203,8207],[8234,8238],[8288,8292],[8294,8303],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43263,43263],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43453],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[65279,65279],[65529,65531]],Hh=[[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[68900,68903],[69446,69456],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69821,69821],[69837,69837],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70089,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70459,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70750,70750],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[71727,71735],[71737,71738],[72148,72151],[72154,72155],[72160,72160],[72193,72202],[72243,72248],[72251,72254],[72263,72263],[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],[73018,73018],[73020,73021],[73023,73029],[73031,73031],[73104,73105],[73109,73109],[73111,73111],[73459,73460],[78896,78904],[92912,92916],[92976,92982],[94031,94031],[94095,94098],[113821,113822],[113824,113827],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[123184,123190],[123628,123631],[125136,125142],[125252,125258],[917505,917505],[917536,917631],[917760,917999]],Uh=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12329],[12334,12350],[12353,12438],[12443,12543],[12549,12591],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510]],Wh=[[94176,94179],[94208,100343],[100352,101106],[110592,110878],[110928,110930],[110948,110951],[110960,111355],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127584,127589],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128725,128725],[128747,128748],[128756,128762],[128992,129003],[129293,129393],[129395,129398],[129402,129442],[129445,129450],[129454,129482],[129485,129535],[129648,129651],[129656,129658],[129664,129666],[129680,129685],[131072,196605],[196608,262141]],Gh;function Kh(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var qh=class{constructor(){if(this.version=`11`,!Gh){Gh=new Uint8Array(65536),Gh.fill(1),Gh[0]=0,Gh.fill(0,1,32),Gh.fill(0,127,160);for(let e=0;e<Vh.length;++e)Gh.fill(0,Vh[e][0],Vh[e][1]+1);for(let e=0;e<Uh.length;++e)Gh.fill(2,Uh[e][0],Uh[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Gh[e]:Kh(e,Hh)?0:Kh(e,Wh)?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Bh.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Bh.createPropertyValue(0,n,r)}},Jh=class{activate(e){e.unicode.register(new qh)}dispose(){}},Yh=Object.create,Xh=Object.defineProperty,Zh=Object.getOwnPropertyDescriptor,Qh=Object.getOwnPropertyNames,$h=Object.getPrototypeOf,eg=Object.prototype.hasOwnProperty,tg=(e=>typeof t<`u`?t:typeof Proxy<`u`?new Proxy(e,{get:(e,n)=>(typeof t<`u`?t:e)[n]}):e)(function(e){if(typeof t<`u`)return t.apply(this,arguments);throw Error(`Dynamic require of "`+e+`" is not supported`)}),$=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ng=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of Qh(t))!eg.call(e,i)&&i!==n&&Xh(e,i,{get:()=>t[i],enumerable:!(r=Zh(t,i))||r.enumerable});return e},rg=(e,t,n)=>(n=e==null?{}:Yh($h(e)),ng(t||!e||!e.__esModule?Xh(n,`default`,{value:e,enumerable:!0}):n,e)),ig=$((e,t)=>{(function(n,r){typeof e==`object`&&typeof t<`u`?r(e):typeof define==`function`&&define.amd?define([`exports`],r):r(n.opentype=n.opentype||{})})(e,function(e){var t=0,n=-3;function r(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function i(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new r,this.dtree=new r}var a=new r,o=new r,s=new Uint8Array(30),c=new Uint16Array(30),l=new Uint8Array(30),u=new Uint16Array(30),d=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),f=new r,p=new Uint8Array(320);function m(e,t,n,r){var i,a;for(i=0;i<n;++i)e[i]=0;for(i=0;i<30-n;++i)e[i+n]=i/n|0;for(a=r,i=0;i<30;++i)t[i]=a,a+=1<<e[i]}function h(e,t){var n;for(n=0;n<7;++n)e.table[n]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,n=0;n<24;++n)e.trans[n]=256+n;for(n=0;n<144;++n)e.trans[24+n]=n;for(n=0;n<8;++n)e.trans[168+n]=280+n;for(n=0;n<112;++n)e.trans[176+n]=144+n;for(n=0;n<5;++n)t.table[n]=0;for(t.table[5]=32,n=0;n<32;++n)t.trans[n]=n}var g=new Uint16Array(16);function _(e,t,n,r){var i,a;for(i=0;i<16;++i)e.table[i]=0;for(i=0;i<r;++i)e.table[t[n+i]]++;for(e.table[0]=0,a=0,i=0;i<16;++i)g[i]=a,a+=e.table[i];for(i=0;i<r;++i)t[n+i]&&(e.trans[g[t[n+i]]++]=i)}function v(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=e.tag&1;return e.tag>>>=1,t}function y(e,t,n){if(!t)return n;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var r=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,r+n}function b(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var n=0,r=0,i=0,a=e.tag;do r=2*r+(a&1),a>>>=1,++i,n+=t.table[i],r-=t.table[i];while(r>=0);return e.tag=a,e.bitcount-=i,t.trans[n+r]}function x(e,t,n){var r,i,a,o,s,c;for(r=y(e,5,257),i=y(e,5,1),a=y(e,4,4),o=0;o<19;++o)p[o]=0;for(o=0;o<a;++o){var l=y(e,3,0);p[d[o]]=l}for(_(f,p,0,19),s=0;s<r+i;){var u=b(e,f);switch(u){case 16:var m=p[s-1];for(c=y(e,2,3);c;--c)p[s++]=m;break;case 17:for(c=y(e,3,3);c;--c)p[s++]=0;break;case 18:for(c=y(e,7,11);c;--c)p[s++]=0;break;default:p[s++]=u;break}}_(t,p,0,r),_(n,p,r,i)}function S(e,n,r){for(;;){var i=b(e,n);if(i===256)return t;if(i<256)e.dest[e.destLen++]=i;else{var a,o,d,f;for(i-=257,a=y(e,s[i],c[i]),o=b(e,r),d=e.destLen-y(e,l[o],u[o]),f=d;f<d+a;++f)e.dest[e.destLen++]=e.dest[f]}}}function ee(e){for(var r,i,a;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if(r=e.source[e.sourceIndex+1],r=256*r+e.source[e.sourceIndex],i=e.source[e.sourceIndex+3],i=256*i+e.source[e.sourceIndex+2],r!==(~i&65535))return n;for(e.sourceIndex+=4,a=r;a;--a)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,t}function C(e,r){var s=new i(e,r),c,l,u;do{switch(c=v(s),l=y(s,2,0),l){case 0:u=ee(s);break;case 1:u=S(s,a,o);break;case 2:x(s,s.ltree,s.dtree),u=S(s,s.ltree,s.dtree);break;default:u=n}if(u!==t)throw Error(`Data error`)}while(!c);return s.destLen<s.dest.length?typeof s.dest.slice==`function`?s.dest.slice(0,s.destLen):s.dest.subarray(0,s.destLen):s.dest}h(a,o),m(s,c,4,3),m(l,u,2,1),s[28]=0,c[28]=258;var w=C;function T(e,t,n,r,i){return(1-i)**3*e+3*(1-i)**2*i*t+3*(1-i)*i**2*n+i**3*r}function E(){this.x1=NaN,this.y1=NaN,this.x2=NaN,this.y2=NaN}E.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},E.prototype.addPoint=function(e,t){typeof e==`number`&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),e<this.x1&&(this.x1=e),e>this.x2&&(this.x2=e)),typeof t==`number`&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),t<this.y1&&(this.y1=t),t>this.y2&&(this.y2=t))},E.prototype.addX=function(e){this.addPoint(e,null)},E.prototype.addY=function(e){this.addPoint(null,e)},E.prototype.addBezier=function(e,t,n,r,i,a,o,s){var c=this,l=[e,t],u=[n,r],d=[i,a],f=[o,s];this.addPoint(e,t),this.addPoint(o,s);for(var p=0;p<=1;p++){var m=6*l[p]-12*u[p]+6*d[p],h=-3*l[p]+9*u[p]-9*d[p]+3*f[p],g=3*u[p]-3*l[p];if(h===0){if(m===0)continue;var _=-g/m;0<_&&_<1&&(p===0&&c.addX(T(l[p],u[p],d[p],f[p],_)),p===1&&c.addY(T(l[p],u[p],d[p],f[p],_)));continue}var v=m**2-4*g*h;if(!(v<0)){var y=(-m+Math.sqrt(v))/(2*h);0<y&&y<1&&(p===0&&c.addX(T(l[p],u[p],d[p],f[p],y)),p===1&&c.addY(T(l[p],u[p],d[p],f[p],y)));var b=(-m-Math.sqrt(v))/(2*h);0<b&&b<1&&(p===0&&c.addX(T(l[p],u[p],d[p],f[p],b)),p===1&&c.addY(T(l[p],u[p],d[p],f[p],b)))}}},E.prototype.addQuad=function(e,t,n,r,i,a){var o=e+.6666666666666666*(n-e),s=t+2/3*(r-t),c=o+1/3*(i-e),l=s+1/3*(a-t);this.addBezier(e,t,o,s,c,l,i,a)};function D(){this.commands=[],this.fill=`black`,this.stroke=null,this.strokeWidth=1}D.prototype.moveTo=function(e,t){this.commands.push({type:`M`,x:e,y:t})},D.prototype.lineTo=function(e,t){this.commands.push({type:`L`,x:e,y:t})},D.prototype.curveTo=D.prototype.bezierCurveTo=function(e,t,n,r,i,a){this.commands.push({type:`C`,x1:e,y1:t,x2:n,y2:r,x:i,y:a})},D.prototype.quadTo=D.prototype.quadraticCurveTo=function(e,t,n,r){this.commands.push({type:`Q`,x1:e,y1:t,x:n,y:r})},D.prototype.close=D.prototype.closePath=function(){this.commands.push({type:`Z`})},D.prototype.extend=function(e){if(e.commands)e=e.commands;else if(e instanceof E){var t=e;this.moveTo(t.x1,t.y1),this.lineTo(t.x2,t.y1),this.lineTo(t.x2,t.y2),this.lineTo(t.x1,t.y2),this.close();return}Array.prototype.push.apply(this.commands,e)},D.prototype.getBoundingBox=function(){for(var e=this,t=new E,n=0,r=0,i=0,a=0,o=0;o<this.commands.length;o++){var s=e.commands[o];switch(s.type){case`M`:t.addPoint(s.x,s.y),n=i=s.x,r=a=s.y;break;case`L`:t.addPoint(s.x,s.y),i=s.x,a=s.y;break;case`Q`:t.addQuad(i,a,s.x1,s.y1,s.x,s.y),i=s.x,a=s.y;break;case`C`:t.addBezier(i,a,s.x1,s.y1,s.x2,s.y2,s.x,s.y),i=s.x,a=s.y;break;case`Z`:i=n,a=r;break;default:throw Error(`Unexpected path command `+s.type)}}return t.isEmpty()&&t.addPoint(0,0),t},D.prototype.draw=function(e){var t=this;e.beginPath();for(var n=0;n<this.commands.length;n+=1){var r=t.commands[n];r.type===`M`?e.moveTo(r.x,r.y):r.type===`L`?e.lineTo(r.x,r.y):r.type===`C`?e.bezierCurveTo(r.x1,r.y1,r.x2,r.y2,r.x,r.y):r.type===`Q`?e.quadraticCurveTo(r.x1,r.y1,r.x,r.y):r.type===`Z`&&e.closePath()}this.fill&&(e.fillStyle=this.fill,e.fill()),this.stroke&&(e.strokeStyle=this.stroke,e.lineWidth=this.strokeWidth,e.stroke())},D.prototype.toPathData=function(e){var t=this;e=e===void 0?2:e;function n(t){return Math.round(t)===t?``+Math.round(t):t.toFixed(e)}function r(){for(var e=arguments,t=``,r=0;r<arguments.length;r+=1){var i=e[r];i>=0&&r>0&&(t+=` `),t+=n(i)}return t}for(var i=``,a=0;a<this.commands.length;a+=1){var o=t.commands[a];o.type===`M`?i+=`M`+r(o.x,o.y):o.type===`L`?i+=`L`+r(o.x,o.y):o.type===`C`?i+=`C`+r(o.x1,o.y1,o.x2,o.y2,o.x,o.y):o.type===`Q`?i+=`Q`+r(o.x1,o.y1,o.x,o.y):o.type===`Z`&&(i+=`Z`)}return i},D.prototype.toSVG=function(e){var t=`<path d="`;return t+=this.toPathData(e),t+=`"`,this.fill&&this.fill!==`black`&&(this.fill===null?t+=` fill="none"`:t+=` fill="`+this.fill+`"`),this.stroke&&(t+=` stroke="`+this.stroke+`" stroke-width="`+this.strokeWidth+`"`),t+=`/>`,t},D.prototype.toDOMElement=function(e){var t=this.toPathData(e),n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return n.setAttribute(`d`,t),n};function O(e){throw Error(e)}function k(e,t){e||O(t)}var A={fail:O,argument:k,assert:k},j=32768,M=2147483648,N={},P={},F={};function te(e){return function(){return e}}P.BYTE=function(e){return A.argument(e>=0&&e<=255,`Byte value should be between 0 and 255.`),[e]},F.BYTE=te(1),P.CHAR=function(e){return[e.charCodeAt(0)]},F.CHAR=te(1),P.CHARARRAY=function(e){for(var t=[],n=0;n<e.length;n+=1)t[n]=e.charCodeAt(n);return t},F.CHARARRAY=function(e){return e.length},P.USHORT=function(e){return[e>>8&255,e&255]},F.USHORT=te(2),P.SHORT=function(e){return e>=j&&(e=-(2*j-e)),[e>>8&255,e&255]},F.SHORT=te(2),P.UINT24=function(e){return[e>>16&255,e>>8&255,e&255]},F.UINT24=te(3),P.ULONG=function(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]},F.ULONG=te(4),P.LONG=function(e){return e>=M&&(e=-(2*M-e)),[e>>24&255,e>>16&255,e>>8&255,e&255]},F.LONG=te(4),P.FIXED=P.ULONG,F.FIXED=F.ULONG,P.FWORD=P.SHORT,F.FWORD=F.SHORT,P.UFWORD=P.USHORT,F.UFWORD=F.USHORT,P.LONGDATETIME=function(e){return[0,0,0,0,e>>24&255,e>>16&255,e>>8&255,e&255]},F.LONGDATETIME=te(8),P.TAG=function(e){return A.argument(e.length===4,`Tag should be exactly 4 ASCII characters.`),[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]},F.TAG=te(4),P.Card8=P.BYTE,F.Card8=F.BYTE,P.Card16=P.USHORT,F.Card16=F.USHORT,P.OffSize=P.BYTE,F.OffSize=F.BYTE,P.SID=P.USHORT,F.SID=F.USHORT,P.NUMBER=function(e){return e>=-107&&e<=107?[e+139]:e>=108&&e<=1131?(e-=108,[(e>>8)+247,e&255]):e>=-1131&&e<=-108?(e=-e-108,[(e>>8)+251,e&255]):e>=-32768&&e<=32767?P.NUMBER16(e):P.NUMBER32(e)},F.NUMBER=function(e){return P.NUMBER(e).length},P.NUMBER16=function(e){return[28,e>>8&255,e&255]},F.NUMBER16=te(3),P.NUMBER32=function(e){return[29,e>>24&255,e>>16&255,e>>8&255,e&255]},F.NUMBER32=te(5),P.REAL=function(e){var t=e.toString(),n=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(t);if(n){var r=parseFloat(`1e`+((n[2]?+n[2]:0)+n[1].length));t=(Math.round(e*r)/r).toString()}for(var i=``,a=0,o=t.length;a<o;a+=1){var s=t[a];s===`e`?i+=t[++a]===`-`?`c`:`b`:s===`.`?i+=`a`:s===`-`?i+=`e`:i+=s}i+=i.length&1?`f`:`ff`;for(var c=[30],l=0,u=i.length;l<u;l+=2)c.push(parseInt(i.substr(l,2),16));return c},F.REAL=function(e){return P.REAL(e).length},P.NAME=P.CHARARRAY,F.NAME=F.CHARARRAY,P.STRING=P.CHARARRAY,F.STRING=F.CHARARRAY,N.UTF8=function(e,t,n){for(var r=[],i=n,a=0;a<i;a++,t+=1)r[a]=e.getUint8(t);return String.fromCharCode.apply(null,r)},N.UTF16=function(e,t,n){for(var r=[],i=n/2,a=0;a<i;a++,t+=2)r[a]=e.getUint16(t);return String.fromCharCode.apply(null,r)},P.UTF16=function(e){for(var t=[],n=0;n<e.length;n+=1){var r=e.charCodeAt(n);t[t.length]=r>>8&255,t[t.length]=r&255}return t},F.UTF16=function(e){return e.length*2};var ne={"x-mac-croatian":`ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ\xA0ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ`,"x-mac-cyrillic":`АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»…\xA0ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю`,"x-mac-gaelic":`ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»…\xA0ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ`,"x-mac-greek":`Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»…\xA0ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ`,"x-mac-icelandic":`ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»…\xA0ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ`,"x-mac-inuit":`ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ…\xA0ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł`,"x-mac-ce":`ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»…\xA0ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ`,macintosh:`ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»…\xA0ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ`,"x-mac-romanian":`ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»…\xA0ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ`,"x-mac-turkish":`ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»…\xA0ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ`};N.MACSTRING=function(e,t,n,r){var i=ne[r];if(i!==void 0){for(var a=``,o=0;o<n;o++){var s=e.getUint8(t+o);s<=127?a+=String.fromCharCode(s):a+=i[s&127]}return a}};var re=typeof WeakMap==`function`&&new WeakMap,ie,ae=function(e){if(!ie)for(var t in ie={},ne)ie[t]=new String(t);var n=ie[e];if(n!==void 0){if(re){var r=re.get(n);if(r!==void 0)return r}var i=ne[e];if(i!==void 0){for(var a={},o=0;o<i.length;o++)a[i.charCodeAt(o)]=o+128;return re&&re.set(n,a),a}}};P.MACSTRING=function(e,t){var n=ae(t);if(n!==void 0){for(var r=[],i=0;i<e.length;i++){var a=e.charCodeAt(i);if(a>=128&&(a=n[a],a===void 0))return;r[i]=a}return r}},F.MACSTRING=function(e,t){var n=P.MACSTRING(e,t);return n===void 0?0:n.length};function I(e){return e>=-128&&e<=127}function oe(e,t,n){for(var r=0,i=e.length;t<i&&r<64&&e[t]===0;)++t,++r;return n.push(128|r-1),t}function se(e,t,n){for(var r=0,i=e.length,a=t;a<i&&r<64;){var o=e[a];if(!I(o)||o===0&&a+1<i&&e[a+1]===0)break;++a,++r}n.push(r-1);for(var s=t;s<a;++s)n.push(e[s]+256&255);return a}function ce(e,t,n){for(var r=0,i=e.length,a=t;a<i&&r<64;){var o=e[a];if(o===0||I(o)&&a+1<i&&I(e[a+1]))break;++a,++r}n.push(64|r-1);for(var s=t;s<a;++s){var c=e[s];n.push(c+65536>>8&255,c+256&255)}return a}P.VARDELTAS=function(e){for(var t=0,n=[];t<e.length;){var r=e[t];t=r===0?oe(e,t,n):r>=-128&&r<=127?se(e,t,n):ce(e,t,n)}return n},P.INDEX=function(e){for(var t=1,n=[t],r=[],i=0;i<e.length;i+=1){var a=P.OBJECT(e[i]);Array.prototype.push.apply(r,a),t+=a.length,n.push(t)}if(r.length===0)return[0,0];for(var o=[],s=1+Math.floor(Math.log(t)/Math.log(2))/8|0,c=[void 0,P.BYTE,P.USHORT,P.UINT24,P.ULONG][s],l=0;l<n.length;l+=1){var u=c(n[l]);Array.prototype.push.apply(o,u)}return Array.prototype.concat(P.Card16(e.length),P.OffSize(s),o,r)},F.INDEX=function(e){return P.INDEX(e).length},P.DICT=function(e){for(var t=[],n=Object.keys(e),r=n.length,i=0;i<r;i+=1){var a=parseInt(n[i],0),o=e[a];t=t.concat(P.OPERAND(o.value,o.type)),t=t.concat(P.OPERATOR(a))}return t},F.DICT=function(e){return P.DICT(e).length},P.OPERATOR=function(e){return e<1200?[e]:[12,e-1200]},P.OPERAND=function(e,t){var n=[];if(Array.isArray(t))for(var r=0;r<t.length;r+=1)A.argument(e.length===t.length,`Not enough arguments given for type`+t),n=n.concat(P.OPERAND(e[r],t[r]));else if(t===`SID`)n=n.concat(P.NUMBER(e));else if(t===`offset`)n=n.concat(P.NUMBER32(e));else if(t===`number`)n=n.concat(P.NUMBER(e));else if(t===`real`)n=n.concat(P.REAL(e));else throw Error(`Unknown operand type `+t);return n},P.OP=P.BYTE,F.OP=F.BYTE;var le=typeof WeakMap==`function`&&new WeakMap;P.CHARSTRING=function(e){if(le){var t=le.get(e);if(t!==void 0)return t}for(var n=[],r=e.length,i=0;i<r;i+=1){var a=e[i];n=n.concat(P[a.type](a.value))}return le&&le.set(e,n),n},F.CHARSTRING=function(e){return P.CHARSTRING(e).length},P.OBJECT=function(e){var t=P[e.type];return A.argument(t!==void 0,`No encoding function for type `+e.type),t(e.value)},F.OBJECT=function(e){var t=F[e.type];return A.argument(t!==void 0,`No sizeOf function for type `+e.type),t(e.value)},P.TABLE=function(e){for(var t=[],n=e.fields.length,r=[],i=[],a=0;a<n;a+=1){var o=e.fields[a],s=P[o.type];A.argument(s!==void 0,`No encoding function for field type `+o.type+` (`+o.name+`)`);var c=e[o.name];c===void 0&&(c=o.value);var l=s(c);o.type===`TABLE`?(i.push(t.length),t=t.concat([0,0]),r.push(l)):t=t.concat(l)}for(var u=0;u<r.length;u+=1){var d=i[u],f=t.length;A.argument(f<65536,`Table `+e.tableName+` too big.`),t[d]=f>>8,t[d+1]=f&255,t=t.concat(r[u])}return t},F.TABLE=function(e){for(var t=0,n=e.fields.length,r=0;r<n;r+=1){var i=e.fields[r],a=F[i.type];A.argument(a!==void 0,`No sizeOf function for field type `+i.type+` (`+i.name+`)`);var o=e[i.name];o===void 0&&(o=i.value),t+=a(o),i.type===`TABLE`&&(t+=2)}return t},P.RECORD=P.TABLE,F.RECORD=F.TABLE,P.LITERAL=function(e){return e},F.LITERAL=function(e){return e.length};function ue(e,t,n){for(var r=this,i=0;i<t.length;i+=1){var a=t[i];r[a.name]=a.value}if(this.tableName=e,this.fields=t,n)for(var o=Object.keys(n),s=0;s<o.length;s+=1){var c=o[s],l=n[c];r[c]!==void 0&&(r[c]=l)}}ue.prototype.encode=function(){return P.TABLE(this)},ue.prototype.sizeOf=function(){return F.TABLE(this)};function de(e,t,n){n===void 0&&(n=t.length);var r=Array(t.length+1);r[0]={name:e+`Count`,type:`USHORT`,value:n};for(var i=0;i<t.length;i++)r[i+1]={name:e+i,type:`USHORT`,value:t[i]};return r}function fe(e,t,n){var r=t.length,i=Array(r+1);i[0]={name:e+`Count`,type:`USHORT`,value:r};for(var a=0;a<r;a++)i[a+1]={name:e+a,type:`TABLE`,value:n(t[a],a)};return i}function pe(e,t,n){var r=t.length,i=[];i[0]={name:e+`Count`,type:`USHORT`,value:r};for(var a=0;a<r;a++)i=i.concat(n(t[a],a));return i}function me(e){e.format===1?ue.call(this,`coverageTable`,[{name:`coverageFormat`,type:`USHORT`,value:1}].concat(de(`glyph`,e.glyphs))):A.assert(!1,`Can't create coverage table format 2 yet.`)}me.prototype=Object.create(ue.prototype),me.prototype.constructor=me;function he(e){ue.call(this,`scriptListTable`,pe(`scriptRecord`,e,function(e,t){var n=e.script,r=n.defaultLangSys;return A.assert(!!r,`Unable to write GSUB: script `+e.tag+` has no default language system.`),[{name:`scriptTag`+t,type:`TAG`,value:e.tag},{name:`script`+t,type:`TABLE`,value:new ue(`scriptTable`,[{name:`defaultLangSys`,type:`TABLE`,value:new ue(`defaultLangSys`,[{name:`lookupOrder`,type:`USHORT`,value:0},{name:`reqFeatureIndex`,type:`USHORT`,value:r.reqFeatureIndex}].concat(de(`featureIndex`,r.featureIndexes)))}].concat(pe(`langSys`,n.langSysRecords,function(e,t){var n=e.langSys;return[{name:`langSysTag`+t,type:`TAG`,value:e.tag},{name:`langSys`+t,type:`TABLE`,value:new ue(`langSys`,[{name:`lookupOrder`,type:`USHORT`,value:0},{name:`reqFeatureIndex`,type:`USHORT`,value:n.reqFeatureIndex}].concat(de(`featureIndex`,n.featureIndexes)))}]})))}]}))}he.prototype=Object.create(ue.prototype),he.prototype.constructor=he;function ge(e){ue.call(this,`featureListTable`,pe(`featureRecord`,e,function(e,t){var n=e.feature;return[{name:`featureTag`+t,type:`TAG`,value:e.tag},{name:`feature`+t,type:`TABLE`,value:new ue(`featureTable`,[{name:`featureParams`,type:`USHORT`,value:n.featureParams}].concat(de(`lookupListIndex`,n.lookupListIndexes)))}]}))}ge.prototype=Object.create(ue.prototype),ge.prototype.constructor=ge;function _e(e,t){ue.call(this,`lookupListTable`,fe(`lookup`,e,function(e){var n=t[e.lookupType];return A.assert(!!n,`Unable to write GSUB lookup type `+e.lookupType+` tables.`),new ue(`lookupTable`,[{name:`lookupType`,type:`USHORT`,value:e.lookupType},{name:`lookupFlag`,type:`USHORT`,value:e.lookupFlag}].concat(fe(`subtable`,e.subtables,n)))}))}_e.prototype=Object.create(ue.prototype),_e.prototype.constructor=_e;var L={Table:ue,Record:ue,Coverage:me,ScriptList:he,FeatureList:ge,LookupList:_e,ushortList:de,tableList:fe,recordList:pe};function ve(e,t){return e.getUint8(t)}function ye(e,t){return e.getUint16(t,!1)}function be(e,t){return e.getInt16(t,!1)}function xe(e,t){return e.getUint32(t,!1)}function Se(e,t){return e.getInt16(t,!1)+e.getUint16(t+2,!1)/65535}function Ce(e,t){for(var n=``,r=t;r<t+4;r+=1)n+=String.fromCharCode(e.getInt8(r));return n}function we(e,t,n){for(var r=0,i=0;i<n;i+=1)r<<=8,r+=e.getUint8(t+i);return r}function Te(e,t,n){for(var r=[],i=t;i<n;i+=1)r.push(e.getUint8(i));return r}function Ee(e){for(var t=``,n=0;n<e.length;n+=1)t+=String.fromCharCode(e[n]);return t}var De={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function R(e,t){this.data=e,this.offset=t,this.relativeOffset=0}R.prototype.parseByte=function(){var e=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},R.prototype.parseChar=function(){var e=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},R.prototype.parseCard8=R.prototype.parseByte,R.prototype.parseUShort=function(){var e=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},R.prototype.parseCard16=R.prototype.parseUShort,R.prototype.parseSID=R.prototype.parseUShort,R.prototype.parseOffset16=R.prototype.parseUShort,R.prototype.parseShort=function(){var e=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},R.prototype.parseF2Dot14=function(){var e=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,e},R.prototype.parseULong=function(){var e=xe(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},R.prototype.parseOffset32=R.prototype.parseULong,R.prototype.parseFixed=function(){var e=Se(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},R.prototype.parseString=function(e){var t=this.data,n=this.offset+this.relativeOffset,r=``;this.relativeOffset+=e;for(var i=0;i<e;i++)r+=String.fromCharCode(t.getUint8(n+i));return r},R.prototype.parseTag=function(){return this.parseString(4)},R.prototype.parseLongDateTime=function(){var e=xe(this.data,this.offset+this.relativeOffset+4);return e-=2082844800,this.relativeOffset+=8,e},R.prototype.parseVersion=function(e){var t=ye(this.data,this.offset+this.relativeOffset),n=ye(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,e===void 0&&(e=4096),t+n/e/10},R.prototype.skip=function(e,t){t===void 0&&(t=1),this.relativeOffset+=De[e]*t},R.prototype.parseULongList=function(e){e===void 0&&(e=this.parseULong());for(var t=Array(e),n=this.data,r=this.offset+this.relativeOffset,i=0;i<e;i++)t[i]=n.getUint32(r),r+=4;return this.relativeOffset+=e*4,t},R.prototype.parseOffset16List=R.prototype.parseUShortList=function(e){e===void 0&&(e=this.parseUShort());for(var t=Array(e),n=this.data,r=this.offset+this.relativeOffset,i=0;i<e;i++)t[i]=n.getUint16(r),r+=2;return this.relativeOffset+=e*2,t},R.prototype.parseShortList=function(e){for(var t=Array(e),n=this.data,r=this.offset+this.relativeOffset,i=0;i<e;i++)t[i]=n.getInt16(r),r+=2;return this.relativeOffset+=e*2,t},R.prototype.parseByteList=function(e){for(var t=Array(e),n=this.data,r=this.offset+this.relativeOffset,i=0;i<e;i++)t[i]=n.getUint8(r++);return this.relativeOffset+=e,t},R.prototype.parseList=function(e,t){var n=this;t||(t=e,e=this.parseUShort());for(var r=Array(e),i=0;i<e;i++)r[i]=t.call(n);return r},R.prototype.parseList32=function(e,t){var n=this;t||(t=e,e=this.parseULong());for(var r=Array(e),i=0;i<e;i++)r[i]=t.call(n);return r},R.prototype.parseRecordList=function(e,t){var n=this;t||(t=e,e=this.parseUShort());for(var r=Array(e),i=Object.keys(t),a=0;a<e;a++){for(var o={},s=0;s<i.length;s++){var c=i[s];o[c]=t[c].call(n)}r[a]=o}return r},R.prototype.parseRecordList32=function(e,t){var n=this;t||(t=e,e=this.parseULong());for(var r=Array(e),i=Object.keys(t),a=0;a<e;a++){for(var o={},s=0;s<i.length;s++){var c=i[s];o[c]=t[c].call(n)}r[a]=o}return r},R.prototype.parseStruct=function(e){var t=this;if(typeof e==`function`)return e.call(this);for(var n=Object.keys(e),r={},i=0;i<n.length;i++){var a=n[i];r[a]=e[a].call(t)}return r},R.prototype.parseValueRecord=function(e){if(e===void 0&&(e=this.parseUShort()),e!==0){var t={};return e&1&&(t.xPlacement=this.parseShort()),e&2&&(t.yPlacement=this.parseShort()),e&4&&(t.xAdvance=this.parseShort()),e&8&&(t.yAdvance=this.parseShort()),e&16&&(t.xPlaDevice=void 0,this.parseShort()),e&32&&(t.yPlaDevice=void 0,this.parseShort()),e&64&&(t.xAdvDevice=void 0,this.parseShort()),e&128&&(t.yAdvDevice=void 0,this.parseShort()),t}},R.prototype.parseValueRecordList=function(){for(var e=this,t=this.parseUShort(),n=this.parseUShort(),r=Array(n),i=0;i<n;i++)r[i]=e.parseValueRecord(t);return r},R.prototype.parsePointer=function(e){var t=this.parseOffset16();if(t>0)return new R(this.data,this.offset+t).parseStruct(e)},R.prototype.parsePointer32=function(e){var t=this.parseOffset32();if(t>0)return new R(this.data,this.offset+t).parseStruct(e)},R.prototype.parseListOfLists=function(e){for(var t=this,n=this.parseOffset16List(),r=n.length,i=this.relativeOffset,a=Array(r),o=0;o<r;o++){var s=n[o];if(s===0){a[o]=void 0;continue}if(t.relativeOffset=s,e){for(var c=t.parseOffset16List(),l=Array(c.length),u=0;u<c.length;u++)t.relativeOffset=s+c[u],l[u]=e.call(t);a[o]=l}else a[o]=t.parseUShortList()}return this.relativeOffset=i,a},R.prototype.parseCoverage=function(){var e=this,t=this.offset+this.relativeOffset,n=this.parseUShort(),r=this.parseUShort();if(n===1)return{format:1,glyphs:this.parseUShortList(r)};if(n===2){for(var i=Array(r),a=0;a<r;a++)i[a]={start:e.parseUShort(),end:e.parseUShort(),index:e.parseUShort()};return{format:2,ranges:i}}throw Error(`0x`+t.toString(16)+`: Coverage format must be 1 or 2.`)},R.prototype.parseClassDef=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(t===2)return{format:2,ranges:this.parseRecordList({start:R.uShort,end:R.uShort,classId:R.uShort})};throw Error(`0x`+e.toString(16)+`: ClassDef format must be 1 or 2.`)},R.list=function(e,t){return function(){return this.parseList(e,t)}},R.list32=function(e,t){return function(){return this.parseList32(e,t)}},R.recordList=function(e,t){return function(){return this.parseRecordList(e,t)}},R.recordList32=function(e,t){return function(){return this.parseRecordList32(e,t)}},R.pointer=function(e){return function(){return this.parsePointer(e)}},R.pointer32=function(e){return function(){return this.parsePointer32(e)}},R.tag=R.prototype.parseTag,R.byte=R.prototype.parseByte,R.uShort=R.offset16=R.prototype.parseUShort,R.uShortList=R.prototype.parseUShortList,R.uLong=R.offset32=R.prototype.parseULong,R.uLongList=R.prototype.parseULongList,R.struct=R.prototype.parseStruct,R.coverage=R.prototype.parseCoverage,R.classDef=R.prototype.parseClassDef;var Oe={reserved:R.uShort,reqFeatureIndex:R.uShort,featureIndexes:R.uShortList};R.prototype.parseScriptList=function(){return this.parsePointer(R.recordList({tag:R.tag,script:R.pointer({defaultLangSys:R.pointer(Oe),langSysRecords:R.recordList({tag:R.tag,langSys:R.pointer(Oe)})})}))||[]},R.prototype.parseFeatureList=function(){return this.parsePointer(R.recordList({tag:R.tag,feature:R.pointer({featureParams:R.offset16,lookupListIndexes:R.uShortList})}))||[]},R.prototype.parseLookupList=function(e){return this.parsePointer(R.list(R.pointer(function(){var t=this.parseUShort();A.argument(1<=t&&t<=9,`GPOS/GSUB lookup type `+t+` unknown.`);var n=this.parseUShort(),r=n&16;return{lookupType:t,lookupFlag:n,subtables:this.parseList(R.pointer(e[t])),markFilteringSet:r?this.parseUShort():void 0}})))||[]},R.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){var e=this.parseUShort(),t=this.parseUShort();return A.argument(e===1&&t<1,`GPOS/GSUB feature variations table unknown.`),this.parseRecordList32({conditionSetOffset:R.offset32,featureTableSubstitutionOffset:R.offset32})})||[]};var z={getByte:ve,getCard8:ve,getUShort:ye,getCard16:ye,getShort:be,getULong:xe,getFixed:Se,getTag:Ce,getOffset:we,getBytes:Te,bytesToString:Ee,Parser:R};function ke(e,t){t.parseUShort(),e.length=t.parseULong(),e.language=t.parseULong();var n;e.groupCount=n=t.parseULong(),e.glyphIndexMap={};for(var r=0;r<n;r+=1)for(var i=t.parseULong(),a=t.parseULong(),o=t.parseULong(),s=i;s<=a;s+=1)e.glyphIndexMap[s]=o,o++}function Ae(e,t,n,r,i){e.length=t.parseUShort(),e.language=t.parseUShort();var a;e.segCount=a=t.parseUShort()>>1,t.skip(`uShort`,3),e.glyphIndexMap={};for(var o=new z.Parser(n,r+i+14),s=new z.Parser(n,r+i+16+a*2),c=new z.Parser(n,r+i+16+a*4),l=new z.Parser(n,r+i+16+a*6),u=r+i+16+a*8,d=0;d<a-1;d+=1)for(var f=void 0,p=o.parseUShort(),m=s.parseUShort(),h=c.parseShort(),g=l.parseUShort(),_=m;_<=p;_+=1)g===0?f=_+h&65535:(u=l.offset+l.relativeOffset-2,u+=g,u+=(_-m)*2,f=z.getUShort(n,u),f!==0&&(f=f+h&65535)),e.glyphIndexMap[_]=f}function je(e,t){var n={};n.version=z.getUShort(e,t),A.argument(n.version===0,`cmap table version should be 0.`),n.numTables=z.getUShort(e,t+2);for(var r=-1,i=n.numTables-1;i>=0;--i){var a=z.getUShort(e,t+4+i*8),o=z.getUShort(e,t+4+i*8+2);if(a===3&&(o===0||o===1||o===10)){r=z.getULong(e,t+4+i*8+4);break}}if(r===-1)throw Error(`No valid cmap sub-tables found.`);var s=new z.Parser(e,t+r);if(n.format=s.parseUShort(),n.format===12)ke(n,s);else if(n.format===4)Ae(n,s,e,t,r);else throw Error(`Only format 4 and 12 cmap tables are supported (found format `+n.format+`).`);return n}function Me(e,t,n){e.segments.push({end:t,start:t,delta:-(t-n),offset:0,glyphIndex:n})}function Ne(e){e.segments.push({end:65535,start:65535,delta:1,offset:0})}function Pe(e){var t=!0,n;for(n=e.length-1;n>0;--n)if(e.get(n).unicode>65535){console.log(`Adding CMAP format 12 (needed!)`),t=!1;break}var r=[{name:`version`,type:`USHORT`,value:0},{name:`numTables`,type:`USHORT`,value:t?1:2},{name:`platformID`,type:`USHORT`,value:3},{name:`encodingID`,type:`USHORT`,value:1},{name:`offset`,type:`ULONG`,value:t?12:20}];t||(r=r.concat([{name:`cmap12PlatformID`,type:`USHORT`,value:3},{name:`cmap12EncodingID`,type:`USHORT`,value:10},{name:`cmap12Offset`,type:`ULONG`,value:0}])),r=r.concat([{name:`format`,type:`USHORT`,value:4},{name:`cmap4Length`,type:`USHORT`,value:0},{name:`language`,type:`USHORT`,value:0},{name:`segCountX2`,type:`USHORT`,value:0},{name:`searchRange`,type:`USHORT`,value:0},{name:`entrySelector`,type:`USHORT`,value:0},{name:`rangeShift`,type:`USHORT`,value:0}]);var i=new L.Table(`cmap`,r);for(i.segments=[],n=0;n<e.length;n+=1){for(var a=e.get(n),o=0;o<a.unicodes.length;o+=1)Me(i,a.unicodes[o],n);i.segments=i.segments.sort(function(e,t){return e.start-t.start})}Ne(i);var s=i.segments.length,c=0,l=[],u=[],d=[],f=[],p=[],m=[];for(n=0;n<s;n+=1){var h=i.segments[n];h.end<=65535&&h.start<=65535?(l=l.concat({name:`end_`+n,type:`USHORT`,value:h.end}),u=u.concat({name:`start_`+n,type:`USHORT`,value:h.start}),d=d.concat({name:`idDelta_`+n,type:`SHORT`,value:h.delta}),f=f.concat({name:`idRangeOffset_`+n,type:`USHORT`,value:h.offset}),h.glyphId!==void 0&&(p=p.concat({name:`glyph_`+n,type:`USHORT`,value:h.glyphId}))):c+=1,!t&&h.glyphIndex!==void 0&&(m=m.concat({name:`cmap12Start_`+n,type:`ULONG`,value:h.start}),m=m.concat({name:`cmap12End_`+n,type:`ULONG`,value:h.end}),m=m.concat({name:`cmap12Glyph_`+n,type:`ULONG`,value:h.glyphIndex}))}if(i.segCountX2=(s-c)*2,i.searchRange=2**Math.floor(Math.log(s-c)/Math.log(2))*2,i.entrySelector=Math.log(i.searchRange/2)/Math.log(2),i.rangeShift=i.segCountX2-i.searchRange,i.fields=i.fields.concat(l),i.fields.push({name:`reservedPad`,type:`USHORT`,value:0}),i.fields=i.fields.concat(u),i.fields=i.fields.concat(d),i.fields=i.fields.concat(f),i.fields=i.fields.concat(p),i.cmap4Length=14+l.length*2+2+u.length*2+d.length*2+f.length*2+p.length*2,!t){var g=16+m.length*4;i.cmap12Offset=20+i.cmap4Length,i.fields=i.fields.concat([{name:`cmap12Format`,type:`USHORT`,value:12},{name:`cmap12Reserved`,type:`USHORT`,value:0},{name:`cmap12Length`,type:`ULONG`,value:g},{name:`cmap12Language`,type:`ULONG`,value:0},{name:`cmap12nGroups`,type:`ULONG`,value:m.length/3}]),i.fields=i.fields.concat(m)}return i}var Fe={parse:je,make:Pe},Ie=`.notdef,space,exclam,quotedbl,numbersign,dollar,percent,ampersand,quoteright,parenleft,parenright,asterisk,plus,comma,hyphen,period,slash,zero,one,two,three,four,five,six,seven,eight,nine,colon,semicolon,less,equal,greater,question,at,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,bracketleft,backslash,bracketright,asciicircum,underscore,quoteleft,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,braceleft,bar,braceright,asciitilde,exclamdown,cent,sterling,fraction,yen,florin,section,currency,quotesingle,quotedblleft,guillemotleft,guilsinglleft,guilsinglright,fi,fl,endash,dagger,daggerdbl,periodcentered,paragraph,bullet,quotesinglbase,quotedblbase,quotedblright,guillemotright,ellipsis,perthousand,questiondown,grave,acute,circumflex,tilde,macron,breve,dotaccent,dieresis,ring,cedilla,hungarumlaut,ogonek,caron,emdash,AE,ordfeminine,Lslash,Oslash,OE,ordmasculine,ae,dotlessi,lslash,oslash,oe,germandbls,onesuperior,logicalnot,mu,trademark,Eth,onehalf,plusminus,Thorn,onequarter,divide,brokenbar,degree,thorn,threequarters,twosuperior,registered,minus,eth,multiply,threesuperior,copyright,Aacute,Acircumflex,Adieresis,Agrave,Aring,Atilde,Ccedilla,Eacute,Ecircumflex,Edieresis,Egrave,Iacute,Icircumflex,Idieresis,Igrave,Ntilde,Oacute,Ocircumflex,Odieresis,Ograve,Otilde,Scaron,Uacute,Ucircumflex,Udieresis,Ugrave,Yacute,Ydieresis,Zcaron,aacute,acircumflex,adieresis,agrave,aring,atilde,ccedilla,eacute,ecircumflex,edieresis,egrave,iacute,icircumflex,idieresis,igrave,ntilde,oacute,ocircumflex,odieresis,ograve,otilde,scaron,uacute,ucircumflex,udieresis,ugrave,yacute,ydieresis,zcaron,exclamsmall,Hungarumlautsmall,dollaroldstyle,dollarsuperior,ampersandsmall,Acutesmall,parenleftsuperior,parenrightsuperior,266 ff,onedotenleader,zerooldstyle,oneoldstyle,twooldstyle,threeoldstyle,fouroldstyle,fiveoldstyle,sixoldstyle,sevenoldstyle,eightoldstyle,nineoldstyle,commasuperior,threequartersemdash,periodsuperior,questionsmall,asuperior,bsuperior,centsuperior,dsuperior,esuperior,isuperior,lsuperior,msuperior,nsuperior,osuperior,rsuperior,ssuperior,tsuperior,ff,ffi,ffl,parenleftinferior,parenrightinferior,Circumflexsmall,hyphensuperior,Gravesmall,Asmall,Bsmall,Csmall,Dsmall,Esmall,Fsmall,Gsmall,Hsmall,Ismall,Jsmall,Ksmall,Lsmall,Msmall,Nsmall,Osmall,Psmall,Qsmall,Rsmall,Ssmall,Tsmall,Usmall,Vsmall,Wsmall,Xsmall,Ysmall,Zsmall,colonmonetary,onefitted,rupiah,Tildesmall,exclamdownsmall,centoldstyle,Lslashsmall,Scaronsmall,Zcaronsmall,Dieresissmall,Brevesmall,Caronsmall,Dotaccentsmall,Macronsmall,figuredash,hypheninferior,Ogoneksmall,Ringsmall,Cedillasmall,questiondownsmall,oneeighth,threeeighths,fiveeighths,seveneighths,onethird,twothirds,zerosuperior,foursuperior,fivesuperior,sixsuperior,sevensuperior,eightsuperior,ninesuperior,zeroinferior,oneinferior,twoinferior,threeinferior,fourinferior,fiveinferior,sixinferior,seveninferior,eightinferior,nineinferior,centinferior,dollarinferior,periodinferior,commainferior,Agravesmall,Aacutesmall,Acircumflexsmall,Atildesmall,Adieresissmall,Aringsmall,AEsmall,Ccedillasmall,Egravesmall,Eacutesmall,Ecircumflexsmall,Edieresissmall,Igravesmall,Iacutesmall,Icircumflexsmall,Idieresissmall,Ethsmall,Ntildesmall,Ogravesmall,Oacutesmall,Ocircumflexsmall,Otildesmall,Odieresissmall,OEsmall,Oslashsmall,Ugravesmall,Uacutesmall,Ucircumflexsmall,Udieresissmall,Yacutesmall,Thornsmall,Ydieresissmall,001.000,001.001,001.002,001.003,Black,Bold,Book,Light,Medium,Regular,Roman,Semibold`.split(`,`),Le=`................................space.exclam.quotedbl.numbersign.dollar.percent.ampersand.quoteright.parenleft.parenright.asterisk.plus.comma.hyphen.period.slash.zero.one.two.three.four.five.six.seven.eight.nine.colon.semicolon.less.equal.greater.question.at.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.bracketleft.backslash.bracketright.asciicircum.underscore.quoteleft.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.braceleft.bar.braceright.asciitilde...................................exclamdown.cent.sterling.fraction.yen.florin.section.currency.quotesingle.quotedblleft.guillemotleft.guilsinglleft.guilsinglright.fi.fl..endash.dagger.daggerdbl.periodcentered..paragraph.bullet.quotesinglbase.quotedblbase.quotedblright.guillemotright.ellipsis.perthousand..questiondown..grave.acute.circumflex.tilde.macron.breve.dotaccent.dieresis..ring.cedilla..hungarumlaut.ogonek.caron.emdash.................AE..ordfeminine.....Lslash.Oslash.OE.ordmasculine......ae....dotlessi...lslash.oslash.oe.germandbls`.split(`.`),Re=`................................space.exclamsmall.Hungarumlautsmall..dollaroldstyle.dollarsuperior.ampersandsmall.Acutesmall.parenleftsuperior.parenrightsuperior.twodotenleader.onedotenleader.comma.hyphen.period.fraction.zerooldstyle.oneoldstyle.twooldstyle.threeoldstyle.fouroldstyle.fiveoldstyle.sixoldstyle.sevenoldstyle.eightoldstyle.nineoldstyle.colon.semicolon.commasuperior.threequartersemdash.periodsuperior.questionsmall..asuperior.bsuperior.centsuperior.dsuperior.esuperior...isuperior...lsuperior.msuperior.nsuperior.osuperior...rsuperior.ssuperior.tsuperior..ff.fi.fl.ffi.ffl.parenleftinferior..parenrightinferior.Circumflexsmall.hyphensuperior.Gravesmall.Asmall.Bsmall.Csmall.Dsmall.Esmall.Fsmall.Gsmall.Hsmall.Ismall.Jsmall.Ksmall.Lsmall.Msmall.Nsmall.Osmall.Psmall.Qsmall.Rsmall.Ssmall.Tsmall.Usmall.Vsmall.Wsmall.Xsmall.Ysmall.Zsmall.colonmonetary.onefitted.rupiah.Tildesmall...................................exclamdownsmall.centoldstyle.Lslashsmall...Scaronsmall.Zcaronsmall.Dieresissmall.Brevesmall.Caronsmall..Dotaccentsmall...Macronsmall...figuredash.hypheninferior...Ogoneksmall.Ringsmall.Cedillasmall....onequarter.onehalf.threequarters.questiondownsmall.oneeighth.threeeighths.fiveeighths.seveneighths.onethird.twothirds...zerosuperior.onesuperior.twosuperior.threesuperior.foursuperior.fivesuperior.sixsuperior.sevensuperior.eightsuperior.ninesuperior.zeroinferior.oneinferior.twoinferior.threeinferior.fourinferior.fiveinferior.sixinferior.seveninferior.eightinferior.nineinferior.centinferior.dollarinferior.periodinferior.commainferior.Agravesmall.Aacutesmall.Acircumflexsmall.Atildesmall.Adieresissmall.Aringsmall.AEsmall.Ccedillasmall.Egravesmall.Eacutesmall.Ecircumflexsmall.Edieresissmall.Igravesmall.Iacutesmall.Icircumflexsmall.Idieresissmall.Ethsmall.Ntildesmall.Ogravesmall.Oacutesmall.Ocircumflexsmall.Otildesmall.Odieresissmall.OEsmall.Oslashsmall.Ugravesmall.Uacutesmall.Ucircumflexsmall.Udieresissmall.Yacutesmall.Thornsmall.Ydieresissmall`.split(`.`),ze=`.notdef,.null,nonmarkingreturn,space,exclam,quotedbl,numbersign,dollar,percent,ampersand,quotesingle,parenleft,parenright,asterisk,plus,comma,hyphen,period,slash,zero,one,two,three,four,five,six,seven,eight,nine,colon,semicolon,less,equal,greater,question,at,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,bracketleft,backslash,bracketright,asciicircum,underscore,grave,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,braceleft,bar,braceright,asciitilde,Adieresis,Aring,Ccedilla,Eacute,Ntilde,Odieresis,Udieresis,aacute,agrave,acircumflex,adieresis,atilde,aring,ccedilla,eacute,egrave,ecircumflex,edieresis,iacute,igrave,icircumflex,idieresis,ntilde,oacute,ograve,ocircumflex,odieresis,otilde,uacute,ugrave,ucircumflex,udieresis,dagger,degree,cent,sterling,section,bullet,paragraph,germandbls,registered,copyright,trademark,acute,dieresis,notequal,AE,Oslash,infinity,plusminus,lessequal,greaterequal,yen,mu,partialdiff,summation,product,pi,integral,ordfeminine,ordmasculine,Omega,ae,oslash,questiondown,exclamdown,logicalnot,radical,florin,approxequal,Delta,guillemotleft,guillemotright,ellipsis,nonbreakingspace,Agrave,Atilde,Otilde,OE,oe,endash,emdash,quotedblleft,quotedblright,quoteleft,quoteright,divide,lozenge,ydieresis,Ydieresis,fraction,currency,guilsinglleft,guilsinglright,fi,fl,daggerdbl,periodcentered,quotesinglbase,quotedblbase,perthousand,Acircumflex,Ecircumflex,Aacute,Edieresis,Egrave,Iacute,Icircumflex,Idieresis,Igrave,Oacute,Ocircumflex,apple,Ograve,Uacute,Ucircumflex,Ugrave,dotlessi,circumflex,tilde,macron,breve,dotaccent,ring,cedilla,hungarumlaut,ogonek,caron,Lslash,lslash,Scaron,scaron,Zcaron,zcaron,brokenbar,Eth,eth,Yacute,yacute,Thorn,thorn,minus,multiply,onesuperior,twosuperior,threesuperior,onehalf,onequarter,threequarters,franc,Gbreve,gbreve,Idotaccent,Scedilla,scedilla,Cacute,cacute,Ccaron,ccaron,dcroat`.split(`,`);function Be(e){this.font=e}Be.prototype.charToGlyphIndex=function(e){var t=e.charCodeAt(0),n=this.font.glyphs;if(n){for(var r=0;r<n.length;r+=1)for(var i=n.get(r),a=0;a<i.unicodes.length;a+=1)if(i.unicodes[a]===t)return r}return null};function Ve(e){this.cmap=e}Ve.prototype.charToGlyphIndex=function(e){return this.cmap.glyphIndexMap[e.charCodeAt(0)]||0};function He(e,t){this.encoding=e,this.charset=t}He.prototype.charToGlyphIndex=function(e){var t=e.charCodeAt(0),n=this.encoding[t];return this.charset.indexOf(n)};function Ue(e){var t=this;switch(e.version){case 1:this.names=ze.slice();break;case 2:this.names=Array(e.numberOfGlyphs);for(var n=0;n<e.numberOfGlyphs;n++)e.glyphNameIndex[n]<ze.length?t.names[n]=ze[e.glyphNameIndex[n]]:t.names[n]=e.names[e.glyphNameIndex[n]-ze.length];break;case 2.5:this.names=Array(e.numberOfGlyphs);for(var r=0;r<e.numberOfGlyphs;r++)t.names[r]=ze[r+e.glyphNameIndex[r]];break;case 3:this.names=[];break;default:this.names=[];break}}Ue.prototype.nameToGlyphIndex=function(e){return this.names.indexOf(e)},Ue.prototype.glyphIndexToName=function(e){return this.names[e]};function We(e){for(var t,n=e.tables.cmap.glyphIndexMap,r=Object.keys(n),i=0;i<r.length;i+=1){var a=r[i],o=n[a];t=e.glyphs.get(o),t.addUnicode(parseInt(a))}for(var s=0;s<e.glyphs.length;s+=1)t=e.glyphs.get(s),e.cffEncoding?e.isCIDFont?t.name=`gid`+s:t.name=e.cffEncoding.charset[s]:e.glyphNames.names&&(t.name=e.glyphNames.glyphIndexToName(s))}function Ge(e,t,n,r,i){e.beginPath(),e.moveTo(t,n),e.lineTo(r,i),e.stroke()}var B={line:Ge};function Ke(e,t,n,r,i){var a;return(t&r)>0?(a=e.parseByte(),(t&i)===0&&(a=-a),a=n+a):a=(t&i)>0?n:n+e.parseShort(),a}function qe(e,t,n){var r=new z.Parser(t,n);e.numberOfContours=r.parseShort(),e._xMin=r.parseShort(),e._yMin=r.parseShort(),e._xMax=r.parseShort(),e._yMax=r.parseShort();var i,a;if(e.numberOfContours>0){for(var o=e.endPointIndices=[],s=0;s<e.numberOfContours;s+=1)o.push(r.parseUShort());e.instructionLength=r.parseUShort(),e.instructions=[];for(var c=0;c<e.instructionLength;c+=1)e.instructions.push(r.parseByte());var l=o[o.length-1]+1;i=[];for(var u=0;u<l;u+=1)if(a=r.parseByte(),i.push(a),(a&8)>0)for(var d=r.parseByte(),f=0;f<d;f+=1)i.push(a),u+=1;if(A.argument(i.length===l,`Bad flags.`),o.length>0){var p=[],m;if(l>0){for(var h=0;h<l;h+=1)a=i[h],m={},m.onCurve=!!(a&1),m.lastPointOfContour=o.indexOf(h)>=0,p.push(m);for(var g=0,_=0;_<l;_+=1)a=i[_],m=p[_],m.x=Ke(r,a,g,2,16),g=m.x;for(var v=0,y=0;y<l;y+=1)a=i[y],m=p[y],m.y=Ke(r,a,v,4,32),v=m.y}e.points=p}else e.points=[]}else if(e.numberOfContours===0)e.points=[];else{e.isComposite=!0,e.points=[],e.components=[];for(var b=!0;b;){i=r.parseUShort();var x={glyphIndex:r.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(i&1)>0?(i&2)>0?(x.dx=r.parseShort(),x.dy=r.parseShort()):x.matchedPoints=[r.parseUShort(),r.parseUShort()]:(i&2)>0?(x.dx=r.parseChar(),x.dy=r.parseChar()):x.matchedPoints=[r.parseByte(),r.parseByte()],(i&8)>0?x.xScale=x.yScale=r.parseF2Dot14():(i&64)>0?(x.xScale=r.parseF2Dot14(),x.yScale=r.parseF2Dot14()):(i&128)>0&&(x.xScale=r.parseF2Dot14(),x.scale01=r.parseF2Dot14(),x.scale10=r.parseF2Dot14(),x.yScale=r.parseF2Dot14()),e.components.push(x),b=!!(i&32)}if(i&256){e.instructionLength=r.parseUShort(),e.instructions=[];for(var S=0;S<e.instructionLength;S+=1)e.instructions.push(r.parseByte())}}}function V(e,t){for(var n=[],r=0;r<e.length;r+=1){var i=e[r],a={x:t.xScale*i.x+t.scale01*i.y+t.dx,y:t.scale10*i.x+t.yScale*i.y+t.dy,onCurve:i.onCurve,lastPointOfContour:i.lastPointOfContour};n.push(a)}return n}function Je(e){for(var t=[],n=[],r=0;r<e.length;r+=1){var i=e[r];n.push(i),i.lastPointOfContour&&(t.push(n),n=[])}return A.argument(n.length===0,`There are still points left in the current contour.`),t}function Ye(e){var t=new D;if(!e)return t;for(var n=Je(e),r=0;r<n.length;++r){var i=n[r],a=null,o=i[i.length-1],s=i[0];if(o.onCurve)t.moveTo(o.x,o.y);else if(s.onCurve)t.moveTo(s.x,s.y);else{var c={x:(o.x+s.x)*.5,y:(o.y+s.y)*.5};t.moveTo(c.x,c.y)}for(var l=0;l<i.length;++l)if(a=o,o=s,s=i[(l+1)%i.length],o.onCurve)t.lineTo(o.x,o.y);else{var u=a,d=s;a.onCurve||(u={x:(o.x+a.x)*.5,y:(o.y+a.y)*.5},t.lineTo(u.x,u.y)),s.onCurve||(d={x:(o.x+s.x)*.5,y:(o.y+s.y)*.5}),t.lineTo(u.x,u.y),t.quadraticCurveTo(o.x,o.y,d.x,d.y)}t.closePath()}return t}function Xe(e,t){if(t.isComposite)for(var n=0;n<t.components.length;n+=1){var r=t.components[n],i=e.get(r.glyphIndex);if(i.getPath(),i.points){var a=void 0;if(r.matchedPoints===void 0)a=V(i.points,r);else{if(r.matchedPoints[0]>t.points.length-1||r.matchedPoints[1]>i.points.length-1)throw Error(`Matched points out of range in `+t.name);var o=t.points[r.matchedPoints[0]],s=i.points[r.matchedPoints[1]],c={xScale:r.xScale,scale01:r.scale01,scale10:r.scale10,yScale:r.yScale,dx:0,dy:0};s=V([s],c)[0],c.dx=o.x-s.x,c.dy=o.y-s.y,a=V(i.points,c)}t.points=t.points.concat(a)}}return Ye(t.points)}function Ze(e,t,n,r){for(var i=new ot.GlyphSet(r),a=0;a<n.length-1;a+=1){var o=n[a];o===n[a+1]?i.push(a,ot.glyphLoader(r,a)):i.push(a,ot.ttfGlyphLoader(r,a,qe,e,t+o,Xe))}return i}var Qe={getPath:Ye,parse:Ze};function $e(e,t){var n=t||new D;return{configurable:!0,get:function(){return typeof n==`function`&&(n=n()),n},set:function(e){n=e}}}function et(e){this.bindConstructorValues(e)}et.prototype.bindConstructorValues=function(e){this.index=e.index||0,this.name=e.name||null,this.unicode=e.unicode||void 0,this.unicodes=e.unicodes||e.unicode!==void 0?[e.unicode]:[],e.xMin&&(this.xMin=e.xMin),e.yMin&&(this.yMin=e.yMin),e.xMax&&(this.xMax=e.xMax),e.yMax&&(this.yMax=e.yMax),e.advanceWidth&&(this.advanceWidth=e.advanceWidth),Object.defineProperty(this,"path",$e(this,e.path))},et.prototype.addUnicode=function(e){this.unicodes.length===0&&(this.unicode=e),this.unicodes.push(e)},et.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},et.prototype.getPath=function(e,t,n,r,i){e=e===void 0?0:e,t=t===void 0?0:t,n=n===void 0?72:n;var a,o;r||={};var s=r.xScale,c=r.yScale;if(r.hinting&&i&&i.hinting&&(o=this.path&&i.hinting.exec(this,n)),o)a=Qe.getPath(o).commands,e=Math.round(e),t=Math.round(t),s=c=1;else{a=this.path.commands;var l=1/this.path.unitsPerEm*n;s===void 0&&(s=l),c===void 0&&(c=l)}for(var u=new D,d=0;d<a.length;d+=1){var f=a[d];f.type===`M`?u.moveTo(e+f.x*s,t+-f.y*c):f.type===`L`?u.lineTo(e+f.x*s,t+-f.y*c):f.type===`Q`?u.quadraticCurveTo(e+f.x1*s,t+-f.y1*c,e+f.x*s,t+-f.y*c):f.type===`C`?u.curveTo(e+f.x1*s,t+-f.y1*c,e+f.x2*s,t+-f.y2*c,e+f.x*s,t+-f.y*c):f.type===`Z`&&u.closePath()}return u},et.prototype.getContours=function(){var e=this;if(this.points===void 0)return[];for(var t=[],n=[],r=0;r<this.points.length;r+=1){var i=e.points[r];n.push(i),i.lastPointOfContour&&(t.push(n),n=[])}return A.argument(n.length===0,`There are still points left in the current contour.`),t},et.prototype.getMetrics=function(){for(var e=this.path.commands,t=[],n=[],r=0;r<e.length;r+=1){var i=e[r];i.type!==`Z`&&(t.push(i.x),n.push(i.y)),(i.type===`Q`||i.type===`C`)&&(t.push(i.x1),n.push(i.y1)),i.type===`C`&&(t.push(i.x2),n.push(i.y2))}var a={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,n),xMax:Math.max.apply(null,t),yMax:Math.max.apply(null,n),leftSideBearing:this.leftSideBearing};return isFinite(a.xMin)||(a.xMin=0),isFinite(a.xMax)||(a.xMax=this.advanceWidth),isFinite(a.yMin)||(a.yMin=0),isFinite(a.yMax)||(a.yMax=0),a.rightSideBearing=this.advanceWidth-a.leftSideBearing-(a.xMax-a.xMin),a},et.prototype.draw=function(e,t,n,r,i){this.getPath(t,n,r,i).draw(e)},et.prototype.drawPoints=function(e,t,n,r){function i(t,n,r,i){var a=Math.PI*2;e.beginPath();for(var o=0;o<t.length;o+=1)e.moveTo(n+t[o].x*i,r+t[o].y*i),e.arc(n+t[o].x*i,r+t[o].y*i,2,0,a,!1);e.closePath(),e.fill()}t=t===void 0?0:t,n=n===void 0?0:n,r=r===void 0?24:r;for(var a=1/this.path.unitsPerEm*r,o=[],s=[],c=this.path,l=0;l<c.commands.length;l+=1){var u=c.commands[l];u.x!==void 0&&o.push({x:u.x,y:-u.y}),u.x1!==void 0&&s.push({x:u.x1,y:-u.y1}),u.x2!==void 0&&s.push({x:u.x2,y:-u.y2})}e.fillStyle=`blue`,i(o,t,n,a),e.fillStyle=`red`,i(s,t,n,a)},et.prototype.drawMetrics=function(e,t,n,r){var i;t=t===void 0?0:t,n=n===void 0?0:n,r=r===void 0?24:r,i=1/this.path.unitsPerEm*r,e.lineWidth=1,e.strokeStyle=`black`,B.line(e,t,-1e4,t,1e4),B.line(e,-1e4,n,1e4,n);var a=this.xMin||0,o=this.yMin||0,s=this.xMax||0,c=this.yMax||0,l=this.advanceWidth||0;e.strokeStyle=`blue`,B.line(e,t+a*i,-1e4,t+a*i,1e4),B.line(e,t+s*i,-1e4,t+s*i,1e4),B.line(e,-1e4,n+-o*i,1e4,n+-o*i),B.line(e,-1e4,n+-c*i,1e4,n+-c*i),e.strokeStyle=`green`,B.line(e,t+l*i,-1e4,t+l*i,1e4)};function tt(e,t,n){Object.defineProperty(e,t,{get:function(){return e.path,e[n]},set:function(t){e[n]=t},enumerable:!0,configurable:!0})}function nt(e,t){var n=this;if(this.font=e,this.glyphs={},Array.isArray(t))for(var r=0;r<t.length;r++)n.glyphs[r]=t[r];this.length=t&&t.length||0}nt.prototype.get=function(e){return typeof this.glyphs[e]==`function`&&(this.glyphs[e]=this.glyphs[e]()),this.glyphs[e]},nt.prototype.push=function(e,t){this.glyphs[e]=t,this.length++};function rt(e,t){return new et({index:t,font:e})}function it(e,t,n,r,i,a){return function(){var o=new et({index:t,font:e});return o.path=function(){n(o,r,i);var t=a(e.glyphs,o);return t.unitsPerEm=e.unitsPerEm,t},tt(o,`xMin`,`_xMin`),tt(o,`xMax`,`_xMax`),tt(o,`yMin`,`_yMin`),tt(o,`yMax`,`_yMax`),o}}function at(e,t,n,r){return function(){var i=new et({index:t,font:e});return i.path=function(){var t=n(e,i,r);return t.unitsPerEm=e.unitsPerEm,t},i}}var ot={GlyphSet:nt,glyphLoader:rt,ttfGlyphLoader:it,cffGlyphLoader:at};function st(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n+=1)if(!st(e[n],t[n]))return!1;return!0}else return!1}function ct(e){var t;return t=e.length<1240?107:e.length<33900?1131:32768,t}function lt(e,t,n){var r=[],i=[],a=z.getCard16(e,t),o,s;if(a!==0){var c=z.getByte(e,t+2);o=t+(a+1)*c+2;for(var l=t+3,u=0;u<a+1;u+=1)r.push(z.getOffset(e,l,c)),l+=c;s=o+r[a]}else s=t+2;for(var d=0;d<r.length-1;d+=1){var f=z.getBytes(e,o+r[d],o+r[d+1]);n&&(f=n(f)),i.push(f)}return{objects:i,startOffset:t,endOffset:s}}function ut(e){for(var t=``,n=15,r=[`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`.`,`E`,`E-`,null,`-`];;){var i=e.parseByte(),a=i>>4,o=i&15;if(a===n||(t+=r[a],o===n))break;t+=r[o]}return parseFloat(t)}function dt(e,t){var n,r,i,a;if(t===28)return n=e.parseByte(),r=e.parseByte(),n<<8|r;if(t===29)return n=e.parseByte(),r=e.parseByte(),i=e.parseByte(),a=e.parseByte(),n<<24|r<<16|i<<8|a;if(t===30)return ut(e);if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return n=e.parseByte(),(t-247)*256+n+108;if(t>=251&&t<=254)return n=e.parseByte(),-(t-251)*256-n-108;throw Error(`Invalid b0 `+t)}function ft(e){for(var t={},n=0;n<e.length;n+=1){var r=e[n][0],i=e[n][1],a=void 0;if(a=i.length===1?i[0]:i,t.hasOwnProperty(r)&&!isNaN(t[r]))throw Error(`Object `+t+` already has key `+r);t[r]=a}return t}function pt(e,t,n){t=t===void 0?0:t;var r=new z.Parser(e,t),i=[],a=[];for(n=n===void 0?e.length:n;r.relativeOffset<n;){var o=r.parseByte();o<=21?(o===12&&(o=1200+r.parseByte()),i.push([o,a]),a=[]):a.push(dt(r,o))}return ft(i)}function mt(e,t){return t=t<=390?Ie[t]:e[t-391],t}function ht(e,t,n){for(var r={},i,a=0;a<t.length;a+=1){var o=t[a];if(Array.isArray(o.type)){var s=[];s.length=o.type.length;for(var c=0;c<o.type.length;c++)i=e[o.op]===void 0?void 0:e[o.op][c],i===void 0&&(i=o.value!==void 0&&o.value[c]!==void 0?o.value[c]:null),o.type[c]===`SID`&&(i=mt(n,i)),s[c]=i;r[o.name]=s}else i=e[o.op],i===void 0&&(i=o.value===void 0?null:o.value),o.type===`SID`&&(i=mt(n,i)),r[o.name]=i}return r}function gt(e,t){var n={};return n.formatMajor=z.getCard8(e,t),n.formatMinor=z.getCard8(e,t+1),n.size=z.getCard8(e,t+2),n.offsetSize=z.getCard8(e,t+3),n.startOffset=t,n.endOffset=t+4,n}var _t=[{name:`version`,op:0,type:`SID`},{name:`notice`,op:1,type:`SID`},{name:`copyright`,op:1200,type:`SID`},{name:`fullName`,op:2,type:`SID`},{name:`familyName`,op:3,type:`SID`},{name:`weight`,op:4,type:`SID`},{name:`isFixedPitch`,op:1201,type:`number`,value:0},{name:`italicAngle`,op:1202,type:`number`,value:0},{name:`underlinePosition`,op:1203,type:`number`,value:-100},{name:`underlineThickness`,op:1204,type:`number`,value:50},{name:`paintType`,op:1205,type:`number`,value:0},{name:`charstringType`,op:1206,type:`number`,value:2},{name:`fontMatrix`,op:1207,type:[`real`,`real`,`real`,`real`,`real`,`real`],value:[.001,0,0,.001,0,0]},{name:`uniqueId`,op:13,type:`number`},{name:`fontBBox`,op:5,type:[`number`,`number`,`number`,`number`],value:[0,0,0,0]},{name:`strokeWidth`,op:1208,type:`number`,value:0},{name:`xuid`,op:14,type:[],value:null},{name:`charset`,op:15,type:`offset`,value:0},{name:`encoding`,op:16,type:`offset`,value:0},{name:`charStrings`,op:17,type:`offset`,value:0},{name:`private`,op:18,type:[`number`,`offset`],value:[0,0]},{name:`ros`,op:1230,type:[`SID`,`SID`,`number`]},{name:`cidFontVersion`,op:1231,type:`number`,value:0},{name:`cidFontRevision`,op:1232,type:`number`,value:0},{name:`cidFontType`,op:1233,type:`number`,value:0},{name:`cidCount`,op:1234,type:`number`,value:8720},{name:`uidBase`,op:1235,type:`number`},{name:`fdArray`,op:1236,type:`offset`},{name:`fdSelect`,op:1237,type:`offset`},{name:`fontName`,op:1238,type:`SID`}],H=[{name:`subrs`,op:19,type:`offset`,value:0},{name:`defaultWidthX`,op:20,type:`number`,value:0},{name:`nominalWidthX`,op:21,type:`number`,value:0}];function vt(e,t){return ht(pt(e,0,e.byteLength),_t,t)}function yt(e,t,n,r){return ht(pt(e,t,n),H,r)}function bt(e,t,n,r){for(var i=[],a=0;a<n.length;a+=1){var o=vt(new DataView(new Uint8Array(n[a]).buffer),r);o._subrs=[],o._subrsBias=0;var s=o.private[0],c=o.private[1];if(s!==0&&c!==0){var l=yt(e,c+t,s,r);o._defaultWidthX=l.defaultWidthX,o._nominalWidthX=l.nominalWidthX,l.subrs!==0&&(o._subrs=lt(e,c+l.subrs+t).objects,o._subrsBias=ct(o._subrs)),o._privateDict=l}i.push(o)}return i}function xt(e,t,n,r){var i,a,o=new z.Parser(e,t);--n;var s=[`.notdef`],c=o.parseCard8();if(c===0)for(var l=0;l<n;l+=1)i=o.parseSID(),s.push(mt(r,i));else if(c===1)for(;s.length<=n;){i=o.parseSID(),a=o.parseCard8();for(var u=0;u<=a;u+=1)s.push(mt(r,i)),i+=1}else if(c===2)for(;s.length<=n;){i=o.parseSID(),a=o.parseCard16();for(var d=0;d<=a;d+=1)s.push(mt(r,i)),i+=1}else throw Error(`Unknown charset format `+c);return s}function St(e,t,n){var r,i={},a=new z.Parser(e,t),o=a.parseCard8();if(o===0)for(var s=a.parseCard8(),c=0;c<s;c+=1)r=a.parseCard8(),i[r]=c;else if(o===1){var l=a.parseCard8();r=1;for(var u=0;u<l;u+=1)for(var d=a.parseCard8(),f=a.parseCard8(),p=d;p<=d+f;p+=1)i[p]=r,r+=1}else throw Error(`Unknown encoding format `+o);return new He(i,n)}function Ct(e,t,n){var r,i,a,o,s=new D,c=[],l=0,u=!1,d=!1,f=0,p=0,m,h,g,_;if(e.isCIDFont){var v=e.tables.cff.topDict._fdSelect[t.index],y=e.tables.cff.topDict._fdArray[v];m=y._subrs,h=y._subrsBias,g=y._defaultWidthX,_=y._nominalWidthX}else m=e.tables.cff.topDict._subrs,h=e.tables.cff.topDict._subrsBias,g=e.tables.cff.topDict._defaultWidthX,_=e.tables.cff.topDict._nominalWidthX;var b=g;function x(e,t){d&&s.closePath(),s.moveTo(e,t),d=!0}function S(){c.length%2!=0&&!u&&(b=c.shift()+_),l+=c.length>>1,c.length=0,u=!0}function ee(n){for(var g,v,y,C,w,T,E,D,O,k,A,j,M=0;M<n.length;){var N=n[M];switch(M+=1,N){case 1:S();break;case 3:S();break;case 4:c.length>1&&!u&&(b=c.shift()+_,u=!0),p+=c.pop(),x(f,p);break;case 5:for(;c.length>0;)f+=c.shift(),p+=c.shift(),s.lineTo(f,p);break;case 6:for(;c.length>0&&(f+=c.shift(),s.lineTo(f,p),c.length!==0);)p+=c.shift(),s.lineTo(f,p);break;case 7:for(;c.length>0&&(p+=c.shift(),s.lineTo(f,p),c.length!==0);)f+=c.shift(),s.lineTo(f,p);break;case 8:for(;c.length>0;)r=f+c.shift(),i=p+c.shift(),a=r+c.shift(),o=i+c.shift(),f=a+c.shift(),p=o+c.shift(),s.curveTo(r,i,a,o,f,p);break;case 10:w=c.pop()+h,T=m[w],T&&ee(T);break;case 11:return;case 12:switch(N=n[M],M+=1,N){case 35:r=f+c.shift(),i=p+c.shift(),a=r+c.shift(),o=i+c.shift(),E=a+c.shift(),D=o+c.shift(),O=E+c.shift(),k=D+c.shift(),A=O+c.shift(),j=k+c.shift(),f=A+c.shift(),p=j+c.shift(),c.shift(),s.curveTo(r,i,a,o,E,D),s.curveTo(O,k,A,j,f,p);break;case 34:r=f+c.shift(),i=p,a=r+c.shift(),o=i+c.shift(),E=a+c.shift(),D=o,O=E+c.shift(),k=o,A=O+c.shift(),j=p,f=A+c.shift(),s.curveTo(r,i,a,o,E,D),s.curveTo(O,k,A,j,f,p);break;case 36:r=f+c.shift(),i=p+c.shift(),a=r+c.shift(),o=i+c.shift(),E=a+c.shift(),D=o,O=E+c.shift(),k=o,A=O+c.shift(),j=k+c.shift(),f=A+c.shift(),s.curveTo(r,i,a,o,E,D),s.curveTo(O,k,A,j,f,p);break;case 37:r=f+c.shift(),i=p+c.shift(),a=r+c.shift(),o=i+c.shift(),E=a+c.shift(),D=o+c.shift(),O=E+c.shift(),k=D+c.shift(),A=O+c.shift(),j=k+c.shift(),Math.abs(A-f)>Math.abs(j-p)?f=A+c.shift():p=j+c.shift(),s.curveTo(r,i,a,o,E,D),s.curveTo(O,k,A,j,f,p);break;default:console.log(`Glyph `+t.index+`: unknown operator 1200`+N),c.length=0}break;case 14:c.length>0&&!u&&(b=c.shift()+_,u=!0),d&&=(s.closePath(),!1);break;case 18:S();break;case 19:case 20:S(),M+=l+7>>3;break;case 21:c.length>2&&!u&&(b=c.shift()+_,u=!0),p+=c.pop(),f+=c.pop(),x(f,p);break;case 22:c.length>1&&!u&&(b=c.shift()+_,u=!0),f+=c.pop(),x(f,p);break;case 23:S();break;case 24:for(;c.length>2;)r=f+c.shift(),i=p+c.shift(),a=r+c.shift(),o=i+c.shift(),f=a+c.shift(),p=o+c.shift(),s.curveTo(r,i,a,o,f,p);f+=c.shift(),p+=c.shift(),s.lineTo(f,p);break;case 25:for(;c.length>6;)f+=c.shift(),p+=c.shift(),s.lineTo(f,p);r=f+c.shift(),i=p+c.shift(),a=r+c.shift(),o=i+c.shift(),f=a+c.shift(),p=o+c.shift(),s.curveTo(r,i,a,o,f,p);break;case 26:for(c.length%2&&(f+=c.shift());c.length>0;)r=f,i=p+c.shift(),a=r+c.shift(),o=i+c.shift(),f=a,p=o+c.shift(),s.curveTo(r,i,a,o,f,p);break;case 27:for(c.length%2&&(p+=c.shift());c.length>0;)r=f+c.shift(),i=p,a=r+c.shift(),o=i+c.shift(),f=a+c.shift(),p=o,s.curveTo(r,i,a,o,f,p);break;case 28:g=n[M],v=n[M+1],c.push((g<<24|v<<16)>>16),M+=2;break;case 29:w=c.pop()+e.gsubrsBias,T=e.gsubrs[w],T&&ee(T);break;case 30:for(;c.length>0&&(r=f,i=p+c.shift(),a=r+c.shift(),o=i+c.shift(),f=a+c.shift(),p=o+(c.length===1?c.shift():0),s.curveTo(r,i,a,o,f,p),c.length!==0);)r=f+c.shift(),i=p,a=r+c.shift(),o=i+c.shift(),p=o+c.shift(),f=a+(c.length===1?c.shift():0),s.curveTo(r,i,a,o,f,p);break;case 31:for(;c.length>0&&(r=f+c.shift(),i=p,a=r+c.shift(),o=i+c.shift(),p=o+c.shift(),f=a+(c.length===1?c.shift():0),s.curveTo(r,i,a,o,f,p),c.length!==0);)r=f,i=p+c.shift(),a=r+c.shift(),o=i+c.shift(),f=a+c.shift(),p=o+(c.length===1?c.shift():0),s.curveTo(r,i,a,o,f,p);break;default:N<32?console.log(`Glyph `+t.index+`: unknown operator `+N):N<247?c.push(N-139):N<251?(g=n[M],M+=1,c.push((N-247)*256+g+108)):N<255?(g=n[M],M+=1,c.push(-(N-251)*256-g-108)):(g=n[M],v=n[M+1],y=n[M+2],C=n[M+3],M+=4,c.push((g<<24|v<<16|y<<8|C)/65536))}}}return ee(n),t.advanceWidth=b,s}function wt(e,t,n,r){var i=[],a,o=new z.Parser(e,t),s=o.parseCard8();if(s===0)for(var c=0;c<n;c++){if(a=o.parseCard8(),a>=r)throw Error(`CFF table CID Font FDSelect has bad FD index value `+a+` (FD count `+r+`)`);i.push(a)}else if(s===3){var l=o.parseCard16(),u=o.parseCard16();if(u!==0)throw Error(`CFF Table CID Font FDSelect format 3 range has bad initial GID `+u);for(var d,f=0;f<l;f++){if(a=o.parseCard8(),d=o.parseCard16(),a>=r)throw Error(`CFF table CID Font FDSelect has bad FD index value `+a+` (FD count `+r+`)`);if(d>n)throw Error(`CFF Table CID Font FDSelect format 3 range has bad GID `+d);for(;u<d;u++)i.push(a);u=d}if(d!==n)throw Error(`CFF Table CID Font FDSelect format 3 range has bad final GID `+d)}else throw Error(`CFF Table CID Font FDSelect table has unsupported format `+s);return i}function Tt(e,t,n){n.tables.cff={};var r=lt(e,lt(e,gt(e,t).endOffset,z.bytesToString).endOffset),i=lt(e,r.endOffset,z.bytesToString);n.gsubrs=lt(e,i.endOffset).objects,n.gsubrsBias=ct(n.gsubrs);var a=bt(e,t,r.objects,i.objects);if(a.length!==1)throw Error(`CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = `+a.length);var o=a[0];if(n.tables.cff.topDict=o,o._privateDict&&(n.defaultWidthX=o._privateDict.defaultWidthX,n.nominalWidthX=o._privateDict.nominalWidthX),o.ros[0]!==void 0&&o.ros[1]!==void 0&&(n.isCIDFont=!0),n.isCIDFont){var s=o.fdArray,c=o.fdSelect;if(s===0||c===0)throw Error(`Font is marked as a CID font, but FDArray and/or FDSelect information is missing`);s+=t;var l=bt(e,t,lt(e,s).objects,i.objects);o._fdArray=l,c+=t,o._fdSelect=wt(e,c,n.numGlyphs,l.length)}var u=t+o.private[1],d=yt(e,u,o.private[0],i.objects);n.defaultWidthX=d.defaultWidthX,n.nominalWidthX=d.nominalWidthX,d.subrs===0?(n.subrs=[],n.subrsBias=0):(n.subrs=lt(e,u+d.subrs).objects,n.subrsBias=ct(n.subrs));var f=lt(e,t+o.charStrings);n.nGlyphs=f.objects.length;var p=xt(e,t+o.charset,n.nGlyphs,i.objects);o.encoding===0?n.cffEncoding=new He(Le,p):o.encoding===1?n.cffEncoding=new He(Re,p):n.cffEncoding=St(e,t+o.encoding,p),n.encoding=n.encoding||n.cffEncoding,n.glyphs=new ot.GlyphSet(n);for(var m=0;m<n.nGlyphs;m+=1){var h=f.objects[m];n.glyphs.push(m,ot.cffGlyphLoader(n,m,Ct,h))}}function Et(e,t){var n,r=Ie.indexOf(e);return r>=0&&(n=r),r=t.indexOf(e),r>=0?n=r+Ie.length:(n=Ie.length+t.length,t.push(e)),n}function Dt(){return new L.Record(`Header`,[{name:`major`,type:`Card8`,value:1},{name:`minor`,type:`Card8`,value:0},{name:`hdrSize`,type:`Card8`,value:4},{name:`major`,type:`Card8`,value:1}])}function Ot(e){var t=new L.Record(`Name INDEX`,[{name:`names`,type:`INDEX`,value:[]}]);t.names=[];for(var n=0;n<e.length;n+=1)t.names.push({name:`name_`+n,type:`NAME`,value:e[n]});return t}function kt(e,t,n){for(var r={},i=0;i<e.length;i+=1){var a=e[i],o=t[a.name];o!==void 0&&!st(o,a.value)&&(a.type===`SID`&&(o=Et(o,n)),r[a.op]={name:a.name,type:a.type,value:o})}return r}function At(e,t){var n=new L.Record(`Top DICT`,[{name:`dict`,type:`DICT`,value:{}}]);return n.dict=kt(_t,e,t),n}function jt(e){var t=new L.Record(`Top DICT INDEX`,[{name:`topDicts`,type:`INDEX`,value:[]}]);return t.topDicts=[{name:`topDict_0`,type:`TABLE`,value:e}],t}function Mt(e){var t=new L.Record(`String INDEX`,[{name:`strings`,type:`INDEX`,value:[]}]);t.strings=[];for(var n=0;n<e.length;n+=1)t.strings.push({name:`string_`+n,type:`STRING`,value:e[n]});return t}function Nt(){return new L.Record(`Global Subr INDEX`,[{name:`subrs`,type:`INDEX`,value:[]}])}function Pt(e,t){for(var n=new L.Record(`Charsets`,[{name:`format`,type:`Card8`,value:0}]),r=0;r<e.length;r+=1){var i=e[r],a=Et(i,t);n.fields.push({name:`glyph_`+r,type:`SID`,value:a})}return n}function Ft(e){var t=[],n=e.path;t.push({name:`width`,type:`NUMBER`,value:e.advanceWidth});for(var r=0,i=0,a=0;a<n.commands.length;a+=1){var o=void 0,s=void 0,c=n.commands[a];if(c.type===`Q`){var l=.3333333333333333,u=2/3;c={type:`C`,x:c.x,y:c.y,x1:l*r+u*c.x1,y1:l*i+u*c.y1,x2:l*c.x+u*c.x1,y2:l*c.y+u*c.y1}}if(c.type===`M`)o=Math.round(c.x-r),s=Math.round(c.y-i),t.push({name:`dx`,type:`NUMBER`,value:o}),t.push({name:`dy`,type:`NUMBER`,value:s}),t.push({name:`rmoveto`,type:`OP`,value:21}),r=Math.round(c.x),i=Math.round(c.y);else if(c.type===`L`)o=Math.round(c.x-r),s=Math.round(c.y-i),t.push({name:`dx`,type:`NUMBER`,value:o}),t.push({name:`dy`,type:`NUMBER`,value:s}),t.push({name:`rlineto`,type:`OP`,value:5}),r=Math.round(c.x),i=Math.round(c.y);else if(c.type===`C`){var d=Math.round(c.x1-r),f=Math.round(c.y1-i),p=Math.round(c.x2-c.x1),m=Math.round(c.y2-c.y1);o=Math.round(c.x-c.x2),s=Math.round(c.y-c.y2),t.push({name:`dx1`,type:`NUMBER`,value:d}),t.push({name:`dy1`,type:`NUMBER`,value:f}),t.push({name:`dx2`,type:`NUMBER`,value:p}),t.push({name:`dy2`,type:`NUMBER`,value:m}),t.push({name:`dx`,type:`NUMBER`,value:o}),t.push({name:`dy`,type:`NUMBER`,value:s}),t.push({name:`rrcurveto`,type:`OP`,value:8}),r=Math.round(c.x),i=Math.round(c.y)}}return t.push({name:`endchar`,type:`OP`,value:14}),t}function It(e){for(var t=new L.Record(`CharStrings INDEX`,[{name:`charStrings`,type:`INDEX`,value:[]}]),n=0;n<e.length;n+=1){var r=e.get(n),i=Ft(r);t.charStrings.push({name:r.name,type:`CHARSTRING`,value:i})}return t}function Lt(e,t){var n=new L.Record(`Private DICT`,[{name:`dict`,type:`DICT`,value:{}}]);return n.dict=kt(H,e,t),n}function Rt(e,t){for(var n=new L.Table(`CFF `,[{name:`header`,type:`RECORD`},{name:`nameIndex`,type:`RECORD`},{name:`topDictIndex`,type:`RECORD`},{name:`stringIndex`,type:`RECORD`},{name:`globalSubrIndex`,type:`RECORD`},{name:`charsets`,type:`RECORD`},{name:`charStringsIndex`,type:`RECORD`},{name:`privateDict`,type:`RECORD`}]),r=1/t.unitsPerEm,i={version:t.version,fullName:t.fullName,familyName:t.familyName,weight:t.weightName,fontBBox:t.fontBBox||[0,0,0,0],fontMatrix:[r,0,0,r,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},a={},o=[],s,c=1;c<e.length;c+=1)s=e.get(c),o.push(s.name);var l=[];n.header=Dt(),n.nameIndex=Ot([t.postScriptName]);var u=At(i,l);return n.topDictIndex=jt(u),n.globalSubrIndex=Nt(),n.charsets=Pt(o,l),n.charStringsIndex=It(e),n.privateDict=Lt(a,l),n.stringIndex=Mt(l),i.charset=n.header.sizeOf()+n.nameIndex.sizeOf()+n.topDictIndex.sizeOf()+n.stringIndex.sizeOf()+n.globalSubrIndex.sizeOf(),i.encoding=0,i.charStrings=i.charset+n.charsets.sizeOf(),i.private[1]=i.charStrings+n.charStringsIndex.sizeOf(),u=At(i,l),n.topDictIndex=jt(u),n}var zt={parse:Tt,make:Rt};function Bt(e,t){var n={},r=new z.Parser(e,t);return n.version=r.parseVersion(),n.fontRevision=Math.round(r.parseFixed()*1e3)/1e3,n.checkSumAdjustment=r.parseULong(),n.magicNumber=r.parseULong(),A.argument(n.magicNumber===1594834165,`Font header has wrong magic number.`),n.flags=r.parseUShort(),n.unitsPerEm=r.parseUShort(),n.created=r.parseLongDateTime(),n.modified=r.parseLongDateTime(),n.xMin=r.parseShort(),n.yMin=r.parseShort(),n.xMax=r.parseShort(),n.yMax=r.parseShort(),n.macStyle=r.parseUShort(),n.lowestRecPPEM=r.parseUShort(),n.fontDirectionHint=r.parseShort(),n.indexToLocFormat=r.parseShort(),n.glyphDataFormat=r.parseShort(),n}function Vt(e){var t=Math.round(new Date().getTime()/1e3)+2082844800,n=t;return e.createdTimestamp&&(n=e.createdTimestamp+2082844800),new L.Table(`head`,[{name:`version`,type:`FIXED`,value:65536},{name:`fontRevision`,type:`FIXED`,value:65536},{name:`checkSumAdjustment`,type:`ULONG`,value:0},{name:`magicNumber`,type:`ULONG`,value:1594834165},{name:`flags`,type:`USHORT`,value:0},{name:`unitsPerEm`,type:`USHORT`,value:1e3},{name:`created`,type:`LONGDATETIME`,value:n},{name:`modified`,type:`LONGDATETIME`,value:t},{name:`xMin`,type:`SHORT`,value:0},{name:`yMin`,type:`SHORT`,value:0},{name:`xMax`,type:`SHORT`,value:0},{name:`yMax`,type:`SHORT`,value:0},{name:`macStyle`,type:`USHORT`,value:0},{name:`lowestRecPPEM`,type:`USHORT`,value:0},{name:`fontDirectionHint`,type:`SHORT`,value:2},{name:`indexToLocFormat`,type:`SHORT`,value:0},{name:`glyphDataFormat`,type:`SHORT`,value:0}],e)}var Ht={parse:Bt,make:Vt};function Ut(e,t){var n={},r=new z.Parser(e,t);return n.version=r.parseVersion(),n.ascender=r.parseShort(),n.descender=r.parseShort(),n.lineGap=r.parseShort(),n.advanceWidthMax=r.parseUShort(),n.minLeftSideBearing=r.parseShort(),n.minRightSideBearing=r.parseShort(),n.xMaxExtent=r.parseShort(),n.caretSlopeRise=r.parseShort(),n.caretSlopeRun=r.parseShort(),n.caretOffset=r.parseShort(),r.relativeOffset+=8,n.metricDataFormat=r.parseShort(),n.numberOfHMetrics=r.parseUShort(),n}function Wt(e){return new L.Table(`hhea`,[{name:`version`,type:`FIXED`,value:65536},{name:`ascender`,type:`FWORD`,value:0},{name:`descender`,type:`FWORD`,value:0},{name:`lineGap`,type:`FWORD`,value:0},{name:`advanceWidthMax`,type:`UFWORD`,value:0},{name:`minLeftSideBearing`,type:`FWORD`,value:0},{name:`minRightSideBearing`,type:`FWORD`,value:0},{name:`xMaxExtent`,type:`FWORD`,value:0},{name:`caretSlopeRise`,type:`SHORT`,value:1},{name:`caretSlopeRun`,type:`SHORT`,value:0},{name:`caretOffset`,type:`SHORT`,value:0},{name:`reserved1`,type:`SHORT`,value:0},{name:`reserved2`,type:`SHORT`,value:0},{name:`reserved3`,type:`SHORT`,value:0},{name:`reserved4`,type:`SHORT`,value:0},{name:`metricDataFormat`,type:`SHORT`,value:0},{name:`numberOfHMetrics`,type:`USHORT`,value:0}],e)}var Gt={parse:Ut,make:Wt};function Kt(e,t,n,r,i){for(var a,o,s=new z.Parser(e,t),c=0;c<r;c+=1){c<n&&(a=s.parseUShort(),o=s.parseShort());var l=i.get(c);l.advanceWidth=a,l.leftSideBearing=o}}function qt(e){for(var t=new L.Table(`hmtx`,[]),n=0;n<e.length;n+=1){var r=e.get(n),i=r.advanceWidth||0,a=r.leftSideBearing||0;t.fields.push({name:`advanceWidth_`+n,type:`USHORT`,value:i}),t.fields.push({name:`leftSideBearing_`+n,type:`SHORT`,value:a})}return t}var Jt={parse:Kt,make:qt};function Yt(e){for(var t=new L.Table(`ltag`,[{name:`version`,type:`ULONG`,value:1},{name:`flags`,type:`ULONG`,value:0},{name:`numTags`,type:`ULONG`,value:e.length}]),n=``,r=12+e.length*4,i=0;i<e.length;++i){var a=n.indexOf(e[i]);a<0&&(a=n.length,n+=e[i]),t.fields.push({name:`offset `+i,type:`USHORT`,value:r+a}),t.fields.push({name:`length `+i,type:`USHORT`,value:e[i].length})}return t.fields.push({name:`stringPool`,type:`CHARARRAY`,value:n}),t}function Xt(e,t){var n=new z.Parser(e,t),r=n.parseULong();A.argument(r===1,`Unsupported ltag table version.`),n.skip(`uLong`,1);for(var i=n.parseULong(),a=[],o=0;o<i;o++){for(var s=``,c=t+n.parseUShort(),l=n.parseUShort(),u=c;u<c+l;++u)s+=String.fromCharCode(e.getInt8(u));a.push(s)}return a}var Zt={make:Yt,parse:Xt};function Qt(e,t){var n={},r=new z.Parser(e,t);return n.version=r.parseVersion(),n.numGlyphs=r.parseUShort(),n.version===1&&(n.maxPoints=r.parseUShort(),n.maxContours=r.parseUShort(),n.maxCompositePoints=r.parseUShort(),n.maxCompositeContours=r.parseUShort(),n.maxZones=r.parseUShort(),n.maxTwilightPoints=r.parseUShort(),n.maxStorage=r.parseUShort(),n.maxFunctionDefs=r.parseUShort(),n.maxInstructionDefs=r.parseUShort(),n.maxStackElements=r.parseUShort(),n.maxSizeOfInstructions=r.parseUShort(),n.maxComponentElements=r.parseUShort(),n.maxComponentDepth=r.parseUShort()),n}function $t(e){return new L.Table(`maxp`,[{name:`version`,type:`FIXED`,value:20480},{name:`numGlyphs`,type:`USHORT`,value:e}])}var en={parse:Qt,make:$t},tn=[`copyright`,`fontFamily`,`fontSubfamily`,`uniqueID`,`fullName`,`version`,`postScriptName`,`trademark`,`manufacturer`,`designer`,`description`,`manufacturerURL`,`designerURL`,`license`,`licenseURL`,`reserved`,`preferredFamily`,`preferredSubfamily`,`compatibleFullName`,`sampleText`,`postScriptFindFontName`,`wwsFamily`,`wwsSubfamily`],nn={0:`en`,1:`fr`,2:`de`,3:`it`,4:`nl`,5:`sv`,6:`es`,7:`da`,8:`pt`,9:`no`,10:`he`,11:`ja`,12:`ar`,13:`fi`,14:`el`,15:`is`,16:`mt`,17:`tr`,18:`hr`,19:`zh-Hant`,20:`ur`,21:`hi`,22:`th`,23:`ko`,24:`lt`,25:`pl`,26:`hu`,27:`es`,28:`lv`,29:`se`,30:`fo`,31:`fa`,32:`ru`,33:`zh`,34:`nl-BE`,35:`ga`,36:`sq`,37:`ro`,38:`cz`,39:`sk`,40:`si`,41:`yi`,42:`sr`,43:`mk`,44:`bg`,45:`uk`,46:`be`,47:`uz`,48:`kk`,49:`az-Cyrl`,50:`az-Arab`,51:`hy`,52:`ka`,53:`mo`,54:`ky`,55:`tg`,56:`tk`,57:`mn-CN`,58:`mn`,59:`ps`,60:`ks`,61:`ku`,62:`sd`,63:`bo`,64:`ne`,65:`sa`,66:`mr`,67:`bn`,68:`as`,69:`gu`,70:`pa`,71:`or`,72:`ml`,73:`kn`,74:`ta`,75:`te`,76:`si`,77:`my`,78:`km`,79:`lo`,80:`vi`,81:`id`,82:`tl`,83:`ms`,84:`ms-Arab`,85:`am`,86:`ti`,87:`om`,88:`so`,89:`sw`,90:`rw`,91:`rn`,92:`ny`,93:`mg`,94:`eo`,128:`cy`,129:`eu`,130:`ca`,131:`la`,132:`qu`,133:`gn`,134:`ay`,135:`tt`,136:`ug`,137:`dz`,138:`jv`,139:`su`,140:`gl`,141:`af`,142:`br`,143:`iu`,144:`gd`,145:`gv`,146:`ga`,147:`to`,148:`el-polyton`,149:`kl`,150:`az`,151:`nn`},rn={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},an={1078:`af`,1052:`sq`,1156:`gsw`,1118:`am`,5121:`ar-DZ`,15361:`ar-BH`,3073:`ar`,2049:`ar-IQ`,11265:`ar-JO`,13313:`ar-KW`,12289:`ar-LB`,4097:`ar-LY`,6145:`ary`,8193:`ar-OM`,16385:`ar-QA`,1025:`ar-SA`,10241:`ar-SY`,7169:`aeb`,14337:`ar-AE`,9217:`ar-YE`,1067:`hy`,1101:`as`,2092:`az-Cyrl`,1068:`az`,1133:`ba`,1069:`eu`,1059:`be`,2117:`bn`,1093:`bn-IN`,8218:`bs-Cyrl`,5146:`bs`,1150:`br`,1026:`bg`,1027:`ca`,3076:`zh-HK`,5124:`zh-MO`,2052:`zh`,4100:`zh-SG`,1028:`zh-TW`,1155:`co`,1050:`hr`,4122:`hr-BA`,1029:`cs`,1030:`da`,1164:`prs`,1125:`dv`,2067:`nl-BE`,1043:`nl`,3081:`en-AU`,10249:`en-BZ`,4105:`en-CA`,9225:`en-029`,16393:`en-IN`,6153:`en-IE`,8201:`en-JM`,17417:`en-MY`,5129:`en-NZ`,13321:`en-PH`,18441:`en-SG`,7177:`en-ZA`,11273:`en-TT`,2057:`en-GB`,1033:`en`,12297:`en-ZW`,1061:`et`,1080:`fo`,1124:`fil`,1035:`fi`,2060:`fr-BE`,3084:`fr-CA`,1036:`fr`,5132:`fr-LU`,6156:`fr-MC`,4108:`fr-CH`,1122:`fy`,1110:`gl`,1079:`ka`,3079:`de-AT`,1031:`de`,5127:`de-LI`,4103:`de-LU`,2055:`de-CH`,1032:`el`,1135:`kl`,1095:`gu`,1128:`ha`,1037:`he`,1081:`hi`,1038:`hu`,1039:`is`,1136:`ig`,1057:`id`,1117:`iu`,2141:`iu-Latn`,2108:`ga`,1076:`xh`,1077:`zu`,1040:`it`,2064:`it-CH`,1041:`ja`,1099:`kn`,1087:`kk`,1107:`km`,1158:`quc`,1159:`rw`,1089:`sw`,1111:`kok`,1042:`ko`,1088:`ky`,1108:`lo`,1062:`lv`,1063:`lt`,2094:`dsb`,1134:`lb`,1071:`mk`,2110:`ms-BN`,1086:`ms`,1100:`ml`,1082:`mt`,1153:`mi`,1146:`arn`,1102:`mr`,1148:`moh`,1104:`mn`,2128:`mn-CN`,1121:`ne`,1044:`nb`,2068:`nn`,1154:`oc`,1096:`or`,1123:`ps`,1045:`pl`,1046:`pt`,2070:`pt-PT`,1094:`pa`,1131:`qu-BO`,2155:`qu-EC`,3179:`qu`,1048:`ro`,1047:`rm`,1049:`ru`,9275:`smn`,4155:`smj-NO`,5179:`smj`,3131:`se-FI`,1083:`se`,2107:`se-SE`,8251:`sms`,6203:`sma-NO`,7227:`sms`,1103:`sa`,7194:`sr-Cyrl-BA`,3098:`sr`,6170:`sr-Latn-BA`,2074:`sr-Latn`,1132:`nso`,1074:`tn`,1115:`si`,1051:`sk`,1060:`sl`,11274:`es-AR`,16394:`es-BO`,13322:`es-CL`,9226:`es-CO`,5130:`es-CR`,7178:`es-DO`,12298:`es-EC`,17418:`es-SV`,4106:`es-GT`,18442:`es-HN`,2058:`es-MX`,19466:`es-NI`,6154:`es-PA`,15370:`es-PY`,10250:`es-PE`,20490:`es-PR`,3082:`es`,1034:`es`,21514:`es-US`,14346:`es-UY`,8202:`es-VE`,2077:`sv-FI`,1053:`sv`,1114:`syr`,1064:`tg`,2143:`tzm`,1097:`ta`,1092:`tt`,1098:`te`,1054:`th`,1105:`bo`,1055:`tr`,1090:`tk`,1152:`ug`,1058:`uk`,1070:`hsb`,1056:`ur`,2115:`uz-Cyrl`,1091:`uz`,1066:`vi`,1106:`cy`,1160:`wo`,1157:`sah`,1144:`ii`,1130:`yo`};function on(e,t,n){switch(e){case 0:if(t===65535)return`und`;if(n)return n[t];break;case 1:return nn[t];case 3:return an[t]}}var sn=`utf-16`,cn={0:`macintosh`,1:`x-mac-japanese`,2:`x-mac-chinesetrad`,3:`x-mac-korean`,6:`x-mac-greek`,7:`x-mac-cyrillic`,9:`x-mac-devanagai`,10:`x-mac-gurmukhi`,11:`x-mac-gujarati`,12:`x-mac-oriya`,13:`x-mac-bengali`,14:`x-mac-tamil`,15:`x-mac-telugu`,16:`x-mac-kannada`,17:`x-mac-malayalam`,18:`x-mac-sinhalese`,19:`x-mac-burmese`,20:`x-mac-khmer`,21:`x-mac-thai`,22:`x-mac-lao`,23:`x-mac-georgian`,24:`x-mac-armenian`,25:`x-mac-chinesesimp`,26:`x-mac-tibetan`,27:`x-mac-mongolian`,28:`x-mac-ethiopic`,29:`x-mac-ce`,30:`x-mac-vietnamese`,31:`x-mac-extarabic`},ln={15:`x-mac-icelandic`,17:`x-mac-turkish`,18:`x-mac-croatian`,24:`x-mac-ce`,25:`x-mac-ce`,26:`x-mac-ce`,27:`x-mac-ce`,28:`x-mac-ce`,30:`x-mac-icelandic`,37:`x-mac-romanian`,38:`x-mac-ce`,39:`x-mac-ce`,40:`x-mac-ce`,143:`x-mac-inuit`,146:`x-mac-gaelic`};function un(e,t,n){switch(e){case 0:return sn;case 1:return ln[n]||cn[t];case 3:if(t===1||t===10)return sn;break}}function dn(e,t,n){for(var r={},i=new z.Parser(e,t),a=i.parseUShort(),o=i.parseUShort(),s=i.offset+i.parseUShort(),c=0;c<o;c++){var l=i.parseUShort(),u=i.parseUShort(),d=i.parseUShort(),f=i.parseUShort(),p=tn[f]||f,m=i.parseUShort(),h=i.parseUShort(),g=on(l,d,n),_=un(l,u,d);if(_!==void 0&&g!==void 0){var v=void 0;if(v=_===sn?N.UTF16(e,s+h,m):N.MACSTRING(e,s+h,m,_),v){var y=r[p];y===void 0&&(y=r[p]={}),y[g]=v}}}return a===1&&i.parseUShort(),r}function fn(e){var t={};for(var n in e)t[e[n]]=parseInt(n);return t}function pn(e,t,n,r,i,a){return new L.Record(`NameRecord`,[{name:`platformID`,type:`USHORT`,value:e},{name:`encodingID`,type:`USHORT`,value:t},{name:`languageID`,type:`USHORT`,value:n},{name:`nameID`,type:`USHORT`,value:r},{name:`length`,type:`USHORT`,value:i},{name:`offset`,type:`USHORT`,value:a}])}function mn(e,t){var n=e.length,r=t.length-n+1;e:for(var i=0;i<r;i++)for(;i<r;i++){for(var a=0;a<n;a++)if(t[i+a]!==e[a])continue e;return i}return-1}function hn(e,t){var n=mn(e,t);if(n<0){n=t.length;for(var r=0,i=e.length;r<i;++r)t.push(e[r])}return n}function gn(e,t){var n,r=[],i={},a=fn(tn);for(var o in e){var s=a[o];if(s===void 0&&(s=o),n=parseInt(s),isNaN(n))throw Error(`Name table entry "`+o+`" does not exist, see nameTableNames for complete list.`);i[n]=e[o],r.push(n)}for(var c=fn(nn),l=fn(an),u=[],d=[],f=0;f<r.length;f++){n=r[f];var p=i[n];for(var m in p){var h=p[m],g=1,_=c[m],v=rn[_],y=un(g,v,_),b=P.MACSTRING(h,y);b===void 0&&(g=0,_=t.indexOf(m),_<0&&(_=t.length,t.push(m)),v=4,b=P.UTF16(h));var x=hn(b,d);u.push(pn(g,v,_,n,b.length,x));var S=l[m];if(S!==void 0){var ee=P.UTF16(h),C=hn(ee,d);u.push(pn(3,1,S,n,ee.length,C))}}}u.sort(function(e,t){return e.platformID-t.platformID||e.encodingID-t.encodingID||e.languageID-t.languageID||e.nameID-t.nameID});for(var w=new L.Table(`name`,[{name:`format`,type:`USHORT`,value:0},{name:`count`,type:`USHORT`,value:u.length},{name:`stringOffset`,type:`USHORT`,value:6+u.length*12}]),T=0;T<u.length;T++)w.fields.push({name:`record_`+T,type:`RECORD`,value:u[T]});return w.fields.push({name:`strings`,type:`LITERAL`,value:d}),w}var _n={parse:dn,make:gn},vn=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function yn(e){for(var t=0;t<vn.length;t+=1){var n=vn[t];if(e>=n.begin&&e<n.end)return t}return-1}function bn(e,t){var n={},r=new z.Parser(e,t);n.version=r.parseUShort(),n.xAvgCharWidth=r.parseShort(),n.usWeightClass=r.parseUShort(),n.usWidthClass=r.parseUShort(),n.fsType=r.parseUShort(),n.ySubscriptXSize=r.parseShort(),n.ySubscriptYSize=r.parseShort(),n.ySubscriptXOffset=r.parseShort(),n.ySubscriptYOffset=r.parseShort(),n.ySuperscriptXSize=r.parseShort(),n.ySuperscriptYSize=r.parseShort(),n.ySuperscriptXOffset=r.parseShort(),n.ySuperscriptYOffset=r.parseShort(),n.yStrikeoutSize=r.parseShort(),n.yStrikeoutPosition=r.parseShort(),n.sFamilyClass=r.parseShort(),n.panose=[];for(var i=0;i<10;i++)n.panose[i]=r.parseByte();return n.ulUnicodeRange1=r.parseULong(),n.ulUnicodeRange2=r.parseULong(),n.ulUnicodeRange3=r.parseULong(),n.ulUnicodeRange4=r.parseULong(),n.achVendID=String.fromCharCode(r.parseByte(),r.parseByte(),r.parseByte(),r.parseByte()),n.fsSelection=r.parseUShort(),n.usFirstCharIndex=r.parseUShort(),n.usLastCharIndex=r.parseUShort(),n.sTypoAscender=r.parseShort(),n.sTypoDescender=r.parseShort(),n.sTypoLineGap=r.parseShort(),n.usWinAscent=r.parseUShort(),n.usWinDescent=r.parseUShort(),n.version>=1&&(n.ulCodePageRange1=r.parseULong(),n.ulCodePageRange2=r.parseULong()),n.version>=2&&(n.sxHeight=r.parseShort(),n.sCapHeight=r.parseShort(),n.usDefaultChar=r.parseUShort(),n.usBreakChar=r.parseUShort(),n.usMaxContent=r.parseUShort()),n}function xn(e){return new L.Table(`OS/2`,[{name:`version`,type:`USHORT`,value:3},{name:`xAvgCharWidth`,type:`SHORT`,value:0},{name:`usWeightClass`,type:`USHORT`,value:0},{name:`usWidthClass`,type:`USHORT`,value:0},{name:`fsType`,type:`USHORT`,value:0},{name:`ySubscriptXSize`,type:`SHORT`,value:650},{name:`ySubscriptYSize`,type:`SHORT`,value:699},{name:`ySubscriptXOffset`,type:`SHORT`,value:0},{name:`ySubscriptYOffset`,type:`SHORT`,value:140},{name:`ySuperscriptXSize`,type:`SHORT`,value:650},{name:`ySuperscriptYSize`,type:`SHORT`,value:699},{name:`ySuperscriptXOffset`,type:`SHORT`,value:0},{name:`ySuperscriptYOffset`,type:`SHORT`,value:479},{name:`yStrikeoutSize`,type:`SHORT`,value:49},{name:`yStrikeoutPosition`,type:`SHORT`,value:258},{name:`sFamilyClass`,type:`SHORT`,value:0},{name:`bFamilyType`,type:`BYTE`,value:0},{name:`bSerifStyle`,type:`BYTE`,value:0},{name:`bWeight`,type:`BYTE`,value:0},{name:`bProportion`,type:`BYTE`,value:0},{name:`bContrast`,type:`BYTE`,value:0},{name:`bStrokeVariation`,type:`BYTE`,value:0},{name:`bArmStyle`,type:`BYTE`,value:0},{name:`bLetterform`,type:`BYTE`,value:0},{name:`bMidline`,type:`BYTE`,value:0},{name:`bXHeight`,type:`BYTE`,value:0},{name:`ulUnicodeRange1`,type:`ULONG`,value:0},{name:`ulUnicodeRange2`,type:`ULONG`,value:0},{name:`ulUnicodeRange3`,type:`ULONG`,value:0},{name:`ulUnicodeRange4`,type:`ULONG`,value:0},{name:`achVendID`,type:`CHARARRAY`,value:`XXXX`},{name:`fsSelection`,type:`USHORT`,value:0},{name:`usFirstCharIndex`,type:`USHORT`,value:0},{name:`usLastCharIndex`,type:`USHORT`,value:0},{name:`sTypoAscender`,type:`SHORT`,value:0},{name:`sTypoDescender`,type:`SHORT`,value:0},{name:`sTypoLineGap`,type:`SHORT`,value:0},{name:`usWinAscent`,type:`USHORT`,value:0},{name:`usWinDescent`,type:`USHORT`,value:0},{name:`ulCodePageRange1`,type:`ULONG`,value:0},{name:`ulCodePageRange2`,type:`ULONG`,value:0},{name:`sxHeight`,type:`SHORT`,value:0},{name:`sCapHeight`,type:`SHORT`,value:0},{name:`usDefaultChar`,type:`USHORT`,value:0},{name:`usBreakChar`,type:`USHORT`,value:0},{name:`usMaxContext`,type:`USHORT`,value:0}],e)}var Sn={parse:bn,make:xn,unicodeRanges:vn,getUnicodeRange:yn};function Cn(e,t){var n={},r=new z.Parser(e,t);switch(n.version=r.parseVersion(),n.italicAngle=r.parseFixed(),n.underlinePosition=r.parseShort(),n.underlineThickness=r.parseShort(),n.isFixedPitch=r.parseULong(),n.minMemType42=r.parseULong(),n.maxMemType42=r.parseULong(),n.minMemType1=r.parseULong(),n.maxMemType1=r.parseULong(),n.version){case 1:n.names=ze.slice();break;case 2:n.numberOfGlyphs=r.parseUShort(),n.glyphNameIndex=Array(n.numberOfGlyphs);for(var i=0;i<n.numberOfGlyphs;i++)n.glyphNameIndex[i]=r.parseUShort();n.names=[];for(var a=0;a<n.numberOfGlyphs;a++)if(n.glyphNameIndex[a]>=ze.length){var o=r.parseChar();n.names.push(r.parseString(o))}break;case 2.5:n.numberOfGlyphs=r.parseUShort(),n.offset=Array(n.numberOfGlyphs);for(var s=0;s<n.numberOfGlyphs;s++)n.offset[s]=r.parseChar();break}return n}function wn(){return new L.Table(`post`,[{name:`version`,type:`FIXED`,value:196608},{name:`italicAngle`,type:`FIXED`,value:0},{name:`underlinePosition`,type:`FWORD`,value:0},{name:`underlineThickness`,type:`FWORD`,value:0},{name:`isFixedPitch`,type:`ULONG`,value:0},{name:`minMemType42`,type:`ULONG`,value:0},{name:`maxMemType42`,type:`ULONG`,value:0},{name:`minMemType1`,type:`ULONG`,value:0},{name:`maxMemType1`,type:`ULONG`,value:0}])}var Tn={parse:Cn,make:wn},En=Array(9);En[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(R.coverage),deltaGlyphId:this.parseUShort()};if(t===2)return{substFormat:2,coverage:this.parsePointer(R.coverage),substitute:this.parseOffset16List()};A.assert(!1,`0x`+e.toString(16)+`: lookup type 1 format must be 1 or 2.`)},En[2]=function(){var e=this.parseUShort();return A.argument(e===1,`GSUB Multiple Substitution Subtable identifier-format must be 1`),{substFormat:e,coverage:this.parsePointer(R.coverage),sequences:this.parseListOfLists()}},En[3]=function(){var e=this.parseUShort();return A.argument(e===1,`GSUB Alternate Substitution Subtable identifier-format must be 1`),{substFormat:e,coverage:this.parsePointer(R.coverage),alternateSets:this.parseListOfLists()}},En[4]=function(){var e=this.parseUShort();return A.argument(e===1,`GSUB ligature table identifier-format must be 1`),{substFormat:e,coverage:this.parsePointer(R.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var Dn={sequenceIndex:R.uShort,lookupListIndex:R.uShort};En[5]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:t,coverage:this.parsePointer(R.coverage),ruleSets:this.parseListOfLists(function(){var e=this.parseUShort(),t=this.parseUShort();return{input:this.parseUShortList(e-1),lookupRecords:this.parseRecordList(t,Dn)}})};if(t===2)return{substFormat:t,coverage:this.parsePointer(R.coverage),classDef:this.parsePointer(R.classDef),classSets:this.parseListOfLists(function(){var e=this.parseUShort(),t=this.parseUShort();return{classes:this.parseUShortList(e-1),lookupRecords:this.parseRecordList(t,Dn)}})};if(t===3){var n=this.parseUShort(),r=this.parseUShort();return{substFormat:t,coverages:this.parseList(n,R.pointer(R.coverage)),lookupRecords:this.parseRecordList(r,Dn)}}A.assert(!1,`0x`+e.toString(16)+`: lookup type 5 format must be 1, 2 or 3.`)},En[6]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(R.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Dn)}})};if(t===2)return{substFormat:2,coverage:this.parsePointer(R.coverage),backtrackClassDef:this.parsePointer(R.classDef),inputClassDef:this.parsePointer(R.classDef),lookaheadClassDef:this.parsePointer(R.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Dn)}})};if(t===3)return{substFormat:3,backtrackCoverage:this.parseList(R.pointer(R.coverage)),inputCoverage:this.parseList(R.pointer(R.coverage)),lookaheadCoverage:this.parseList(R.pointer(R.coverage)),lookupRecords:this.parseRecordList(Dn)};A.assert(!1,`0x`+e.toString(16)+`: lookup type 6 format must be 1, 2 or 3.`)},En[7]=function(){var e=this.parseUShort();A.argument(e===1,`GSUB Extension Substitution subtable identifier-format must be 1`);var t=this.parseUShort(),n=new R(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:t,extension:En[t].call(n)}},En[8]=function(){var e=this.parseUShort();return A.argument(e===1,`GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1`),{substFormat:e,coverage:this.parsePointer(R.coverage),backtrackCoverage:this.parseList(R.pointer(R.coverage)),lookaheadCoverage:this.parseList(R.pointer(R.coverage)),substitutes:this.parseUShortList()}};function On(e,t){t||=0;var n=new R(e,t),r=n.parseVersion(1);return A.argument(r===1||r===1.1,`Unsupported GSUB table version.`),r===1?{version:r,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(En)}:{version:r,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(En),variations:n.parseFeatureVariationsList()}}var kn=Array(9);kn[1]=function(e){return e.substFormat===1?new L.Table(`substitutionTable`,[{name:`substFormat`,type:`USHORT`,value:1},{name:`coverage`,type:`TABLE`,value:new L.Coverage(e.coverage)},{name:`deltaGlyphID`,type:`USHORT`,value:e.deltaGlyphId}]):new L.Table(`substitutionTable`,[{name:`substFormat`,type:`USHORT`,value:2},{name:`coverage`,type:`TABLE`,value:new L.Coverage(e.coverage)}].concat(L.ushortList(`substitute`,e.substitute)))},kn[3]=function(e){return A.assert(e.substFormat===1,`Lookup type 3 substFormat must be 1.`),new L.Table(`substitutionTable`,[{name:`substFormat`,type:`USHORT`,value:1},{name:`coverage`,type:`TABLE`,value:new L.Coverage(e.coverage)}].concat(L.tableList(`altSet`,e.alternateSets,function(e){return new L.Table(`alternateSetTable`,L.ushortList(`alternate`,e))})))},kn[4]=function(e){return A.assert(e.substFormat===1,`Lookup type 4 substFormat must be 1.`),new L.Table(`substitutionTable`,[{name:`substFormat`,type:`USHORT`,value:1},{name:`coverage`,type:`TABLE`,value:new L.Coverage(e.coverage)}].concat(L.tableList(`ligSet`,e.ligatureSets,function(e){return new L.Table(`ligatureSetTable`,L.tableList(`ligature`,e,function(e){return new L.Table(`ligatureTable`,[{name:`ligGlyph`,type:`USHORT`,value:e.ligGlyph}].concat(L.ushortList(`component`,e.components,e.components.length+1)))}))})))};function An(e){return new L.Table(`GSUB`,[{name:`version`,type:`ULONG`,value:65536},{name:`scripts`,type:`TABLE`,value:new L.ScriptList(e.scripts)},{name:`features`,type:`TABLE`,value:new L.FeatureList(e.features)},{name:`lookups`,type:`TABLE`,value:new L.LookupList(e.lookups,kn)}])}var jn={parse:On,make:An};function Mn(e,t){var n=new z.Parser(e,t),r=n.parseULong();A.argument(r===1,`Unsupported META table version.`),n.parseULong(),n.parseULong();for(var i=n.parseULong(),a={},o=0;o<i;o++){var s=n.parseTag(),c=n.parseULong(),l=n.parseULong();a[s]=N.UTF8(e,t+c,l)}return a}function Nn(e){var t=Object.keys(e).length,n=``,r=16+t*12,i=new L.Table(`meta`,[{name:`version`,type:`ULONG`,value:1},{name:`flags`,type:`ULONG`,value:0},{name:`offset`,type:`ULONG`,value:r},{name:`numTags`,type:`ULONG`,value:t}]);for(var a in e){var o=n.length;n+=e[a],i.fields.push({name:`tag `+a,type:`TAG`,value:a}),i.fields.push({name:`offset `+a,type:`ULONG`,value:r+o}),i.fields.push({name:`length `+a,type:`ULONG`,value:e[a].length})}return i.fields.push({name:`stringPool`,type:`CHARARRAY`,value:n}),i}var Pn={parse:Mn,make:Nn};function Fn(e){return Math.log(e)/Math.log(2)|0}function In(e){for(;e.length%4!=0;)e.push(0);for(var t=0,n=0;n<e.length;n+=4)t+=(e[n]<<24)+(e[n+1]<<16)+(e[n+2]<<8)+e[n+3];return t%=2**32,t}function Ln(e,t,n,r){return new L.Record(`Table Record`,[{name:`tag`,type:`TAG`,value:e===void 0?``:e},{name:`checkSum`,type:`ULONG`,value:t===void 0?0:t},{name:`offset`,type:`ULONG`,value:n===void 0?0:n},{name:`length`,type:`ULONG`,value:r===void 0?0:r}])}function Rn(e){var t=new L.Table(`sfnt`,[{name:`version`,type:`TAG`,value:`OTTO`},{name:`numTables`,type:`USHORT`,value:0},{name:`searchRange`,type:`USHORT`,value:0},{name:`entrySelector`,type:`USHORT`,value:0},{name:`rangeShift`,type:`USHORT`,value:0}]);t.tables=e,t.numTables=e.length;var n=2**Fn(t.numTables);t.searchRange=16*n,t.entrySelector=Fn(n),t.rangeShift=t.numTables*16-t.searchRange;for(var r=[],i=[],a=t.sizeOf()+Ln().sizeOf()*t.numTables;a%4!=0;)a+=1,i.push({name:`padding`,type:`BYTE`,value:0});for(var o=0;o<e.length;o+=1){var s=e[o];A.argument(s.tableName.length===4,`Table name`+s.tableName+` is invalid.`);var c=s.sizeOf(),l=Ln(s.tableName,In(s.encode()),a,c);for(r.push({name:l.tag+` Table Record`,type:`RECORD`,value:l}),i.push({name:s.tableName+` table`,type:`RECORD`,value:s}),a+=c,A.argument(!isNaN(a),`Something went wrong calculating the offset.`);a%4!=0;)a+=1,i.push({name:`padding`,type:`BYTE`,value:0})}return r.sort(function(e,t){return e.value.tag>t.value.tag?1:-1}),t.fields=t.fields.concat(r),t.fields=t.fields.concat(i),t}function zn(e,t,n){for(var r=0;r<t.length;r+=1){var i=e.charToGlyphIndex(t[r]);if(i>0)return e.glyphs.get(i).getMetrics()}return n}function Bn(e){for(var t=0,n=0;n<e.length;n+=1)t+=e[n];return t/e.length}function Vn(e){for(var t=[],n=[],r=[],i=[],a=[],o=[],s=[],c,l=0,u=0,d=0,f=0,p=0,m=0;m<e.glyphs.length;m+=1){var h=e.glyphs.get(m),g=h.unicode|0;if(isNaN(h.advanceWidth))throw Error(`Glyph `+h.name+` (`+m+`): advanceWidth is not a number.`);(c>g||c===void 0)&&g>0&&(c=g),l<g&&(l=g);var _=Sn.getUnicodeRange(g);if(_<32)u|=1<<_;else if(_<64)d|=1<<_-32;else if(_<96)f|=1<<_-64;else if(_<123)p|=1<<_-96;else throw Error(`Unicode ranges bits > 123 are reserved for internal usage`);if(h.name!==`.notdef`){var v=h.getMetrics();t.push(v.xMin),n.push(v.yMin),r.push(v.xMax),i.push(v.yMax),o.push(v.leftSideBearing),s.push(v.rightSideBearing),a.push(h.advanceWidth)}}var y={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,n),xMax:Math.max.apply(null,r),yMax:Math.max.apply(null,i),advanceWidthMax:Math.max.apply(null,a),advanceWidthAvg:Bn(a),minLeftSideBearing:Math.min.apply(null,o),maxLeftSideBearing:Math.max.apply(null,o),minRightSideBearing:Math.min.apply(null,s)};y.ascender=e.ascender,y.descender=e.descender;var b=Ht.make({flags:3,unitsPerEm:e.unitsPerEm,xMin:y.xMin,yMin:y.yMin,xMax:y.xMax,yMax:y.yMax,lowestRecPPEM:3,createdTimestamp:e.createdTimestamp}),x=Gt.make({ascender:y.ascender,descender:y.descender,advanceWidthMax:y.advanceWidthMax,minLeftSideBearing:y.minLeftSideBearing,minRightSideBearing:y.minRightSideBearing,xMaxExtent:y.maxLeftSideBearing+(y.xMax-y.xMin),numberOfHMetrics:e.glyphs.length}),S=en.make(e.glyphs.length),ee=Sn.make({xAvgCharWidth:Math.round(y.advanceWidthAvg),usWeightClass:e.tables.os2.usWeightClass,usWidthClass:e.tables.os2.usWidthClass,usFirstCharIndex:c,usLastCharIndex:l,ulUnicodeRange1:u,ulUnicodeRange2:d,ulUnicodeRange3:f,ulUnicodeRange4:p,fsSelection:e.tables.os2.fsSelection,sTypoAscender:y.ascender,sTypoDescender:y.descender,sTypoLineGap:0,usWinAscent:y.yMax,usWinDescent:Math.abs(y.yMin),ulCodePageRange1:1,sxHeight:zn(e,`xyvw`,{yMax:Math.round(y.ascender/2)}).yMax,sCapHeight:zn(e,`HIKLEFJMNTZBDPRAGOQSUVWXY`,y).yMax,usDefaultChar:e.hasChar(` `)?32:0,usBreakChar:e.hasChar(` `)?32:0}),C=Jt.make(e.glyphs),w=Fe.make(e.glyphs),T=e.getEnglishName(`fontFamily`),E=e.getEnglishName(`fontSubfamily`),D=T+` `+E,O=e.getEnglishName(`postScriptName`);O||=T.replace(/\s/g,``)+`-`+E;var k={};for(var A in e.names)k[A]=e.names[A];k.uniqueID||={en:e.getEnglishName(`manufacturer`)+`:`+D},k.postScriptName||={en:O},k.preferredFamily||=e.names.fontFamily,k.preferredSubfamily||=e.names.fontSubfamily;var j=[],M=_n.make(k,j),N=j.length>0?Zt.make(j):void 0,P=Tn.make(),F=zt.make(e.glyphs,{version:e.getEnglishName(`version`),fullName:D,familyName:T,weightName:E,postScriptName:O,unitsPerEm:e.unitsPerEm,fontBBox:[0,y.yMin,y.ascender,y.advanceWidthMax]}),te=e.metas&&Object.keys(e.metas).length>0?Pn.make(e.metas):void 0,ne=[b,x,S,ee,M,w,P,F,C];N&&ne.push(N),e.tables.gsub&&ne.push(jn.make(e.tables.gsub)),te&&ne.push(te);for(var re=Rn(ne),ie=In(re.encode()),ae=re.fields,I=!1,oe=0;oe<ae.length;oe+=1)if(ae[oe].name===`head table`){ae[oe].value.checkSumAdjustment=2981146554-ie,I=!0;break}if(!I)throw Error(`Could not find head table with checkSum to adjust.`);return re}var Hn={make:Rn,fontToTable:Vn,computeCheckSum:In};function Un(e,t){for(var n=0,r=e.length-1;n<=r;){var i=n+r>>>1,a=e[i].tag;if(a===t)return i;a<t?n=i+1:r=i-1}return-n-1}function Wn(e,t){for(var n=0,r=e.length-1;n<=r;){var i=n+r>>>1,a=e[i];if(a===t)return i;a<t?n=i+1:r=i-1}return-n-1}function Gn(e,t){for(var n,r=0,i=e.length-1;r<=i;){var a=r+i>>>1;n=e[a];var o=n.start;if(o===t)return n;o<t?r=a+1:i=a-1}if(r>0)return n=e[r-1],t>n.end?0:n}function Kn(e,t){this.font=e,this.tableName=t}Kn.prototype={searchTag:Un,binSearch:Wn,getTable:function(e){var t=this.font.tables[this.tableName];return!t&&e&&(t=this.font.tables[this.tableName]=this.createDefaultTable()),t},getScriptNames:function(){var e=this.getTable();return e?e.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){var e=this.getTable();if(e){for(var t=!1,n=0;n<e.scripts.length;n++){var r=e.scripts[n].tag;if(r===`DFLT`)return r;r===`latn`&&(t=!0)}if(t)return`latn`}},getScriptTable:function(e,t){var n=this.getTable(t);if(n){e||=`DFLT`;var r=n.scripts,i=Un(n.scripts,e);if(i>=0)return r[i].script;if(t){var a={tag:e,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return r.splice(-1-i,0,a),a.script}}},getLangSysTable:function(e,t,n){var r=this.getScriptTable(e,n);if(r){if(!t||t===`dflt`||t===`DFLT`)return r.defaultLangSys;var i=Un(r.langSysRecords,t);if(i>=0)return r.langSysRecords[i].langSys;if(n){var a={tag:t,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return r.langSysRecords.splice(-1-i,0,a),a.langSys}}},getFeatureTable:function(e,t,n,r){var i=this.getLangSysTable(e,t,r);if(i){for(var a,o=i.featureIndexes,s=this.font.tables[this.tableName].features,c=0;c<o.length;c++)if(a=s[o[c]],a.tag===n)return a.feature;if(r){var l=s.length;return A.assert(l===0||n>=s[l-1].tag,`Features must be added in alphabetical order.`),a={tag:n,feature:{params:0,lookupListIndexes:[]}},s.push(a),o.push(l),a.feature}}},getLookupTables:function(e,t,n,r,i){var a=this.getFeatureTable(e,t,n,i),o=[];if(a){for(var s,c=a.lookupListIndexes,l=this.font.tables[this.tableName].lookups,u=0;u<c.length;u++)s=l[c[u]],s.lookupType===r&&o.push(s);if(o.length===0&&i){s={lookupType:r,lookupFlag:0,subtables:[],markFilteringSet:void 0};var d=l.length;return l.push(s),c.push(d),[s]}}return o},getGlyphClass:function(e,t){switch(e.format){case 1:return e.startGlyph<=t&&t<e.startGlyph+e.classes.length?e.classes[t-e.startGlyph]:0;case 2:var n=Gn(e.ranges,t);return n?n.classId:0}},getCoverageIndex:function(e,t){switch(e.format){case 1:var n=Wn(e.glyphs,t);return n>=0?n:-1;case 2:var r=Gn(e.ranges,t);return r?r.index+t-r.start:-1}},expandCoverage:function(e){if(e.format===1)return e.glyphs;for(var t=[],n=e.ranges,r=0;r<n.length;r++)for(var i=n[r],a=i.start,o=i.end,s=a;s<=o;s++)t.push(s);return t}};function qn(e){Kn.call(this,e,`gpos`)}qn.prototype=Kn.prototype,qn.prototype.getKerningValue=function(e,t,n){for(var r=this,i=0;i<e.length;i++)for(var a=e[i].subtables,o=0;o<a.length;o++){var s=a[o],c=r.getCoverageIndex(s.coverage,t);if(!(c<0))switch(s.posFormat){case 1:for(var l=s.pairSets[c],u=0;u<l.length;u++){var d=l[u];if(d.secondGlyph===n)return d.value1&&d.value1.xAdvance||0}break;case 2:var f=r.getGlyphClass(s.classDef1,t),p=r.getGlyphClass(s.classDef2,n),m=s.classRecords[f][p];return m.value1&&m.value1.xAdvance||0}}return 0},qn.prototype.getKerningTables=function(e,t){if(this.font.tables.gpos)return this.getLookupTables(e,t,`kern`,2)};function Jn(e){Kn.call(this,e,`gsub`)}function Yn(e,t){var n=e.length;if(n!==t.length)return!1;for(var r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function Xn(e,t,n){for(var r=e.subtables,i=0;i<r.length;i++){var a=r[i];if(a.substFormat===t)return a}if(n)return r.push(n),n}Jn.prototype=Kn.prototype,Jn.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:`DFLT`,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Jn.prototype.getSingle=function(e,t,n){for(var r=this,i=[],a=this.getLookupTables(t,n,e,1),o=0;o<a.length;o++)for(var s=a[o].subtables,c=0;c<s.length;c++){var l=s[c],u=r.expandCoverage(l.coverage),d=void 0;if(l.substFormat===1){var f=l.deltaGlyphId;for(d=0;d<u.length;d++){var p=u[d];i.push({sub:p,by:p+f})}}else{var m=l.substitute;for(d=0;d<u.length;d++)i.push({sub:u[d],by:m[d]})}}return i},Jn.prototype.getAlternates=function(e,t,n){for(var r=this,i=[],a=this.getLookupTables(t,n,e,3),o=0;o<a.length;o++)for(var s=a[o].subtables,c=0;c<s.length;c++)for(var l=s[c],u=r.expandCoverage(l.coverage),d=l.alternateSets,f=0;f<u.length;f++)i.push({sub:u[f],by:d[f]});return i},Jn.prototype.getLigatures=function(e,t,n){for(var r=this,i=[],a=this.getLookupTables(t,n,e,4),o=0;o<a.length;o++)for(var s=a[o].subtables,c=0;c<s.length;c++)for(var l=s[c],u=r.expandCoverage(l.coverage),d=l.ligatureSets,f=0;f<u.length;f++)for(var p=u[f],m=d[f],h=0;h<m.length;h++){var g=m[h];i.push({sub:[p].concat(g.components),by:g.ligGlyph})}return i},Jn.prototype.addSingle=function(e,t,n,r){var i=this.getLookupTables(n,r,e,1,!0)[0],a=Xn(i,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});A.assert(a.coverage.format===1,`Ligature: unable to modify coverage table format `+a.coverage.format);var o=t.sub,s=this.binSearch(a.coverage.glyphs,o);s<0&&(s=-1-s,a.coverage.glyphs.splice(s,0,o),a.substitute.splice(s,0,0)),a.substitute[s]=t.by},Jn.prototype.addAlternate=function(e,t,n,r){var i=this.getLookupTables(n,r,e,3,!0)[0],a=Xn(i,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});A.assert(a.coverage.format===1,`Ligature: unable to modify coverage table format `+a.coverage.format);var o=t.sub,s=this.binSearch(a.coverage.glyphs,o);s<0&&(s=-1-s,a.coverage.glyphs.splice(s,0,o),a.alternateSets.splice(s,0,0)),a.alternateSets[s]=t.by},Jn.prototype.addLigature=function(e,t,n,r){var i=this.getLookupTables(n,r,e,4,!0)[0],a=i.subtables[0];a||(a={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},i.subtables[0]=a),A.assert(a.coverage.format===1,`Ligature: unable to modify coverage table format `+a.coverage.format);var o=t.sub[0],s=t.sub.slice(1),c={ligGlyph:t.by,components:s},l=this.binSearch(a.coverage.glyphs,o);if(l>=0){for(var u=a.ligatureSets[l],d=0;d<u.length;d++)if(Yn(u[d].components,s))return;u.push(c)}else l=-1-l,a.coverage.glyphs.splice(l,0,o),a.ligatureSets.splice(l,0,[c])},Jn.prototype.getFeature=function(e,t,n){if(/ss\d\d/.test(e))return this.getSingle(e,t,n);switch(e){case`aalt`:case`salt`:return this.getSingle(e,t,n).concat(this.getAlternates(e,t,n));case`dlig`:case`liga`:case`rlig`:return this.getLigatures(e,t,n)}},Jn.prototype.add=function(e,t,n,r){if(/ss\d\d/.test(e))return this.addSingle(e,t,n,r);switch(e){case`aalt`:case`salt`:return typeof t.by==`number`?this.addSingle(e,t,n,r):this.addAlternate(e,t,n,r);case`dlig`:case`liga`:case`rlig`:return this.addLigature(e,t,n,r)}};function U(){return typeof window<`u`}function Zn(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r<e.length;++r)n[r]=e[r];return t}function Qn(e){for(var t=new Buffer(e.byteLength),n=new Uint8Array(e),r=0;r<t.length;++r)t[r]=n[r];return t}function $n(e,t){if(!e)throw t}var er,tr,nr,rr;function ir(e){this.font=e,this._fpgmState=this._prepState=void 0,this._errorState=0}function ar(e){return e}function or(e){return Math.sign(e)*Math.round(Math.abs(e))}function sr(e){return Math.sign(e)*Math.round(Math.abs(e*2))/2}function cr(e){return Math.sign(e)*(Math.round(Math.abs(e)+.5)-.5)}function lr(e){return Math.sign(e)*Math.ceil(Math.abs(e))}function ur(e){return Math.sign(e)*Math.floor(Math.abs(e))}var dr=function(e){var t=this.srPeriod,n=this.srPhase,r=this.srThreshold,i=1;return e<0&&(e=-e,i=-1),e+=r-n,e=Math.trunc(e/t)*t,e+=n,e<0?n*i:e*i},fr={x:1,y:0,axis:`x`,distance:function(e,t,n,r){return(n?e.xo:e.x)-(r?t.xo:t.x)},interpolate:function(e,t,n,r){var i,a,o,s,c,l,u;if(!r||r===this){if(i=e.xo-t.xo,a=e.xo-n.xo,c=t.x-t.xo,l=n.x-n.xo,o=Math.abs(i),s=Math.abs(a),u=o+s,u===0){e.x=e.xo+(c+l)/2;return}e.x=e.xo+(c*s+l*o)/u;return}if(i=r.distance(e,t,!0,!0),a=r.distance(e,n,!0,!0),c=r.distance(t,t,!1,!0),l=r.distance(n,n,!1,!0),o=Math.abs(i),s=Math.abs(a),u=o+s,u===0){fr.setRelative(e,e,(c+l)/2,r,!0);return}fr.setRelative(e,e,(c*s+l*o)/u,r,!0)},normalSlope:-1/0,setRelative:function(e,t,n,r,i){if(!r||r===this){e.x=(i?t.xo:t.x)+n;return}var a=i?t.xo:t.x,o=i?t.yo:t.y,s=a+n*r.x,c=o+n*r.y;e.x=s+(e.y-c)/r.normalSlope},slope:0,touch:function(e){e.xTouched=!0},touched:function(e){return e.xTouched},untouch:function(e){e.xTouched=!1}},pr={x:0,y:1,axis:`y`,distance:function(e,t,n,r){return(n?e.yo:e.y)-(r?t.yo:t.y)},interpolate:function(e,t,n,r){var i,a,o,s,c,l,u;if(!r||r===this){if(i=e.yo-t.yo,a=e.yo-n.yo,c=t.y-t.yo,l=n.y-n.yo,o=Math.abs(i),s=Math.abs(a),u=o+s,u===0){e.y=e.yo+(c+l)/2;return}e.y=e.yo+(c*s+l*o)/u;return}if(i=r.distance(e,t,!0,!0),a=r.distance(e,n,!0,!0),c=r.distance(t,t,!1,!0),l=r.distance(n,n,!1,!0),o=Math.abs(i),s=Math.abs(a),u=o+s,u===0){pr.setRelative(e,e,(c+l)/2,r,!0);return}pr.setRelative(e,e,(c*s+l*o)/u,r,!0)},normalSlope:0,setRelative:function(e,t,n,r,i){if(!r||r===this){e.y=(i?t.yo:t.y)+n;return}var a=i?t.xo:t.x,o=i?t.yo:t.y,s=a+n*r.x;e.y=o+n*r.y+r.normalSlope*(e.x-s)},slope:1/0,touch:function(e){e.yTouched=!0},touched:function(e){return e.yTouched},untouch:function(e){e.yTouched=!1}};Object.freeze(fr),Object.freeze(pr);function mr(e,t){this.x=e,this.y=t,this.axis=void 0,this.slope=t/e,this.normalSlope=-e/t,Object.freeze(this)}mr.prototype.distance=function(e,t,n,r){return this.x*fr.distance(e,t,n,r)+this.y*pr.distance(e,t,n,r)},mr.prototype.interpolate=function(e,t,n,r){var i,a,o,s,c,l,u;if(o=r.distance(e,t,!0,!0),s=r.distance(e,n,!0,!0),i=r.distance(t,t,!1,!0),a=r.distance(n,n,!1,!0),c=Math.abs(o),l=Math.abs(s),u=c+l,u===0){this.setRelative(e,e,(i+a)/2,r,!0);return}this.setRelative(e,e,(i*l+a*c)/u,r,!0)},mr.prototype.setRelative=function(e,t,n,r,i){r||=this;var a=i?t.xo:t.x,o=i?t.yo:t.y,s=a+n*r.x,c=o+n*r.y,l=r.normalSlope,u=this.slope,d=e.x,f=e.y;e.x=(u*d-l*s+c-f)/(u-l),e.y=u*(e.x-d)+f},mr.prototype.touch=function(e){e.xTouched=!0,e.yTouched=!0};function hr(e,t){var n=Math.sqrt(e*e+t*t);return e/=n,t/=n,e===1&&t===0?fr:e===0&&t===1?pr:new mr(e,t)}function gr(e,t,n,r){this.x=this.xo=Math.round(e*64)/64,this.y=this.yo=Math.round(t*64)/64,this.lastPointOfContour=n,this.onCurve=r,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}gr.prototype.nextTouched=function(e){for(var t=this.nextPointOnContour;!e.touched(t)&&t!==this;)t=t.nextPointOnContour;return t},gr.prototype.prevTouched=function(e){for(var t=this.prevPointOnContour;!e.touched(t)&&t!==this;)t=t.prevPointOnContour;return t};var _r=Object.freeze(new gr(0,0)),vr={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function yr(e,t){switch(this.env=e,this.stack=[],this.prog=t,e){case`glyf`:this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case`prep`:this.fv=this.pv=this.dpv=fr,this.round=or}}ir.prototype.exec=function(t,n){if(typeof n!=`number`)throw Error(`Point size is not a number!`);if(!(this._errorState>2)){var r=this.font,i=this._prepState;if(!i||i.ppem!==n){var a=this._fpgmState;if(!a){yr.prototype=vr,a=this._fpgmState=new yr(`fpgm`,r.tables.fpgm),a.funcs=[],a.font=r,e.DEBUG&&(console.log(`---EXEC FPGM---`),a.step=-1);try{tr(a)}catch(e){console.log(`Hinting error in FPGM:`+e),this._errorState=3;return}}yr.prototype=a,i=this._prepState=new yr(`prep`,r.tables.prep),i.ppem=n;var o=r.tables.cvt;if(o)for(var s=i.cvt=Array(o.length),c=n/r.unitsPerEm,l=0;l<o.length;l++)s[l]=o[l]*c;else i.cvt=[];e.DEBUG&&(console.log(`---EXEC PREP---`),i.step=-1);try{tr(i)}catch(e){this._errorState<2&&console.log(`Hinting error in PREP:`+e),this._errorState=2}}if(!(this._errorState>1))try{return nr(t,i)}catch(e){this._errorState<1&&(console.log(`Hinting error:`+e),console.log(`Note: further hinting errors are silenced`)),this._errorState=1;return}}},nr=function(t,n){var r=n.ppem/n.font.unitsPerEm,i=r,a=t.components,o,s,c;if(yr.prototype=n,!a)c=new yr(`glyf`,t.instructions),e.DEBUG&&(console.log(`---EXEC GLYPH---`),c.step=-1),rr(t,c,r,i),s=c.gZone;else{var l=n.font;s=[],o=[];for(var u=0;u<a.length;u++){var d=a[u],f=l.glyphs.get(d.glyphIndex);c=new yr(`glyf`,f.instructions),e.DEBUG&&(console.log(`---EXEC COMP `+u+`---`),c.step=-1),rr(f,c,r,i);for(var p=Math.round(d.dx*r),m=Math.round(d.dy*i),h=c.gZone,g=c.contours,_=0;_<h.length;_++){var v=h[_];v.xTouched=v.yTouched=!1,v.xo=v.x+=p,v.yo=v.y+=m}var y=s.length;s.push.apply(s,h);for(var b=0;b<g.length;b++)o.push(g[b]+y)}t.instructions&&!c.inhibitGridFit&&(c=new yr(`glyf`,t.instructions),c.gZone=c.z0=c.z1=c.z2=s,c.contours=o,s.push(new gr(0,0),new gr(Math.round(t.advanceWidth*r),0)),e.DEBUG&&(console.log(`---EXEC COMPOSITE---`),c.step=-1),tr(c),s.length-=2)}return s},rr=function(t,n,r,i){for(var a=t.points||[],o=a.length,s=n.gZone=n.z0=n.z1=n.z2=[],c=n.contours=[],l,u=0;u<o;u++)l=a[u],s[u]=new gr(l.x*r,l.y*i,l.lastPointOfContour,l.onCurve);for(var d,f,p=0;p<o;p++)l=s[p],d||(d=l,c.push(p)),l.lastPointOfContour?(l.nextPointOnContour=d,d.prevPointOnContour=l,d=void 0):(f=s[p+1],l.nextPointOnContour=f,f.prevPointOnContour=l);if(!n.inhibitGridFit){if(e.DEBUG){console.log(`PROCESSING GLYPH`,n.stack);for(var m=0;m<o;m++)console.log(m,s[m].x,s[m].y)}if(s.push(new gr(0,0),new gr(Math.round(t.advanceWidth*r),0)),tr(n),s.length-=2,e.DEBUG){console.log(`FINISHED GLYPH`,n.stack);for(var h=0;h<o;h++)console.log(h,s[h].x,s[h].y)}}},tr=function(t){var n=t.prog;if(n){var r=n.length,i;for(t.ip=0;t.ip<r;t.ip++){if(e.DEBUG&&t.step++,i=er[n[t.ip]],!i)throw Error(`unknown instruction: 0x`+Number(n[t.ip]).toString(16));i(t)}}};function br(e){for(var t=e.tZone=Array(e.gZone.length),n=0;n<t.length;n++)t[n]=new gr(0,0)}function xr(e,t){var n=e.prog,r=e.ip,i=1,a;do if(a=n[++r],a===88)i++;else if(a===89)i--;else if(a===64)r+=n[r+1]+1;else if(a===65)r+=2*n[r+1]+1;else if(a>=176&&a<=183)r+=a-176+1;else if(a>=184&&a<=191)r+=(a-184+1)*2;else if(t&&i===1&&a===27)break;while(i>0);e.ip=r}function Sr(t,n){e.DEBUG&&console.log(n.step,`SVTCA[`+t.axis+`]`),n.fv=n.pv=n.dpv=t}function Cr(t,n){e.DEBUG&&console.log(n.step,`SPVTCA[`+t.axis+`]`),n.pv=n.dpv=t}function wr(t,n){e.DEBUG&&console.log(n.step,`SFVTCA[`+t.axis+`]`),n.fv=t}function Tr(t,n){var r=n.stack,i=r.pop(),a=r.pop(),o=n.z2[i],s=n.z1[a];e.DEBUG&&console.log(`SPVTL[`+t+`]`,i,a);var c,l;t?(c=o.y-s.y,l=s.x-o.x):(c=s.x-o.x,l=s.y-o.y),n.pv=n.dpv=hr(c,l)}function Er(t,n){var r=n.stack,i=r.pop(),a=r.pop(),o=n.z2[i],s=n.z1[a];e.DEBUG&&console.log(`SFVTL[`+t+`]`,i,a);var c,l;t?(c=o.y-s.y,l=s.x-o.x):(c=s.x-o.x,l=s.y-o.y),n.fv=hr(c,l)}function Dr(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`SPVFS[]`,r,i),t.pv=t.dpv=hr(i,r)}function Or(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`SPVFS[]`,r,i),t.fv=hr(i,r)}function kr(t){var n=t.stack,r=t.pv;e.DEBUG&&console.log(t.step,`GPV[]`),n.push(r.x*16384),n.push(r.y*16384)}function Ar(t){var n=t.stack,r=t.fv;e.DEBUG&&console.log(t.step,`GFV[]`),n.push(r.x*16384),n.push(r.y*16384)}function jr(t){t.fv=t.pv,e.DEBUG&&console.log(t.step,`SFVTPV[]`)}function Mr(t){var n=t.stack,r=n.pop(),i=n.pop(),a=n.pop(),o=n.pop(),s=n.pop(),c=t.z0,l=t.z1,u=c[r],d=c[i],f=l[a],p=l[o],m=t.z2[s];e.DEBUG&&console.log(`ISECT[], `,r,i,a,o,s);var h=u.x,g=u.y,_=d.x,v=d.y,y=f.x,b=f.y,x=p.x,S=p.y,ee=(h-_)*(b-S)-(g-v)*(y-x),C=h*v-g*_,w=y*S-b*x;m.x=(C*(y-x)-w*(h-_))/ee,m.y=(C*(b-S)-w*(g-v))/ee}function Nr(t){t.rp0=t.stack.pop(),e.DEBUG&&console.log(t.step,`SRP0[]`,t.rp0)}function Pr(t){t.rp1=t.stack.pop(),e.DEBUG&&console.log(t.step,`SRP1[]`,t.rp1)}function Fr(t){t.rp2=t.stack.pop(),e.DEBUG&&console.log(t.step,`SRP2[]`,t.rp2)}function Ir(t){var n=t.stack.pop();switch(e.DEBUG&&console.log(t.step,`SZP0[]`,n),t.zp0=n,n){case 0:t.tZone||br(t),t.z0=t.tZone;break;case 1:t.z0=t.gZone;break;default:throw Error(`Invalid zone pointer`)}}function Lr(t){var n=t.stack.pop();switch(e.DEBUG&&console.log(t.step,`SZP1[]`,n),t.zp1=n,n){case 0:t.tZone||br(t),t.z1=t.tZone;break;case 1:t.z1=t.gZone;break;default:throw Error(`Invalid zone pointer`)}}function Rr(t){var n=t.stack.pop();switch(e.DEBUG&&console.log(t.step,`SZP2[]`,n),t.zp2=n,n){case 0:t.tZone||br(t),t.z2=t.tZone;break;case 1:t.z2=t.gZone;break;default:throw Error(`Invalid zone pointer`)}}function zr(t){var n=t.stack.pop();switch(e.DEBUG&&console.log(t.step,`SZPS[]`,n),t.zp0=t.zp1=t.zp2=n,n){case 0:t.tZone||br(t),t.z0=t.z1=t.z2=t.tZone;break;case 1:t.z0=t.z1=t.z2=t.gZone;break;default:throw Error(`Invalid zone pointer`)}}function Br(t){t.loop=t.stack.pop(),e.DEBUG&&console.log(t.step,`SLOOP[]`,t.loop)}function Vr(t){e.DEBUG&&console.log(t.step,`RTG[]`),t.round=or}function Hr(t){e.DEBUG&&console.log(t.step,`RTHG[]`),t.round=cr}function Ur(t){var n=t.stack.pop();e.DEBUG&&console.log(t.step,`SMD[]`,n),t.minDis=n/64}function Wr(t){e.DEBUG&&console.log(t.step,`ELSE[]`),xr(t,!1)}function Gr(t){var n=t.stack.pop();e.DEBUG&&console.log(t.step,`JMPR[]`,n),t.ip+=n-1}function Kr(t){var n=t.stack.pop();e.DEBUG&&console.log(t.step,`SCVTCI[]`,n),t.cvCutIn=n/64}function qr(t){var n=t.stack;e.DEBUG&&console.log(t.step,`DUP[]`),n.push(n[n.length-1])}function Jr(t){e.DEBUG&&console.log(t.step,`POP[]`),t.stack.pop()}function Yr(t){e.DEBUG&&console.log(t.step,`CLEAR[]`),t.stack.length=0}function W(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`SWAP[]`),n.push(r),n.push(i)}function Xr(t){var n=t.stack;e.DEBUG&&console.log(t.step,`DEPTH[]`),n.push(n.length)}function Zr(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`LOOPCALL[]`,r,i);var a=t.ip,o=t.prog;t.prog=t.funcs[r];for(var s=0;s<i;s++)tr(t),e.DEBUG&&console.log(++t.step,s+1<i?`next loopcall`:`done loopcall`,s);t.ip=a,t.prog=o}function Qr(t){var n=t.stack.pop();e.DEBUG&&console.log(t.step,`CALL[]`,n);var r=t.ip,i=t.prog;t.prog=t.funcs[n],tr(t),t.ip=r,t.prog=i,e.DEBUG&&console.log(++t.step,`returning from`,n)}function $r(t){var n=t.stack,r=n.pop();e.DEBUG&&console.log(t.step,`CINDEX[]`,r),n.push(n[n.length-r])}function ei(t){var n=t.stack,r=n.pop();e.DEBUG&&console.log(t.step,`MINDEX[]`,r),n.push(n.splice(n.length-r,1)[0])}function ti(t){if(t.env!==`fpgm`)throw Error(`FDEF not allowed here`);var n=t.stack,r=t.prog,i=t.ip,a=n.pop(),o=i;for(e.DEBUG&&console.log(t.step,`FDEF[]`,a);r[++i]!==45;);t.ip=i,t.funcs[a]=r.slice(o+1,i)}function G(t,n){var r=n.stack.pop(),i=n.z0[r],a=n.fv,o=n.pv;e.DEBUG&&console.log(n.step,`MDAP[`+t+`]`,r);var s=o.distance(i,_r);t&&(s=n.round(s)),a.setRelative(i,_r,s,o),a.touch(i),n.rp0=n.rp1=r}function ni(t,n){var r=n.z2,i=r.length-2,a,o,s;e.DEBUG&&console.log(n.step,`IUP[`+t.axis+`]`);for(var c=0;c<i;c++)a=r[c],!t.touched(a)&&(o=a.prevTouched(t),o!==a&&(s=a.nextTouched(t),o===s&&t.setRelative(a,a,t.distance(o,o,!1,!0),t,!0),t.interpolate(a,o,s,t)))}function ri(t,n){for(var r=n.stack,i=t?n.rp1:n.rp2,a=(t?n.z0:n.z1)[i],o=n.fv,s=n.pv,c=n.loop,l=n.z2;c--;){var u=r.pop(),d=l[u],f=s.distance(a,a,!1,!0);o.setRelative(d,d,f,s),o.touch(d),e.DEBUG&&console.log(n.step,(n.loop>1?`loop `+(n.loop-c)+`: `:``)+`SHP[`+(t?`rp1`:`rp2`)+`]`,u)}n.loop=1}function K(t,n){var r=n.stack,i=t?n.rp1:n.rp2,a=(t?n.z0:n.z1)[i],o=n.fv,s=n.pv,c=r.pop(),l=n.z2[n.contours[c]],u=l;e.DEBUG&&console.log(n.step,`SHC[`+t+`]`,c);var d=s.distance(a,a,!1,!0);do u!==a&&o.setRelative(u,u,d,s),u=u.nextPointOnContour;while(u!==l)}function q(t,n){var r=n.stack,i=t?n.rp1:n.rp2,a=(t?n.z0:n.z1)[i],o=n.fv,s=n.pv,c=r.pop();e.DEBUG&&console.log(n.step,`SHZ[`+t+`]`,c);var l;switch(c){case 0:l=n.tZone;break;case 1:l=n.gZone;break;default:throw Error(`Invalid zone`)}for(var u,d=s.distance(a,a,!1,!0),f=l.length-2,p=0;p<f;p++)u=l[p],o.setRelative(u,u,d,s)}function ii(t){for(var n=t.stack,r=t.loop,i=t.fv,a=n.pop()/64,o=t.z2;r--;){var s=n.pop(),c=o[s];e.DEBUG&&console.log(t.step,(t.loop>1?`loop `+(t.loop-r)+`: `:``)+`SHPIX[]`,s,a),i.setRelative(c,c,a),i.touch(c)}t.loop=1}function ai(t){for(var n=t.stack,r=t.rp1,i=t.rp2,a=t.loop,o=t.z0[r],s=t.z1[i],c=t.fv,l=t.dpv,u=t.z2;a--;){var d=n.pop(),f=u[d];e.DEBUG&&console.log(t.step,(t.loop>1?`loop `+(t.loop-a)+`: `:``)+`IP[]`,d,r,`<->`,i),c.interpolate(f,o,s,l),c.touch(f)}t.loop=1}function oi(t,n){var r=n.stack,i=r.pop()/64,a=r.pop(),o=n.z1[a],s=n.z0[n.rp0],c=n.fv,l=n.pv;c.setRelative(o,s,i,l),c.touch(o),e.DEBUG&&console.log(n.step,`MSIRP[`+t+`]`,i,a),n.rp1=n.rp0,n.rp2=a,t&&(n.rp0=a)}function si(t){for(var n=t.stack,r=t.rp0,i=t.z0[r],a=t.loop,o=t.fv,s=t.pv,c=t.z1;a--;){var l=n.pop(),u=c[l];e.DEBUG&&console.log(t.step,(t.loop>1?`loop `+(t.loop-a)+`: `:``)+`ALIGNRP[]`,l),o.setRelative(u,i,0,s),o.touch(u)}t.loop=1}function ci(t){e.DEBUG&&console.log(t.step,`RTDG[]`),t.round=sr}function li(t,n){var r=n.stack,i=r.pop(),a=r.pop(),o=n.z0[a],s=n.fv,c=n.pv,l=n.cvt[i];e.DEBUG&&console.log(n.step,`MIAP[`+t+`]`,i,`(`,l,`)`,a);var u=c.distance(o,_r);t&&(Math.abs(u-l)<n.cvCutIn&&(u=l),u=n.round(u)),s.setRelative(o,_r,u,c),n.zp0===0&&(o.xo=o.x,o.yo=o.y),s.touch(o),n.rp0=n.rp1=a}function ui(t){var n=t.prog,r=t.ip,i=t.stack,a=n[++r];e.DEBUG&&console.log(t.step,`NPUSHB[]`,a);for(var o=0;o<a;o++)i.push(n[++r]);t.ip=r}function di(t){var n=t.ip,r=t.prog,i=t.stack,a=r[++n];e.DEBUG&&console.log(t.step,`NPUSHW[]`,a);for(var o=0;o<a;o++){var s=r[++n]<<8|r[++n];s&32768&&(s=-((s^65535)+1)),i.push(s)}t.ip=n}function fi(t){var n=t.stack,r=t.store;r||=t.store=[];var i=n.pop(),a=n.pop();e.DEBUG&&console.log(t.step,`WS`,i,a),r[a]=i}function pi(t){var n=t.stack,r=t.store,i=n.pop();e.DEBUG&&console.log(t.step,`RS`,i);var a=r&&r[i]||0;n.push(a)}function mi(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`WCVTP`,r,i),t.cvt[i]=r/64}function hi(t){var n=t.stack,r=n.pop();e.DEBUG&&console.log(t.step,`RCVT`,r),n.push(t.cvt[r]*64)}function gi(t,n){var r=n.stack,i=r.pop(),a=n.z2[i];e.DEBUG&&console.log(n.step,`GC[`+t+`]`,i),r.push(n.dpv.distance(a,_r,t,!1)*64)}function _i(t,n){var r=n.stack,i=r.pop(),a=r.pop(),o=n.z1[i],s=n.z0[a],c=n.dpv.distance(s,o,t,t);e.DEBUG&&console.log(n.step,`MD[`+t+`]`,i,a,`->`,c),n.stack.push(Math.round(c*64))}function vi(t){e.DEBUG&&console.log(t.step,`MPPEM[]`),t.stack.push(t.ppem)}function yi(t){e.DEBUG&&console.log(t.step,`FLIPON[]`),t.autoFlip=!0}function bi(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`LT[]`,r,i),n.push(+(i<r))}function xi(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`LTEQ[]`,r,i),n.push(+(i<=r))}function Si(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`GT[]`,r,i),n.push(+(i>r))}function Ci(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`GTEQ[]`,r,i),n.push(+(i>=r))}function wi(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`EQ[]`,r,i),n.push(+(r===i))}function Ti(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`NEQ[]`,r,i),n.push(r===i?0:1)}function Ei(t){var n=t.stack,r=n.pop();e.DEBUG&&console.log(t.step,`ODD[]`,r),n.push(Math.trunc(r)%2?1:0)}function Di(t){var n=t.stack,r=n.pop();e.DEBUG&&console.log(t.step,`EVEN[]`,r),n.push(Math.trunc(r)%2?0:1)}function Oi(t){var n=t.stack.pop(),r;e.DEBUG&&console.log(t.step,`IF[]`,n),n||(xr(t,!0),e.DEBUG&&console.log(t.step,r===27?`ELSE[]`:`EIF[]`))}function ki(t){e.DEBUG&&console.log(t.step,`EIF[]`)}function Ai(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`AND[]`,r,i),n.push(r&&i?1:0)}function ji(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`OR[]`,r,i),n.push(r||i?1:0)}function Mi(t){var n=t.stack,r=n.pop();e.DEBUG&&console.log(t.step,`NOT[]`,r),n.push(+!r)}function Ni(t,n){var r=n.stack,i=r.pop(),a=n.fv,o=n.pv,s=n.ppem,c=n.deltaBase+(t-1)*16,l=n.deltaShift,u=n.z0;e.DEBUG&&console.log(n.step,`DELTAP[`+t+`]`,i,r);for(var d=0;d<i;d++){var f=r.pop(),p=r.pop();if(c+((p&240)>>4)===s){var m=(p&15)-8;m>=0&&m++,e.DEBUG&&console.log(n.step,`DELTAPFIX`,f,`by`,m*l);var h=u[f];a.setRelative(h,h,m*l,o)}}}function Pi(t){var n=t.stack.pop();e.DEBUG&&console.log(t.step,`SDB[]`,n),t.deltaBase=n}function Fi(t){var n=t.stack.pop();e.DEBUG&&console.log(t.step,`SDS[]`,n),t.deltaShift=.5**n}function Ii(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`ADD[]`,r,i),n.push(i+r)}function Li(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`SUB[]`,r,i),n.push(i-r)}function Ri(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`DIV[]`,r,i),n.push(i*64/r)}function zi(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`MUL[]`,r,i),n.push(i*r/64)}function Bi(t){var n=t.stack,r=n.pop();e.DEBUG&&console.log(t.step,`ABS[]`,r),n.push(Math.abs(r))}function Vi(t){var n=t.stack,r=n.pop();e.DEBUG&&console.log(t.step,`NEG[]`,r),n.push(-r)}function Hi(t){var n=t.stack,r=n.pop();e.DEBUG&&console.log(t.step,`FLOOR[]`,r),n.push(Math.floor(r/64)*64)}function Ui(t){var n=t.stack,r=n.pop();e.DEBUG&&console.log(t.step,`CEILING[]`,r),n.push(Math.ceil(r/64)*64)}function Wi(t,n){var r=n.stack,i=r.pop();e.DEBUG&&console.log(n.step,`ROUND[]`),r.push(n.round(i/64)*64)}function Gi(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`WCVTF[]`,r,i),t.cvt[i]=r*t.ppem/t.font.unitsPerEm}function Ki(t,n){var r=n.stack,i=r.pop(),a=n.ppem,o=n.deltaBase+(t-1)*16,s=n.deltaShift;e.DEBUG&&console.log(n.step,`DELTAC[`+t+`]`,i,r);for(var c=0;c<i;c++){var l=r.pop(),u=r.pop();if(o+((u&240)>>4)===a){var d=(u&15)-8;d>=0&&d++;var f=d*s;e.DEBUG&&console.log(n.step,`DELTACFIX`,l,`by`,f),n.cvt[l]+=f}}}function qi(t){var n=t.stack.pop();e.DEBUG&&console.log(t.step,`SROUND[]`,n),t.round=dr;var r;switch(n&192){case 0:r=.5;break;case 64:r=1;break;case 128:r=2;break;default:throw Error(`invalid SROUND value`)}switch(t.srPeriod=r,n&48){case 0:t.srPhase=0;break;case 16:t.srPhase=.25*r;break;case 32:t.srPhase=.5*r;break;case 48:t.srPhase=.75*r;break;default:throw Error(`invalid SROUND value`)}n&=15,n===0?t.srThreshold=0:t.srThreshold=(n/8-.5)*r}function Ji(t){var n=t.stack.pop();e.DEBUG&&console.log(t.step,`S45ROUND[]`,n),t.round=dr;var r;switch(n&192){case 0:r=Math.sqrt(2)/2;break;case 64:r=Math.sqrt(2);break;case 128:r=2*Math.sqrt(2);break;default:throw Error(`invalid S45ROUND value`)}switch(t.srPeriod=r,n&48){case 0:t.srPhase=0;break;case 16:t.srPhase=.25*r;break;case 32:t.srPhase=.5*r;break;case 48:t.srPhase=.75*r;break;default:throw Error(`invalid S45ROUND value`)}n&=15,n===0?t.srThreshold=0:t.srThreshold=(n/8-.5)*r}function Yi(t){e.DEBUG&&console.log(t.step,`ROFF[]`),t.round=ar}function Xi(t){e.DEBUG&&console.log(t.step,`RUTG[]`),t.round=lr}function Zi(t){e.DEBUG&&console.log(t.step,`RDTG[]`),t.round=ur}function Qi(t){var n=t.stack.pop();e.DEBUG&&console.log(t.step,`SCANCTRL[]`,n)}function $i(t,n){var r=n.stack,i=r.pop(),a=r.pop(),o=n.z2[i],s=n.z1[a];e.DEBUG&&console.log(n.step,`SDPVTL[`+t+`]`,i,a);var c,l;t?(c=o.y-s.y,l=s.x-o.x):(c=s.x-o.x,l=s.y-o.y),n.dpv=hr(c,l)}function ea(t){var n=t.stack,r=n.pop(),i=0;e.DEBUG&&console.log(t.step,`GETINFO[]`,r),r&1&&(i=35),r&32&&(i|=4096),n.push(i)}function ta(t){var n=t.stack,r=n.pop(),i=n.pop(),a=n.pop();e.DEBUG&&console.log(t.step,`ROLL[]`),n.push(i),n.push(r),n.push(a)}function na(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`MAX[]`,r,i),n.push(Math.max(i,r))}function ra(t){var n=t.stack,r=n.pop(),i=n.pop();e.DEBUG&&console.log(t.step,`MIN[]`,r,i),n.push(Math.min(i,r))}function ia(t){var n=t.stack.pop();e.DEBUG&&console.log(t.step,`SCANTYPE[]`,n)}function aa(t){var n=t.stack.pop(),r=t.stack.pop();switch(e.DEBUG&&console.log(t.step,`INSTCTRL[]`,n,r),n){case 1:t.inhibitGridFit=!!r;return;case 2:t.ignoreCvt=!!r;return;default:throw Error(`invalid INSTCTRL[] selector`)}}function oa(t,n){var r=n.stack,i=n.prog,a=n.ip;e.DEBUG&&console.log(n.step,`PUSHB[`+t+`]`);for(var o=0;o<t;o++)r.push(i[++a]);n.ip=a}function sa(t,n){var r=n.ip,i=n.prog,a=n.stack;e.DEBUG&&console.log(n.ip,`PUSHW[`+t+`]`);for(var o=0;o<t;o++){var s=i[++r]<<8|i[++r];s&32768&&(s=-((s^65535)+1)),a.push(s)}n.ip=r}function J(t,n,r,i,a,o){var s=o.stack,c=t&&s.pop(),l=s.pop(),u=o.rp0,d=o.z0[u],f=o.z1[l],p=o.minDis,m=o.fv,h=o.dpv,g,_=g=h.distance(f,d,!0,!0),v=_>=0?1:-1,y;_=Math.abs(_),t&&(y=o.cvt[c],i&&Math.abs(_-y)<o.cvCutIn&&(_=y)),r&&_<p&&(_=p),i&&(_=o.round(_)),m.setRelative(f,d,v*_,h),m.touch(f),e.DEBUG&&console.log(o.step,(t?`MIRP[`:`MDRP[`)+(n?`M`:`m`)+(r?`>`:`_`)+(i?`R`:`_`)+(a===0?`Gr`:a===1?`Bl`:a===2?`Wh`:``)+`]`,t?c+`(`+o.cvt[c]+`,`+y+`)`:``,l,`(d =`,g,`->`,v*_,`)`),o.rp1=o.rp0,o.rp2=l,n&&(o.rp0=l)}er=[Sr.bind(void 0,pr),Sr.bind(void 0,fr),Cr.bind(void 0,pr),Cr.bind(void 0,fr),wr.bind(void 0,pr),wr.bind(void 0,fr),Tr.bind(void 0,0),Tr.bind(void 0,1),Er.bind(void 0,0),Er.bind(void 0,1),Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,void 0,void 0,qr,Jr,Yr,W,Xr,$r,ei,void 0,void 0,void 0,Zr,Qr,ti,void 0,G.bind(void 0,0),G.bind(void 0,1),ni.bind(void 0,pr),ni.bind(void 0,fr),ri.bind(void 0,0),ri.bind(void 0,1),K.bind(void 0,0),K.bind(void 0,1),q.bind(void 0,0),q.bind(void 0,1),ii,ai,oi.bind(void 0,0),oi.bind(void 0,1),si,ci,li.bind(void 0,0),li.bind(void 0,1),ui,di,fi,pi,mi,hi,gi.bind(void 0,0),gi.bind(void 0,1),void 0,_i.bind(void 0,0),_i.bind(void 0,1),vi,void 0,yi,void 0,void 0,bi,xi,Si,Ci,wi,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni.bind(void 0,1),Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi.bind(void 0,0),Wi.bind(void 0,1),Wi.bind(void 0,2),Wi.bind(void 0,3),void 0,void 0,void 0,void 0,Gi,Ni.bind(void 0,2),Ni.bind(void 0,3),Ki.bind(void 0,1),Ki.bind(void 0,2),Ki.bind(void 0,3),qi,Ji,void 0,void 0,Yi,void 0,Xi,Zi,Jr,Jr,void 0,void 0,void 0,void 0,void 0,Qi,$i.bind(void 0,0),$i.bind(void 0,1),ea,void 0,ta,na,ra,ia,aa,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,oa.bind(void 0,1),oa.bind(void 0,2),oa.bind(void 0,3),oa.bind(void 0,4),oa.bind(void 0,5),oa.bind(void 0,6),oa.bind(void 0,7),oa.bind(void 0,8),sa.bind(void 0,1),sa.bind(void 0,2),sa.bind(void 0,3),sa.bind(void 0,4),sa.bind(void 0,5),sa.bind(void 0,6),sa.bind(void 0,7),sa.bind(void 0,8),J.bind(void 0,0,0,0,0,0),J.bind(void 0,0,0,0,0,1),J.bind(void 0,0,0,0,0,2),J.bind(void 0,0,0,0,0,3),J.bind(void 0,0,0,0,1,0),J.bind(void 0,0,0,0,1,1),J.bind(void 0,0,0,0,1,2),J.bind(void 0,0,0,0,1,3),J.bind(void 0,0,0,1,0,0),J.bind(void 0,0,0,1,0,1),J.bind(void 0,0,0,1,0,2),J.bind(void 0,0,0,1,0,3),J.bind(void 0,0,0,1,1,0),J.bind(void 0,0,0,1,1,1),J.bind(void 0,0,0,1,1,2),J.bind(void 0,0,0,1,1,3),J.bind(void 0,0,1,0,0,0),J.bind(void 0,0,1,0,0,1),J.bind(void 0,0,1,0,0,2),J.bind(void 0,0,1,0,0,3),J.bind(void 0,0,1,0,1,0),J.bind(void 0,0,1,0,1,1),J.bind(void 0,0,1,0,1,2),J.bind(void 0,0,1,0,1,3),J.bind(void 0,0,1,1,0,0),J.bind(void 0,0,1,1,0,1),J.bind(void 0,0,1,1,0,2),J.bind(void 0,0,1,1,0,3),J.bind(void 0,0,1,1,1,0),J.bind(void 0,0,1,1,1,1),J.bind(void 0,0,1,1,1,2),J.bind(void 0,0,1,1,1,3),J.bind(void 0,1,0,0,0,0),J.bind(void 0,1,0,0,0,1),J.bind(void 0,1,0,0,0,2),J.bind(void 0,1,0,0,0,3),J.bind(void 0,1,0,0,1,0),J.bind(void 0,1,0,0,1,1),J.bind(void 0,1,0,0,1,2),J.bind(void 0,1,0,0,1,3),J.bind(void 0,1,0,1,0,0),J.bind(void 0,1,0,1,0,1),J.bind(void 0,1,0,1,0,2),J.bind(void 0,1,0,1,0,3),J.bind(void 0,1,0,1,1,0),J.bind(void 0,1,0,1,1,1),J.bind(void 0,1,0,1,1,2),J.bind(void 0,1,0,1,1,3),J.bind(void 0,1,1,0,0,0),J.bind(void 0,1,1,0,0,1),J.bind(void 0,1,1,0,0,2),J.bind(void 0,1,1,0,0,3),J.bind(void 0,1,1,0,1,0),J.bind(void 0,1,1,0,1,1),J.bind(void 0,1,1,0,1,2),J.bind(void 0,1,1,0,1,3),J.bind(void 0,1,1,1,0,0),J.bind(void 0,1,1,1,0,1),J.bind(void 0,1,1,1,0,2),J.bind(void 0,1,1,1,0,3),J.bind(void 0,1,1,1,1,0),J.bind(void 0,1,1,1,1,1),J.bind(void 0,1,1,1,1,2),J.bind(void 0,1,1,1,1,3)];function Y(e){e||={},e.empty||($n(e.familyName,`When creating a new Font object, familyName is required.`),$n(e.styleName,`When creating a new Font object, styleName is required.`),$n(e.unitsPerEm,`When creating a new Font object, unitsPerEm is required.`),$n(e.ascender,`When creating a new Font object, ascender is required.`),$n(e.descender,`When creating a new Font object, descender is required.`),$n(e.descender<0,`Descender should be negative (e.g. -512).`),this.names={fontFamily:{en:e.familyName||` `},fontSubfamily:{en:e.styleName||` `},fullName:{en:e.fullName||e.familyName+` `+e.styleName},postScriptName:{en:e.postScriptName||e.familyName+e.styleName},designer:{en:e.designer||` `},designerURL:{en:e.designerURL||` `},manufacturer:{en:e.manufacturer||` `},manufacturerURL:{en:e.manufacturerURL||` `},license:{en:e.license||` `},licenseURL:{en:e.licenseURL||` `},version:{en:e.version||`Version 0.1`},description:{en:e.description||` `},copyright:{en:e.copyright||` `},trademark:{en:e.trademark||` `}},this.unitsPerEm=e.unitsPerEm||1e3,this.ascender=e.ascender,this.descender=e.descender,this.createdTimestamp=e.createdTimestamp,this.tables={os2:{usWeightClass:e.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:e.widthClass||this.usWidthClasses.MEDIUM,fsSelection:e.fsSelection||this.fsSelectionValues.REGULAR}}),this.supported=!0,this.glyphs=new ot.GlyphSet(this,e.glyphs||[]),this.encoding=new Be(this),this.position=new qn(this),this.substitution=new Jn(this),this.tables=this.tables||{},Object.defineProperty(this,"hinting",{get:function(){if(this._hinting)return this._hinting;if(this.outlinesFormat===`truetype`)return this._hinting=new ir(this)}})}Y.prototype.hasChar=function(e){return this.encoding.charToGlyphIndex(e)!==null},Y.prototype.charToGlyphIndex=function(e){return this.encoding.charToGlyphIndex(e)},Y.prototype.charToGlyph=function(e){var t=this.charToGlyphIndex(e),n=this.glyphs.get(t);return n||=this.glyphs.get(0),n},Y.prototype.stringToGlyphs=function(e,t){var n=this;t||=this.defaultRenderOptions;for(var r=[],i=0;i<e.length;i+=1){var a=e[i];r.push(n.charToGlyphIndex(a))}var o=r.length;if(t.features){var s=t.script||this.substitution.getDefaultScriptName(),c=[];t.features.liga&&(c=c.concat(this.substitution.getFeature(`liga`,s,t.language))),t.features.rlig&&(c=c.concat(this.substitution.getFeature(`rlig`,s,t.language)));for(var l=0;l<o;l+=1)for(var u=0;u<c.length;u++){for(var d=c[u],f=d.sub,p=f.length,m=0;m<p&&f[m]===r[l+m];)m++;m===p&&(r.splice(l,p,d.by),o=o-p+1)}}for(var h=Array(o),g=this.glyphs.get(0),_=0;_<o;_+=1)h[_]=n.glyphs.get(r[_])||g;return h},Y.prototype.nameToGlyphIndex=function(e){return this.glyphNames.nameToGlyphIndex(e)},Y.prototype.nameToGlyph=function(e){var t=this.nameToGlyphIndex(e),n=this.glyphs.get(t);return n||=this.glyphs.get(0),n},Y.prototype.glyphIndexToName=function(e){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(e):``},Y.prototype.getKerningValue=function(e,t){return e=e.index||e,t=t.index||t,this.kerningPairs[e+`,`+t]||0},Y.prototype.defaultRenderOptions={kerning:!0,features:{liga:!0,rlig:!0}},Y.prototype.forEachGlyph=function(e,t,n,r,i,a){var o=this;t=t===void 0?0:t,n=n===void 0?0:n,r=r===void 0?72:r,i||=this.defaultRenderOptions;var s=1/this.unitsPerEm*r,c=this.stringToGlyphs(e,i),l;if(i.kerning){var u=i.script||this.position.getDefaultScriptName();l=this.position.getKerningTables(u,i.language)}for(var d=0;d<c.length;d+=1){var f=c[d];if(a.call(o,f,t,n,r,i),f.advanceWidth&&(t+=f.advanceWidth*s),i.kerning&&d<c.length-1){var p=l?o.position.getKerningValue(l,f.index,c[d+1].index):o.getKerningValue(f,c[d+1]);t+=p*s}i.letterSpacing?t+=i.letterSpacing*r:i.tracking&&(t+=i.tracking/1e3*r)}return t},Y.prototype.getPath=function(e,t,n,r,i){var a=new D;return this.forEachGlyph(e,t,n,r,i,function(e,t,n,r){var o=e.getPath(t,n,r,i,this);a.extend(o)}),a},Y.prototype.getPaths=function(e,t,n,r,i){var a=[];return this.forEachGlyph(e,t,n,r,i,function(e,t,n,r){var o=e.getPath(t,n,r,i,this);a.push(o)}),a},Y.prototype.getAdvanceWidth=function(e,t,n){return this.forEachGlyph(e,0,0,t,n,function(){})},Y.prototype.draw=function(e,t,n,r,i,a){this.getPath(t,n,r,i,a).draw(e)},Y.prototype.drawPoints=function(e,t,n,r,i,a){this.forEachGlyph(t,n,r,i,a,function(t,n,r,i){t.drawPoints(e,n,r,i)})},Y.prototype.drawMetrics=function(e,t,n,r,i,a){this.forEachGlyph(t,n,r,i,a,function(t,n,r,i){t.drawMetrics(e,n,r,i)})},Y.prototype.getEnglishName=function(e){var t=this.names[e];if(t)return t.en},Y.prototype.validate=function(){var e=[],t=this;function n(t,n){t||e.push(n)}function r(e){var r=t.getEnglishName(e);n(r&&r.trim().length>0,`No English `+e+` specified.`)}r(`fontFamily`),r(`weightName`),r(`manufacturer`),r(`copyright`),r(`version`),n(this.unitsPerEm>0,`No unitsPerEm specified.`)},Y.prototype.toTables=function(){return Hn.fontToTable(this)},Y.prototype.toBuffer=function(){return console.warn(`Font.toBuffer is deprecated. Use Font.toArrayBuffer instead.`),this.toArrayBuffer()},Y.prototype.toArrayBuffer=function(){for(var e=this.toTables().encode(),t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r<e.length;r++)n[r]=e[r];return t},Y.prototype.download=function(e){var t=this.getEnglishName(`fontFamily`),n=this.getEnglishName(`fontSubfamily`);e||=t.replace(/\s/g,``)+`-`+n+`.otf`;var r=this.toArrayBuffer();if(U())window.requestFileSystem=window.requestFileSystem||window.webkitRequestFileSystem,window.requestFileSystem(window.TEMPORARY,r.byteLength,function(t){t.root.getFile(e,{create:!0},function(e){e.createWriter(function(t){var n=new DataView(r),i=new Blob([n],{type:`font/opentype`});t.write(i),t.addEventListener(`writeend`,function(){location.href=e.toURL()},!1)})})},function(e){throw Error(e.name+`: `+e.message)});else{var i=tg(`fs`),a=Qn(r);i.writeFileSync(e,a)}},Y.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},Y.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},Y.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};function ca(e,t){var n=JSON.stringify(e),r=256;for(var i in t){var a=parseInt(i);if(!(!a||a<256)){if(JSON.stringify(t[i])===n)return a;r<=a&&(r=a+1)}}return t[r]=e,r}function la(e,t,n){var r=ca(t.name,n);return[{name:`tag_`+e,type:`TAG`,value:t.tag},{name:`minValue_`+e,type:`FIXED`,value:t.minValue<<16},{name:`defaultValue_`+e,type:`FIXED`,value:t.defaultValue<<16},{name:`maxValue_`+e,type:`FIXED`,value:t.maxValue<<16},{name:`flags_`+e,type:`USHORT`,value:0},{name:`nameID_`+e,type:`USHORT`,value:r}]}function ua(e,t,n){var r={},i=new z.Parser(e,t);return r.tag=i.parseTag(),r.minValue=i.parseFixed(),r.defaultValue=i.parseFixed(),r.maxValue=i.parseFixed(),i.skip(`uShort`,1),r.name=n[i.parseUShort()]||{},r}function da(e,t,n,r){for(var i=ca(t.name,r),a=[{name:`nameID_`+e,type:`USHORT`,value:i},{name:`flags_`+e,type:`USHORT`,value:0}],o=0;o<n.length;++o){var s=n[o].tag;a.push({name:`axis_`+e+` `+s,type:`FIXED`,value:t.coordinates[s]<<16})}return a}function fa(e,t,n,r){var i={},a=new z.Parser(e,t);i.name=r[a.parseUShort()]||{},a.skip(`uShort`,1),i.coordinates={};for(var o=0;o<n.length;++o)i.coordinates[n[o].tag]=a.parseFixed();return i}function pa(e,t){var n=new L.Table(`fvar`,[{name:`version`,type:`ULONG`,value:65536},{name:`offsetToData`,type:`USHORT`,value:0},{name:`countSizePairs`,type:`USHORT`,value:2},{name:`axisCount`,type:`USHORT`,value:e.axes.length},{name:`axisSize`,type:`USHORT`,value:20},{name:`instanceCount`,type:`USHORT`,value:e.instances.length},{name:`instanceSize`,type:`USHORT`,value:4+e.axes.length*4}]);n.offsetToData=n.sizeOf();for(var r=0;r<e.axes.length;r++)n.fields=n.fields.concat(la(r,e.axes[r],t));for(var i=0;i<e.instances.length;i++)n.fields=n.fields.concat(da(i,e.instances[i],e.axes,t));return n}function ma(e,t,n){var r=new z.Parser(e,t),i=r.parseULong();A.argument(i===65536,`Unsupported fvar table version.`);var a=r.parseOffset16();r.skip(`uShort`,1);for(var o=r.parseUShort(),s=r.parseUShort(),c=r.parseUShort(),l=r.parseUShort(),u=[],d=0;d<o;d++)u.push(ua(e,t+a+d*s,n));for(var f=[],p=t+a+o*s,m=0;m<c;m++)f.push(fa(e,p+m*l,u,n));return{axes:u,instances:f}}var ha={make:pa,parse:ma},ga=Array(10);ga[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{posFormat:1,coverage:this.parsePointer(R.coverage),value:this.parseValueRecord()};if(t===2)return{posFormat:2,coverage:this.parsePointer(R.coverage),values:this.parseValueRecordList()};A.assert(!1,`0x`+e.toString(16)+`: GPOS lookup type 1 format must be 1 or 2.`)},ga[2]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort(),n=this.parsePointer(R.coverage),r=this.parseUShort(),i=this.parseUShort();if(t===1)return{posFormat:t,coverage:n,valueFormat1:r,valueFormat2:i,pairSets:this.parseList(R.pointer(R.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(r),value2:this.parseValueRecord(i)}})))};if(t===2){var a=this.parsePointer(R.classDef),o=this.parsePointer(R.classDef),s=this.parseUShort(),c=this.parseUShort();return{posFormat:t,coverage:n,valueFormat1:r,valueFormat2:i,classDef1:a,classDef2:o,class1Count:s,class2Count:c,classRecords:this.parseList(s,R.list(c,function(){return{value1:this.parseValueRecord(r),value2:this.parseValueRecord(i)}}))}}A.assert(!1,`0x`+e.toString(16)+`: GPOS lookup type 2 format must be 1 or 2.`)},ga[3]=function(){return{error:`GPOS Lookup 3 not supported`}},ga[4]=function(){return{error:`GPOS Lookup 4 not supported`}},ga[5]=function(){return{error:`GPOS Lookup 5 not supported`}},ga[6]=function(){return{error:`GPOS Lookup 6 not supported`}},ga[7]=function(){return{error:`GPOS Lookup 7 not supported`}},ga[8]=function(){return{error:`GPOS Lookup 8 not supported`}},ga[9]=function(){return{error:`GPOS Lookup 9 not supported`}};function _a(e,t){t||=0;var n=new R(e,t),r=n.parseVersion(1);return A.argument(r===1||r===1.1,`Unsupported GPOS table version `+r),r===1?{version:r,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(ga)}:{version:r,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(ga),variations:n.parseFeatureVariationsList()}}var va=Array(10);function ya(e){return new L.Table(`GPOS`,[{name:`version`,type:`ULONG`,value:65536},{name:`scripts`,type:`TABLE`,value:new L.ScriptList(e.scripts)},{name:`features`,type:`TABLE`,value:new L.FeatureList(e.features)},{name:`lookups`,type:`TABLE`,value:new L.LookupList(e.lookups,va)}])}var ba={parse:_a,make:ya};function xa(e){var t={};e.skip(`uShort`);var n=e.parseUShort();A.argument(n===0,`Unsupported kern sub-table version.`),e.skip(`uShort`,2);var r=e.parseUShort();e.skip(`uShort`,3);for(var i=0;i<r;i+=1){var a=e.parseUShort(),o=e.parseUShort(),s=e.parseShort();t[a+`,`+o]=s}return t}function Sa(e){var t={};e.skip(`uShort`),e.parseULong()>1&&console.warn(`Only the first kern subtable is supported.`),e.skip(`uLong`);var n=e.parseUShort()&255;if(e.skip(`uShort`),n===0){var r=e.parseUShort();e.skip(`uShort`,3);for(var i=0;i<r;i+=1){var a=e.parseUShort(),o=e.parseUShort(),s=e.parseShort();t[a+`,`+o]=s}}return t}function Ca(e,t){var n=new z.Parser(e,t),r=n.parseUShort();if(r===0)return xa(n);if(r===1)return Sa(n);throw Error(`Unsupported kern table version (`+r+`).`)}var wa={parse:Ca};function Ta(e,t,n,r){for(var i=new z.Parser(e,t),a=r?i.parseUShort:i.parseULong,o=[],s=0;s<n+1;s+=1){var c=a.call(i);r&&(c*=2),o.push(c)}return o}var Ea={parse:Ta};function Da(e,t){tg(`fs`).readFile(e,function(e,n){if(e)return t(e.message);t(null,Zn(n))})}function Oa(e,t){var n=new XMLHttpRequest;n.open(`get`,e,!0),n.responseType=`arraybuffer`,n.onload=function(){return n.response?t(null,n.response):t(`Font could not be loaded: `+n.statusText)},n.onerror=function(){t(`Font could not be loaded`)},n.send()}function ka(e,t){for(var n=[],r=12,i=0;i<t;i+=1){var a=z.getTag(e,r),o=z.getULong(e,r+4),s=z.getULong(e,r+8),c=z.getULong(e,r+12);n.push({tag:a,checksum:o,offset:s,length:c,compression:!1}),r+=16}return n}function Aa(e,t){for(var n=[],r=44,i=0;i<t;i+=1){var a=z.getTag(e,r),o=z.getULong(e,r+4),s=z.getULong(e,r+8),c=z.getULong(e,r+12),l=void 0;l=s<c?`WOFF`:!1,n.push({tag:a,offset:o,compression:l,compressedLength:s,length:c}),r+=20}return n}function ja(e,t){if(t.compression===`WOFF`){var n=new Uint8Array(e.buffer,t.offset+2,t.compressedLength-2),r=new Uint8Array(t.length);if(w(n,r),r.byteLength!==t.length)throw Error(`Decompression error: `+t.tag+` decompressed length doesn't match recorded length`);return{data:new DataView(r.buffer,0),offset:0}}else return{data:e,offset:t.offset}}function Ma(e){var t,n,r=new Y({empty:!0}),i=new DataView(e,0),a,o=[],s=z.getTag(i,0);if(s===`\0\0\0`||s===`true`||s===`typ1`)r.outlinesFormat=`truetype`,a=z.getUShort(i,4),o=ka(i,a);else if(s===`OTTO`)r.outlinesFormat=`cff`,a=z.getUShort(i,4),o=ka(i,a);else if(s===`wOFF`){var c=z.getTag(i,4);if(c===`\0\0\0`)r.outlinesFormat=`truetype`;else if(c===`OTTO`)r.outlinesFormat=`cff`;else throw Error(`Unsupported OpenType flavor `+s);a=z.getUShort(i,12),o=Aa(i,a)}else throw Error(`Unsupported OpenType signature `+s);for(var l,u,d,f,p,m,h,g,_,v,y,b=0;b<a;b+=1){var x=o[b],S=void 0;switch(x.tag){case`cmap`:S=ja(i,x),r.tables.cmap=Fe.parse(S.data,S.offset),r.encoding=new Ve(r.tables.cmap);break;case`cvt `:S=ja(i,x),y=new z.Parser(S.data,S.offset),r.tables.cvt=y.parseShortList(x.length/2);break;case`fvar`:u=x;break;case`fpgm`:S=ja(i,x),y=new z.Parser(S.data,S.offset),r.tables.fpgm=y.parseByteList(x.length);break;case`head`:S=ja(i,x),r.tables.head=Ht.parse(S.data,S.offset),r.unitsPerEm=r.tables.head.unitsPerEm,t=r.tables.head.indexToLocFormat;break;case`hhea`:S=ja(i,x),r.tables.hhea=Gt.parse(S.data,S.offset),r.ascender=r.tables.hhea.ascender,r.descender=r.tables.hhea.descender,r.numberOfHMetrics=r.tables.hhea.numberOfHMetrics;break;case`hmtx`:m=x;break;case`ltag`:S=ja(i,x),n=Zt.parse(S.data,S.offset);break;case`maxp`:S=ja(i,x),r.tables.maxp=en.parse(S.data,S.offset),r.numGlyphs=r.tables.maxp.numGlyphs;break;case`name`:_=x;break;case`OS/2`:S=ja(i,x),r.tables.os2=Sn.parse(S.data,S.offset);break;case`post`:S=ja(i,x),r.tables.post=Tn.parse(S.data,S.offset),r.glyphNames=new Ue(r.tables.post);break;case`prep`:S=ja(i,x),y=new z.Parser(S.data,S.offset),r.tables.prep=y.parseByteList(x.length);break;case`glyf`:d=x;break;case`loca`:g=x;break;case`CFF `:l=x;break;case`kern`:h=x;break;case`GPOS`:f=x;break;case`GSUB`:p=x;break;case`meta`:v=x;break}}var ee=ja(i,_);if(r.tables.name=_n.parse(ee.data,ee.offset,n),r.names=r.tables.name,d&&g){var C=t===0,w=ja(i,g),T=Ea.parse(w.data,w.offset,r.numGlyphs,C),E=ja(i,d);r.glyphs=Qe.parse(E.data,E.offset,T,r)}else if(l){var D=ja(i,l);zt.parse(D.data,D.offset,r)}else throw Error(`Font doesn't contain TrueType or CFF outlines.`);var O=ja(i,m);if(Jt.parse(O.data,O.offset,r.numberOfHMetrics,r.numGlyphs,r.glyphs),We(r),h){var k=ja(i,h);r.kerningPairs=wa.parse(k.data,k.offset)}else r.kerningPairs={};if(f){var A=ja(i,f);r.tables.gpos=ba.parse(A.data,A.offset)}if(p){var j=ja(i,p);r.tables.gsub=jn.parse(j.data,j.offset)}if(u){var M=ja(i,u);r.tables.fvar=ha.parse(M.data,M.offset,r.names)}if(v){var N=ja(i,v);r.tables.meta=Pn.parse(N.data,N.offset),r.metas=r.tables.meta}return r}function Na(e,t){(typeof window>`u`?Da:Oa)(e,function(e,n){if(e)return t(e);var r;try{r=Ma(n)}catch(e){return t(e,null)}return t(null,r)})}function Pa(e){return Ma(Zn(tg(`fs`).readFileSync(e)))}e.Font=Y,e.Glyph=et,e.Path=D,e.BoundingBox=E,e._parse=z,e.parse=Ma,e.load=Na,e.loadSync=Pa,Object.defineProperty(e,"__esModule",{value:!0})})}),ag=$((e,t)=>{t.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}}),og=$((e,t)=>{t.exports=n,n.Node=o,n.create=n;function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach==`function`)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}n.prototype.removeNode=function(e){if(e.list!==this)throw Error(`removing node which does not belong to this list`);var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||=e,this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||=e,this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)a(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},n.prototype.forEach=function(e,t){t||=this;for(var n=this.head,r=0;n!==null;r++)e.call(t,n.value,r,this),n=n.next},n.prototype.forEachReverse=function(e,t){t||=this;for(var n=this.tail,r=this.length-1;n!==null;r--)e.call(t,n.value,r,this),n=n.prev},n.prototype.get=function(e){for(var t=0,n=this.head;n!==null&&t<e;t++)n=n.next;if(t===e&&n!==null)return n.value},n.prototype.getReverse=function(e){for(var t=0,n=this.tail;n!==null&&t<e;t++)n=n.prev;if(t===e&&n!==null)return n.value},n.prototype.map=function(e,t){t||=this;for(var r=new n,i=this.head;i!==null;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t||=this;for(var r=new n,i=this.tail;i!==null;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else if(this.head)r=this.head.next,n=this.head.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=0;r!==null;i++)n=e(n,r.value,i),r=r.next;return n},n.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=this.length-1;r!==null;i--)n=e(n,r.value,i),r=r.prev;return n},n.prototype.toArray=function(){for(var e=Array(this.length),t=0,n=this.head;n!==null;t++)e[t]=n.value,n=n.next;return e},n.prototype.toArrayReverse=function(){for(var e=Array(this.length),t=0,n=this.tail;n!==null;t++)e[t]=n.value,n=n.prev;return e},n.prototype.slice=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(;a!==null&&i<t;i++,a=a.next)r.push(a.value);return r},n.prototype.sliceReverse=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,a=this.tail;a!==null&&i>t;i--)a=a.prev;for(;a!==null&&i>e;i--,a=a.prev)r.push(a.value);return r},n.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(var o=[],i=0;a&&i<t;i++)o.push(a.value),a=this.removeNode(a);a===null&&(a=this.tail),a!==this.head&&a!==this.tail&&(a=a.prev);for(var i=0;i<n.length;i++)a=r(this,a,n[i]);return o},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;n!==null;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};function r(e,t,n){var r=t===e.head?new o(n,null,t,e):new o(n,t,t.next,e);return r.next===null&&(e.tail=r),r.prev===null&&(e.head=r),e.length++,r}function i(e,t){e.tail=new o(t,e.tail,null,e),e.head||=e.tail,e.length++}function a(e,t){e.head=new o(t,null,e.head,e),e.tail||=e.head,e.length++}function o(e,t,n,r){if(!(this instanceof o))return new o(e,t,n,r);this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{ag()(n)}catch{}}),sg=$((e,t)=>{var n=og(),r=Symbol(`max`),i=Symbol(`length`),a=Symbol(`lengthCalculator`),o=Symbol(`allowStale`),s=Symbol(`maxAge`),c=Symbol(`dispose`),l=Symbol(`noDisposeOnSet`),u=Symbol(`lruList`),d=Symbol(`cache`),f=Symbol(`updateAgeOnGet`),p=()=>1,m=class{constructor(e){if(typeof e==`number`&&(e={max:e}),e||={},e.max&&(typeof e.max!=`number`||e.max<0))throw TypeError(`max must be a non-negative number`);this[r]=e.max||1/0;let t=e.length||p;if(this[a]=typeof t==`function`?t:p,this[o]=e.stale||!1,e.maxAge&&typeof e.maxAge!=`number`)throw TypeError(`maxAge must be a number`);this[s]=e.maxAge||0,this[c]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!=`number`||e<0)throw TypeError(`max must be a non-negative number`);this[r]=e||1/0,_(this)}get max(){return this[r]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if(typeof e!=`number`)throw TypeError(`maxAge must be a non-negative number`);this[s]=e,_(this)}get maxAge(){return this[s]}set lengthCalculator(e){typeof e!=`function`&&(e=p),e!==this[a]&&(this[a]=e,this[i]=0,this[u].forEach(e=>{e.length=this[a](e.value,e.key),this[i]+=e.length})),_(this)}get lengthCalculator(){return this[a]}get length(){return this[i]}get itemCount(){return this[u].length}rforEach(e,t){t||=this;for(let n=this[u].tail;n!==null;){let r=n.prev;b(this,e,n,t),n=r}}forEach(e,t){t||=this;for(let n=this[u].head;n!==null;){let r=n.next;b(this,e,n,t),n=r}}keys(){return this[u].toArray().map(e=>e.key)}values(){return this[u].toArray().map(e=>e.value)}reset(){this[c]&&this[u]&&this[u].length&&this[u].forEach(e=>this[c](e.key,e.value)),this[d]=new Map,this[u]=new n,this[i]=0}dump(){return this[u].map(e=>g(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[u]}set(e,t,n){if(n||=this[s],n&&typeof n!=`number`)throw TypeError(`maxAge must be a number`);let o=n?Date.now():0,f=this[a](t,e);if(this[d].has(e)){if(f>this[r])return v(this,this[d].get(e)),!1;let a=this[d].get(e).value;return this[c]&&(this[l]||this[c](e,a.value)),a.now=o,a.maxAge=n,a.value=t,this[i]+=f-a.length,a.length=f,this.get(e),_(this),!0}let p=new y(e,t,f,o,n);return p.length>this[r]?(this[c]&&this[c](e,t),!1):(this[i]+=p.length,this[u].unshift(p),this[d].set(e,this[u].head),_(this),!0)}has(e){if(!this[d].has(e))return!1;let t=this[d].get(e).value;return!g(this,t)}get(e){return h(this,e,!0)}peek(e){return h(this,e,!1)}pop(){let e=this[u].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[d].get(e))}load(e){this.reset();let t=Date.now();for(let n=e.length-1;n>=0;n--){let r=e[n],i=r.e||0;if(i===0)this.set(r.k,r.v);else{let e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[d].forEach((e,t)=>h(this,t,!1))}},h=(e,t,n)=>{let r=e[d].get(t);if(r){let t=r.value;if(g(e,t)){if(v(e,r),!e[o])return}else n&&(e[f]&&(r.value.now=Date.now()),e[u].unshiftNode(r));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[s])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[s]&&n>e[s]},_=e=>{if(e[i]>e[r])for(let t=e[u].tail;e[i]>e[r]&&t!==null;){let n=t.prev;v(e,t),t=n}},v=(e,t)=>{if(t){let n=t.value;e[c]&&e[c](n.key,n.value),e[i]-=n.length,e[d].delete(n.key),e[u].removeNode(t)}},y=class{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}},b=(e,t,n,r)=>{let i=n.value;g(e,i)&&(v(e,n),e[o]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};t.exports=m}),cg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t={individual:{},range:[]};for(let r of e)n(t,r);return t}e.default=t;function n(e,t){for(let[n,i]of Object.entries(t.individual))if(e.individual[n])r(e.individual[n],i);else{let t=!1;for(let[o,{range:c,entry:l}]of e.range.entries()){let u=a(Number(n),c);if(u.both!==null){t=!0,e.individual[n]=i,r(e.individual[n],s(l)),e.range.splice(o,1);for(let t of u.second)Array.isArray(t)?e.range.push({range:t,entry:s(l)}):e.individual[t]=s(l)}}t||(e.individual[n]=i)}for(let{range:n,entry:o}of t.range){let t=[n];for(let n=0;n<e.range.length;n++){let{range:c,entry:l}=e.range[n];for(let[u,d]of t.entries())if(Array.isArray(d)){let a=i(d,c);if(a.both===null)continue;e.range.splice(n,1),n--;let u=s(l);Array.isArray(a.both)?e.range.push({range:a.both,entry:u}):e.individual[a.both]=u,r(u,s(o));for(let t of a.second)Array.isArray(t)?e.range.push({range:t,entry:s(l)}):e.individual[t]=s(l);t=a.first}else{let i=a(d,c);if(i.both===null)continue;e.individual[d]=s(o),r(e.individual[d],s(l)),e.range.splice(n,1),n--;for(let t of i.second)Array.isArray(t)?e.range.push({range:t,entry:s(l)}):e.individual[t]=s(l);t.splice(u,1,...i.first);break}}for(let n of Object.keys(e.individual))for(let[i,c]of t.entries())if(Array.isArray(c)){let l=a(Number(n),c);if(l.both===null)continue;r(e.individual[n],s(o)),t.splice(i,1,...l.second);break}else if(Number(n)===c){r(e.individual[n],s(o));break}for(let n of t)Array.isArray(n)?e.range.push({range:n,entry:s(o)}):e.individual[n]=s(o)}}function r(e,t){t.lookup&&(!e.lookup||e.lookup.index>t.lookup.index||e.lookup.index===t.lookup.index&&e.lookup.subIndex>t.lookup.subIndex)&&(e.lookup=t.lookup),t.forward&&(e.forward?n(e.forward,t.forward):e.forward=t.forward),t.reverse&&(e.reverse?n(e.reverse,t.reverse):e.reverse=t.reverse)}function i(e,t){let n={first:[],second:[],both:null};if(e[0]<t[1]&&t[0]<e[1]&&(n.both=o(Math.max(e[0],t[0]),Math.min(e[1],t[1]))),e[0]<t[0]){let r=e[0],i=Math.min(t[0],e[1]);n.first.push(o(r,i))}else if(t[0]<e[0]){let r=t[0],i=Math.min(t[1],e[0]);n.second.push(o(r,i))}if(e[1]>t[1]){let r=Math.max(e[0],t[1]),i=e[1];n.first.push(o(r,i))}else if(t[1]>e[1]){let r=Math.max(e[1],t[0]),i=t[1];n.second.push(o(r,i))}return n}function a(e,t){if(e<t[0]||e>t[1])return{first:[e],second:[t],both:null};let n={first:[],second:[],both:e};return t[0]<e&&n.second.push(o(t[0],e)),t[1]>e&&n.second.push(o(e+1,t[1])),n}function o(e,t){return t-e===1?e:[e,t]}function s(e){let t={};return e.forward&&(t.forward=c(e.forward)),e.reverse&&(t.reverse=c(e.reverse)),e.lookup&&(t.lookup={contextRange:e.lookup.contextRange.slice(),index:e.lookup.index,length:e.lookup.length,subIndex:e.lookup.subIndex,substitutions:e.lookup.substitutions.slice()}),t}function c(e){let t={};for(let[n,r]of Object.entries(e.individual))t[n]=s(r);return{individual:t,range:e.range.map(({range:e,entry:t})=>({range:e.slice(),entry:s(t)}))}}}),lg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e,r,i,a){let o=e[r[a]];if(!o)return;let s=o.lookup;if(o.reverse){let e=n(o.reverse,r,i);(!s&&e||e&&s&&(s.index>e.index||s.index===e.index&&s.subIndex>e.subIndex))&&(s=e)}if(++a>=r.length||!o.forward)return s;let c=t(o.forward,r,i,a);return(!s&&c||c&&s&&(s.index>c.index||s.index===c.index&&s.subIndex>c.subIndex))&&(s=c),s}e.default=t;function n(e,t,n){let r=e[t[--n]],i=r&&r.lookup;for(;r&&((!i&&r.lookup||r.lookup&&i&&i.index>r.lookup.index)&&(i=r.lookup),!(--n<0||!r.reverse));)r=r.reverse[t[n]];return i}}),ug=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e,t,n){let r=!1;for(let i=0;i<e.length;i++){let a=e[i];if(r){if(n<=a[0])return e[i-1][1]=n,e;if(n<=a[1])return e[i-1][1]=Math.max(n,a[1]),e.splice(i,1),r=!1,e;e.splice(i,1),i--}else{if(n<=a[0])return e.splice(i,0,[t,n]),e;if(n<=a[1])return a[0]=Math.min(t,a[0]),e;if(t<a[1])a[0]=Math.min(t,a[0]),r=!0;else continue}}return r?e[e.length-1][1]=n:e.push([t,n]),e}e.default=t}),dg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e,t){switch(e.format){case 1:let n=e.glyphs.indexOf(t);return n===-1?null:n;case 2:let r=e.ranges.find(e=>e.start<=t&&e.end>=t);return r?r.index:null}}e.default=t;function n(e){switch(e.format){case 1:return e.glyphs.map((e,t)=>({glyphId:e,index:t}));case 2:let t=[];for(let[n,r]of e.ranges.entries())r.end===r.start?t.push({glyphId:r.start,index:n}):t.push({glyphId:[r.start,r.end+1],index:n});return t}}e.listGlyphsByIndex=n}),fg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=dg();function n(e,t){let n=t[0],i=r(e,n),a=t[0]+1,o=new Map;for(;a<t[1];)r(e,a)!==i&&(a-n<=1?o.set(n,i):o.set([n,a],i)),a++;return a-n<=1?o.set(n,i):o.set([n,a],i),o}e.getRangeSubstitutionGlyphs=n;function r(e,n){let r=t.default(e.coverage,n);if(r===null)return null;switch(e.substFormat){case 1:return(n+e.deltaGlyphId)%2**16;case 2:return e.substitute[r]==null?null:e.substitute[r]}}e.getIndividualSubstitutionGlyph=r}),pg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=fg();function n(e,t,n,r,i){let o=[];for(let s of n){s.entry.forward={individual:{},range:[]};for(let n of e)o.push(...a(s.entry.forward,r,i,t,n).map(({entry:e,substitution:t})=>({entry:e,substitutions:[...s.substitutions,t]})))}return o}e.processInputPosition=n;function r(e,t){let n=[];for(let r of t)for(let t of e){let e={};r.entry.forward||(r.entry.forward={individual:{},range:[]}),n.push({entry:e,substitutions:r.substitutions}),Array.isArray(t)?r.entry.forward.range.push({entry:e,range:t}):r.entry.forward.individual[t]=e}return n}e.processLookaheadPosition=r;function i(e,t){let n=[];for(let r of t)for(let t of e){let e={};r.entry.reverse||(r.entry.reverse={individual:{},range:[]}),n.push({entry:e,substitutions:r.substitutions}),Array.isArray(t)?r.entry.reverse.range.push({entry:e,range:t}):r.entry.reverse.individual[t]=e}return n}e.processBacktrackPosition=i;function a(e,t,n,r,i){let a=[];if(!Array.isArray(i))e.individual[i]={},a.push({entry:e.individual[i],substitution:s(t,n,r,i)});else{let s=o(t,n,r,i);for(let[t,n]of s){let r={};Array.isArray(t)?e.range.push({range:t,entry:r}):e.individual[t]={},a.push({entry:r,substitution:n})}}return a}e.getInputTree=a;function o(e,n,r,i){for(let a of e.filter(e=>e.sequenceIndex===r))for(let e of n[a.lookupListIndex].subtables){let n=t.getRangeSubstitutionGlyphs(e,i);if(!Array.from(n.values()).every(e=>e!==null))return n}return new Map([[i,null]])}function s(e,n,r,i){for(let a of e.filter(e=>e.sequenceIndex===r))for(let e of n[a.lookupListIndex].subtables){let n=t.getIndividualSubstitutionGlyph(e,i);if(n!==null)return n}return null}}),mg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=dg(),n=pg();function r(e,r,i){let a={individual:{},range:[]},o=t.listGlyphsByIndex(e.coverage);for(let{glyphId:t,index:s}of o){let o=e.chainRuleSets[s];if(o)for(let[e,s]of o.entries()){let o=n.getInputTree(a,s.lookupRecords,r,0,t).map(({entry:e,substitution:t})=>({entry:e,substitutions:[t]}));for(let[e,t]of s.input.entries())o=n.processInputPosition([t],e+1,o,s.lookupRecords,r);for(let e of s.lookahead)o=n.processLookaheadPosition([e],o);for(let e of s.backtrack)o=n.processBacktrackPosition([e],o);for(let{entry:t,substitutions:n}of o)t.lookup={substitutions:n,length:s.input.length+1,index:i,subIndex:e,contextRange:[-1*s.backtrack.length,1+s.input.length+s.lookahead.length]}}}return a}e.default=r}),hg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e,t){switch(e.format){case 2:return Array.isArray(t)?n(e,t):new Map([[t,r(e,t)]]);default:return new Map([[t,null]])}}e.default=t;function n(e,t){let n=t[0],i=r(e,n),a=t[0]+1,o=new Map;for(;a<t[1];)r(e,a)!==i&&(a-n<=1?o.set(n,i):o.set([n,a],i)),a++;return a-n<=1?o.set(n,i):o.set([n,a],i),o}function r(e,t){for(let n of e.ranges)if(n.start<=t&&n.end>=t)return n.classId;return null}function i(e,t){switch(e.format){case 2:let n=[];for(let r of e.ranges)r.classId===t&&(r.end===r.start?n.push(r.start):n.push([r.start,r.end+1]));return n;default:return[]}}e.listClassGlyphs=i}),gg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=cg(),n=dg(),r=hg(),i=pg();function a(e,a,o){let s=[],c=n.listGlyphsByIndex(e.coverage);for(let{glyphId:t}of c){let n=r.default(e.inputClassDef,t);for(let[t,c]of n.entries()){if(c===null)continue;let n=e.chainClassSet[c];if(n)for(let[c,l]of n.entries()){let n={individual:{},range:[]},u=i.getInputTree(n,l.lookupRecords,a,0,t).map(({entry:e,substitution:t})=>({entry:e,substitutions:[t]}));for(let[t,n]of l.input.entries())u=i.processInputPosition(r.listClassGlyphs(e.inputClassDef,n),t+1,u,l.lookupRecords,a);for(let t of l.lookahead)u=i.processLookaheadPosition(r.listClassGlyphs(e.lookaheadClassDef,t),u);for(let t of l.backtrack)u=i.processBacktrackPosition(r.listClassGlyphs(e.backtrackClassDef,t),u);for(let{entry:e,substitutions:t}of u)e.lookup={substitutions:t,index:o,subIndex:c,length:l.input.length+1,contextRange:[-1*l.backtrack.length,1+l.input.length+l.lookahead.length]};s.push(n)}}}return t.default(s)}e.default=a}),_g=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=dg(),n=pg();function r(e,r,i){let a={individual:{},range:[]},o=t.listGlyphsByIndex(e.inputCoverage[0]);for(let{glyphId:s}of o){let o=n.getInputTree(a,e.lookupRecords,r,0,s).map(({entry:e,substitution:t})=>({entry:e,substitutions:[t]}));for(let[i,a]of e.inputCoverage.slice(1).entries())o=n.processInputPosition(t.listGlyphsByIndex(a).map(e=>e.glyphId),i+1,o,e.lookupRecords,r);for(let r of e.lookaheadCoverage)o=n.processLookaheadPosition(t.listGlyphsByIndex(r).map(e=>e.glyphId),o);for(let r of e.backtrackCoverage)o=n.processBacktrackPosition(t.listGlyphsByIndex(r).map(e=>e.glyphId),o);for(let{entry:t,substitutions:n}of o)t.lookup={substitutions:n,index:i,subIndex:0,length:e.inputCoverage.length,contextRange:[-1*e.backtrackCoverage.length,e.inputCoverage.length+e.lookaheadCoverage.length]}}return a}e.default=r}),vg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=dg(),n=pg();function r(e,r){let i={individual:{},range:[]},a=t.listGlyphsByIndex(e.coverage);for(let{glyphId:o,index:s}of a){let a={};Array.isArray(o)?i.range.push({entry:a,range:o}):i.individual[o]=a;let c=[{entry:a,substitutions:[e.substitutes[s]]}];for(let r of e.lookaheadCoverage)c=n.processLookaheadPosition(t.listGlyphsByIndex(r).map(e=>e.glyphId),c);for(let r of e.backtrackCoverage)c=n.processBacktrackPosition(t.listGlyphsByIndex(r).map(e=>e.glyphId),c);for(let{entry:t,substitutions:n}of c)t.lookup={substitutions:n,index:r,subIndex:0,length:1,contextRange:[-1*e.backtrackCoverage.length,1+e.lookaheadCoverage.length]}}return i}e.default=r}),yg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){let t={};for(let[r,i]of Object.entries(e.individual))t[r]=n(i);for(let{range:r,entry:i}of e.range){let e=n(i);for(let n=r[0];n<r[1];n++)t[n]=e}return t}e.default=t;function n(e){let n={};return e.forward&&(n.forward=t(e.forward)),e.reverse&&(n.reverse=t(e.reverse)),e.lookup&&(n.lookup=e.lookup),n}}),bg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=tg(`fs`),n=tg(`util`),r=tg(`path`),i=n.promisify(t.readdir),a=n.promisify(t.stat);async function o(e,t){let n=new Set;return await Promise.all(e.map(async e=>{let i=await s(r.resolve(e),RegExp(`\\.${t.map(e=>`(?:${e})`).join(`|`)}$`,`i`));for(let e of i)n.add(e)})),[...n]}e.default=o;async function s(e,t,n=10){if(n<=0)return[];let o;try{o=await i(e)}catch{return[]}let c=[];return await Promise.all(o.map(async i=>{let o=r.join(e,i),l;try{l=await a(o)}catch{return}l.isFile()&&t.test(o)?c.push(o):l.isDirectory()&&c.push(...await s(o,t,n-1))})),c}}),xg=$((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=tg(`path`),r=tg(`os`),i=bg(),a={win32:()=>{let e=n.join({}.WINDIR||`C:\\Windows`,`Fonts`),t=`Microsoft\\Windows\\Fonts`,r;return{}.LOCALAPPDATA?r=n.join({}.LOCALAPPDATA,t):{}.APPDATA?r=n.join({}.APPDATA,`Local`,t):{}.USERPROFILE&&(r=n.join({}.USERPROFILE,`AppData`,`Local`,t)),r?[e,r]:[e]},darwin:()=>{let e=r.homedir();return[...e?[n.join(e,`/Library/Fonts`)]:[],`/Library/Fonts`,`/Network/Library/Fonts`,`/System/Library/Fonts`,`/System Folder/Fonts`]},linux:()=>{let e=r.homedir();return[`/usr/share/fonts`,`/usr/local/share/fonts`,...e?[n.join(e,`.fonts`),n.join(e,`.local/share/fonts`)]:[]]}};function o(e){let t=Object.assign({extensions:[`ttf`,`otf`,`ttc`,`woff`,`woff2`],additionalFolders:[]},e),n=r.platform(),o=a[n];if(!o)throw Error(`Unsupported platform: ${n}`);let s=o();return i.default([...s,...t.additionalFolders],t.extensions)}t.exports=Object.assign(o,{default:o}),e.default=o}),Sg=$((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});var n=tg(`stream`),r=class extends n.Writable{constructor(){super(...arguments),this.offset=0,this._waiters=[],this._closed=!1}_write(e,t,n){let r=0,i=()=>{for(;this._waiters.length>0;){let t=this._waiters[0];if(this._buffer){let i=this._buffer.size-this._buffer.offset;if(i+e.length>=t.size){if(t.skip)this._buffer=void 0,t.resolve();else{let n=Math.min(i,t.size),r=Buffer.alloc(t.size);this._buffer.buf.copy(r,0,this._buffer.offset,this._buffer.offset+n),e.copy(r,n,0,t.size-n),t.resolve(r)}if(this.offset+=t.size,this._waiters.shift(),this._buffer=void 0,i+e.length===t.size){n();break}else r+=t.size-i}else{if(!t.skip){let t=Buffer.alloc(i+e.length);this._buffer.buf.copy(t,0,this._buffer.offset,this._buffer.size),e.copy(t,i,0,e.length),this._buffer.buf=t}this._buffer.offset=0,this._buffer.size=i+e.length,n();break}}else if(e.length-r>=t.size){if(t.skip?t.resolve():t.resolve(e.slice(r,r+t.size)),this.offset+=t.size,this._waiters.shift(),r+=t.size,e.length===r){n();break}}else{this._buffer={buf:t.skip?void 0:e.slice(r),offset:0,size:e.length-r},r=e.length,n();break}}this._processTrigger=e.length-r>0?i:void 0};i()}_destroy(e,t){this._processTrigger=void 0;for(let t of this._waiters)t.reject(e||Error(`stream destroyed`));this._waiters=[],this._closed=!0}_final(e){this._processTrigger=void 0;for(let e of this._waiters)e.reject(Error(`not enough data in stream`));this._waiters=[],this._closed=!0}read(e){return new Promise((t,n)=>{this._closed&&n(Error(`stream is closed`)),this._waiters.push({resolve:t,reject:n,size:e,skip:!1}),this._processTrigger&&this._processTrigger()})}skip(e){return new Promise((t,n)=>{this._closed&&n(Error(`stream is closed`)),this._waiters.push({resolve:t,reject:n,size:e,skip:!0}),this._processTrigger&&this._processTrigger()})}};function i(){return new r}t.exports=Object.assign(i,{default:i}),e.default=i}),Cg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=[`copyright`,`fontFamily`,`fontSubfamily`,`uniqueID`,`fullName`,`version`,`postScriptName`,`trademark`,`manufacturer`,`designer`,`description`,`manufacturerURL`,`designerURL`,`license`,`licenseURL`,`reserved`,`preferredFamily`,`preferredSubfamily`,`compatibleFullName`,`sampleText`,`postScriptFindFontName`,`wwsFamily`,`wwsSubfamily`],n={0:`en`,1:`fr`,2:`de`,3:`it`,4:`nl`,5:`sv`,6:`es`,7:`da`,8:`pt`,9:`no`,10:`he`,11:`ja`,12:`ar`,13:`fi`,14:`el`,15:`is`,16:`mt`,17:`tr`,18:`hr`,19:`zh-Hant`,20:`ur`,21:`hi`,22:`th`,23:`ko`,24:`lt`,25:`pl`,26:`hu`,27:`es`,28:`lv`,29:`se`,30:`fo`,31:`fa`,32:`ru`,33:`zh`,34:`nl-BE`,35:`ga`,36:`sq`,37:`ro`,38:`cz`,39:`sk`,40:`si`,41:`yi`,42:`sr`,43:`mk`,44:`bg`,45:`uk`,46:`be`,47:`uz`,48:`kk`,49:`az-Cyrl`,50:`az-Arab`,51:`hy`,52:`ka`,53:`mo`,54:`ky`,55:`tg`,56:`tk`,57:`mn-CN`,58:`mn`,59:`ps`,60:`ks`,61:`ku`,62:`sd`,63:`bo`,64:`ne`,65:`sa`,66:`mr`,67:`bn`,68:`as`,69:`gu`,70:`pa`,71:`or`,72:`ml`,73:`kn`,74:`ta`,75:`te`,76:`si`,77:`my`,78:`km`,79:`lo`,80:`vi`,81:`id`,82:`tl`,83:`ms`,84:`ms-Arab`,85:`am`,86:`ti`,87:`om`,88:`so`,89:`sw`,90:`rw`,91:`rn`,92:`ny`,93:`mg`,94:`eo`,128:`cy`,129:`eu`,130:`ca`,131:`la`,132:`qu`,133:`gn`,134:`ay`,135:`tt`,136:`ug`,137:`dz`,138:`jv`,139:`su`,140:`gl`,141:`af`,142:`br`,143:`iu`,144:`gd`,145:`gv`,146:`ga`,147:`to`,148:`el-polyton`,149:`kl`,150:`az`,151:`nn`},r={1078:`af`,1052:`sq`,1156:`gsw`,1118:`am`,5121:`ar-DZ`,15361:`ar-BH`,3073:`ar`,2049:`ar-IQ`,11265:`ar-JO`,13313:`ar-KW`,12289:`ar-LB`,4097:`ar-LY`,6145:`ary`,8193:`ar-OM`,16385:`ar-QA`,1025:`ar-SA`,10241:`ar-SY`,7169:`aeb`,14337:`ar-AE`,9217:`ar-YE`,1067:`hy`,1101:`as`,2092:`az-Cyrl`,1068:`az`,1133:`ba`,1069:`eu`,1059:`be`,2117:`bn`,1093:`bn-IN`,8218:`bs-Cyrl`,5146:`bs`,1150:`br`,1026:`bg`,1027:`ca`,3076:`zh-HK`,5124:`zh-MO`,2052:`zh`,4100:`zh-SG`,1028:`zh-TW`,1155:`co`,1050:`hr`,4122:`hr-BA`,1029:`cs`,1030:`da`,1164:`prs`,1125:`dv`,2067:`nl-BE`,1043:`nl`,3081:`en-AU`,10249:`en-BZ`,4105:`en-CA`,9225:`en-029`,16393:`en-IN`,6153:`en-IE`,8201:`en-JM`,17417:`en-MY`,5129:`en-NZ`,13321:`en-PH`,18441:`en-SG`,7177:`en-ZA`,11273:`en-TT`,2057:`en-GB`,1033:`en`,12297:`en-ZW`,1061:`et`,1080:`fo`,1124:`fil`,1035:`fi`,2060:`fr-BE`,3084:`fr-CA`,1036:`fr`,5132:`fr-LU`,6156:`fr-MC`,4108:`fr-CH`,1122:`fy`,1110:`gl`,1079:`ka`,3079:`de-AT`,1031:`de`,5127:`de-LI`,4103:`de-LU`,2055:`de-CH`,1032:`el`,1135:`kl`,1095:`gu`,1128:`ha`,1037:`he`,1081:`hi`,1038:`hu`,1039:`is`,1136:`ig`,1057:`id`,1117:`iu`,2141:`iu-Latn`,2108:`ga`,1076:`xh`,1077:`zu`,1040:`it`,2064:`it-CH`,1041:`ja`,1099:`kn`,1087:`kk`,1107:`km`,1158:`quc`,1159:`rw`,1089:`sw`,1111:`kok`,1042:`ko`,1088:`ky`,1108:`lo`,1062:`lv`,1063:`lt`,2094:`dsb`,1134:`lb`,1071:`mk`,2110:`ms-BN`,1086:`ms`,1100:`ml`,1082:`mt`,1153:`mi`,1146:`arn`,1102:`mr`,1148:`moh`,1104:`mn`,2128:`mn-CN`,1121:`ne`,1044:`nb`,2068:`nn`,1154:`oc`,1096:`or`,1123:`ps`,1045:`pl`,1046:`pt`,2070:`pt-PT`,1094:`pa`,1131:`qu-BO`,2155:`qu-EC`,3179:`qu`,1048:`ro`,1047:`rm`,1049:`ru`,9275:`smn`,4155:`smj-NO`,5179:`smj`,3131:`se-FI`,1083:`se`,2107:`se-SE`,8251:`sms`,6203:`sma-NO`,7227:`sms`,1103:`sa`,7194:`sr-Cyrl-BA`,3098:`sr`,6170:`sr-Latn-BA`,2074:`sr-Latn`,1132:`nso`,1074:`tn`,1115:`si`,1051:`sk`,1060:`sl`,11274:`es-AR`,16394:`es-BO`,13322:`es-CL`,9226:`es-CO`,5130:`es-CR`,7178:`es-DO`,12298:`es-EC`,17418:`es-SV`,4106:`es-GT`,18442:`es-HN`,2058:`es-MX`,19466:`es-NI`,6154:`es-PA`,15370:`es-PY`,10250:`es-PE`,20490:`es-PR`,3082:`es`,1034:`es`,21514:`es-US`,14346:`es-UY`,8202:`es-VE`,2077:`sv-FI`,1053:`sv`,1114:`syr`,1064:`tg`,2143:`tzm`,1097:`ta`,1092:`tt`,1098:`te`,1054:`th`,1105:`bo`,1055:`tr`,1090:`tk`,1152:`ug`,1058:`uk`,1070:`hsb`,1056:`ur`,2115:`uz-Cyrl`,1091:`uz`,1066:`vi`,1106:`cy`,1160:`wo`,1157:`sah`,1144:`ii`,1130:`yo`};function i(e,t,i){switch(e){case 0:if(t===65535)return`und`;if(i)return i[t];break;case 1:return n[t];case 3:return r[t]}}var a=`utf-16`,o={0:`macintosh`,1:`x-mac-japanese`,2:`x-mac-chinesetrad`,3:`x-mac-korean`,6:`x-mac-greek`,7:`x-mac-cyrillic`,9:`x-mac-devanagai`,10:`x-mac-gurmukhi`,11:`x-mac-gujarati`,12:`x-mac-oriya`,13:`x-mac-bengali`,14:`x-mac-tamil`,15:`x-mac-telugu`,16:`x-mac-kannada`,17:`x-mac-malayalam`,18:`x-mac-sinhalese`,19:`x-mac-burmese`,20:`x-mac-khmer`,21:`x-mac-thai`,22:`x-mac-lao`,23:`x-mac-georgian`,24:`x-mac-armenian`,25:`x-mac-chinesesimp`,26:`x-mac-tibetan`,27:`x-mac-mongolian`,28:`x-mac-ethiopic`,29:`x-mac-ce`,30:`x-mac-vietnamese`,31:`x-mac-extarabic`},s={15:`x-mac-icelandic`,17:`x-mac-turkish`,18:`x-mac-croatian`,24:`x-mac-ce`,25:`x-mac-ce`,26:`x-mac-ce`,27:`x-mac-ce`,28:`x-mac-ce`,30:`x-mac-icelandic`,37:`x-mac-romanian`,38:`x-mac-ce`,39:`x-mac-ce`,40:`x-mac-ce`,143:`x-mac-inuit`,146:`x-mac-gaelic`};function c(e,t,n){switch(e){case 0:return a;case 1:return s[n]||o[t];case 3:if(t===1||t===10)return a;break}}function l(e,n){let r={},o=e.readUInt16BE(2),s=e.readUInt16BE(4),l=6;for(let u=0;u<o;u++){let o=e.readUInt16BE(l+0),u=e.readUInt16BE(l+2),f=e.readUInt16BE(l+4),p=e.readUInt16BE(l+6),m=t[p]||String(p),h=e.readUInt16BE(l+8),g=e.readUInt16BE(l+10),_=i(o,f,n),v=c(o,u,f);if(l+=12,v!==void 0&&_!==void 0){let t;if(v===a){let n=h/2,r=Array(n);for(let t=0;t<n;t++)r[t]=e.readUInt16BE(s+g+t*2);t=String.fromCharCode(...r)}else t=d(e,s+g,h,v);if(t){let e=r[m];e===void 0&&(e=r[m]={}),e[_]=t}}}return r}e.default=l;var u={"x-mac-croatian":`ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ`,"x-mac-cyrillic":`АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю`,"x-mac-gaelic":`ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ`,"x-mac-greek":`Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ`,"x-mac-icelandic":`ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ`,"x-mac-inuit":`ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł`,"x-mac-ce":`ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ`,macintosh:`ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ`,"x-mac-romanian":`ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ`,"x-mac-turkish":`ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ`};function d(e,t,n,r){let i=u[r];if(i===void 0)return;let a=``;for(let r=0;r<n;r++){let n=e.readUInt8(t+r);n<=127?a+=String.fromCharCode(n):a+=i[n&127]}return a}}),wg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){if(e.readUInt32BE(0)!==1)throw Error(`Unsupported ltag table version.`);let t=e.readUInt32BE(8),n=[];for(let r=0;r<t;r++){let t=``,i=e.readUInt16BE(12+r*4),a=e.readUInt16BE(14+r*4);for(let n=i;n<i+a;++n)t+=String.fromCharCode(e.readInt8(n));n.push(t)}return n}e.default=t}),Tg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){if(e.length<78)return;let t={version:e.readUInt16BE(0),xAvgCharWidth:e.readUInt16BE(2),usWeightClass:e.readUInt16BE(4),usWidthClass:e.readUInt16BE(6),fsType:e.readUInt16BE(8),ySubscriptXSize:e.readInt16BE(10),ySubscriptYSize:e.readInt16BE(12),ySubscriptXOffset:e.readInt16BE(14),ySubscriptYOffset:e.readInt16BE(16),ySuperscriptXSize:e.readInt16BE(18),ySuperscriptYSize:e.readInt16BE(20),ySuperscriptXOffset:e.readInt16BE(22),ySuperscriptYOffset:e.readInt16BE(24),yStrikeoutSize:e.readInt16BE(26),yStrikeoutPosition:e.readInt16BE(28),sFamilyClass:e.readInt16BE(30),panose:[e.readUInt8(32),e.readUInt8(33),e.readUInt8(34),e.readUInt8(35),e.readUInt8(36),e.readUInt8(37),e.readUInt8(38),e.readUInt8(39),e.readUInt8(40),e.readUInt8(41)],ulUnicodeRange1:e.readUInt32BE(42),ulUnicodeRange2:e.readUInt32BE(46),ulUnicodeRange3:e.readUInt32BE(50),ulUnicodeRange4:e.readUInt32BE(54),achVendID:String.fromCharCode(e.readUInt8(58),e.readUInt8(59),e.readUInt8(60),e.readUInt8(61)),fsSelection:e.readUInt16BE(62),usFirstCharIndex:e.readUInt16BE(64),usLastCharIndex:e.readUInt16BE(66),sTypoAscender:e.readInt16BE(68),sTypoDescender:e.readInt16BE(70),sTypoLineGap:e.readInt16BE(72),usWinAscent:e.readUInt16BE(74),usWinDescent:e.readUInt16BE(76)};return t.version>=1&&e.length>=86&&(t.ulCodePageRange1=e.readUInt32BE(78),t.ulCodePageRange2=e.readUInt32BE(82)),t.version>=2&&e.length>=96&&(t.sxHeight=e.readInt16BE(86),t.sCapHeight=e.readInt16BE(88),t.usDefaultChar=e.readUInt16BE(90),t.usBreakChar=e.readUInt16BE(92),t.usMaxContent=e.readUInt16BE(94)),t}e.default=t}),Eg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e,t){return e+t/2**16}e.formatFixed=t;function n(e,t){return(e*2**32+t-2082844800)*1e3}e.formatLongDateTime=n}),Dg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Eg();function n(e){return{version:t.formatFixed(e.readUInt16BE(0),e.readUInt16BE(2)),fontRevision:t.formatFixed(e.readUInt16BE(4),e.readUInt16BE(6)),checkSumAdjustment:e.readUInt32BE(8),magicNumber:e.readUInt32BE(12),flags:e.readUInt16BE(16),unitsPerEm:e.readUInt16BE(18),created:t.formatLongDateTime(e.readUInt32BE(20),e.readUInt32BE(24)),modified:t.formatLongDateTime(e.readUInt32BE(28),e.readUInt32BE(32)),xMin:e.readInt16BE(36),yMin:e.readInt16BE(38),xMax:e.readInt16BE(40),yMax:e.readInt16BE(42),macStyle:e.readUInt16BE(44),lowestRecPPEM:e.readUInt16BE(46),fontDirectionHint:e.readInt16BE(48),indexToLocFormat:e.readInt16BE(50),glyphDataFormat:e.readInt16BE(52)}}e.default=n}),Og=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Eg();function n(e){return{version:t.formatFixed(e.readUInt16BE(0),e.readUInt16BE(2)),italicAngle:t.formatFixed(e.readUInt16BE(4),e.readUInt16BE(6)),underlinePosition:e.readInt16BE(8),underlineThickness:e.readInt16BE(10),isFixedPitch:e.readUInt32BE(12),minMemType42:e.readUInt32BE(16),maxMemType42:e.readUInt32BE(20),minMemType1:e.readUInt32BE(24),maxMemType1:e.readUInt32BE(28)}}e.default=n}),kg=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=tg(`fs`),n=Sg(),r=Cg(),i=wg(),a=Tg(),o=Dg(),s=Og(),c;(function(e){e[e.TrueType=0]=`TrueType`,e[e.CFF=1]=`CFF`,e[e.Woff=2]=`Woff`})(c||={});var l={name:{tag:Buffer.from(`name`),parse:r.default},ltag:{tag:Buffer.from(`ltag`),parse:i.default},os2:{tag:Buffer.from(`OS/2`),parse:a.default},head:{tag:Buffer.from(`head`),parse:o.default},post:{tag:Buffer.from(`post`),parse:s.default}};async function u(e){return new Promise((r,i)=>{(async()=>{let r=n.default(),a=t.createReadStream(e),o=!1,s=()=>{o=!0};a.once(`close`,s),a.once(`end`,s),a.once(`error`,e=>{o=!0,i(e)}),a.pipe(r);try{switch(f(await r.read(4))){case c.TrueType:case c.CFF:let t=(await r.read(2)).readUInt16BE(0);await r.skip(6);let n=await p(r,t),i=Object.entries(n).sort((e,t)=>e[1].offset-t[1].offset),a={};for(let[e,t]of i)await r.skip(t.offset-r.offset),a[e]=await r.read(t.length);let o=[];if(a.ltag&&(o=l.ltag.parse(a.ltag)),!a.name)throw Error(`missing required OpenType table 'name' in font file: ${e}`);return{names:l.name.parse(a.name,o),os2:a.os2&&l.os2.parse(a.os2),head:a.head&&l.head.parse(a.head),post:a.post&&l.post.parse(a.post)};case c.Woff:default:throw Error(`provided font type is not supported yet`)}}finally{a.unpipe(r),o||(a.destroy(),r.destroy())}})().then(r,i)})}e.default=u;var d={one:Buffer.from([0,1,0,0]),otto:Buffer.from(`OTTO`),true:Buffer.from(`true`),typ1:Buffer.from(`typ1`),woff:Buffer.from(`wOFF`)};function f(e){if(e.equals(d.one)||e.equals(d.true)||e.equals(d.typ1))return c.TrueType;if(e.equals(d.otto))return c.CFF;if(e.equals(d.woff))return c.Woff;throw Error(`Unsupported signature type: ${e}`)}async function p(e,t){let n={};for(let r=0;r<t;r++){let t=await e.read(4),r=await e.read(12);for(let[e,i]of Object.entries(l))if(t.equals(i.tag)&&(n[e]={offset:r.readUInt32BE(4),length:r.readUInt32BE(8)},n.name&&n.ltag&&n.os2))return n}return n}}),Ag=$(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=tg(`os`),n;(function(e){e.Serif=`serif`,e.SansSerif=`sansSerif`,e.Monospace=`monospace`,e.Cursive=`cursive`,e.Unknown=`unknown`})(n=e.Type||={});var r;(function(e){e.Regular=`regular`,e.Italic=`italic`,e.Oblique=`oblique`,e.Bold=`bold`,e.BoldItalic=`boldItalic`,e.BoldOblique=`boldOblique`,e.Other=`other`})(r=e.Style||={});var i=[` Regular`,` Bold`,` Bold Italic`,` Bold Oblique`,` Italic`,` Oblique`];function a(e,n){let r=e.names.preferredFamily&&e.names.preferredFamily[n]?e.names.preferredFamily[n]:e.names.fontFamily[n];if(t.platform()===`win32`){let t=`${r} ${e.names.preferredSubfamily&&e.names.preferredSubfamily[n]?e.names.preferredSubfamily[n]:e.names.fontSubfamily[n]}`,a=-1;for(let e of i){let n=t.lastIndexOf(e);if(n!==-1){a=n;break}}return a===-1?t:t.substring(0,a)}return r}e.name=a;function o(e){if(e.os2)switch(e.os2.panose[0]){case 2:return e.os2.panose[3]===9?n.Monospace:e.os2.panose[1]>=11&&e.os2.panose[1]<=15||e.os2.panose[1]===0?n.SansSerif:n.Serif;case 3:return n.Cursive}else if(e.post&&e.post.isFixedPitch)return n.Monospace;return n.Unknown}e.type=o;function s(e){if(!e.os2&&!e.head)return r.Other;let t=e.os2?e.os2.fsSelection&32:e.head.macStyle&1,n=e.os2?e.os2.fsSelection&1:e.post?e.post.italicAngle<0:e.head.macStyle&2,i=e.os2?e.os2.fsSelection&512:e.post?e.post.italicAngle>0:0,a=e.os2?e.os2.fsSelection&320:1;return t?i?r.BoldOblique:n?r.BoldItalic:r.Bold:i?r.Oblique:n?r.Italic:a?r.Regular:r.Other}e.style=s;var c=[r.Bold,r.BoldItalic,r.BoldOblique];function l(e){return e.os2?e.os2.usWeightClass:c.includes(s(e))?700:400}e.weight=l}),jg=$(e=>{var t=e&&e.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&(n[r[i]]=e[r[i]]);return n};Object.defineProperty(e,"__esModule",{value:!0});var n=xg(),r=kg(),i=Ag(),a=Ag();e.Type=a.Type,e.Style=a.Style;async function o(e){let i=Object.assign({concurrency:4,language:`en`,onFontError:null},e),a=await u(async e=>{try{return l(e,await r.default(e),i.language)}catch(t){i.onFontError&&i.onFontError(e,t)}},await n.default({extensions:[`ttf`,`otf`]}),i.concurrency),o={};for(let e of a.filter(e=>e)){let{name:n}=e,r=t(e,[`name`]);o[n]||(o[n]=[]),o[n].push(r)}return o}e.list=o;async function s(e,t){return(await o(t))[e]||[]}e.listVariants=s;async function c(e,t){let n=Object.assign({language:`en`},t);return l(e,await r.default(e),n.language)}e.get=c;function l(e,t,n){return{name:i.name(t,n),path:e,type:i.type(t),weight:i.weight(t),style:i.style(t)}}async function u(e,t,n){let r=[],i=0,a=async n=>{r.push(await e(t[n])),i<t.length&&await a(i++)},o=[];for(;i<t.length&&i<n;i++)o.push(a(i));return await Promise.all(o),r}}),Mg=rg($(e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=ig(),n=sg(),r=cg(),i=lg(),a=ug(),o=mg(),s=gg(),c=_g(),l=vg(),u=yg(),d=class{constructor(e,t){this._lookupTrees=[],this._glyphLookups={},this._font=e,t.cacheSize>0&&(this._cache=new n({max:t.cacheSize,length:(e,t)=>t.length}));let i=(this._font.tables.gsub&&this._font.tables.gsub.features.filter(e=>e.tag===`calt`)||[]).reduce((e,t)=>[...e,...t.feature.lookupListIndexes],[]),a=this._font.tables.gsub&&this._font.tables.gsub.lookups||[],d=a.filter((e,t)=>i.some(e=>e===t));for(let[e,t]of d.entries()){let n=[];switch(t.lookupType){case 6:for(let[e,r]of t.subtables.entries())switch(r.substFormat){case 1:n.push(o.default(r,a,e));break;case 2:n.push(s.default(r,a,e));break;case 3:n.push(c.default(r,a,e));break}break;case 8:for(let[e,r]of t.subtables.entries())n.push(l.default(r,e));break}let i=u.default(r.default(n));this._lookupTrees.push({tree:i,processForward:t.lookupType!==8});for(let t of Object.keys(i))this._glyphLookups[t]||(this._glyphLookups[t]=[]),this._glyphLookups[t].push(e)}}findLigatures(e){let t=this._cache&&this._cache.get(e);if(t&&!Array.isArray(t))return t;let n=[];for(let t of e)n.push(this._font.charToGlyphIndex(t));if(this._lookupTrees.length===0)return{inputGlyphs:n,outputGlyphs:n,contextRanges:[]};let r=this._findInternal(n.slice()),i={inputGlyphs:n,outputGlyphs:r.sequence,contextRanges:r.ranges};return this._cache&&this._cache.set(e,i),i}findLigatureRanges(e){if(this._lookupTrees.length===0)return[];let t=this._cache&&this._cache.get(e);if(t)return Array.isArray(t)?t:t.contextRanges;let n=[];for(let t of e)n.push(this._font.charToGlyphIndex(t));let r=this._findInternal(n);return this._cache&&this._cache.set(e,r.ranges),r.ranges}_findInternal(e){let t=[],n=this._getNextLookup(e,0);for(;n.index!==null;){let r=this._lookupTrees[n.index];if(r.processForward){let o=n.last;for(let s=n.first;s<o;s++){let n=i.default(r.tree,e,s,s);if(n){for(let t=0;t<n.substitutions.length;t++){let r=n.substitutions[t];r!==null&&(e[s+t]=r)}a.default(t,n.contextRange[0]+s,n.contextRange[1]+s),s+n.length>=o&&(o=s+n.length+1),s+=n.length-1}}}else for(let o=n.last-1;o>=n.first;o--){let n=i.default(r.tree,e,o,o);if(n){for(let t=0;t<n.substitutions.length;t++){let r=n.substitutions[t];r!==null&&(e[o+t]=r)}a.default(t,n.contextRange[0]+o,n.contextRange[1]+o),o-=n.length-1}}n=this._getNextLookup(e,n.index+1)}return{sequence:e,ranges:t}}_getNextLookup(e,t){let n={index:null,first:1/0,last:-1};for(let r=0;r<e.length;r++){let i=this._glyphLookups[e[r]];if(i)for(let e=0;e<i.length;e++){let a=i[e];if(a>=t){(n.index===null||a<=n.index)&&(n.index=a,n.first>r&&(n.first=r),n.last=r+1);break}}}return n}};async function f(e,t){let[n]=await Promise.resolve().then(()=>jg()).then(t=>t.listVariants(e));if(!n)throw Error(`Font ${e} not found`);return p(n.path,t)}e.load=f;async function p(e,n){return new d(await Promise.resolve().then(()=>tg(`util`)).then(n=>n.promisify(t.load)(e)),Object.assign({cacheSize:0},n))}e.loadFile=p;function m(e,n){return new d(t.parse(e),Object.assign({cacheSize:0},n))}e.loadBuffer=m})());function Ng(e){if(typeof e!=`string`)throw Error(`Font family must be a string`);let t={input:e,offset:0},n=[],r=``;for(;t.offset<t.input.length;){let e=t.input[t.offset++];switch(e){case`'`:case`"`:r+=Pg(t,e);break;case`,`:n.push(r),r=``;break;default:/\s/.test(e)||(t.offset--,r+=Fg(t),n.push(r),r=``)}}return n}function Pg(e,t){let n=``,r=!1;for(;e.offset<e.input.length;){let i=e.input[e.offset++];if(r)/[\dA-Fa-f]/.test(i)?(e.offset--,n+=Ig(e)):i!==`
|
|
172
|
+
`&&(n+=i),r=!1;else switch(i){case t:return n;case`\\`:r=!0;break;default:n+=i}}throw Error(`Unterminated string`)}function Fg(e){let t=``,n=!1;for(;e.offset<e.input.length;){let r=e.input[e.offset++];if(n)/[\dA-Fa-f]/.test(r)?(e.offset--,t+=Ig(e)):t+=r,n=!1;else switch(r){case`\\`:n=!0;break;case`,`:return t;default:/\s/.test(r)?t.endsWith(` `)||(t+=` `):t+=r}}return t}function Ig(e){let t=``;for(;e.offset<e.input.length;){let n=e.input[e.offset++];if(/\s/.test(n))return Lg(t);if(t.length>=6||!/[\dA-Fa-f]/.test(n))return e.offset--,Lg(t);t+=n}return Lg(t)}function Lg(e){return String.fromCodePoint(parseInt(e,16))}var Rg;async function zg(e,t){if(!Rg){if(typeof navigator<`u`&&`fonts`in navigator){try{let e=await navigator.permissions.request?.({name:`local-fonts`});if(e&&e.state!==`granted`)throw Error(`Permission to access local fonts not granted.`)}catch(e){if(e.name!==`TypeError`)throw e}let e={};try{let t=await navigator.fonts.query();for(let n of t)e.hasOwnProperty(n.family)||(e[n.family]=[]),e[n.family].push(n);Rg=Promise.resolve(e)}catch(e){console.error(e.name,e.message)}}else if(typeof window<`u`&&`queryLocalFonts`in window){let e={};try{let t=await window.queryLocalFonts();for(let n of t)e.hasOwnProperty(n.family)||(e[n.family]=[]),e[n.family].push(n);Rg=Promise.resolve(e)}catch(e){console.error(e.name,e.message)}}Rg||=Promise.resolve({})}let n=await Rg;for(let r of Ng(e)){if(Bg.includes(r))return;if(n.hasOwnProperty(r)&&n[r].length>0){let e=n[r][0];if(`blob`in e){let n=await(await e.blob()).arrayBuffer();return(0,Mg.loadBuffer)(n,{cacheSize:t})}return}}}var Bg=[`serif`,`sans-serif`,`cursive`,`fantasy`,`monospace`,`system-ui`,`emoji`,`math`,`fangsong`],Vg=1e5;function Hg(e,t=[]){let n,r,i=0,a;return e.registerCharacterJoiner(o=>{let s=e.options.fontFamily;if(s&&(i===0||n!==s)){r=void 0,i=1,n=s;let t=n;zg(t,Vg).then(n=>{t===e.options.fontFamily&&(i=2,r=n,n&&e.refresh(0,e.rows-1))}).catch(n=>{t===e.options.fontFamily&&(i=3,e.options.logLevel===`debug`&&console.debug(a,Error(`Failure while loading font`)),r=void 0,a=n)})}return r&&i===2?r.findLigatureRanges(o).map(e=>[e[0],e[1]]):Ug(o,t)})}function Ug(e,t){let n=[];for(let r=0;r<e.length;r++)for(let i=0;i<t.length;i++)if(e.startsWith(t[i],r)){n.push([r,r+t[i].length]),r+=t[i].length-1;break}return n}var Wg=class{constructor(e){this._fallbackLigatures=(e?.fallbackLigatures||`<--.<---.<<-.<-.->.->>.-->.--->.<==.<===.<<=.<=.=>.=>>.==>.===>.>=.>>=.<->.<-->.<--->.<---->.<=>.<==>.<===>.<====>.::.:::.<~~.</.</>./>.~~>.==.!=./=.~=.<>.===.!==.!===.<:.:=.*=.*+.<*.<*>.*>.<|.<|>.|>.+*.=*.=:.:>./*.*/.+++.<!--.<!---`.split(`.`)).sort((e,t)=>t.length-e.length),this._fontFeatureSettings=e?.fontFeatureSettings}activate(e){if(!e.element)throw Error(`Cannot activate LigaturesAddon before open is called`);this._terminal=e,this._characterJoinerId=Hg(e,this._fallbackLigatures),e.element.style.fontFeatureSettings=this._fontFeatureSettings??`"calt" on`}dispose(){this._characterJoinerId!==void 0&&(this._terminal?.deregisterCharacterJoiner(this._characterJoinerId),this._characterJoinerId=void 0),this._terminal?.element&&(this._terminal.element.style.fontFeatureSettings=``)}},Gg=r(),Kg={background:`#1a1c20`,foreground:`#dadbdc`,cursor:`#e1e4e8`,cursorAccent:`#1a1c20`,selectionBackground:`#3e4451`,black:`#3a3e44`,red:`#e06c75`,green:`#98c379`,yellow:`#e5c07b`,blue:`#61afef`,magenta:`#c678dd`,cyan:`#56b6c2`,white:`#dadbdc`,brightBlack:`#5c6370`,brightRed:`#e06c75`,brightGreen:`#98c379`,brightYellow:`#e5c07b`,brightBlue:`#61afef`,brightMagenta:`#c678dd`,brightCyan:`#56b6c2`,brightWhite:`#ffffff`},qg=[1e3,2e3,4e3,8e3,16e3];function Jg(e,t,n){return`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}/ws/loop/${e}/term?cols=${t}&rows=${n}`}function Yg({loopId:e,currentUserId:t,onStatusChange:n}){let r=(0,i.useRef)(null),a=(0,i.useRef)(null),o=(0,i.useRef)(null),s=(0,i.useRef)(null),c=(0,i.useRef)(null),l=(0,i.useRef)({attempt:0,timer:null}),[u,d]=(0,i.useState)(`connected`);function f(e){d(e),n?.(e)}(0,i.useEffect)(()=>{if(!r.current)return;let t=new Fs({cursorBlink:!0,cursorStyle:`block`,fontFamily:`"JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", Menlo, Consolas, "DejaVu Sans Mono", ui-monospace, monospace`,fontSize:12.5,lineHeight:1.3,letterSpacing:0,theme:Kg,convertEol:!0,scrollback:5e3,smoothScrollDuration:80,allowProposedApi:!0,drawBoldTextInBrightColors:!0,minimumContrastRatio:4,rightClickSelectsWord:!0,ignoreBracketedPasteMode:!0}),n=new Rs,i=new Xp;t.loadAddon(n),t.loadAddon(i);try{t.loadAddon(new Ef)}catch{}try{t.loadAddon(new Pm)}catch{}try{t.loadAddon(new Jh)}catch{}try{t.loadAddon(new Wg)}catch{}t.open(r.current);let u=r.current.querySelector(`.xterm-helper-textarea`);u&&u.setAttribute(`name`,`terminal-input`),n.fit(),t.focus(),a.current=t,s.current=n,c.current=i;function d(){let n=new WebSocket(Jg(e,t.cols,t.rows));o.current=n,n.onopen=()=>{l.current.attempt=0,f(`connected`),m()},n.onmessage=e=>{try{let n=JSON.parse(e.data);n.type===`data`?t.write(n.data):n.type===`exit`?t.write(`\r\n\x1b[2m[process exited ${n.code}]\x1b[0m\r\n`):n.type===`error`&&t.write(`\r\n\x1b[31m[error] ${n.message}\x1b[0m\r\n`)}catch{}},n.onclose=()=>{let{attempt:e}=l.current;if(e<qg.length){let n=qg[e];l.current.attempt=e+1,f(`reconnecting`),t.write(`\r\n\x1b[33m[Disconnected, reconnecting in ${n/1e3}s (${e+1}/${qg.length})...]\x1b[0m\r\n`),l.current.timer=setTimeout(d,n)}else f(`disconnected`),t.write(`\r
|
|
173
|
+
\x1B[2m[Disconnected]\x1B[0m\r
|
|
174
|
+
`)},n.onerror=()=>{}}let p=t.onData(e=>{o.current?.readyState===WebSocket.OPEN&&o.current.send(JSON.stringify({type:`data`,data:e}))}),m=()=>{let e=o.current;!e||e.readyState!==WebSocket.OPEN||e.send(JSON.stringify({type:`resize`,cols:t.cols,rows:t.rows}))},h=!1,g=()=>{try{if(n.fit(),h)m();else{if(t.cols<10)return;h=!0,d()}}catch{}};g(),window.addEventListener(`resize`,g);let _=new ResizeObserver(g);return r.current&&_.observe(r.current),t.attachCustomKeyEventHandler(e=>{if(e.ctrlKey&&e.shiftKey&&e.key===`F`){let e=prompt(`Terminal search:`);return e&&c.current&&c.current.findNext(e),!1}return!0}),()=>{window.removeEventListener(`resize`,g),_.disconnect(),p.dispose(),l.current.timer&&clearTimeout(l.current.timer);try{o.current?.close()}catch{}t.dispose(),a.current=null,s.current=null,c.current=null,o.current=null}},[e,t]);let p=u===`connected`?`#98c379`:u===`reconnecting`?`#e5c07b`:`#e06c75`;return(0,Gg.jsxs)(`div`,{style:{width:`100%`,height:`100%`,position:`relative`},children:[(0,Gg.jsx)(`div`,{ref:r,style:{width:`100%`,height:`100%`,background:Kg.background,padding:`10px 12px 4px`,boxSizing:`border-box`}}),(0,Gg.jsx)(`div`,{title:u===`connected`?`Connected`:u===`reconnecting`?`Reconnecting...`:`Disconnected`,style:{position:`absolute`,top:6,right:8,width:8,height:8,borderRadius:`50%`,background:p,boxShadow:`0 0 4px ${p}`,transition:`background 0.3s, box-shadow 0.3s`,zIndex:10,pointerEvents:`none`}})]})}export{Yg as Terminal};
|